Program interface that implements cl_program. More...
#include <cl.hpp>
Public Types | |
typedef VECTOR_CLASS < std::pair< const void *,::size_t > > | Binaries |
typedef VECTOR_CLASS < std::pair< const char *,::size_t > > | Sources |
Public Member Functions | |
Program (const STRING_CLASS &source, cl_int *err=NULL) | |
Program (const STRING_CLASS &source, bool build, cl_int *err=NULL) | |
Program (const Context &context, const STRING_CLASS &source, bool build=false, cl_int *err=NULL) | |
Program (const Context &context, const Sources &sources, cl_int *err=NULL) | |
Program (const Context &context, const VECTOR_CLASS< Device > &devices, const Binaries &binaries, VECTOR_CLASS< cl_int > *binaryStatus=NULL, cl_int *err=NULL) | |
Program () | |
Program (const Program &program) | |
Program (const cl_program &program) | |
Program & | operator= (const Program &rhs) |
Program & | operator= (const cl_program &rhs) |
cl_int | build (const VECTOR_CLASS< Device > &devices, const char *options=NULL, void(CL_CALLBACK *notifyFptr)(cl_program, void *)=NULL, void *data=NULL) const |
cl_int | build (const char *options=NULL, void(CL_CALLBACK *notifyFptr)(cl_program, void *)=NULL, void *data=NULL) const |
template<typename T > | |
cl_int | getInfo (cl_program_info name, T *param) const |
template<cl_int name> | |
detail::param_traits < detail::cl_program_info, name >::param_type | getInfo (cl_int *err=NULL) const |
template<typename T > | |
cl_int | getBuildInfo (const Device &device, cl_program_build_info name, T *param) const |
template<cl_int name> | |
detail::param_traits < detail::cl_program_build_info, name >::param_type | getBuildInfo (const Device &device, cl_int *err=NULL) const |
cl_int | createKernels (VECTOR_CLASS< Kernel > *kernels) |
template<> | |
VECTOR_CLASS< char * > | getInfo (cl_int *err) const |
typedef VECTOR_CLASS<std::pair<const void*, ::size_t> > cl::Program::Binaries |
typedef VECTOR_CLASS<std::pair<const char*, ::size_t> > cl::Program::Sources |
cl::Program::Program | ( | const STRING_CLASS & | source, |
cl_int * | err = NULL |
||
) | [inline] |
Definition at line 2801 of file cl.hpp.
{ cl_int error; const char * strings = source.c_str(); const ::size_t length = source.size(); Context context = Context::getDefault(err); object_ = ::clCreateProgramWithSource( context(), (cl_uint)1, &strings, &length, &error); detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR); if (error == CL_SUCCESS) { error = ::clBuildProgram( object_, 0, NULL, "", NULL, NULL); detail::errHandler(error, __BUILD_PROGRAM_ERR); } if (err != NULL) { *err = error; } }
cl::Program::Program | ( | const STRING_CLASS & | source, |
bool | build, | ||
cl_int * | err = NULL |
||
) | [inline] |
Definition at line 2835 of file cl.hpp.
{ cl_int error; const char * strings = source.c_str(); const ::size_t length = source.size(); Context context = Context::getDefault(err); object_ = ::clCreateProgramWithSource( context(), (cl_uint)1, &strings, &length, &error); detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR); if (error == CL_SUCCESS && build) { error = ::clBuildProgram( object_, 0, NULL, "", NULL, NULL); detail::errHandler(error, __BUILD_PROGRAM_ERR); } if (err != NULL) { *err = error; } }
cl::Program::Program | ( | const Context & | context, |
const STRING_CLASS & | source, | ||
bool | build = false , |
||
cl_int * | err = NULL |
||
) | [inline] |
Definition at line 2870 of file cl.hpp.
{ cl_int error; const char * strings = source.c_str(); const ::size_t length = source.size(); object_ = ::clCreateProgramWithSource( context(), (cl_uint)1, &strings, &length, &error); detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR); if (error == CL_SUCCESS && build) { error = ::clBuildProgram( object_, 0, NULL, "", NULL, NULL); detail::errHandler(error, __BUILD_PROGRAM_ERR); } if (err != NULL) { *err = error; } }
cl::Program::Program | ( | const Context & | context, |
const Sources & | sources, | ||
cl_int * | err = NULL |
||
) | [inline] |
Definition at line 2904 of file cl.hpp.
{ cl_int error; const ::size_t n = (::size_t)sources.size(); ::size_t* lengths = (::size_t*) alloca(n * sizeof(::size_t)); const char** strings = (const char**) alloca(n * sizeof(const char*)); for (::size_t i = 0; i < n; ++i) { strings[i] = sources[(int)i].first; lengths[i] = sources[(int)i].second; } object_ = ::clCreateProgramWithSource( context(), (cl_uint)n, strings, lengths, &error); detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR); if (err != NULL) { *err = error; } }
cl::Program::Program | ( | const Context & | context, |
const VECTOR_CLASS< Device > & | devices, | ||
const Binaries & | binaries, | ||
VECTOR_CLASS< cl_int > * | binaryStatus = NULL , |
||
cl_int * | err = NULL |
||
) | [inline] |
Definition at line 2929 of file cl.hpp.
{ cl_int error; const ::size_t n = binaries.size(); ::size_t* lengths = (::size_t*) alloca(n * sizeof(::size_t)); const unsigned char** images = (const unsigned char**) alloca(n * sizeof(const void*)); for (::size_t i = 0; i < n; ++i) { images[i] = (const unsigned char*)binaries[(int)i].first; lengths[i] = binaries[(int)i].second; } object_ = ::clCreateProgramWithBinary( context(), (cl_uint) devices.size(), (cl_device_id*)&devices.front(), lengths, images, binaryStatus != NULL ? (cl_int*) &binaryStatus->front() : NULL, &error); detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR); if (err != NULL) { *err = error; } }
cl::Program::Program | ( | ) | [inline] |
cl::Program::Program | ( | const Program & | program | ) | [inline] |
cl::Program::Program | ( | const cl_program & | program | ) | [inline] |
cl_int cl::Program::build | ( | const VECTOR_CLASS< Device > & | devices, |
const char * | options = NULL , |
||
void(CL_CALLBACK *notifyFptr)(cl_program, void *) | = NULL , |
||
void * | data = NULL |
||
) | const [inline] |
Definition at line 2979 of file cl.hpp.
{ return detail::errHandler( ::clBuildProgram( object_, (cl_uint) devices.size(), (cl_device_id*)&devices.front(), options, notifyFptr, data), __BUILD_PROGRAM_ERR); }
cl_int cl::Program::build | ( | const char * | options = NULL , |
void(CL_CALLBACK *notifyFptr)(cl_program, void *) | = NULL , |
||
void * | data = NULL |
||
) | const [inline] |
Definition at line 2997 of file cl.hpp.
{ return detail::errHandler( ::clBuildProgram( object_, 0, NULL, options, notifyFptr, data), __BUILD_PROGRAM_ERR); }
cl_int cl::Program::createKernels | ( | VECTOR_CLASS< Kernel > * | kernels | ) | [inline] |
Definition at line 3057 of file cl.hpp.
{ cl_uint numKernels; cl_int err = ::clCreateKernelsInProgram(object_, 0, NULL, &numKernels); if (err != CL_SUCCESS) { return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR); } Kernel* value = (Kernel*) alloca(numKernels * sizeof(Kernel)); err = ::clCreateKernelsInProgram( object_, numKernels, (cl_kernel*) value, NULL); if (err != CL_SUCCESS) { return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR); } kernels->assign(&value[0], &value[numKernels]); return CL_SUCCESS; }
cl_int cl::Program::getBuildInfo | ( | const Device & | device, |
cl_program_build_info | name, | ||
T * | param | ||
) | const [inline] |
Definition at line 3035 of file cl.hpp.
{ return detail::errHandler( detail::getInfo( &::clGetProgramBuildInfo, object_, device(), name, param), __GET_PROGRAM_BUILD_INFO_ERR); }
detail::param_traits<detail::cl_program_build_info, name>::param_type cl::Program::getBuildInfo | ( | const Device & | device, |
cl_int * | err = NULL |
||
) | const [inline] |
Definition at line 3046 of file cl.hpp.
{ typename detail::param_traits< detail::cl_program_build_info, name>::param_type param; cl_int result = getBuildInfo(device, name, ¶m); if (err != NULL) { *err = result; } return param; }
cl_int cl::Program::getInfo | ( | cl_program_info | name, |
T * | param | ||
) | const [inline] |
Definition at line 3014 of file cl.hpp.
{ return detail::errHandler( detail::getInfo(&::clGetProgramInfo, object_, name, param), __GET_PROGRAM_INFO_ERR); }
detail::param_traits<detail::cl_program_info, name>::param_type cl::Program::getInfo | ( | cl_int * | err = NULL | ) | const [inline] |
VECTOR_CLASS<char *> cl::Program::getInfo | ( | cl_int * | err | ) | const [inline] |
Definition at line 3078 of file cl.hpp.
{ VECTOR_CLASS< ::size_t> sizes = getInfo<CL_PROGRAM_BINARY_SIZES>(); VECTOR_CLASS<char *> binaries; for (VECTOR_CLASS< ::size_t>::iterator s = sizes.begin(); s != sizes.end(); ++s) { char *ptr = NULL; if (*s != 0) ptr = new char[*s]; binaries.push_back(ptr); } cl_int result = getInfo(CL_PROGRAM_BINARIES, &binaries); if (err != NULL) { *err = result; } return binaries; }
Definition at line 2965 of file cl.hpp.
{ if (this != &rhs) { detail::Wrapper<cl_type>::operator=(rhs); } return *this; }
Program& cl::Program::operator= | ( | const cl_program & | rhs | ) | [inline] |
Reimplemented from cl::detail::Wrapper< cl_program >.
Definition at line 2973 of file cl.hpp.
{ detail::Wrapper<cl_type>::operator=(rhs); return *this; }