| 288 | { |
| 289 | public: |
| 290 | clblasFunc(StatisticalTimer& _timer, cl_device_type devType) |
| 291 | : timer(_timer) |
| 292 | { |
| 293 | cl_int err; |
| 294 | |
| 295 | /* Setup OpenCL environment. */ |
| 296 | OPENCL_V_THROW(clGetPlatformIDs(1, &platform_, NULL), |
| 297 | "getting platform IDs"); |
| 298 | OPENCL_V_THROW(clGetDeviceIDs(platform_, devType, 1, |
| 299 | &device_, NULL), "getting device IDs"); |
| 300 | props_[0] = CL_CONTEXT_PLATFORM; |
| 301 | props_[1] = (cl_context_properties)platform_; |
| 302 | props_[2] = 0; |
| 303 | ctx_ = clCreateContext(props_, 1, &device_, NULL, NULL, &err); |
| 304 | OPENCL_V_THROW(err, "creating context"); |
| 305 | for (unsigned int i = 0; i < numQueues; i++) { |
| 306 | queues_[i] = clCreateCommandQueue(ctx_, device_, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &err); |
| 307 | } |
| 308 | |
| 309 | timer_id = timer.getUniqueID( "clfunc", 0 ); |
| 310 | |
| 311 | |
| 312 | maxMemAllocSize = queryMemAllocSize( device_ ); |
| 313 | |
| 314 | /* Setup clblas. */ |
| 315 | err = clblasSetup(); |
| 316 | if (err != CL_SUCCESS) { |
| 317 | std::cerr << "clblasSetup() failed with %d\n"; |
| 318 | for (unsigned int i = 0; i < numQueues; i++) { |
| 319 | clReleaseCommandQueue(queues_[i]); |
| 320 | } |
| 321 | clReleaseContext(ctx_); |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | virtual ~clblasFunc() |
| 326 | { |
nothing calls this directly
no test coverage detected