openGPMP
Open Source Mathematics Package
Macros | Functions
_cl_err.h File Reference
#include <CL/cl.h>

Go to the source code of this file.

Macros

#define checkError(E, S)   check_error(E, S, __FILE__, __LINE__)
 

Functions

const char * accl_err (cl_int err_in)
 
void check_error (cl_int err, const char *operation, char *filename, int line)
 

Macro Definition Documentation

◆ checkError

#define checkError (   E,
 
)    check_error(E, S, __FILE__, __LINE__)

Definition at line 150 of file _cl_err.h.

Function Documentation

◆ accl_err()

const char* accl_err ( cl_int  err_in)

Definition at line 33 of file _cl_err.h.

33  {
34  switch (err_in) {
35  case CL_SUCCESS:
36  return (char *)"CL_SUCCESS";
37  case CL_DEVICE_NOT_FOUND:
38  return (char *)"CL_DEVICE_NOT_FOUND";
39  case CL_DEVICE_NOT_AVAILABLE:
40  return (char *)"CL_DEVICE_NOT_AVAILABLE";
41  case CL_COMPILER_NOT_AVAILABLE:
42  return (char *)"CL_COMPILER_NOT_AVAILABLE";
43  case CL_MEM_OBJECT_ALLOCATION_FAILURE:
44  return (char *)"CL_MEM_OBJECT_ALLOCATION_FAILURE";
45  case CL_OUT_OF_RESOURCES:
46  return (char *)"CL_OUT_OF_RESOURCES";
47  case CL_OUT_OF_HOST_MEMORY:
48  return (char *)"CL_OUT_OF_HOST_MEMORY";
49  case CL_PROFILING_INFO_NOT_AVAILABLE:
50  return (char *)"CL_PROFILING_INFO_NOT_AVAILABLE";
51  case CL_MEM_COPY_OVERLAP:
52  return (char *)"CL_MEM_COPY_OVERLAP";
53  case CL_IMAGE_FORMAT_MISMATCH:
54  return (char *)"CL_IMAGE_FORMAT_MISMATCH";
55  case CL_IMAGE_FORMAT_NOT_SUPPORTED:
56  return (char *)"CL_IMAGE_FORMAT_NOT_SUPPORTED";
57  case CL_BUILD_PROGRAM_FAILURE:
58  return (char *)"CL_BUILD_PROGRAM_FAILURE";
59  case CL_MAP_FAILURE:
60  return (char *)"CL_MAP_FAILURE";
61  case CL_MISALIGNED_SUB_BUFFER_OFFSET:
62  return (char *)"CL_MISALIGNED_SUB_BUFFER_OFFSET";
63  case CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST:
64  return (char *)"CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST";
65  case CL_INVALID_VALUE:
66  return (char *)"CL_INVALID_VALUE";
67  case CL_INVALID_DEVICE_TYPE:
68  return (char *)"CL_INVALID_DEVICE_TYPE";
69  case CL_INVALID_PLATFORM:
70  return (char *)"CL_INVALID_PLATFORM";
71  case CL_INVALID_DEVICE:
72  return (char *)"CL_INVALID_DEVICE";
73  case CL_INVALID_CONTEXT:
74  return (char *)"CL_INVALID_CONTEXT";
75  case CL_INVALID_QUEUE_PROPERTIES:
76  return (char *)"CL_INVALID_QUEUE_PROPERTIES";
77  case CL_INVALID_COMMAND_QUEUE:
78  return (char *)"CL_INVALID_COMMAND_QUEUE";
79  case CL_INVALID_HOST_PTR:
80  return (char *)"CL_INVALID_HOST_PTR";
81  case CL_INVALID_MEM_OBJECT:
82  return (char *)"CL_INVALID_MEM_OBJECT";
83  case CL_INVALID_IMAGE_FORMAT_DESCRIPTOR:
84  return (char *)"CL_INVALID_IMAGE_FORMAT_DESCRIPTOR";
85  case CL_INVALID_IMAGE_SIZE:
86  return (char *)"CL_INVALID_IMAGE_SIZE";
87  case CL_INVALID_SAMPLER:
88  return (char *)"CL_INVALID_SAMPLER";
89  case CL_INVALID_BINARY:
90  return (char *)"CL_INVALID_BINARY";
91  case CL_INVALID_BUILD_OPTIONS:
92  return (char *)"CL_INVALID_BUILD_OPTIONS";
93  case CL_INVALID_PROGRAM:
94  return (char *)"CL_INVALID_PROGRAM";
95  case CL_INVALID_PROGRAM_EXECUTABLE:
96  return (char *)"CL_INVALID_PROGRAM_EXECUTABLE";
97  case CL_INVALID_KERNEL_NAME:
98  return (char *)"CL_INVALID_KERNEL_NAME";
99  case CL_INVALID_KERNEL_DEFINITION:
100  return (char *)"CL_INVALID_KERNEL_DEFINITION";
101  case CL_INVALID_KERNEL:
102  return (char *)"CL_INVALID_KERNEL";
103  case CL_INVALID_ARG_INDEX:
104  return (char *)"CL_INVALID_ARG_INDEX";
105  case CL_INVALID_ARG_VALUE:
106  return (char *)"CL_INVALID_ARG_VALUE";
107  case CL_INVALID_ARG_SIZE:
108  return (char *)"CL_INVALID_ARG_SIZE";
109  case CL_INVALID_KERNEL_ARGS:
110  return (char *)"CL_INVALID_KERNEL_ARGS";
111  case CL_INVALID_WORK_DIMENSION:
112  return (char *)"CL_INVALID_WORK_DIMENSION";
113  case CL_INVALID_WORK_GROUP_SIZE:
114  return (char *)"CL_INVALID_WORK_GROUP_SIZE";
115  case CL_INVALID_WORK_ITEM_SIZE:
116  return (char *)"CL_INVALID_WORK_ITEM_SIZE";
117  case CL_INVALID_GLOBAL_OFFSET:
118  return (char *)"CL_INVALID_GLOBAL_OFFSET";
119  case CL_INVALID_EVENT_WAIT_LIST:
120  return (char *)"CL_INVALID_EVENT_WAIT_LIST";
121  case CL_INVALID_EVENT:
122  return (char *)"CL_INVALID_EVENT";
123  case CL_INVALID_OPERATION:
124  return (char *)"CL_INVALID_OPERATION";
125  case CL_INVALID_GL_OBJECT:
126  return (char *)"CL_INVALID_GL_OBJECT";
127  case CL_INVALID_BUFFER_SIZE:
128  return (char *)"CL_INVALID_BUFFER_SIZE";
129  case CL_INVALID_MIP_LEVEL:
130  return (char *)"CL_INVALID_MIP_LEVEL";
131  case CL_INVALID_GLOBAL_WORK_SIZE:
132  return (char *)"CL_INVALID_GLOBAL_WORK_SIZE";
133  case CL_INVALID_PROPERTY:
134  return (char *)"CL_INVALID_PROPERTY";
135 
136  default:
137  return (char *)"UNKNOWN ERROR";
138  }
139 }

◆ check_error()

void check_error ( cl_int  err,
const char *  operation,
char *  filename,
int  line 
)

Definition at line 141 of file _cl_err.h.

141  {
142  if (err != CL_SUCCESS) {
143  fprintf(stderr, "Error during operation '%s', ", operation);
144  fprintf(stderr, "in '%s' on line %d\n", filename, line);
145  fprintf(stderr, "Error code was \"%s\" (%d)\n", err_code(err), err);
146  exit(EXIT_FAILURE);
147  }
148 }