aclElementBase.h
Go to the documentation of this file.
/*
* Advanced Simulation Library <http://asl.org.il>
*
* Copyright 2015 Avtech Scientific <http://avtechscientific.com>
*
*
* This file is part of Advanced Simulation Library (ASL).
*
* ASL is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3 of the License.
*
* ASL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with ASL. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ACLELEMENTBASE_H
#define ACLELEMENTBASE_H
#include "aclStdIncludes.h"
//#include "aclHardware.h"
#include "Kernels/aclKernelConfiguration.h"
#include <memory>
#include "aclTypes.h"
namespace cl
{
class CommandQueue;
class Kernel;
}
namespace acl
{
typedef std::shared_ptr<cl::CommandQueue> CommandQueue;
// GLOBALS
extern const std::string INDEX;
extern const KernelConfiguration KERNEL_BASIC;
using namespace std;
class ElementBase
{
protected:
unsigned int size;
TypeID typeID;
CommandQueue queue;
ElementBase(bool isWritable_, unsigned int size_, TypeID typeID_);
public:
const bool isWritable;
virtual string str(const KernelConfiguration & kernelConfig = KERNEL_BASIC) const = 0;
virtual string getName() const = 0;
virtual string getAddressSpaceQualifier() const;
unsigned int getSize() const;
CommandQueue getQueue() const;
TypeID getTypeID() const;
virtual string getTypeSignature(const KernelConfiguration & kernelConfig = KERNEL_BASIC) const = 0;
virtual string getLocalDeclaration(const KernelConfiguration & kernelConfig = KERNEL_BASIC) const = 0;
virtual void addToKernelSource(vector<shared_ptr<ElementBase> > & arguments,
vector<shared_ptr<ElementBase> > & localDeclarations) const = 0;
virtual void setAsArgument(cl::Kernel & kernel, unsigned int argumentIndex) const = 0;
virtual ~ElementBase();
};
typedef std::shared_ptr<ElementBase> Element;
} // namespace acl
#endif // ACLELEMENTBASE_H
acl::ElementBase::getTypeID
TypeID getTypeID() const
acl::ElementBase::addToKernelSource
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.
acl::ElementBase::str
virtual string str(const KernelConfiguration &kernelConfig=KERNEL_BASIC) const =0
acl::ElementBase::ElementBase
ElementBase(bool isWritable_, unsigned int size_, TypeID typeID_)
acl::ElementBase::getQueue
CommandQueue getQueue() const
acl::ElementBase::getLocalDeclaration
virtual string getLocalDeclaration(const KernelConfiguration &kernelConfig=KERNEL_BASIC) const =0
acl::ElementBase::~ElementBase
virtual ~ElementBase()
acl::ElementBase::getTypeSignature
virtual string getTypeSignature(const KernelConfiguration &kernelConfig=KERNEL_BASIC) const =0
acl::ElementBase::setAsArgument
virtual void setAsArgument(cl::Kernel &kernel, unsigned int argumentIndex) const =0
acl::ElementBase::getAddressSpaceQualifier
virtual string getAddressSpaceQualifier() const
acl::ElementBase::getName
virtual string getName() const =0
acl::ElementBase::getSize
unsigned int getSize() const
acl::KernelConfiguration
ACL Kernel configuration class.
Definition: aclKernelConfiguration.h:35
cl::Kernel
Class interface for cl_kernel.
Definition: cl.hpp:4722
acl::KERNEL_BASIC
const KernelConfiguration KERNEL_BASIC
Definition: aclElementBase.h:45
acl
Advanced Computational Language.
Definition: acl.h:41
acl::INDEX
const std::string INDEX
Definition: aclUtilities.h:39
acl::CommandQueue
std::shared_ptr< cl::CommandQueue > CommandQueue
Definition: acl.h:51
acl::TypeID
TypeID
Definition: aclTypes.h:39
acl::Element
std::shared_ptr< ElementBase > Element
Definition: acl.h:49
cl
The OpenCL C++ bindings are defined within this namespace.
Definition: acl.h:34
aclStdIncludes.h
aclTypes.h