[SYCL 1.2.1] Add check for FP64 support

Fixes #98
This commit is contained in:
Tom Deakin 2021-05-17 15:25:43 +01:00
parent d3269ece59
commit 82dedad676

View File

@ -28,6 +28,14 @@ SYCLStream<T>::SYCLStream(const int ARRAY_SIZE, const int device_index)
throw std::runtime_error("Invalid device index"); throw std::runtime_error("Invalid device index");
device dev = devices[device_index]; device dev = devices[device_index];
// Check device can support FP64 if needed
if (sizeof(T) == sizeof(double))
{
if (dev.get_info<info::device::double_fp_config>().size() == 0) {
throw std::runtime_error("Device does not support double precision, please use --float");
}
}
// Determine sensible dot kernel NDRange configuration // Determine sensible dot kernel NDRange configuration
if (dev.is_cpu()) if (dev.is_cpu())
{ {