Check for double support in OpenCL
This commit is contained in:
parent
fd8bf0ef60
commit
3bb92747ba
8
common.h
8
common.h
@ -93,6 +93,14 @@ struct badmemsize : public std::exception
|
||||
}
|
||||
};
|
||||
|
||||
struct nodouble : public std::exception
|
||||
{
|
||||
virtual const char * what () const throw ()
|
||||
{
|
||||
return "Device does not support double precision, please use --float";
|
||||
}
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
void check_solution(void* a_in, void* b_in, void* c_in)
|
||||
{
|
||||
|
||||
@ -165,6 +165,9 @@ int main(int argc, char *argv[])
|
||||
std::string name = getDeviceName(device);
|
||||
std::cout << "Using OpenCL device " << name << std::endl;
|
||||
|
||||
// Check device can do double precision if requested
|
||||
if (!useFloat && !device.getInfo<CL_DEVICE_DOUBLE_FP_CONFIG>()) throw nodouble();
|
||||
|
||||
// Check buffers fit on the device
|
||||
status = "Getting device memory sizes";
|
||||
cl_ulong totalmem = device.getInfo<CL_DEVICE_GLOBAL_MEM_SIZE>();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user