diff --git a/lib/gpu/lal_device.cpp b/lib/gpu/lal_device.cpp index 6c6a206307..911cdda383 100644 --- a/lib/gpu/lal_device.cpp +++ b/lib/gpu/lal_device.cpp @@ -783,3 +783,39 @@ double lmp_gpu_forces(double **f, double **tor, double *eatom, double **vatom, double *virial, double &ecoul) { return global_device.fix_gpu(f,tor,eatom,vatom,virial,ecoul); } + +bool lmp_gpu_config(const std::string &category, const std::string &setting) +{ + if (category == "api") { +#if defined(USE_OPENCL) + return setting == "opencl"; +#elif defined(USE_HIP) + return setting == "hip"; +#elif defined(USE_CUDA) + return setting == "cuda"; +#endif + return false; + } + if (category == "precision") { + if (setting == "single") { +#if defined(_SINGLE_SINGLE) + return true; +#else + return false; +#endif + } else if (setting == "mixed") { +#if defined(_SINGLE_DOUBLE) + return true; +#else + return false; +#endif + } else if (setting == "double") { +#if defined(_DOUBLE_DOUBLE) + return true; +#else + return false; +#endif + } else return false; + } + return false; +} diff --git a/src/info.cpp b/src/info.cpp index 8e181a79ed..d18bd68171 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -94,6 +94,7 @@ enum {COMPUTES=1<<0, REGION_STYLES=1<<23, DUMP_STYLES=1<<24, COMMAND_STYLES=1<<25, + ACCELERATOR=1<<26, ALL=~0}; static const int STYLES = ATOM_STYLES | INTEGRATE_STYLES | MINIMIZE_STYLES @@ -198,6 +199,9 @@ void Info::command(int narg, char **arg) } else if (strncmp(arg[idx],"coeffs",3) == 0) { flags |= COEFFS; ++idx; + } else if (strncmp(arg[idx],"accelerator",3) == 0) { + flags |= ACCELERATOR; + ++idx; } else if (strncmp(arg[idx],"styles",3) == 0) { if (idx+1 < narg) { ++idx; @@ -314,6 +318,22 @@ void Info::command(int narg, char **arg) fputs("\n",out); } + if (flags & ACCELERATOR) { + fputs("\nAccelerator configuration:\n\n",out); + std::string mesg; + if (has_package("GPU")) { + mesg = "GPU package API: "; + if (has_accelerator_feature("GPU","api","cuda")) mesg += "CUDA\n"; + if (has_accelerator_feature("GPU","api","hip")) mesg += "HIP\n"; + if (has_accelerator_feature("GPU","api","opencl")) mesg += "OpenCL\n"; + mesg += "GPU package precision: "; + if (has_accelerator_feature("GPU","precision","single")) mesg += "single\n"; + if (has_accelerator_feature("GPU","precision","mixed")) mesg += "mixed\n"; + if (has_accelerator_feature("GPU","precision","double")) mesg += "double\n"; + fputs(mesg.c_str(),out); + } + } + if (flags & MEMORY) { double meminfo[3]; @@ -1129,6 +1149,10 @@ bool Info::has_package(const std::string &package_name) { return false; } +#if defined(LMP_GPU) +extern bool lmp_gpu_config(const std::string &, const std::string &); +#endif + bool Info::has_accelerator_feature(const std::string &package, const std::string &category, const std::string &setting) @@ -1143,6 +1167,7 @@ bool Info::has_accelerator_feature(const std::string &package, #endif #if defined(LMP_GPU) if (package == "GPU") { + return lmp_gpu_config(category,setting); } #endif #if defined(LMP_USER_OMP)