preliminary interface to detect whether a viable GPU is present
This commit is contained in:
@ -1026,6 +1026,15 @@ Device<PRECISION,ACC_PRECISION> global_device;
|
|||||||
}
|
}
|
||||||
|
|
||||||
using namespace LAMMPS_AL;
|
using namespace LAMMPS_AL;
|
||||||
|
|
||||||
|
bool lmp_has_device()
|
||||||
|
{
|
||||||
|
auto tmpgpu = new UCL_Device();
|
||||||
|
int num = tmpgpu->num_platforms();
|
||||||
|
delete tmpgpu;
|
||||||
|
return num > 0;
|
||||||
|
}
|
||||||
|
|
||||||
int lmp_init_device(MPI_Comm world, MPI_Comm replica, const int ngpu,
|
int lmp_init_device(MPI_Comm world, MPI_Comm replica, const int ngpu,
|
||||||
const int first_gpu_id, const int gpu_mode,
|
const int first_gpu_id, const int gpu_mode,
|
||||||
const double particle_split, const int t_per_atom,
|
const double particle_split, const int t_per_atom,
|
||||||
|
|||||||
12
src/info.cpp
12
src/info.cpp
@ -320,6 +320,7 @@ void Info::command(int narg, char **arg)
|
|||||||
if (flags & ACCELERATOR) {
|
if (flags & ACCELERATOR) {
|
||||||
fmt::print(out,"\nAccelerator configuration:\n\n{}",
|
fmt::print(out,"\nAccelerator configuration:\n\n{}",
|
||||||
get_accelerator_info());
|
get_accelerator_info());
|
||||||
|
fmt::print(out,"\nGPU present: {}\n",has_gpu_device() ? "yes" : "no");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & MEMORY) {
|
if (flags & MEMORY) {
|
||||||
@ -1139,6 +1140,17 @@ bool Info::has_package(const std::string &package_name) {
|
|||||||
|
|
||||||
#if defined(LMP_GPU)
|
#if defined(LMP_GPU)
|
||||||
extern bool lmp_gpu_config(const std::string &, const std::string &);
|
extern bool lmp_gpu_config(const std::string &, const std::string &);
|
||||||
|
extern bool lmp_has_device();
|
||||||
|
|
||||||
|
bool Info::has_gpu_device()
|
||||||
|
{
|
||||||
|
return lmp_has_device();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
bool Info::has_gpu_device()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(LMP_KOKKOS)
|
#if defined(LMP_KOKKOS)
|
||||||
|
|||||||
@ -47,6 +47,7 @@ class Info : public Command {
|
|||||||
static bool has_accelerator_feature(const std::string &,
|
static bool has_accelerator_feature(const std::string &,
|
||||||
const std::string &,
|
const std::string &,
|
||||||
const std::string &);
|
const std::string &);
|
||||||
|
static bool has_gpu_device();
|
||||||
|
|
||||||
static std::string get_os_info();
|
static std::string get_os_info();
|
||||||
static std::string get_compiler_info();
|
static std::string get_compiler_info();
|
||||||
|
|||||||
Reference in New Issue
Block a user