Commit c2355d3a authored by Konstantin Matskevich's avatar Konstantin Matskevich

case-insensitivity

parent 79fc3a62
...@@ -2179,7 +2179,6 @@ static cl_device_id selectOpenCLDevice() ...@@ -2179,7 +2179,6 @@ static cl_device_id selectOpenCLDevice()
goto not_found; goto not_found;
} }
} }
if (deviceTypes.size() == 0) if (deviceTypes.size() == 0)
{ {
if (!isID) if (!isID)
...@@ -2193,13 +2192,16 @@ static cl_device_id selectOpenCLDevice() ...@@ -2193,13 +2192,16 @@ static cl_device_id selectOpenCLDevice()
for (size_t t = 0; t < deviceTypes.size(); t++) for (size_t t = 0; t < deviceTypes.size(); t++)
{ {
int deviceType = 0; int deviceType = 0;
if (deviceTypes[t] == "GPU" || deviceTypes[t] == "dGPU" || deviceTypes[t] == "iGPU") std::string tempStrDeviceType = deviceTypes[t];
std::transform( tempStrDeviceType.begin(), tempStrDeviceType.end(), tempStrDeviceType.begin(), tolower );
if (tempStrDeviceType == "gpu" || tempStrDeviceType == "dgpu" || tempStrDeviceType == "igpu")
deviceType = Device::TYPE_GPU; deviceType = Device::TYPE_GPU;
else if (deviceTypes[t] == "CPU") else if (tempStrDeviceType == "cpu")
deviceType = Device::TYPE_CPU; deviceType = Device::TYPE_CPU;
else if (deviceTypes[t] == "ACCELERATOR") else if (tempStrDeviceType == "accelerator")
deviceType = Device::TYPE_ACCELERATOR; deviceType = Device::TYPE_ACCELERATOR;
else if (deviceTypes[t] == "ALL") else if (tempStrDeviceType == "all")
deviceType = Device::TYPE_ALL; deviceType = Device::TYPE_ALL;
else else
{ {
...@@ -2230,11 +2232,11 @@ static cl_device_id selectOpenCLDevice() ...@@ -2230,11 +2232,11 @@ static cl_device_id selectOpenCLDevice()
std::string name; std::string name;
CV_OclDbgAssert(getStringInfo(clGetDeviceInfo, devices[i], CL_DEVICE_NAME, name) == CL_SUCCESS); CV_OclDbgAssert(getStringInfo(clGetDeviceInfo, devices[i], CL_DEVICE_NAME, name) == CL_SUCCESS);
cl_bool useGPU = true; cl_bool useGPU = true;
if(deviceTypes[t] == "dGPU" || deviceTypes[t] == "iGPU") if(tempStrDeviceType == "dgpu" || tempStrDeviceType == "igpu")
{ {
cl_bool isIGPU = CL_FALSE; cl_bool isIGPU = CL_FALSE;
clGetDeviceInfo(devices[i], CL_DEVICE_HOST_UNIFIED_MEMORY, sizeof(isIGPU), &isIGPU, NULL); clGetDeviceInfo(devices[i], CL_DEVICE_HOST_UNIFIED_MEMORY, sizeof(isIGPU), &isIGPU, NULL);
useGPU = deviceTypes[t] == "dGPU" ? !isIGPU : isIGPU; useGPU = tempStrDeviceType == "dgpu" ? !isIGPU : isIGPU;
} }
if ( (isID || name.find(deviceName) != std::string::npos) && useGPU) if ( (isID || name.find(deviceName) != std::string::npos) && useGPU)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment