1 #ifndef OCL_UTILITIES_H
2 #define OCL_UTILITIES_H
5 #include <OpenCL/opencl.h>
10 /* Return the OpenCL error string for a given error number.
12 const char *opencl_error_string(cl_int error
);
14 /* Find a GPU or a CPU associated with the first available platform.
15 * If use_gpu is set, then this function first tries to look for a GPU
16 * in the first available platform.
17 * If this fails or if use_gpu is not set, then it tries to use the CPU.
19 cl_device_id
opencl_create_device(int use_gpu
);
21 /* Create an OpenCL program from a string and compile it.
23 cl_program
opencl_build_program_from_string(cl_context ctx
, cl_device_id dev
,
24 const char *program_source
, size_t program_size
,
25 const char *opencl_options
);
27 /* Create an OpenCL program from a source file and compile it.
29 cl_program
opencl_build_program_from_file(cl_context ctx
, cl_device_id dev
,
30 const char* filename
, const char* opencl_options
);