Implemented OpenCL library loader
[hashcat.git] / src / ext_OpenCL.c
1 /**
2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * Gabriele Gristina <matrix@hashcat.net>
4 *
5 * License.....: MIT
6 */
7
8 #include <ext_OpenCL.h>
9
10 const char *val2cstr_cl (cl_int CL_err)
11 {
12 #define CLERR(a) case a: return #a
13
14 switch (CL_err)
15 {
16 CLERR (CL_BUILD_PROGRAM_FAILURE);
17 CLERR (CL_COMPILER_NOT_AVAILABLE);
18 CLERR (CL_DEVICE_NOT_FOUND);
19 CLERR (CL_INVALID_ARG_INDEX);
20 CLERR (CL_INVALID_ARG_SIZE);
21 CLERR (CL_INVALID_ARG_VALUE);
22 CLERR (CL_INVALID_BINARY);
23 CLERR (CL_INVALID_BUFFER_SIZE);
24 CLERR (CL_INVALID_BUILD_OPTIONS);
25 CLERR (CL_INVALID_COMMAND_QUEUE);
26 CLERR (CL_INVALID_CONTEXT);
27 CLERR (CL_INVALID_DEVICE);
28 CLERR (CL_INVALID_DEVICE_TYPE);
29 CLERR (CL_INVALID_EVENT);
30 CLERR (CL_INVALID_EVENT_WAIT_LIST);
31 CLERR (CL_INVALID_GLOBAL_OFFSET);
32 CLERR (CL_INVALID_HOST_PTR);
33 CLERR (CL_INVALID_KERNEL);
34 CLERR (CL_INVALID_KERNEL_ARGS);
35 CLERR (CL_INVALID_KERNEL_DEFINITION);
36 CLERR (CL_INVALID_KERNEL_NAME);
37 CLERR (CL_INVALID_MEM_OBJECT);
38 CLERR (CL_INVALID_OPERATION);
39 CLERR (CL_INVALID_PLATFORM);
40 CLERR (CL_INVALID_PROGRAM);
41 CLERR (CL_INVALID_PROGRAM_EXECUTABLE);
42 CLERR (CL_INVALID_QUEUE_PROPERTIES);
43 CLERR (CL_INVALID_SAMPLER);
44 CLERR (CL_INVALID_VALUE);
45 CLERR (CL_INVALID_WORK_DIMENSION);
46 CLERR (CL_INVALID_WORK_GROUP_SIZE);
47 CLERR (CL_INVALID_WORK_ITEM_SIZE);
48 CLERR (CL_MISALIGNED_SUB_BUFFER_OFFSET);
49 CLERR (CL_MAP_FAILURE);
50 CLERR (CL_MEM_COPY_OVERLAP);
51 CLERR (CL_MEM_OBJECT_ALLOCATION_FAILURE);
52 CLERR (CL_OUT_OF_HOST_MEMORY);
53 CLERR (CL_OUT_OF_RESOURCES);
54 }
55
56 return "CL_UNKNOWN_ERROR";
57 }
58
59 #define LOAD_FUNC(ptr,name,type) \
60 ptr->name = (type) hc_dlsym (ptr->lib, #name); \
61 if (!ptr->name) { \
62 log_error ("ERROR: #name is missing from opencl shared library"); \
63 exit (-1); \
64 }
65
66 void ocl_init (OCL_PTR *ocl)
67 {
68 memset (ocl, 0, sizeof (hc_opencl_lib_t));
69
70 #ifdef _WIN
71 ocl->lib = hc_dlopen ("OpenCL");
72 #elif OSX
73 ocl->lib = hc_dlopen ("/System/Library/Frameworks/OpenCL.framework/OpenCL", RTLD_NOW);
74 #else
75 ocl->lib = hc_dlopen ("libOpenCL.so", RTLD_NOW);
76 #endif
77
78 if (!ocl->lib)
79 {
80 log_error ("ERROR: cannot load opencl library");
81
82 exit (-1);
83 }
84
85 LOAD_FUNC(ocl, clBuildProgram, OCL_CLBUILDPROGRAM)
86 LOAD_FUNC(ocl, clCreateBuffer, OCL_CLCREATEBUFFER)
87 LOAD_FUNC(ocl, clCreateCommandQueue, OCL_CLCREATECOMMANDQUEUE)
88 LOAD_FUNC(ocl, clCreateContext, OCL_CLCREATECONTEXT)
89 LOAD_FUNC(ocl, clCreateKernel, OCL_CLCREATEKERNEL)
90 LOAD_FUNC(ocl, clCreateProgramWithBinary, OCL_CLCREATEPROGRAMWITHBINARY)
91 LOAD_FUNC(ocl, clCreateProgramWithSource, OCL_CLCREATEPROGRAMWITHSOURCE)
92 LOAD_FUNC(ocl, clEnqueueCopyBuffer, OCL_CLENQUEUECOPYBUFFER)
93 LOAD_FUNC(ocl, clEnqueueFillBuffer, OCL_CLENQUEUEFILLBUFFER)
94 LOAD_FUNC(ocl, clEnqueueMapBuffer, OCL_CLENQUEUEMAPBUFFER)
95 LOAD_FUNC(ocl, clEnqueueNDRangeKernel, OCL_CLENQUEUENDRANGEKERNEL)
96 LOAD_FUNC(ocl, clEnqueueReadBuffer, OCL_CLENQUEUEREADBUFFER)
97 LOAD_FUNC(ocl, clEnqueueUnmapMemObject, OCL_CLENQUEUEUNMAPMEMOBJECT)
98 LOAD_FUNC(ocl, clEnqueueWriteBuffer, OCL_CLENQUEUEWRITEBUFFER)
99 LOAD_FUNC(ocl, clFinish, OCL_CLFINISH)
100 LOAD_FUNC(ocl, clFlush, OCL_CLFLUSH)
101 LOAD_FUNC(ocl, clGetDeviceIDs, OCL_CLGETDEVICEIDS)
102 LOAD_FUNC(ocl, clGetDeviceInfo, OCL_CLGETDEVICEINFO)
103 LOAD_FUNC(ocl, clGetEventInfo, OCL_CLGETEVENTINFO)
104 LOAD_FUNC(ocl, clGetKernelWorkGroupInfo, OCL_CLGETKERNELWORKGROUPINFO)
105 LOAD_FUNC(ocl, clGetPlatformIDs, OCL_CLGETPLATFORMIDS)
106 LOAD_FUNC(ocl, clGetPlatformInfo, OCL_CLGETPLATFORMINFO)
107 LOAD_FUNC(ocl, clGetProgramBuildInfo, OCL_CLGETPROGRAMBUILDINFO)
108 LOAD_FUNC(ocl, clGetProgramInfo, OCL_CLGETPROGRAMINFO)
109 LOAD_FUNC(ocl, clReleaseCommandQueue, OCL_CLRELEASECOMMANDQUEUE)
110 LOAD_FUNC(ocl, clReleaseContext, OCL_CLRELEASECONTEXT)
111 LOAD_FUNC(ocl, clReleaseKernel, OCL_CLRELEASEKERNEL)
112 LOAD_FUNC(ocl, clReleaseMemObject, OCL_CLRELEASEMEMOBJECT)
113 LOAD_FUNC(ocl, clReleaseProgram, OCL_CLRELEASEPROGRAM)
114 LOAD_FUNC(ocl, clSetKernelArg, OCL_CLSETKERNELARG)
115 }
116
117 void ocl_close (OCL_PTR *ocl)
118 {
119 if (ocl)
120 {
121 if (ocl->lib)
122 hc_dlclose (ocl->lib);
123
124 free (ocl);
125 }
126 }
127
128 void hc_clEnqueueNDRangeKernel (OCL_PTR *ocl, cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim, const size_t *global_work_offset, const size_t *global_work_size, const size_t *local_work_size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
129 {
130 cl_int CL_err = ocl->clEnqueueNDRangeKernel (command_queue, kernel, work_dim, global_work_offset, global_work_size, local_work_size, num_events_in_wait_list, event_wait_list, event);
131
132 if (CL_err != CL_SUCCESS)
133 {
134 log_error ("ERROR: %s : %d : %s\n", "clEnqueueNDRangeKernel()", CL_err, val2cstr_cl (CL_err));
135
136 exit (-1);
137 }
138 }
139
140 void hc_clGetEventInfo (OCL_PTR *ocl, cl_event event, cl_event_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
141 {
142 cl_int CL_err = ocl->clGetEventInfo (event, param_name, param_value_size, param_value, param_value_size_ret);
143
144 if (CL_err != CL_SUCCESS)
145 {
146 log_error ("ERROR: %s : %d : %s\n", "clGetEventInfo()", CL_err, val2cstr_cl (CL_err));
147
148 exit (-1);
149 }
150 }
151
152 void hc_clFlush (OCL_PTR *ocl, cl_command_queue command_queue)
153 {
154 cl_int CL_err = ocl->clFlush (command_queue);
155
156 if (CL_err != CL_SUCCESS)
157 {
158 log_error ("ERROR: %s : %d : %s\n", "clFlush()", CL_err, val2cstr_cl (CL_err));
159
160 exit (-1);
161 }
162 }
163
164 void hc_clFinish (OCL_PTR *ocl, cl_command_queue command_queue)
165 {
166 cl_int CL_err = ocl->clFinish (command_queue);
167
168 if (CL_err != CL_SUCCESS)
169 {
170 log_error ("ERROR: %s : %d : %s\n", "clFinish()", CL_err, val2cstr_cl (CL_err));
171
172 exit (-1);
173 }
174 }
175
176 void hc_clSetKernelArg (OCL_PTR *ocl, cl_kernel kernel, cl_uint arg_index, size_t arg_size, const void *arg_value)
177 {
178 cl_int CL_err = ocl->clSetKernelArg (kernel, arg_index, arg_size, arg_value);
179
180 if (CL_err != CL_SUCCESS)
181 {
182 log_error ("ERROR: %s : %d : %s\n", "clSetKernelArg()", CL_err, val2cstr_cl (CL_err));
183
184 exit (-1);
185 }
186 }
187
188 void hc_clEnqueueWriteBuffer (OCL_PTR *ocl, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, size_t offset, size_t cb, const void *ptr, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
189 {
190 cl_int CL_err = ocl->clEnqueueWriteBuffer (command_queue, buffer, blocking_write, offset, cb, ptr, num_events_in_wait_list, event_wait_list, event);
191
192 if (CL_err != CL_SUCCESS)
193 {
194 log_error ("ERROR: %s : %d : %s\n", "clEnqueueWriteBuffer()", CL_err, val2cstr_cl (CL_err));
195
196 exit (-1);
197 }
198 }
199
200 void hc_clEnqueueCopyBuffer (OCL_PTR *ocl, cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, size_t src_offset, size_t dst_offset, size_t cb, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
201 {
202 cl_int CL_err = ocl->clEnqueueCopyBuffer (command_queue, src_buffer, dst_buffer, src_offset, dst_offset, cb, num_events_in_wait_list, event_wait_list, event);
203
204 if (CL_err != CL_SUCCESS)
205 {
206 log_error ("ERROR: %s : %d : %s\n", "clEnqueueCopyBuffer()", CL_err, val2cstr_cl (CL_err));
207
208 exit (-1);
209 }
210 }
211
212 void hc_clEnqueueReadBuffer (OCL_PTR *ocl, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, size_t offset, size_t cb, void *ptr, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
213 {
214 cl_int CL_err = ocl->clEnqueueReadBuffer (command_queue, buffer, blocking_read, offset, cb, ptr, num_events_in_wait_list, event_wait_list, event);
215
216 if (CL_err != CL_SUCCESS)
217 {
218 log_error ("ERROR: %s : %d : %s\n", "clEnqueueReadBuffer()", CL_err, val2cstr_cl (CL_err));
219
220 exit (-1);
221 }
222 }
223
224 void hc_clGetPlatformIDs (OCL_PTR *ocl, cl_uint num_entries, cl_platform_id *platforms, cl_uint *num_platforms)
225 {
226 cl_int CL_err = ocl->clGetPlatformIDs (num_entries, platforms, num_platforms);
227
228 if (CL_err != CL_SUCCESS)
229 {
230 log_error ("ERROR: %s : %d : %s\n", "clGetPlatformIDs()", CL_err, val2cstr_cl (CL_err));
231
232 exit (-1);
233 }
234 }
235
236 void hc_clGetPlatformInfo (OCL_PTR *ocl, cl_platform_id platform, cl_platform_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
237 {
238 cl_int CL_err = ocl->clGetPlatformInfo (platform, param_name, param_value_size, param_value, param_value_size_ret);
239
240 if (CL_err != CL_SUCCESS)
241 {
242 log_error ("ERROR: %s : %d : %s\n", "clGetPlatformInfo()", CL_err, val2cstr_cl (CL_err));
243
244 exit (-1);
245 }
246 }
247
248 void hc_clGetDeviceIDs (OCL_PTR *ocl, cl_platform_id platform, cl_device_type device_type, cl_uint num_entries, cl_device_id *devices, cl_uint *num_devices)
249 {
250 cl_int CL_err = ocl->clGetDeviceIDs (platform, device_type, num_entries, devices, num_devices);
251
252 if (CL_err != CL_SUCCESS)
253 {
254 log_error ("ERROR: %s : %d : %s\n", "clGetDeviceIDs()", CL_err, val2cstr_cl (CL_err));
255
256 exit (-1);
257 }
258 }
259
260 void hc_clGetDeviceInfo (OCL_PTR *ocl, cl_device_id device, cl_device_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
261 {
262 cl_int CL_err = ocl->clGetDeviceInfo (device, param_name, param_value_size, param_value, param_value_size_ret);
263
264 if (CL_err != CL_SUCCESS)
265 {
266 log_error ("ERROR: %s : %d : %s\n", "clGetDeviceInfo()", CL_err, val2cstr_cl (CL_err));
267
268 exit (-1);
269 }
270 }
271
272 cl_context hc_clCreateContext (OCL_PTR *ocl, cl_context_properties *properties, cl_uint num_devices, const cl_device_id *devices, void (CL_CALLBACK *pfn_notify) (const char *, const void *, size_t, void *), void *user_data)
273 {
274 cl_int CL_err;
275
276 cl_context context = ocl->clCreateContext (properties, num_devices, devices, pfn_notify, user_data, &CL_err);
277
278 if (CL_err != CL_SUCCESS)
279 {
280 log_error ("ERROR: %s : %d : %s\n", "clCreateContext()", CL_err, val2cstr_cl (CL_err));
281
282 exit (-1);
283 }
284
285 return (context);
286 }
287
288 cl_command_queue hc_clCreateCommandQueue (OCL_PTR *ocl, cl_context context, cl_device_id device, cl_command_queue_properties properties)
289 {
290 cl_int CL_err;
291
292 cl_command_queue command_queue = ocl->clCreateCommandQueue (context, device, properties, &CL_err);
293
294 if (CL_err != CL_SUCCESS)
295 {
296 log_error ("ERROR: %s : %d : %s\n", "clCreateCommandQueue()", CL_err, val2cstr_cl (CL_err));
297
298 exit (-1);
299 }
300
301 return (command_queue);
302 }
303
304 /*
305 cl_command_queue hc_clCreateCommandQueueWithProperties (cl_context context, cl_device_id device, const cl_queue_properties *properties)
306 {
307 cl_int CL_err;
308
309 cl_command_queue command_queue = clCreateCommandQueueWithProperties (context, device, properties, &CL_err);
310
311 if (CL_err != CL_SUCCESS)
312 {
313 log_error ("ERROR: %s : %d : %s\n", "clCreateCommandQueueWithProperties()", CL_err, val2cstr_cl (CL_err));
314
315 exit (-1);
316 }
317
318 return (command_queue);
319 }
320 */
321
322 cl_mem hc_clCreateBuffer (OCL_PTR *ocl, cl_context context, cl_mem_flags flags, size_t size, void *host_ptr)
323 {
324 cl_int CL_err;
325
326 cl_mem mem = ocl->clCreateBuffer (context, flags, size, host_ptr, &CL_err);
327
328 if (CL_err != CL_SUCCESS)
329 {
330 log_error ("ERROR: %s : %d : %s\n", "clCreateBuffer()", CL_err, val2cstr_cl (CL_err));
331
332 exit (-1);
333 }
334
335 return (mem);
336 }
337
338 cl_program hc_clCreateProgramWithSource (OCL_PTR *ocl, cl_context context, cl_uint count, const char **strings, const size_t *lengths)
339 {
340 cl_int CL_err;
341
342 cl_program program = ocl->clCreateProgramWithSource (context, count, strings, lengths, &CL_err);
343
344 if (CL_err != CL_SUCCESS)
345 {
346 log_error ("ERROR: %s : %d : %s\n", "clCreateProgramWithSource()", CL_err, val2cstr_cl (CL_err));
347
348 exit (-1);
349 }
350
351 return (program);
352 }
353
354 cl_program hc_clCreateProgramWithBinary (OCL_PTR *ocl, cl_context context, cl_uint num_devices, const cl_device_id *device_list, const size_t *lengths, const unsigned char **binaries, cl_int *binary_status)
355 {
356 cl_int CL_err;
357
358 cl_program program = ocl->clCreateProgramWithBinary (context, num_devices, device_list, lengths, binaries, binary_status, &CL_err);
359
360 if (CL_err != CL_SUCCESS)
361 {
362 log_error ("ERROR: %s : %d : %s\n", "clCreateProgramWithBinary()", CL_err, val2cstr_cl (CL_err));
363
364 exit (-1);
365 }
366
367 return (program);
368 }
369
370 void hc_clBuildProgram (OCL_PTR *ocl, cl_program program, cl_uint num_devices, const cl_device_id *device_list, const char *options, void (CL_CALLBACK *pfn_notify) (cl_program program, void *user_data), void *user_data)
371 {
372 cl_int CL_err = ocl->clBuildProgram (program, num_devices, device_list, options, pfn_notify, user_data);
373
374 if (CL_err != CL_SUCCESS)
375 {
376 log_error ("ERROR: %s : %d : %s\n", "clBuildProgram()", CL_err, val2cstr_cl (CL_err));
377
378 // If we exit here we can't see the error message
379 // exit (-1);
380 }
381 }
382
383 cl_kernel hc_clCreateKernel (OCL_PTR *ocl, cl_program program, const char *kernel_name)
384 {
385 cl_int CL_err;
386
387 cl_kernel kernel = ocl->clCreateKernel (program, kernel_name, &CL_err);
388
389 if (CL_err != CL_SUCCESS)
390 {
391 log_error ("ERROR: %s %d - %s\n", "clCreateKernel()", CL_err, kernel_name);
392
393 exit (-1);
394 }
395
396 return (kernel);
397 }
398
399 void hc_clReleaseMemObject (OCL_PTR *ocl, cl_mem mem)
400 {
401 cl_int CL_err = ocl->clReleaseMemObject (mem);
402
403 if (CL_err != CL_SUCCESS)
404 {
405 log_error ("ERROR: %s : %d : %s\n", "clReleaseMemObject()", CL_err, val2cstr_cl (CL_err));
406
407 exit (-1);
408 }
409 }
410
411 void hc_clReleaseKernel (OCL_PTR *ocl, cl_kernel kernel)
412 {
413 cl_int CL_err = ocl->clReleaseKernel (kernel);
414
415 if (CL_err != CL_SUCCESS)
416 {
417 log_error ("ERROR: %s : %d : %s\n", "clReleaseProgram()", CL_err, val2cstr_cl (CL_err));
418
419 exit (-1);
420 }
421 }
422
423 void hc_clReleaseProgram (OCL_PTR *ocl, cl_program program)
424 {
425 cl_int CL_err = ocl->clReleaseProgram (program);
426
427 if (CL_err != CL_SUCCESS)
428 {
429 log_error ("ERROR: %s : %d : %s\n", "clReleaseProgram()", CL_err, val2cstr_cl (CL_err));
430
431 exit (-1);
432 }
433 }
434
435 void hc_clReleaseCommandQueue (OCL_PTR *ocl, cl_command_queue command_queue)
436 {
437 cl_int CL_err = ocl->clReleaseCommandQueue (command_queue);
438
439 if (CL_err != CL_SUCCESS)
440 {
441 log_error ("ERROR: %s : %d : %s\n", "clReleaseCommandQueue()", CL_err, val2cstr_cl (CL_err));
442
443 exit (-1);
444 }
445 }
446
447 void hc_clReleaseContext (OCL_PTR *ocl, cl_context context)
448 {
449 cl_int CL_err = ocl->clReleaseContext (context);
450
451 if (CL_err != CL_SUCCESS)
452 {
453 log_error ("ERROR: %s : %d : %s\n", "clReleaseContext()", CL_err, val2cstr_cl (CL_err));
454
455 exit (-1);
456 }
457 }
458
459 void *hc_clEnqueueMapBuffer (OCL_PTR *ocl, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, cl_map_flags map_flags, size_t offset, size_t cb, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
460 {
461 cl_int CL_err;
462
463 void *buf = ocl->clEnqueueMapBuffer (command_queue, buffer, blocking_read, map_flags, offset, cb, num_events_in_wait_list, event_wait_list, event, &CL_err);
464
465 if (CL_err != CL_SUCCESS)
466 {
467 log_error ("ERROR: %s : %d : %s\n", "clEnqueueMapBuffer()", CL_err, val2cstr_cl (CL_err));
468
469 exit (-1);
470 }
471
472 return buf;
473 }
474
475 void hc_clEnqueueUnmapMemObject (OCL_PTR *ocl, cl_command_queue command_queue, cl_mem memobj, void *mapped_ptr, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
476 {
477 cl_int CL_err = ocl->clEnqueueUnmapMemObject (command_queue, memobj, mapped_ptr, num_events_in_wait_list, event_wait_list, event);
478
479 if (CL_err != CL_SUCCESS)
480 {
481 log_error ("ERROR: %s : %d : %s\n", "clEnqueueUnmapMemObject()", CL_err, val2cstr_cl (CL_err));
482
483 exit (-1);
484 }
485 }
486
487 void hc_clEnqueueFillBuffer (OCL_PTR *ocl, cl_command_queue command_queue, cl_mem buffer, const void *pattern, size_t pattern_size, size_t offset, size_t size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
488 {
489 cl_int CL_err = ocl->clEnqueueFillBuffer (command_queue, buffer, pattern, pattern_size, offset, size, num_events_in_wait_list, event_wait_list, event);
490
491 if (CL_err != CL_SUCCESS)
492 {
493 log_error ("ERROR: %s : %d : %s\n", "clEnqueueFillBuffer()", CL_err, val2cstr_cl (CL_err));
494
495 exit (-1);
496 }
497 }
498
499 void hc_clGetKernelWorkGroupInfo (OCL_PTR *ocl, cl_kernel kernel, cl_device_id device, cl_kernel_work_group_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
500 {
501 cl_int CL_err = ocl->clGetKernelWorkGroupInfo (kernel, device, param_name, param_value_size, param_value, param_value_size_ret);
502
503 if (CL_err != CL_SUCCESS)
504 {
505 log_error ("ERROR: %s : %d : %s\n", "clGetKernelWorkGroupInfo()", CL_err, val2cstr_cl (CL_err));
506
507 exit (-1);
508 }
509 }
510
511 void hc_clGetProgramBuildInfo (OCL_PTR *ocl, cl_program program, cl_device_id device, cl_program_build_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
512 {
513 cl_int CL_err = ocl->clGetProgramBuildInfo (program, device, param_name, param_value_size, param_value, param_value_size_ret);
514
515 if (CL_err != CL_SUCCESS)
516 {
517 log_error ("ERROR: %s : %d : %s\n", "clGetProgramBuildInfo()", CL_err, val2cstr_cl (CL_err));
518
519 exit (-1);
520 }
521 }
522
523 void hc_clGetProgramInfo (OCL_PTR *ocl, cl_program program, cl_program_info param_name, size_t param_value_size, void *param_value, size_t * param_value_size_ret)
524 {
525 cl_int CL_err = ocl->clGetProgramInfo (program, param_name, param_value_size, param_value, param_value_size_ret);
526
527 if (CL_err != CL_SUCCESS)
528 {
529 log_error ("ERROR: %s : %d : %s\n", "clGetProgramInfo()", CL_err, val2cstr_cl (CL_err));
530
531 exit (-1);
532 }
533 }