Check device support float

This commit is contained in:
Tom Deakin 2016-05-03 11:05:21 +01:00
parent d7c17d72d5
commit 3462e61c16

View File

@ -70,7 +70,12 @@ OCLStream<T>::OCLStream(const unsigned int ARRAY_SIZE, const int device_index)
// Create program
cl::Program program(context, kernels);
if (sizeof(T) == sizeof(double))
{
// Check device can do double
if (!device.getInfo<CL_DEVICE_DOUBLE_FP_CONFIG>())
throw std::runtime_error("Device does not support double precision, please use --float");
program.build("-DTYPE=double");
}
else if (sizeof(T) == sizeof(float))
program.build("-DTYPE=float");