Report only compatible GPU, i.e. no GPU if mixed/double precision is requested by the hardware does not support it

This commit is contained in:
Axel Kohlmeyer
2021-10-13 21:15:16 -04:00
parent c322064ff3
commit afad3f42d5
3 changed files with 15 additions and 5 deletions

View File

@ -1039,10 +1039,18 @@ Device<PRECISION,ACC_PRECISION> global_device;
using namespace LAMMPS_AL;
bool lmp_has_gpu_device()
// check if a suitable GPU is present.
// for mixed and double precision GPU library compilation
// also the GPU needs to support double precision.
bool lmp_has_compatible_gpu_device()
{
UCL_Device gpu;
return (gpu.num_platforms() > 0);
bool compatible_gpu = gpu.num_platforms() > 0;
#if defined(_SINGLE_DOUBLE) || defined(_DOUBLE_DOUBLE)
if (!gpu.double_precision(0))
compatible_gpu = false;
#endif
return compatible_gpu;
}
std::string lmp_gpu_device_info()