| 604 | } |
| 605 | |
| 606 | static void populateGPUEnvFromDevice( GPUEnv *gpuInfo, cl_device_id device ) { |
| 607 | //printf("[DS] populateGPUEnvFromDevice\n"); |
| 608 | size_t size; |
| 609 | gpuInfo->mnIsUserCreated = 1; |
| 610 | // device |
| 611 | gpuInfo->mpDevID = device; |
| 612 | gpuInfo->mpArryDevsID = new cl_device_id[1]; |
| 613 | gpuInfo->mpArryDevsID[0] = gpuInfo->mpDevID; |
| 614 | clStatus = |
| 615 | clGetDeviceInfo(gpuInfo->mpDevID, CL_DEVICE_TYPE, |
| 616 | sizeof(cl_device_type), &gpuInfo->mDevType, &size); |
| 617 | CHECK_OPENCL( clStatus, "populateGPUEnv::getDeviceInfo(TYPE)"); |
| 618 | // platform |
| 619 | clStatus = |
| 620 | clGetDeviceInfo(gpuInfo->mpDevID, CL_DEVICE_PLATFORM, |
| 621 | sizeof(cl_platform_id), &gpuInfo->mpPlatformID, &size); |
| 622 | CHECK_OPENCL( clStatus, "populateGPUEnv::getDeviceInfo(PLATFORM)"); |
| 623 | // context |
| 624 | cl_context_properties props[3]; |
| 625 | props[0] = CL_CONTEXT_PLATFORM; |
| 626 | props[1] = (cl_context_properties) gpuInfo->mpPlatformID; |
| 627 | props[2] = 0; |
| 628 | gpuInfo->mpContext = clCreateContext(props, 1, &gpuInfo->mpDevID, NULL, |
| 629 | NULL, &clStatus); |
| 630 | CHECK_OPENCL( clStatus, "populateGPUEnv::createContext"); |
| 631 | // queue |
| 632 | cl_command_queue_properties queueProperties = 0; |
| 633 | gpuInfo->mpCmdQueue = clCreateCommandQueue( gpuInfo->mpContext, gpuInfo->mpDevID, queueProperties, &clStatus ); |
| 634 | CHECK_OPENCL( clStatus, "populateGPUEnv::createCommandQueue"); |
| 635 | } |
| 636 | |
| 637 | int OpenclDevice::LoadOpencl() |
| 638 | { |
no outgoing calls
no test coverage detected