Bolt
1.3
C++ template library with support for OpenCL
|
Classes | |
struct | TypeName< TypeNameType > |
struct | ClCode< Type > |
The definition of a type trait for the definition of a type, which could be arbitrarily complex. More... | |
Macros | |
#define | STRINGIFY_CODE2(...) #__VA_ARGS__ |
Macro that wraps around arbitrary text, and creates a string out of it This macro is helpful to write inline OpenCL programs, as it avoids wrapping every line of OpenCL line with "XXX" . | |
#define | STRINGIFY_CODE(...) STRINGIFY_CODE2( __VA_ARGS__ ) |
#define | BOLT_CODE_STRING(...) STRINGIFY_CODE( __VA_ARGS__ ); __VA_ARGS__; |
#define | BOLT_HOST_DEVICE_DEFINITION(...) "namespace bolt { namespace cl {\n" STRINGIFY_CODE( __VA_ARGS__ ) "\n } } \n" ; __VA_ARGS__; |
#define | BOLT_CREATE_TYPENAME(...) template<> struct TypeName< __VA_ARGS__ > { static std::string get( ) { return #__VA_ARGS__; } }; |
#define | BOLT_CREATE_CLCODE(Type, CODE_STRING) |
#define | BOLT_TEMPLATE_REGISTER_NEW_TYPE(CONTAINER, OLDTYPE, NEWTYPE) |
This macro specializes a template with a new type using the template definition of a previously defined type This is a convenience macro to specialize a template for a new type, using the generic template definition from a previosly defined type. | |
#define | BOLT_TEMPLATE_REGISTER_NEW_ITERATOR(CONTAINER, OLDTYPE, NEWTYPE) |
This macro specializes a template iterator with a new type using the template definition of a previously defined iterator type This is a convenience macro to specialize an iterator for a new type, using the generic template definition from a previosly defined iterator. | |
#define | BOLT_CREATE_DEFINE(DefineName, D,...) |
This macro defines a macro on the kernel code. | |
#define | BOLT_TEMPLATE_REGISTER_NEW_TRANSFORM_ITERATOR(FUNCTOR, DATATYPE) |
This macro creates a TypeName and the ClCode data structure for the transform iterator associated with FUNCTOR and DATA_TYPE. The use of this macro is necessary if transform iterator is used in the algorithm This macro creates a TypeName and the ClCode data structure for the transform iterator associated with FUNCTOR and DATA_TYPE. The use of this macro is necessary if transform iterator is used in the algorithm. | |
#define | BOLT_TEMPLATE_REGISTER_NEW_PERMUTATION_ITERATOR(ELEMENT_ITERATOR, INDEX_ITERATOR) |
A Permutation iterator is associated with an ELEMENT_ITERATOR and INDEX_ITERATOR. This Macro creates a ClCode and TypeName for the permutation iterator. A Permutation iterator is associated with an ELEMENT_ITERATOR and INDEX_ITERATOR. This Macro creates a ClCode and TypeName for the permutation iterator. Note that the data type associated with the element and index iterators must be declared within the BOLT_FUNCTOR macro. Only device vector iterators can be used with permutation iterators. Both the iterators has to be either std iterators or device vector iterators. Combination of the two is not supported. | |
#define | BOLT_FUNCTOR(T,...) |
#define | BOLT_TEMPLATE_FUNCTOR1(CONTAINER, TYPE1,...) |
#define | BOLT_TEMPLATE_FUNCTOR2(CONTAINER, TYPE1, TYPE2,...) |
#define | BOLT_TEMPLATE_FUNCTOR3(CONTAINER, TYPE1, TYPE2, TYPE3,...) |
#define | BOLT_TEMPLATE_FUNCTOR4(CONTAINER, TYPE1, TYPE2, TYPE3, TYPE4,...) |
#define | BOLT_CREATE_CODE_SNIPPET(Name,...) |
#define | BOLT_ADD_DEPENDENCY(Type, DependingType) ClCode<Type>::addDependency(ClCode<DependingType>::get()); |
Functions | |
static std::string | TypeName< TypeNameType >::get () |
static std::string | ClCode< Type >::get () |
#define BOLT_ADD_DEPENDENCY | ( | Type, | |
DependingType | |||
) | ClCode<Type>::addDependency(ClCode<DependingType>::get()); |
This macro is used to specify an A-depends-on-B type relationship between types. Bolt will ensure that whenever the definition of the A type is needed, the definition for the B type is also included
Type | The A type |
DependingType | The B type |
An example:
#define BOLT_CODE_STRING | ( | ... | ) | STRINGIFY_CODE( __VA_ARGS__ ); __VA_ARGS__; |
Return a string with the specified function F, and also create code that is fed to the host compiler.
#define BOLT_CREATE_CLCODE | ( | Type, | |
CODE_STRING | |||
) |
Creates the ClCode trait that associates the specified type T
with the string CODE_STRING
.
Type | A fully specified type name |
CODE_STRING | The definition of the type, which could be a template definition |
An example:
Another approach is to define the code string in a file (so host and string are identical), then pass the string read from the file to BOLT_CREATE_CLCODE. (See clCodeFromFile)
#define BOLT_CREATE_CODE_SNIPPET | ( | Name, | |
... | |||
) |
Registers code used on both host and device. It is used to help define complex relationships between user defined types, such as when one type contains instances of another. BOLT_CREATE_CODE_SNIPPET defines new types and BOLT_ADD_DEPENDENCY is used to specify the relationship to Bolt how the definition of one type relies on the definition of the other.
Name | An identifier to associate with the trailing code |
... | Arbitrary user defined code |
#define BOLT_CREATE_DEFINE | ( | DefineName, | |
D, | |||
... | |||
) |
This macro defines a macro on the kernel code.
DefineName | Name of the macro. Can be used with other Bolt macros. |
D | The macro |
... | Value of the macro ( Arbitrary type definition to associate with the type ) See ClCodeTraits |
#define BOLT_CREATE_TYPENAME | ( | ... | ) | template<> struct TypeName< __VA_ARGS__ > { static std::string get( ) { return #__VA_ARGS__; } }; |
A convenience macro to create the TypeName trait for a specified class T
.
T | : Class for which TypeName trait will be defined. |
See TypeName for more information.
#define BOLT_FUNCTOR | ( | T, | |
... | |||
) |
Creates a string and a regular version of the functor F, and automatically defines the ClCode trait to associate the code string with the specified class T.
Type | A fully specified type name |
... | Arbitrary type definition to associate with the type. See ClCodeTraits |
An example:
#define BOLT_HOST_DEVICE_DEFINITION | ( | ... | ) | "namespace bolt { namespace cl {\n" STRINGIFY_CODE( __VA_ARGS__ ) "\n } } \n" ; __VA_ARGS__; |
/brief Types that are defined within the bolt::cl namespace in host code should also be defined within the same namespace within the kernel code /detail This is a convenience macro, intended to only be used by the Bolt library itself, to wrap internal types in the appropriate bolt namespaces
#define BOLT_TEMPLATE_FUNCTOR1 | ( | CONTAINER, | |
TYPE1, | |||
... | |||
) |
Helper macro to define and specialize a template type for Bolt. The code given as the macro vararg should be a template container that requires 1 template paramter. The type passed into the TYPE1 argument is used to fully specialize the template container into a concrete type for Bolt.
CONTAINER | Name to associate with the code given in the macro variable argument |
TYPE1 | Type used to fully specialize the template code given in the macro variable argument |
... | Arbitrary user defined code; expected to be a 1 argument template type |
An example:
#define BOLT_TEMPLATE_FUNCTOR2 | ( | CONTAINER, | |
TYPE1, | |||
TYPE2, | |||
... | |||
) |
Helper macro to define and specialize a template type for Bolt. The code given as the macro vararg should be a template container that requires 1 template paramter. The types passed into TYPE1 & TYPE2 are used to fully specialize the template container into concrete types for Bolt use with two different types
CONTAINER | Name to associate with the code given in the macro variable argument |
TYPE1 | Type used to fully specialize the template code given in the macro variable argument |
TYPE2 | Second type used to fully specialize the template code, independant of 1st type |
... | Arbitrary user defined code; expected to be a 1 argument template type |
#define BOLT_TEMPLATE_FUNCTOR3 | ( | CONTAINER, | |
TYPE1, | |||
TYPE2, | |||
TYPE3, | |||
... | |||
) |
Helper macro to define and specialize a template type for Bolt. The code given as the macro vararg should be a template container that requires 1 template paramter. The types passed into TYPE1 & TYPE2 & TYPE3 are used to fully specialize the template container into concrete types for Bolt use with two different types
CONTAINER | Name to associate with the code given in the macro variable argument |
TYPE1 | Type used to fully specialize the template code given in the macro variable argument |
TYPE2 | Second type used to fully specialize the template code , independant of other types |
TYPE3 | Third type used to fully specialize the template code, independant of other types |
... | Arbitrary user defined code; expected to be a 1 argument template type |
#define BOLT_TEMPLATE_FUNCTOR4 | ( | CONTAINER, | |
TYPE1, | |||
TYPE2, | |||
TYPE3, | |||
TYPE4, | |||
... | |||
) |
Helper macro to define and specialize a template type for Bolt. The code given as the macro vararg should be a template container that requires 1 template paramter. The types passed into TYPE1 & TYPE2 & TYPE3 & type4 are used to fully specialize the template container into concrete types for Bolt use with two different types
CONTAINER | Name to associate with the code given in the macro variable argument |
TYPE1 | Type used to fully specialize the template code given in the macro variable argument |
TYPE2 | Second type used to fully specialize the template code , independant of other types |
TYPE3 | Third type used to fully specialize the template code, independant of other types |
TYPE4 | Fourth type used to fully specialize the template code, independant of other types |
... | Arbitrary user defined code; expected to be a 1 argument template type |
#define BOLT_TEMPLATE_REGISTER_NEW_ITERATOR | ( | CONTAINER, | |
OLDTYPE, | |||
NEWTYPE | |||
) |
This macro specializes a template iterator with a new type using the template definition of a previously defined iterator type This is a convenience macro to specialize an iterator for a new type, using the generic template definition from a previosly defined iterator.
CONTAINER | A template template parameter, such as std::vector without the type specified |
OLDTYPE | A type that has already been registered with the container template definition |
NEWTYPE | A new type to register with the template definition |
An example:
#define BOLT_TEMPLATE_REGISTER_NEW_PERMUTATION_ITERATOR | ( | ELEMENT_ITERATOR, | |
INDEX_ITERATOR | |||
) |
A Permutation iterator is associated with an ELEMENT_ITERATOR and INDEX_ITERATOR. This Macro creates a ClCode and TypeName for the permutation iterator. A Permutation iterator is associated with an ELEMENT_ITERATOR and INDEX_ITERATOR. This Macro creates a ClCode and TypeName for the permutation iterator. Note that the data type associated with the element and index iterators must be declared within the BOLT_FUNCTOR macro. Only device vector iterators can be used with permutation iterators. Both the iterators has to be either std iterators or device vector iterators. Combination of the two is not supported.
ELEMENT_ITERATOR | This specifies the iterator for elements |
INDEX_ITERATOR | This specifies the iterator for the index elements |
An example:
#define BOLT_TEMPLATE_REGISTER_NEW_TRANSFORM_ITERATOR | ( | FUNCTOR, | |
DATATYPE | |||
) |
This macro creates a TypeName and the ClCode data structure for the transform iterator associated with FUNCTOR and DATA_TYPE. The use of this macro is necessary if transform iterator is used in the algorithm This macro creates a TypeName and the ClCode data structure for the transform iterator associated with FUNCTOR and DATA_TYPE. The use of this macro is necessary if transform iterator is used in the algorithm.
FUNCTOR | This defines the unary function for the transform iterator. FUNCTOR should be previously defined using BOLT_FUNCTOR. The FUNCTOR is used to transform the objects of type DATA_TYPE. The FUNCTOR should also define an associated type result_type. |
DATATYPE | This is the type of the data which the transform iterator points to and the unary function FUNCTOR operates on. |
An example:
#define BOLT_TEMPLATE_REGISTER_NEW_TYPE | ( | CONTAINER, | |
OLDTYPE, | |||
NEWTYPE | |||
) |
This macro specializes a template with a new type using the template definition of a previously defined type This is a convenience macro to specialize a template for a new type, using the generic template definition from a previosly defined type.
CONTAINER | A template template parameter, such as std::vector without the type specified |
OLDTYPE | A type that has already been registered with the container template definition |
NEWTYPE | A new type to register with the template definition |
An example:
#define STRINGIFY_CODE2 | ( | ... | ) | #__VA_ARGS__ |
Macro that wraps around arbitrary text, and creates a string out of it This macro is helpful to write inline OpenCL programs, as it avoids wrapping every line of OpenCL line with "XXX"
.