[OCL] Print build log if kernel compilation fails

This commit is contained in:
James Price 2016-07-06 14:11:29 +01:00
parent 1ec98b4496
commit a2778f523e

View File

@ -78,8 +78,19 @@ OCLStream<T>::OCLStream(const unsigned int ARRAY_SIZE, const int device_index)
// 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");
try
{
program.build("-DTYPE=double");
}
catch (cl::Error& err)
{
if (err.err() == CL_BUILD_PROGRAM_FAILURE)
{
std::cout << program.getBuildInfo<CL_PROGRAM_BUILD_LOG>()[0].second << std::endl;
throw err;
}
}
}
else if (sizeof(T) == sizeof(float))
program.build("-DTYPE=float");