summaryrefslogtreecommitdiff
path: root/cl_util.c
blob: 1bccd8c8ee3c345d2acc0552b7b3f01ca5a19c7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <CL/cl.h>

#include <fcntl.h>
#include <stdio.h>
#include <string.h>

#include "cl_util.h"

#define CASE_ERR(ec) case ec: return #ec;

const char * clUtilErrorString(cl_int error)
{
   switch(error) {

   CASE_ERR(CL_DEVICE_NOT_AVAILABLE);
   CASE_ERR(CL_DEVICE_NOT_FOUND);
   CASE_ERR(CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST);
   CASE_ERR(CL_INVALID_ARG_INDEX);
   CASE_ERR(CL_INVALID_ARG_SIZE);
   CASE_ERR(CL_INVALID_ARG_VALUE);
   CASE_ERR(CL_INVALID_BUFFER_SIZE);
   CASE_ERR(CL_INVALID_COMMAND_QUEUE);
   CASE_ERR(CL_INVALID_CONTEXT);
   CASE_ERR(CL_INVALID_DEVICE);
   CASE_ERR(CL_INVALID_DEVICE_TYPE);
   CASE_ERR(CL_INVALID_EVENT_WAIT_LIST);
   CASE_ERR(CL_INVALID_GLOBAL_OFFSET);
   CASE_ERR(CL_INVALID_GLOBAL_WORK_SIZE);
   CASE_ERR(CL_INVALID_HOST_PTR);
   CASE_ERR(CL_INVALID_IMAGE_SIZE);
   CASE_ERR(CL_INVALID_KERNEL);
   CASE_ERR(CL_INVALID_KERNEL_ARGS);
   CASE_ERR(CL_INVALID_KERNEL_DEFINITION);
   CASE_ERR(CL_INVALID_KERNEL_NAME);
   CASE_ERR(CL_INVALID_MEM_OBJECT);
   CASE_ERR(CL_INVALID_OPERATION);
   CASE_ERR(CL_INVALID_PLATFORM);
   CASE_ERR(CL_INVALID_PROGRAM);
   CASE_ERR(CL_INVALID_PROGRAM_EXECUTABLE);
   CASE_ERR(CL_INVALID_PROPERTY);
   CASE_ERR(CL_INVALID_SAMPLER);
   CASE_ERR(CL_INVALID_VALUE);
   CASE_ERR(CL_INVALID_WORK_DIMENSION);
   CASE_ERR(CL_INVALID_WORK_GROUP_SIZE);
   CASE_ERR(CL_INVALID_WORK_ITEM_SIZE);
   CASE_ERR(CL_MEM_OBJECT_ALLOCATION_FAILURE);
   CASE_ERR(CL_MISALIGNED_SUB_BUFFER_OFFSET);
   CASE_ERR(CL_OUT_OF_HOST_MEMORY);
   CASE_ERR(CL_OUT_OF_RESOURCES);
   CASE_ERR(CL_SUCCESS);

   }
}