[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,7 +78,18 @@ OCLStream<T>::OCLStream(const unsigned int ARRAY_SIZE, const int device_index)
// Check device can do double // Check device can do double
if (!device.getInfo<CL_DEVICE_DOUBLE_FP_CONFIG>()) if (!device.getInfo<CL_DEVICE_DOUBLE_FP_CONFIG>())
throw std::runtime_error("Device does not support double precision, please use --float"); throw std::runtime_error("Device does not support double precision, please use --float");
program.build("-DTYPE=double"); 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)) else if (sizeof(T) == sizeof(float))
program.build("-DTYPE=float"); program.build("-DTYPE=float");