finalize available GPU hardware introspection functions

This commit is contained in:
Axel Kohlmeyer
2021-05-10 16:34:27 -04:00
parent fbdcfb2f72
commit a687868c69
4 changed files with 29 additions and 8 deletions

View File

@ -18,6 +18,7 @@
#include <map>
#include <cmath>
#include <cstdlib>
#include <iostream>
#if (LAL_USE_OMP == 1)
#include <omp.h>
#endif
@ -1027,12 +1028,19 @@ Device<PRECISION,ACC_PRECISION> global_device;
using namespace LAMMPS_AL;
bool lmp_has_device()
bool lmp_has_gpu_device()
{
auto tmpgpu = new UCL_Device();
int num = tmpgpu->num_platforms();
delete tmpgpu;
return num > 0;
UCL_Device gpu;
return (gpu.num_platforms() > 0);
}
std::string lmp_gpu_device_info()
{
std::ostringstream out;
UCL_Device gpu;
if (gpu.num_platforms() > 0)
gpu.print_all(out);
return out.str();
}
int lmp_init_device(MPI_Comm world, MPI_Comm replica, const int ngpu,