BioDynaMo
v1.05.120-25dc9790
|
Go to the documentation of this file.
20 #define CL_HPP_ENABLE_EXCEPTIONS
21 #define CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY
22 #define CL_HPP_MINIMUM_OPENCL_VERSION 120
23 #define CL_HPP_TARGET_OPENCL_VERSION 120
26 #define CL_HPP_ENABLE_EXCEPTIONS
27 #define CL_HPP_MINIMUM_OPENCL_VERSION 210
28 #define CL_HPP_TARGET_OPENCL_VERSION 210
37 struct OpenCLState::OpenCLImpl {
38 cl::Context opencl_context_;
39 cl::CommandQueue opencl_command_queue_;
41 std::vector<cl::Device> opencl_devices_;
42 std::vector<cl::Program> opencl_programs_;
43 std::vector<bool> fp64_support_;
44 int selected_gpu_ = -1;
48 impl_ = std::unique_ptr<OpenCLState::OpenCLImpl,
49 OpenCLState::OpenCLImplDestructor>(
50 new OpenCLState::OpenCLImpl());
58 return &
impl_->opencl_command_queue_;
63 return &
impl_->opencl_devices_;
69 return &
impl_->fp64_support_;
74 return &
impl_->opencl_programs_;
79 return impl_->fp64_support_[
impl_->selected_gpu_];
83 impl_->fp64_support_.push_back(
false);
87 impl_->fp64_support_.push_back(
true);
96 return "CL_DEVICE_NOT_FOUND";
98 return "CL_DEVICE_NOT_AVAILABLE";
100 return "CL_COMPILER_NOT_AVAILABLE";
102 return "CL_MEM_OBJECT_ALLOCATION_FAILURE";
104 return "CL_OUT_OF_RESOURCES";
106 return "CL_OUT_OF_HOST_MEMORY";
108 return "CL_PROFILING_INFO_NOT_AVAILABLE";
110 return "CL_MEM_COPY_OVERLAP";
112 return "CL_IMAGE_FORMAT_MISMATCH";
114 return "CL_IMAGE_FORMAT_NOT_SUPPORTED";
116 return "CL_BUILD_PROGRAM_FAILURE";
118 return "CL_MAP_FAILURE";
120 return "CL_MISALIGNED_SUB_BUFFER_OFFSET";
122 return "CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST";
124 return "CL_COMPILE_PROGRAM_FAILURE";
126 return "CL_LINKER_NOT_AVAILABLE";
128 return "CL_LINK_PROGRAM_FAILURE";
130 return "CL_DEVICE_PARTITION_FAILED";
132 return "CL_KERNEL_ARG_INFO_NOT_AVAILABLE";
136 return "CL_INVALID_VALUE";
138 return "CL_INVALID_DEVICE_TYPE";
140 return "CL_INVALID_PLATFORM";
142 return "CL_INVALID_DEVICE";
144 return "CL_INVALID_CONTEXT";
146 return "CL_INVALID_QUEUE_PROPERTIES";
148 return "CL_INVALID_COMMAND_QUEUE";
150 return "CL_INVALID_HOST_PTR";
152 return "CL_INVALID_MEM_OBJECT";
154 return "CL_INVALID_IMAGE_FORMAT_DESCRIPTOR";
156 return "CL_INVALID_IMAGE_SIZE";
158 return "CL_INVALID_SAMPLER";
160 return "CL_INVALID_BINARY";
162 return "CL_INVALID_BUILD_OPTIONS";
164 return "CL_INVALID_PROGRAM";
166 return "CL_INVALID_PROGRAM_EXECUTABLE";
168 return "CL_INVALID_KERNEL_NAME";
170 return "CL_INVALID_KERNEL_DEFINITION";
172 return "CL_INVALID_KERNEL";
174 return "CL_INVALID_ARG_INDEX";
176 return "CL_INVALID_ARG_VALUE";
178 return "CL_INVALID_ARG_SIZE";
180 return "CL_INVALID_KERNEL_ARGS";
182 return "CL_INVALID_WORK_DIMENSION";
184 return "CL_INVALID_WORK_GROUP_SIZE";
186 return "CL_INVALID_WORK_ITEM_SIZE";
188 return "CL_INVALID_GLOBAL_OFFSET";
190 return "CL_INVALID_EVENT_WAIT_LIST";
192 return "CL_INVALID_EVENT";
194 return "CL_INVALID_OPERATION";
196 return "CL_INVALID_GL_OBJECT";
198 return "CL_INVALID_BUFFER_SIZE";
200 return "CL_INVALID_MIP_LEVEL";
202 return "CL_INVALID_GLOBAL_WORK_SIZE";
204 return "CL_INVALID_PROPERTY";
206 return "CL_INVALID_IMAGE_DESCRIPTOR";
208 return "CL_INVALID_COMPILER_OPTIONS";
210 return "CL_INVALID_LINKER_OPTIONS";
212 return "CL_INVALID_DEVICE_PARTITION_COUNT";
216 return "CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR";
218 return "CL_PLATFORM_NOT_FOUND_KHR";
220 return "CL_INVALID_D3D10_DEVICE_KHR";
222 return "CL_INVALID_D3D10_RESOURCE_KHR";
224 return "CL_D3D10_RESOURCE_ALREADY_ACQUIRED_KHR";
226 return "CL_D3D10_RESOURCE_NOT_ACQUIRED_KHR";
228 return "Unknown OpenCL error";
233 int const line,
bool const abort) {
234 if (code != CL_SUCCESS) {
237 fprintf(stderr,
"\"%s\", line %d: ClAssert (%d) = \"%s\"", file, line, code,
262 int const line,
bool const abort) {
void operator()(OpenCLImpl *p)
std::unique_ptr< OpenCLImpl, OpenCLImplDestructor > impl_
std::vector< cl::Program > * GetOpenCLProgramList()
Returns the OpenCL program (kernel) list.
cl::Context * GetOpenCLContext()
Returns the OpenCL Context.
std::vector< cl::Device > * GetOpenCLDeviceList()
Returns the OpenCL device (GPU) list.
bool HasSupportForDouble()
void DisableSupportForDouble()
Disable support for double-precision floating point operations.
const char * GetErrorString(int error)
std::vector< bool > * GetFp64Support()
void EnableSupportForDouble()
Enable support for double-precision floating point operations.
cl::CommandQueue * GetOpenCLCommandQueue()
Returns the OpenCL command queue.
int ClAssert(int const code, char const *const file, int const line, bool const abort)