acl.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 ACL_H
#define ACL_H
#include "aclStdIncludes.h"
#include <memory>
#include "Kernels/aclKernelConfiguration.h"
//#include "aclHardware.h"
#include "aclTypes.h"
namespace cl
{
class CommandQueue;
}
namespace acl
{
class ExpressionContainer;
class VectorOfElements;
class MatrixOfElements;
class MemBlock;
class ElementBase;
template <class T> class Array;
typedef std::shared_ptr<MemBlock> ElementData;
typedef std::shared_ptr<ElementBase> Element;
extern const KernelConfiguration KERNEL_BASIC;
typedef std::shared_ptr<cl::CommandQueue> CommandQueue;
namespace elementOperators
{
// Math Operators
Element operator-(Element e);
Element operator+(Element e1, Element e2);
Element operator-(Element e1, Element e2);
Element operator*(Element e1, Element e2);
Element operator/(Element e1, Element e2);
Element operator%(Element e1, Element e2);
// Assignment Operators
Element operatorAssignment(Element e1, Element e2);
Element operatorAssignmentSafe(Element e1, Element e2);
Element operator+=(Element e1, Element e2);
Element operator-=(Element e1, Element e2);
Element operator*=(Element e1, Element e2);
Element operator/=(Element e1, Element e2);
Element operator>(Element e1, Element e2);
Element operator<(Element e1, Element e2);
Element operator>=(Element e1, Element e2);
Element operator<=(Element e1, Element e2);
Element isEqual(Element e1, Element e2);
Element isNotEqual(Element e1, Element e2);
Element operator&&(Element e1, Element e2);
Element operator||(Element e1, Element e2);
Element operator!(Element e);
// Mathematical Functions
Element sin(Element e);
Element cos(Element e);
Element sqrt(Element e);
Element rsqrt(Element e);
Element log(Element e);
Element log10(Element e);
Element powI(Element a, unsigned int i);
Element exp(Element a);
Element fabs(Element a);
Element abs(Element a);
Element abs_diff(Element a,Element b);
Element floor(Element a);
Element isnan(Element a);
Element nan(TypeID t);
Element copysign(Element a,Element b);
Element sign(Element a);
Element min(Element a,Element b);
Element max(Element a,Element b);
Element atomic_add(Element e1, Element e2);
Element atomic_sub(Element e1, Element e2);
Element atomic_xchg(Element e1, Element e2);
Element mad(Element e1, Element e2, Element e3);
// Synchronization Functions
Element syncCopy(Element source,
Element destination,
Element srcOffset,
Element dstOffset,
Element length);
Element barrier(std::string flags = "CLK_LOCAL_MEM_FENCE");
// Special Purpose Functions
Element excerpt(Element source, Element filter);
Element parse(const std::vector<std::pair<Element, std::string> > & elementNamePairs,
const std::string & statement);
Element convert(const TypeID tName, Element e1, bool strong=true);
Element printfFunction(std::string args);
Element returnStatement();
Element ifElse(Element condition,
const std::vector<Element> & thenBody,
const std::vector<Element> & elseBody);
Element select(Element e1, Element e2, Element e3);
Element forLoop(Element initialization,
Element condition,
Element increase,
const std::vector<Element> & body);
Element any(Element e);
Element all(Element e);
}
// RTTI functions
bool isConstant(Element e);
bool isSingleValue(Element e);
bool isMemBlock(Element e);
template <typename T> void copy(MemBlock &source, T* destination);
template <typename T> void copy(T* source, MemBlock &destination);
template <typename T> void copy(MemBlock &source, std::vector<T> &destination);
template <typename T> void copy(std::vector<T> &source, MemBlock &destination);
template <typename T> void copy(MemBlock &source, MemBlock &destination);
template <typename T> void copy(Element source, std::vector<T> &destination);
template <typename T> void copy(std::vector<T> &source, Element destination);
template <typename T> void copy(Element source, T* destination);
template <typename T> void copy(T* source, Element destination);
ExpressionContainer & operator<<(ExpressionContainer & ec,
const std::vector<Element> & a);
std::vector<Element> & operator<<(std::vector<Element> & ec,
const std::vector<Element> & a);
ExpressionContainer & operator<<(ExpressionContainer & ec,
const MatrixOfElements & a);
ExpressionContainer & operator<<(ExpressionContainer & ec,
const ExpressionContainer & a);
void initData(Element a,
Element initializationValue,
const KernelConfiguration & kernelConfig = KERNEL_BASIC);
Element generateSubElement(Element, unsigned int size, int offset);
Element generateSubElement(Element, unsigned int size, int * offset);
Element generateSubElement(Element, unsigned int size, Element offset);
Element generateShiftedElement(Element, int offset);
Element generateShiftedElement(Element, int* offset);
Element generateShiftedElement(Element, Element offset);
template <typename T> void swapBuffers(std::shared_ptr<Array<T> >a,
std::shared_ptr<Array<T> > b);
ElementData generateElementArray(TypeID typeID,
unsigned int size);
ElementData generateElementArray(TypeID typeID,
unsigned int size,
CommandQueue queue_);
Element generateElementLocalArray(TypeID typeID,
unsigned int size);
} // namespace acl
#endif // ACL_H
acl::Array
Global array.
Definition: aclArray.h:37
acl::ElementBase
Definition: aclElementBase.h:50
acl::ExpressionContainer
Definition: aclExpressionContainer.h:44
acl::KernelConfiguration
ACL Kernel configuration class.
Definition: aclKernelConfiguration.h:35
acl::MatrixOfElements
The class represents a matrix elements of Element.
Definition: aclMatrixOfElements.h:36
acl::MemBlock
Definition: aclMemBlock.h:40
acl::VectorOfElements
The class represents several Element.
Definition: aclVectorOfElementsDef.h:92
acl::VectorOfElements::operator<<
ExpressionContainer & operator<<(ExpressionContainer &ec, const std::vector< Element > &a)
puts a vector<Element> in ExpressionContainer
acl::VectorOfElements::operator<<
ExpressionContainer & operator<<(ExpressionContainer &ec, const ExpressionContainer &a)
puts a ExpressionContainer in ExpressionContainer
acl::VectorOfElements::operator<<
ExpressionContainer & operator<<(ExpressionContainer &ec, const MatrixOfElements &a)
puts a MatrixOfElements in ExpressionContainer
cl::CommandQueue
CommandQueue interface for cl_command_queue.
Definition: cl.hpp:5355
acl::elementOperators::operator+=
Element operator+=(Element e1, Element e2)
acl::elementOperators::operatorAssignment
Element operatorAssignment(Element e1, Element e2)
acl::elementOperators::operator-=
Element operator-=(Element e1, Element e2)
acl::elementOperators::operator/=
Element operator/=(Element e1, Element e2)
acl::elementOperators::operator*=
Element operator*=(Element e1, Element e2)
acl::elementOperators::operatorAssignmentSafe
Element operatorAssignmentSafe(Element e1, Element e2)
acl::elementOperators::atomic_add
Element atomic_add(Element e1, Element e2)
acl::elementOperators::atomic_xchg
Element atomic_xchg(Element e1, Element e2)
acl::elementOperators::atomic_sub
Element atomic_sub(Element e1, Element e2)
acl::elementOperators::operator&&
Element operator&&(Element e1, Element e2)
acl::elementOperators::operator<=
Element operator<=(Element e1, Element e2)
acl::elementOperators::isNotEqual
Element isNotEqual(Element e1, Element e2)
acl::elementOperators::operator>=
Element operator>=(Element e1, Element e2)
acl::elementOperators::operator>
Element operator>(Element e1, Element e2)
acl::elementOperators::operator<
Element operator<(Element e1, Element e2)
acl::elementOperators::isEqual
Element isEqual(Element e1, Element e2)
acl::elementOperators::operator||
Element operator||(Element e1, Element e2)
acl::elementOperators::forLoop
Element forLoop(Element initialization, Element condition, Element increase, const std::vector< Element > &body)
acl::elementOperators::select
Element select(Element e1, Element e2, Element e3)
acl::elementOperators::returnStatement
Element returnStatement()
acl::elementOperators::ifElse
Element ifElse(Element condition, const std::vector< Element > &thenBody, const std::vector< Element > &elseBody)
asl::offset
const Block offset(const Block &bl, int a=1)
acl::KERNEL_BASIC
const KernelConfiguration KERNEL_BASIC
Definition: aclElementBase.h:45
acl::elementOperators::nan
Element nan(TypeID t)
acl::elementOperators::exp
Element exp(Element a)
acl::elementOperators::max
Element max(Element a, Element b)
acl::elementOperators::sign
Element sign(Element a)
acl::elementOperators::isnan
Element isnan(Element a)
acl::elementOperators::log
Element log(Element e)
acl::elementOperators::sqrt
Element sqrt(Element e)
acl::elementOperators::sin
Element sin(Element e)
acl::elementOperators::fabs
Element fabs(Element a)
acl::elementOperators::mad
Element mad(Element e1, Element e2, Element e3)
acl::elementOperators::min
Element min(Element a, Element b)
acl::elementOperators::floor
Element floor(Element a)
acl::elementOperators::abs_diff
Element abs_diff(Element a, Element b)
acl::elementOperators::rsqrt
Element rsqrt(Element e)
acl::elementOperators::copysign
Element copysign(Element a, Element b)
acl::elementOperators::abs
Element abs(Element a)
acl::elementOperators::powI
Element powI(Element a, unsigned int i)
acl::elementOperators::cos
Element cos(Element e)
acl::elementOperators::log10
Element log10(Element e)
acl::elementOperators::operator+
Element operator+(Element e1, Element e2)
acl::elementOperators::operator!
Element operator!(Element e)
acl::elementOperators::operator-
Element operator-(Element e)
acl::elementOperators::operator*
Element operator*(Element e1, Element e2)
acl::elementOperators::operator%
Element operator%(Element e1, Element e2)
acl::elementOperators::operator/
Element operator/(Element e1, Element e2)
acl::initData
void initData(Element a, Element initializationValue, const KernelConfiguration &kernelConfig=KERNEL_BASIC)
acl::elementOperators::convert
Element convert(const TypeID tName, Element e1, bool strong=true)
acl::elementOperators::printfFunction
Element printfFunction(std::string args)
acl::elementOperators::parse
Element parse(const std::vector< std::pair< Element, std::string > > &elementNamePairs, const std::string &statement)
acl::elementOperators::excerpt
Element excerpt(Element source, Element filter)
acl::elementOperators::syncCopy
Element syncCopy(Element source, Element destination, Element srcOffset, Element dstOffset, Element length)
acl::elementOperators::barrier
Element barrier(std::string flags="CLK_LOCAL_MEM_FENCE")
acl::elementOperators::any
Element any(Element e)
Corresponds to the openCL operation any.
acl::elementOperators::all
Element all(Element e)
Corresponds to the openCL operation all.
acl
Advanced Computational Language.
Definition: acl.h:41
acl::generateElementArray
ElementData generateElementArray(TypeID typeID, unsigned int size)
acl::isConstant
bool isConstant(Element e)
acl::isMemBlock
bool isMemBlock(Element e)
acl::CommandQueue
std::shared_ptr< cl::CommandQueue > CommandQueue
Definition: acl.h:51
acl::generateElementLocalArray
Element generateElementLocalArray(TypeID typeID, unsigned int size)
acl::isSingleValue
bool isSingleValue(Element e)
The function returns true when the input is a single valued object e.g. aclConstatnt,...
acl::generateSubElement
Element generateSubElement(Element, unsigned int size, int offset)
function creates subElement with given length and offset; offset is constant
acl::copy
void copy(MemBlock &source, T *destination)
acl::generateShiftedElement
Element generateShiftedElement(Element, int offset)
acl::TypeID
TypeID
Definition: aclTypes.h:39
acl::ElementData
std::shared_ptr< MemBlock > ElementData
Definition: acl.h:47
acl::swapBuffers
void swapBuffers(std::shared_ptr< Array< T > >a, std::shared_ptr< Array< T > > b)
acl::Element
std::shared_ptr< ElementBase > Element
Definition: acl.h:49
asl::operator<<
std::ostream & operator<<(std::ostream &output, const std::vector< T > &vector)
Prints elements of the vector separated by space.
Definition: aslUtilities.h:173
cl
The OpenCL C++ bindings are defined within this namespace.
Definition: acl.h:34
aclStdIncludes.h
aclTypes.h