51 #define CLOGS_VERSION_MAJOR 1 52 #define CLOGS_VERSION_MINOR 5 83 #ifdef __CL_ENABLE_EXCEPTIONS 84 typedef cl::Error
Error;
86 class CLOGS_LOCAL Error
93 explicit Error(cl_int err,
const char *errStr = NULL) : err_(err), errStr_(errStr)
97 virtual const char *what()
const 99 return errStr_ != NULL ? errStr_ :
"";
107 #endif // !__CL_ENABLE_EXCEPTIONS 155 bool isStorable(
const cl::Device &device)
const;
160 bool isComputable(
const cl::Device &device)
const;
161 bool isIntegral()
const;
162 bool isSigned()
const;
163 std::string getName()
const;
164 ::size_t getSize()
const;
165 ::size_t getBaseSize()
const;
170 unsigned int getLength()
const;
173 static std::vector<Type> allTypes();
188 if (err != CL_SUCCESS)
189 throw Error(err, errStr);
197 template<
typename T,
bool Thin = sizeof(T) == sizeof(
typename T::cl_type)>
206 std::vector<typename T::cl_type> raw;
213 raw.reserve(in->size());
214 for (std::size_t i = 0; i < in->size(); i++)
215 raw.push_back((*in)[i]());
219 cl_uint size()
const {
return raw.size(); }
220 const typename T::cl_type *data()
const {
return raw.empty() ? NULL : &raw[0]; }
227 const typename T::cl_type *data_;
233 if (in != NULL && !in->empty())
235 data_ =
reinterpret_cast<const typename T::cl_type *
>(&(*in)[0]);
245 cl_uint size()
const {
return size_; }
246 const typename T::cl_type *data()
const {
return data_; }
251 void (CL_CALLBACK *callback)(
const cl::Event &,
void *);
252 void (CL_CALLBACK *free)(
void *);
256 static inline void CL_CALLBACK callbackWrapperCall(cl_event event,
void *userData)
259 clRetainEvent(event);
260 wrapper->callback(cl::Event(event), wrapper->userData);
263 static inline void CL_CALLBACK callbackWrapperFree(
void *userData)
267 wrapper->free(wrapper->userData);
272 void (CL_CALLBACK *callback)(
const cl::Event &,
void *),
274 void (CL_CALLBACK *free)(
void *))
277 wrapper->callback = callback;
278 wrapper->userData = userData;
279 wrapper->free = free;
284 static inline void CL_CALLBACK genericCallbackCall(cl_event event,
void *userData)
286 T *
self =
reinterpret_cast<T *
>(userData);
287 clRetainEvent(event);
288 (*self)(cl::Event(event));
292 static inline void CL_CALLBACK genericCallbackFree(
void *userData)
294 T *
self =
reinterpret_cast<T *
>(userData);
308 detail::Algorithm *detail_;
321 detail::Algorithm *moveAssign(
Algorithm &other);
326 detail::Algorithm *getDetail()
const;
332 detail::Algorithm *getDetailNonNull()
const;
337 void setDetail(detail::Algorithm *ptr);
356 void (CL_CALLBACK *callback)(
const cl::Event &,
void *),
358 void (CL_CALLBACK *free)(
void *) = NULL)
361 detail::callbackWrapperCall,
362 detail::makeCallbackWrapper(callback, userData, free),
363 detail::callbackWrapperFree);
376 detail::genericCallbackCall<T>,
378 detail::genericCallbackFree<T>);
382 void setEventCallback(
383 void (CL_CALLBACK *callback)(cl_event,
void *),
385 void (CL_CALLBACK *free)(
void *) = NULL);
Exception thrown when a configuration could not be tuned at all.
Definition: core.h:76
void setEventCallback(const T &callback)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: core.h:373
Pops default visibility if appropriate.
BaseType
Enumeration of scalar types supported by OpenCL C which can be stored in a buffer.
Definition: core.h:112
Exception thrown on internal errors that are not the user's fault.
Definition: core.h:58
Pushes default visibility if appropriate.
Encapsulation of an OpenCL built-in type that can be stored in a buffer.
Definition: core.h:134
Exception thrown when the autotuning cache could not be read.
Definition: core.h:67
Creates an array of handles from a vector of wrappers.
Definition: core.h:198
void setEventCallback(void(*callback)(const cl::Event &, void *), void *userData, void(*free)(void *)=NULL)
Set a callback function that will receive a list of all underlying events.
Definition: core.h:355
static void handleError(cl_int err, const char *errStr)
Throws an exception if a non-success error code is given.
Definition: core.h:186
Base class for all algorithm classes.
Definition: core.h:305
OpenCL primitives.
Definition: clogs.h:56