From 9f38177e1b8b5fdf49cc2cdd6eb0ef45e51d057c Mon Sep 17 00:00:00 2001 From: Tom Deakin Date: Mon, 17 May 2021 15:32:42 +0100 Subject: [PATCH] [SYCL 2020] Add check for FP64 support using device aspects. This will resolve #98 in the future SYCL 2020 version. --- SYCLStream.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/SYCLStream.cpp b/SYCLStream.cpp index b4fa514..9e23175 100644 --- a/SYCLStream.cpp +++ b/SYCLStream.cpp @@ -34,6 +34,15 @@ SYCLStream::SYCLStream(const int ARRAY_SIZE, const int device_index) std::cout << "Using SYCL device " << getDeviceName(device_index) << std::endl; std::cout << "Driver: " << getDeviceDriver(device_index) << std::endl; + // Check device can support FP64 if needed + if (sizeof(T) == sizeof(double)) + { + if (!dev.has(sycl::aspect::fp64)) + { + throw std::runtime_error("Device does not support double precision, please use --float"); + } + } + queue = std::make_unique(dev, sycl::async_handler{[&](sycl::exception_list l) { bool error = false;