diff --git a/src/info.cpp b/src/info.cpp index f1ee327191..18926ed49e 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -317,57 +317,8 @@ void Info::command(int narg, char **arg) } 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"; - if (has_accelerator_feature("GPU","api","hip")) mesg += " HIP"; - if (has_accelerator_feature("GPU","api","opencl")) mesg += " OpenCL"; - mesg += "\nGPU package precision:"; - if (has_accelerator_feature("GPU","precision","single")) mesg += " single"; - if (has_accelerator_feature("GPU","precision","mixed")) mesg += " mixed"; - if (has_accelerator_feature("GPU","precision","double")) mesg += " double"; - mesg += "\n"; - fputs(mesg.c_str(),out); - } - if (has_package("KOKKOS")) { - mesg = "KOKKOS package API:"; - if (has_accelerator_feature("KOKKOS","api","cuda")) mesg += " CUDA"; - if (has_accelerator_feature("KOKKOS","api","hip")) mesg += " HIP"; - if (has_accelerator_feature("KOKKOS","api","sycl")) mesg += " SYCL"; - if (has_accelerator_feature("KOKKOS","api","openmp")) mesg += " OpenMP"; - if (has_accelerator_feature("KOKKOS","api","serial")) mesg += " Serial"; - if (has_accelerator_feature("KOKKOS","api","pthreads")) mesg += " Pthreads"; - mesg += "\nKOKKOS package precision:"; - if (has_accelerator_feature("KOKKOS","precision","single")) mesg += " single"; - if (has_accelerator_feature("KOKKOS","precision","mixed")) mesg += " mixed"; - if (has_accelerator_feature("KOKKOS","precision","double")) mesg += " double"; - mesg += "\n"; - fputs(mesg.c_str(),out); - } - if (has_package("USER-OMP")) { - mesg = "USER-OMP package API:"; - if (has_accelerator_feature("USER-OMP","api","openmp")) mesg += " OpenMP"; - if (has_accelerator_feature("USER-OMP","api","serial")) mesg += " Serial"; - mesg += "\nUSER-OMP package precision:"; - if (has_accelerator_feature("USER-OMP","precision","single")) mesg += " single"; - if (has_accelerator_feature("USER-OMP","precision","mixed")) mesg += " mixed"; - if (has_accelerator_feature("USER-OMP","precision","double")) mesg += " double"; - mesg += "\n"; - fputs(mesg.c_str(),out); - } - if (has_package("USER-INTEL")) { - mesg = "USER-INTEL package API:"; - if (has_accelerator_feature("USER-INTEL","api","phi")) mesg += " Phi"; - if (has_accelerator_feature("USER-INTEL","api","openmp")) mesg += " OpenMP"; - mesg += "\nUSER-INTEL package precision:"; - if (has_accelerator_feature("USER-INTEL","precision","single")) mesg += " single"; - if (has_accelerator_feature("USER-INTEL","precision","mixed")) mesg += " mixed"; - if (has_accelerator_feature("USER-INTEL","precision","double")) mesg += " double"; - mesg += "\n"; - fputs(mesg.c_str(),out); - } + fmt::print(out,"\nAccelerator configuration:\n\n{}", + get_accelerator_info()); } if (flags & MEMORY) { @@ -1429,6 +1380,57 @@ std::string Info::get_cxx_info() #endif } +std::string Info::get_accelerator_info(const std::string &package) +{ + std::string mesg(""); + if ((package.empty() || (package == "GPU")) && has_package("GPU")) { + mesg += "GPU package API:"; + if (has_accelerator_feature("GPU","api","cuda")) mesg += " CUDA"; + if (has_accelerator_feature("GPU","api","hip")) mesg += " HIP"; + if (has_accelerator_feature("GPU","api","opencl")) mesg += " OpenCL"; + mesg += "\nGPU package precision:"; + if (has_accelerator_feature("GPU","precision","single")) mesg += " single"; + if (has_accelerator_feature("GPU","precision","mixed")) mesg += " mixed"; + if (has_accelerator_feature("GPU","precision","double")) mesg += " double"; + mesg += "\n"; + } + if ((package.empty() || (package == "KOKKOS")) && has_package("KOKKOS")) { + mesg += "KOKKOS package API:"; + if (has_accelerator_feature("KOKKOS","api","cuda")) mesg += " CUDA"; + if (has_accelerator_feature("KOKKOS","api","hip")) mesg += " HIP"; + if (has_accelerator_feature("KOKKOS","api","sycl")) mesg += " SYCL"; + if (has_accelerator_feature("KOKKOS","api","openmp")) mesg += " OpenMP"; + if (has_accelerator_feature("KOKKOS","api","serial")) mesg += " Serial"; + if (has_accelerator_feature("KOKKOS","api","pthreads")) mesg += " Pthreads"; + mesg += "\nKOKKOS package precision:"; + if (has_accelerator_feature("KOKKOS","precision","single")) mesg += " single"; + if (has_accelerator_feature("KOKKOS","precision","mixed")) mesg += " mixed"; + if (has_accelerator_feature("KOKKOS","precision","double")) mesg += " double"; + mesg += "\n"; + } + if ((package.empty() || (package == "USER-OMP")) && has_package("USER-OMP")) { + mesg += "USER-OMP package API:"; + if (has_accelerator_feature("USER-OMP","api","openmp")) mesg += " OpenMP"; + if (has_accelerator_feature("USER-OMP","api","serial")) mesg += " Serial"; + mesg += "\nUSER-OMP package precision:"; + if (has_accelerator_feature("USER-OMP","precision","single")) mesg += " single"; + if (has_accelerator_feature("USER-OMP","precision","mixed")) mesg += " mixed"; + if (has_accelerator_feature("USER-OMP","precision","double")) mesg += " double"; + mesg += "\n"; + } + if ((package.empty() || (package == "USER-INTEL")) && has_package("USER-INTEL")) { + mesg += "USER-INTEL package API:"; + if (has_accelerator_feature("USER-INTEL","api","phi")) mesg += " Phi"; + if (has_accelerator_feature("USER-INTEL","api","openmp")) mesg += " OpenMP"; + mesg += "\nUSER-INTEL package precision:"; + if (has_accelerator_feature("USER-INTEL","precision","single")) mesg += " single"; + if (has_accelerator_feature("USER-INTEL","precision","mixed")) mesg += " mixed"; + if (has_accelerator_feature("USER-INTEL","precision","double")) mesg += " double"; + mesg += "\n"; + } + return mesg; +} + /* ---------------------------------------------------------------------- */ void Info::get_memory_info(double *meminfo) diff --git a/src/info.h b/src/info.h index 386d38c39f..cc07327e9c 100644 --- a/src/info.h +++ b/src/info.h @@ -54,6 +54,7 @@ class Info : public Command { static std::string get_mpi_vendor(); static std::string get_mpi_info(int &, int &); static std::string get_cxx_info(); + static std::string get_accelerator_info(const std::string &pkg=""); void get_memory_info(double *); char **get_variable_names(int &num); diff --git a/src/lammps.cpp b/src/lammps.cpp index 277ec4414f..d6c63c1af8 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -1326,6 +1326,9 @@ void LAMMPS::print_config(FILE *fp) std::string infobuf = Info::get_mpi_info(major,minor); fmt::print(fp,"MPI v{}.{}: {}\n\n",major,minor,infobuf); + fmt::print(fp,"Accelerator configuration:\n\n{}\n", + Info::get_accelerator_info()); + fputs("Active compile time flags:\n\n",fp); if (Info::has_gzip_support()) fputs("-DLAMMPS_GZIP\n",fp); if (Info::has_png_support()) fputs("-DLAMMPS_PNG\n",fp);