Fixing suported device list.

This commit is contained in:
Mehdi Goli 2017-05-22 16:40:33 +01:00
parent 0d08165a7f
commit 2d17128d6f

View File

@ -81,28 +81,26 @@ struct memsetCghFunctor{
} }
}; };
//get_devices returns all the available opencl devices. Either use device_selector or exclude devices that computecpp does not support (AMD OpenCL for CPU and intel GPU) //get_devices returns all the available opencl devices. Either use device_selector or exclude devices that computecpp does not support (AMD OpenCL for CPU and intel GPU)
EIGEN_STRONG_INLINE auto get_sycl_supported_devices()->decltype(cl::sycl::device::get_devices()){ EIGEN_STRONG_INLINE auto get_sycl_supported_devices()->decltype(cl::sycl::device::get_devices()){
auto devices = cl::sycl::device::get_devices(); std::vector<cl::sycl::device> supported_devices;
std::vector<cl::sycl::device>::iterator it =devices.begin(); auto plafrom_list =cl::sycl::platform::get_platforms();
while(it!=devices.end()) { for(const auto& platform : plafrom_list){
///FIXME: Currently there is a bug in amd cpu OpenCL auto device_list = platform.get_devices();
auto name = (*it).template get_info<cl::sycl::info::device::name>(); auto platform_name =platform.template get_info<cl::sycl::info::platform::name>();
std::transform(name.begin(), name.end(), name.begin(), ::tolower); std::transform(platform_name.begin(), platform_name.end(), platform_name.begin(), ::tolower);
auto vendor = (*it).template get_info<cl::sycl::info::device::vendor>(); for(const auto& device : device_list){
auto vendor = device.template get_info<cl::sycl::info::device::vendor>();
std::transform(vendor.begin(), vendor.end(), vendor.begin(), ::tolower); std::transform(vendor.begin(), vendor.end(), vendor.begin(), ::tolower);
bool unsuported_condition = (device.is_cpu() && platform_name.find("amd")!=std::string::npos && vendor.find("apu") == std::string::npos) ||
if((*it).is_cpu() && vendor.find("amd")!=std::string::npos && vendor.find("apu") == std::string::npos){ // remove amd cpu as it is not supported by computecpp allow APUs (device.is_gpu() && platform_name.find("intel")!=std::string::npos);
it = devices.erase(it); if(!unsuported_condition){
//FIXME: currently there is a bug in intel gpu driver regarding memory allignment issue. std::cout << "Platform name "<< platform_name << std::endl;
}else if((*it).is_gpu() && name.find("intel")!=std::string::npos){ supported_devices.push_back(device);
it = devices.erase(it);
}
else{
++it;
} }
} }
return devices; }
return supported_devices;
} }
class QueueInterface { class QueueInterface {