ASL 0.1.7
Advanced Simulation Library
Loading...
Searching...
No Matches
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"
29#include "Kernels/aclKernelConfiguration.h"
30#include <memory>
31#include "aclTypes.h"
32
33namespace cl
34{
35 class CommandQueue;
36 class Kernel;
37}
38
39namespace 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;
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
TypeID getTypeID() const
virtual void addToKernelSource(vector< shared_ptr< ElementBase > > &arguments, vector< shared_ptr< ElementBase > > &localDeclarations) const =0
Adds ElementBase to the kernel source either as an argument or as a local declaration.
virtual string str(const KernelConfiguration &kernelConfig=KERNEL_BASIC) const =0
ElementBase(bool isWritable_, unsigned int size_, TypeID typeID_)
CommandQueue getQueue() const
CommandQueue queue
virtual string getLocalDeclaration(const KernelConfiguration &kernelConfig=KERNEL_BASIC) const =0
virtual ~ElementBase()
virtual string getTypeSignature(const KernelConfiguration &kernelConfig=KERNEL_BASIC) const =0
const bool isWritable
virtual void setAsArgument(cl::Kernel &kernel, unsigned int argumentIndex) const =0
virtual string getAddressSpaceQualifier() const
unsigned int size
virtual string getName() const =0
unsigned int getSize() const
ACL Kernel configuration class.
Class interface for cl_kernel.
Definition cl.hpp:4722
const KernelConfiguration KERNEL_BASIC
Advanced Computational Language.
Definition acl.h:41
const std::string INDEX
std::shared_ptr< cl::CommandQueue > CommandQueue
Definition acl.h:51
TypeID
Definition aclTypes.h:39
std::shared_ptr< ElementBase > Element
Definition acl.h:49
The OpenCL C++ bindings are defined within this namespace.
Definition acl.h:34
STL namespace.