Commit 7d3357c9 by Marcus Winter

mtapi_opencl_c: added check for successful dynamic linking of opencl runtime

parent 7f904252
...@@ -258,31 +258,32 @@ void mtapi_opencl_plugin_initialize( ...@@ -258,31 +258,32 @@ void mtapi_opencl_plugin_initialize(
cl_int err; cl_int err;
embb_mtapi_opencl_plugin_t * plugin = &embb_mtapi_opencl_plugin; embb_mtapi_opencl_plugin_t * plugin = &embb_mtapi_opencl_plugin;
embb_mtapi_opencl_link_at_runtime(); err = embb_mtapi_opencl_link_at_runtime();
if (err != 0) {
err = clGetPlatformIDs(1, &plugin->platform_id, NULL); err = clGetPlatformIDs(1, &plugin->platform_id, NULL);
if (CL_SUCCESS == err) { if (CL_SUCCESS == err) {
err = clGetDeviceIDs(plugin->platform_id, CL_DEVICE_TYPE_DEFAULT, err = clGetDeviceIDs(plugin->platform_id, CL_DEVICE_TYPE_DEFAULT,
1, &plugin->device_id, NULL); 1, &plugin->device_id, NULL);
} }
if (CL_SUCCESS == err) { if (CL_SUCCESS == err) {
plugin->context = clCreateContext(NULL, 1, &plugin->device_id, plugin->context = clCreateContext(NULL, 1, &plugin->device_id,
NULL, NULL, &err); NULL, NULL, &err);
} }
if (CL_SUCCESS == err) { if (CL_SUCCESS == err) {
err = clGetDeviceInfo(plugin->device_id, CL_DEVICE_MAX_WORK_GROUP_SIZE, err = clGetDeviceInfo(plugin->device_id, CL_DEVICE_MAX_WORK_GROUP_SIZE,
sizeof(cl_uint), &plugin->work_group_size, NULL); sizeof(cl_uint), &plugin->work_group_size, NULL);
} }
if (CL_SUCCESS == err) { if (CL_SUCCESS == err) {
err = clGetDeviceInfo(plugin->device_id, CL_DEVICE_MAX_WORK_ITEM_SIZES, err = clGetDeviceInfo(plugin->device_id, CL_DEVICE_MAX_WORK_ITEM_SIZES,
3 * sizeof(cl_uint), &plugin->work_item_sizes[0], NULL); 3 * sizeof(cl_uint), &plugin->work_item_sizes[0], NULL);
} }
if (CL_SUCCESS == err) { if (CL_SUCCESS == err) {
plugin->command_queue = clCreateCommandQueue(plugin->context, plugin->command_queue = clCreateCommandQueue(plugin->context,
plugin->device_id, 0, &err); plugin->device_id, 0, &err);
} }
if (CL_SUCCESS == err) { if (CL_SUCCESS == err) {
local_status = MTAPI_SUCCESS; local_status = MTAPI_SUCCESS;
}
} }
mtapi_status_set(status, local_status); mtapi_status_set(status, local_status);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment