1#ifndef STAN_MATH_OPENCL_ERR_CHECK_OPENCL_HPP
2#define STAN_MATH_OPENCL_ERR_CHECK_OPENCL_HPP
7#include <CL/opencl.hpp>
31 system_error(function,
e.what(),
e.err(),
"CL_DEVICE_NOT_AVAILABLE");
33 system_error(function,
e.what(),
e.err(),
"CL_COMPILER_NOT_AVAILABLE");
36 "CL_MEM_OBJECT_ALLOCATION_FAILURE");
40 system_error(function,
e.what(),
e.err(),
"CL_OUT_OF_HOST_MEMORY");
43 "CL_PROFILING_INFO_NOT_AVAILABLE");
47 system_error(function,
e.what(),
e.err(),
"CL_IMAGE_FORMAT_MISMATCH");
50 "CL_IMAGE_FORMAT_NOT_SUPPORTED");
52 system_error(function,
e.what(),
e.err(),
"CL_BUILD_PROGRAM_FAILURE");
57 "CL_MISALIGNED_SUB_BUFFER_OFFSET");
60 "CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST");
62 system_error(function,
e.what(),
e.err(),
"CL_COMPILE_PROGRAM_FAILURE");
64 system_error(function,
e.what(),
e.err(),
"CL_LINKER_NOT_AVAILABLE");
66 system_error(function,
e.what(),
e.err(),
"CL_LINK_PROGRAM_FAILURE");
68 system_error(function,
e.what(),
e.err(),
"CL_DEVICE_PARTITION_FAILED");
71 "CL_KERNEL_ARG_INFO_NOT_AVAILABLE");
75 system_error(function,
e.what(),
e.err(),
"CL_INVALID_DEVICE_TYPE");
83 system_error(function,
e.what(),
e.err(),
"CL_INVALID_QUEUE_PROPERTIES");
85 system_error(function,
e.what(),
e.err(),
"CL_INVALID_COMMAND_QUEUE");
89 system_error(function,
e.what(),
e.err(),
"CL_INVALID_MEM_OBJECT");
92 "CL_INVALID_IMAGE_FORMAT_DESCRIPTOR");
94 system_error(function,
e.what(),
e.err(),
"CL_INVALID_IMAGE_SIZE");
100 system_error(function,
e.what(),
e.err(),
"CL_INVALID_BUILD_OPTIONS");
105 "CL_INVALID_PROGRAM_EXECUTABLE");
107 system_error(function,
e.what(),
e.err(),
"CL_INVALID_KERNEL_NAME");
109 system_error(function,
e.what(),
e.err(),
"CL_INVALID_KERNEL_DEFINITION");
113 system_error(function,
e.what(),
e.err(),
"CL_INVALID_ARG_INDEX");
115 system_error(function,
e.what(),
e.err(),
"CL_INVALID_ARG_VALUE");
119 system_error(function,
e.what(),
e.err(),
"CL_INVALID_KERNEL_ARGS");
121 system_error(function,
e.what(),
e.err(),
"CL_INVALID_WORK_DIMENSION");
123 system_error(function,
e.what(),
e.err(),
"CL_INVALID_WORK_GROUP_SIZE");
125 system_error(function,
e.what(),
e.err(),
"CL_INVALID_WORK_ITEM_SIZE");
127 system_error(function,
e.what(),
e.err(),
"CL_INVALID_GLOBAL_OFFSET");
129 system_error(function,
e.what(),
e.err(),
"CL_INVALID_EVENT_WAIT_LIST");
133 system_error(function,
e.what(),
e.err(),
"CL_INVALID_OPERATION");
135 system_error(function,
e.what(),
e.err(),
"CL_INVALID_GL_OBJECT");
137 system_error(function,
e.what(),
e.err(),
"CL_INVALID_BUFFER_SIZE");
139 system_error(function,
e.what(),
e.err(),
"CL_INVALID_MIP_LEVEL");
141 system_error(function,
e.what(),
e.err(),
"CL_INVALID_GLOBAL_WORK_SIZE");
145 system_error(function,
e.what(),
e.err(),
"CL_INVALID_IMAGE_DESCRIPTOR");
147 system_error(function,
e.what(),
e.err(),
"CL_INVALID_COMPILER_OPTIONS");
149 system_error(function,
e.what(),
e.err(),
"CL_INVALID_LINKER_OPTIONS");
152 "CL_INVALID_DEVICE_PARTITION_COUNT");
154 system_error(function,
e.what(),
e.err(),
"CL_INVALID_PIPE_SIZE");
156 system_error(function,
e.what(),
e.err(),
"CL_INVALID_DEVICE_QUEUE");
159 "CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR");
161 system_error(function,
e.what(),
e.err(),
"CL_PLATFORM_NOT_FOUND_KHR");
163 system_error(function,
e.what(),
e.err(),
"CL_INVALID_D3D10_DEVICE_KHR");
166 "CL_INVALID_D3D10_RESOURCE_KHR");
169 "CL_D3D10_RESOURCE_ALREADY_ACQUIRED_KHR");
172 "CL_D3D10_RESOURCE_NOT_ACQUIRED_KHR");
174 system_error(function,
e.what(),
e.err(),
"CL_INVALID_D3D11_DEVICE_KHR");
177 "CL_INVALID_D3D11_RESOURCE_KHR");
180 "CL_D3D11_RESOURCE_ALREADY_ACQUIRED_KHR");
183 "CL_D3D11_RESOURCE_NOT_ACQUIRED_KHR");
185 system_error(function,
e.what(),
e.err(),
"CL_INVALID_D3D9_DEVICE_NV ");
187 system_error(function,
e.what(),
e.err(),
"CL_INVALID_D3D9_RESOURCE_NV ");
190 "CL_D3D9_RESOURCE_ALREADY_ACQUIRED_NV "
191 "CL_DX9_RESOURCE_ALREADY_ACQUIRED_INTEL");
194 "CL_D3D9_RESOURCE_NOT_ACQUIRED_NV "
195 "CL_DX9_RESOURCE_NOT_ACQUIRED_INTEL");
198 "CL_EGL_RESOURCE_NOT_ACQUIRED_KHR");
200 system_error(function,
e.what(),
e.err(),
"CL_INVALID_EGL_OBJECT_KHR");
202 system_error(function,
e.what(),
e.err(),
"CL_INVALID_ACCELERATOR_INTEL");
205 "CL_INVALID_ACCELERATOR_TYPE_INTEL");
208 "CL_INVALID_ACCELERATOR_DESCRIPTOR_INTEL");
211 "CL_ACCELERATOR_TYPE_NOT_SUPPORTED_INTEL");
214 "CL_INVALID_VA_API_MEDIA_ADAPTER_INTEL");
217 "CL_INVALID_VA_API_MEDIA_SURFACE_INTEL");
220 "CL_VA_API_MEDIA_SURFACE_ALREADY_ACQUIRED_INTEL");
223 "CL_VA_API_MEDIA_SURFACE_NOT_ACQUIRED_INTEL");
225 system_error(function,
e.what(),
e.err(),
"ILLEGAL_READ_OR_WRITE_NVIDIA");
228 std::to_string(
e.err()).c_str());
void check_opencl_error(const char *function, const cl::Error &e)
Throws the domain error with specifying the OpenCL error that occurred.
static constexpr double e()
Return the base of the natural logarithm.
void system_error(const char *function, const char *name, const int &y, const char *msg1, const char *msg2)
Throw a system error with a consistently formatted message.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...