ASL  0.1.7
Advanced Simulation Library
aclElementBase.h
Go to the documentation of this file.
1 /*
2  * Advanced Simulation Library <http://asl.org.il>
3  *
4  * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5  *
6  *
7  * This file is part of Advanced Simulation Library (ASL).
8  *
9  * ASL is free software: you can redistribute it and/or modify it
10  * under the terms of the GNU Affero General Public License as
11  * published by the Free Software Foundation, version 3 of the License.
12  *
13  * ASL is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Affero General Public License for more details.
17  *
18  * You should have received a copy of the GNU Affero General Public License
19  * along with ASL. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 
24 #ifndef ACLELEMENTBASE_H
25 #define ACLELEMENTBASE_H
26 
27 #include "aclStdIncludes.h"
28 //#include "aclHardware.h"
30 #include <memory>
31 #include "aclTypes.h"
32 
33 namespace cl
34 {
35  class CommandQueue;
36  class Kernel;
37 }
38 
39 namespace acl
40 {
41  typedef std::shared_ptr<cl::CommandQueue> CommandQueue;
42 
43  // GLOBALS
44  extern const std::string INDEX;
46 
47  using namespace std;
48 
50  {
51  protected:
52  unsigned int size;
55  ElementBase(bool isWritable_, unsigned int size_, TypeID typeID_);
56  public:
57  const bool isWritable;
58  virtual string str(const KernelConfiguration & kernelConfig = KERNEL_BASIC) const = 0;
59  virtual string getName() const = 0;
60  virtual string getAddressSpaceQualifier() const;
61  unsigned int getSize() const;
62  CommandQueue getQueue() const;
63  TypeID getTypeID() const;
64  virtual string getTypeSignature(const KernelConfiguration & kernelConfig = KERNEL_BASIC) const = 0;
65  virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig = KERNEL_BASIC) const = 0;
67  virtual void addToKernelSource(vector<shared_ptr<ElementBase> > & arguments,
68  vector<shared_ptr<ElementBase> > & localDeclarations) const = 0;
69 
70  virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const = 0;
71  virtual ~ElementBase();
72  };
73 
74  typedef std::shared_ptr<ElementBase> Element;
75 
76 } // namespace acl
77 #endif // ACLELEMENTBASE_H
Advanced Computational Language.
Definition: acl.h:40
The OpenCL C++ bindings are defined within this namespace.
Definition: acl.h:33
std::shared_ptr< cl::CommandQueue > CommandQueue
Definition: acl.h:51
const bool isWritable
ACL Kernel configuration class.
std::shared_ptr< ElementBase > Element
Definition: acl.h:49
CommandQueue queue
unsigned int size
Class interface for cl_kernel.
Definition: cl.hpp:4721
TypeID
Definition: aclTypes.h:38
const KernelConfiguration KERNEL_BASIC
const std::string INDEX
Definition: aclUtilities.h:39