SOCL_CreateContext
SOCL_CreateContext
SOCL_context_t *
SOCL_CreateContextAndLoadProgram(cl_device_type dtype,
unsigned int socl_create_flags,
char * source_file_name)
Description
SOCL_CreateContextAndLoadProgram initializes the OpenCL runtime system, selects a target device, and creates an SOCL context object to keep track of allocated resources. After the context is created, the file source_file_name is compiled with the OpenCL just-in-time compiler.
Parameters
dtype one of CL_DEVICE_TYPE_CPU, CL_DEVICE_TYPE_GPU, CL_DEVICE_TYPE_ACCELERATOR, CL_DEVICE_TYPE_DEFAULT, or CL_DEVICE_TYPE_ALL. Typically, this is CL_DEVICE_TYPE_GPU.
See the OpenCL reference for clGetDeviceIDs.
socl_create_flags bitwise OR of
SOCL_ABORT_ON_ERROR SOCL will call exit(-1) for any unrecoverable error in calling the OpenCL runtime.
SOCL_WAIT_FOR_COMPLETION SOCL operations that enqueue operations to the device will not return until the operation is complete.
SOCL_COLLECT_TIMING The SOCL runtime will measure time-to-complete each major operation and write the results to SOCL.log when SOCL_Close is called.
source_file_name is the name of an OpenCL program file containing kernel definitions.
Errors
SOCL_CreateContext will return NULL on any error unless SOCL_ABORT_ON_ERROR is set. In the latter case, the program will terminate.
Notes
SOCL_CreateContext or SOCL_CreateContextAndLoadProgram must be called before any other SOCL routines.