From c62e2ad4d12e10e2abf066383014dca0175084d5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 20 Apr 2022 17:39:33 -0400 Subject: [PATCH 01/20] disable warnings with PGI/NVHPC compilers and import CMAKE_TUNE_FLAGS --- cmake/CMakeLists.txt | 6 ++++++ cmake/Modules/Packages/COLVARS.cmake | 4 ++++ cmake/presets/pgi.cmake | 2 +- unittest/CMakeLists.txt | 6 ++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 7d1b2894c8..bb5072d9dc 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -105,6 +105,11 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") endif() endif() +# silence excessive warnings for PGI/NVHPC compilers +if((CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "PGI")) + set(CMAKE_TUNE_DEFAULT "-Minform=severe") +endif() + # we require C++11 without extensions. Kokkos requires at least C++14 (currently) set(CMAKE_CXX_STANDARD 11) if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 14)) @@ -468,6 +473,7 @@ set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler and machine separate_arguments(CMAKE_TUNE_FLAGS) foreach(_FLAG ${CMAKE_TUNE_FLAGS}) target_compile_options(lammps PRIVATE ${_FLAG}) + target_compile_options(lmp PRIVATE ${_FLAG}) endforeach() ######################################################################## # Basic system tests (standard libraries, headers, functions, types) # diff --git a/cmake/Modules/Packages/COLVARS.cmake b/cmake/Modules/Packages/COLVARS.cmake index 3488aa62b1..da5b685536 100644 --- a/cmake/Modules/Packages/COLVARS.cmake +++ b/cmake/Modules/Packages/COLVARS.cmake @@ -19,6 +19,10 @@ endif() add_library(colvars STATIC ${COLVARS_SOURCES}) target_compile_definitions(colvars PRIVATE -DCOLVARS_LAMMPS) +separate_arguments(CMAKE_TUNE_FLAGS) +foreach(_FLAG ${CMAKE_TUNE_FLAGS}) + target_compile_options(colvars PRIVATE ${_FLAG}) +endforeach() set_target_properties(colvars PROPERTIES OUTPUT_NAME lammps_colvars${LAMMPS_MACHINE}) target_include_directories(colvars PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars) # The line below is needed to locate math_eigen_impl.h diff --git a/cmake/presets/pgi.cmake b/cmake/presets/pgi.cmake index b34cb05331..2b7fee7efa 100644 --- a/cmake/presets/pgi.cmake +++ b/cmake/presets/pgi.cmake @@ -1,4 +1,4 @@ -# preset that will enable clang/clang++ with support for MPI and OpenMP (on Linux boxes) +# preset that will enable PGI (Nvidia) compilers with support for MPI and OpenMP (on Linux boxes) set(CMAKE_CXX_COMPILER "pgc++" CACHE STRING "" FORCE) set(CMAKE_C_COMPILER "pgcc" CACHE STRING "" FORCE) diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt index a166ad792a..40ef8204aa 100644 --- a/unittest/CMakeLists.txt +++ b/unittest/CMakeLists.txt @@ -20,6 +20,12 @@ add_library(GTest::GMock ALIAS gmock) add_library(GTest::GTestMain ALIAS gtest_main) add_library(GTest::GMockMain ALIAS gmock_main) +# import +foreach(_FLAG ${CMAKE_TUNE_FLAGS}) + add_compile_options(${_FLAG}) +endforeach() + + ######################################## # General tests using the LAMMPS executable itself ######################################## From 38093ffe4727fc4f02d48d12fb74d07c148bc6ff Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 20 Apr 2022 18:13:42 -0400 Subject: [PATCH 02/20] KOKKOS doesn't require nvcc_wrapper anymore when compiling with CMake --- cmake/presets/kokkos-cuda.cmake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmake/presets/kokkos-cuda.cmake b/cmake/presets/kokkos-cuda.cmake index 36d099479d..c0f9e7f21b 100644 --- a/cmake/presets/kokkos-cuda.cmake +++ b/cmake/presets/kokkos-cuda.cmake @@ -5,7 +5,5 @@ set(PKG_KOKKOS ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_CUDA ON CACHE BOOL "" FORCE) -set(Kokkos_ARCH_MAXWELL50 on CACHE BOOL "" FORCE) +set(Kokkos_ARCH_PASCAL60 ON CACHE BOOL "" FORCE) set(BUILD_OMP ON CACHE BOOL "" FORCE) -get_filename_component(NVCC_WRAPPER_CMD ${CMAKE_CURRENT_SOURCE_DIR}/../lib/kokkos/bin/nvcc_wrapper ABSOLUTE) -set(CMAKE_CXX_COMPILER ${NVCC_WRAPPER_CMD} CACHE FILEPATH "" FORCE) From 4544664edcb22f75a772730240d828653443b3d6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 20 Apr 2022 18:14:10 -0400 Subject: [PATCH 03/20] comment out assertion causing many warnings --- src/fmt/core.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fmt/core.h b/src/fmt/core.h index b7f9a960c6..8444cd9546 100644 --- a/src/fmt/core.h +++ b/src/fmt/core.h @@ -429,7 +429,9 @@ template inline auto convert_for_visit(T) -> monostate { template FMT_CONSTEXPR auto to_unsigned(Int value) -> typename std::make_unsigned::type { - FMT_ASSERT(value >= 0, "negative value"); + // LAMMPS CUSTOMIZATION + // FMT_ASSERT(value >= 0, "negative value"); + // END LAMMPS CUSTOMIZATION return static_cast::type>(value); } From 96e22b110414731fc39dc7df056c7a5c0a313b3d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 20 Apr 2022 18:42:09 -0400 Subject: [PATCH 04/20] disable CUDA support with Eigen3 --- cmake/Modules/Packages/MACHDYN.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/Modules/Packages/MACHDYN.cmake b/cmake/Modules/Packages/MACHDYN.cmake index d90ca8146c..fcc298da2f 100644 --- a/cmake/Modules/Packages/MACHDYN.cmake +++ b/cmake/Modules/Packages/MACHDYN.cmake @@ -36,3 +36,5 @@ endif() if((CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC")) target_compile_definitions(lammps PRIVATE -DEIGEN_DONT_VECTORIZE) endif() + +target_compile_definitions(lammps PRIVATE -DEIGEN_NO_CUDA) From 9cac62401d75beb95da4cae55e5b6f985e29d66b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 20 Apr 2022 19:32:42 -0400 Subject: [PATCH 05/20] only set the C++ standard value if it is not set externally --- cmake/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index bb5072d9dc..93e6c4849f 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -111,7 +111,9 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_CXX_COMPILER_ID STREQUAL " endif() # we require C++11 without extensions. Kokkos requires at least C++14 (currently) -set(CMAKE_CXX_STANDARD 11) +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) +endif() if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 14)) set(CMAKE_CXX_STANDARD 14) endif() From c07551072d8b06bbefa12ba6a6587020310cfecf Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 21 Apr 2022 07:50:30 -0400 Subject: [PATCH 06/20] must check if externally set C++ standard is at least c++11 --- cmake/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 93e6c4849f..cd98808762 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -114,6 +114,9 @@ endif() if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11) endif() +if(CMAKE_CXX_STANDARD LESS 11) + message(FATAL_ERROR "C++ standard must be set to at least 11") +endif() if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 14)) set(CMAKE_CXX_STANDARD 14) endif() From e9eb74e13aefe216d98233702ad14ff2d1eae550 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 21 Apr 2022 07:50:48 -0400 Subject: [PATCH 07/20] add missing override --- src/fix_bond_history.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fix_bond_history.h b/src/fix_bond_history.h index 511bc57bd2..9ac5a9e393 100644 --- a/src/fix_bond_history.h +++ b/src/fix_bond_history.h @@ -41,7 +41,7 @@ class FixBondHistory : public Fix { double memory_usage() override; void write_restart(FILE *fp) override; void restart(char *buf) override; - void set_arrays(int); + void set_arrays(int) override; void update_atom_value(int, int, int, double); double get_atom_value(int, int, int); From 1a8ba25444090c492d6a3c5313781fbbb46ca0ab Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 21 Apr 2022 07:58:43 -0400 Subject: [PATCH 08/20] silence some excessive warning by the new Intel compilers --- cmake/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index cd98808762..9b574d251c 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -105,6 +105,11 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") endif() endif() +# silence excessive warnings for new Intel Compilers +if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") + set(CMAKE_TUNE_DEFAULT "-Wno-tautological-constant-compare") +endif() + # silence excessive warnings for PGI/NVHPC compilers if((CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "PGI")) set(CMAKE_TUNE_DEFAULT "-Minform=severe") From b7d329f9b3f80b35384297c301af22078a1bf2b4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 21 Apr 2022 07:58:54 -0400 Subject: [PATCH 09/20] remove unused field in class --- src/BPM/atom_vec_bpm_sphere.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BPM/atom_vec_bpm_sphere.h b/src/BPM/atom_vec_bpm_sphere.h index e7672eeb3c..c6f80b89d9 100644 --- a/src/BPM/atom_vec_bpm_sphere.h +++ b/src/BPM/atom_vec_bpm_sphere.h @@ -45,7 +45,7 @@ class AtomVecBPMSphere : public AtomVec { int **nspecial; double *radius, *rmass; - double **omega, **torque, **quat; + double **omega, **quat; int any_bond_negative; int bond_per_atom; From 556ad777d1ae1c9bab60ed795a158a6adf0a84bd Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 21 Apr 2022 11:53:59 -0400 Subject: [PATCH 10/20] update code to use safe fread() and thus silence compiler warnings on ubuntu --- src/BPM/pair_bpm_spring.cpp | 8 +- src/EXTRA-PAIR/pair_coul_slater_long.cpp | 95 +++++------------------- src/EXTRA-PAIR/pair_coul_slater_long.h | 1 - src/EXTRA-PAIR/pair_wf_cut.cpp | 18 ++--- 4 files changed, 31 insertions(+), 91 deletions(-) diff --git a/src/BPM/pair_bpm_spring.cpp b/src/BPM/pair_bpm_spring.cpp index 0dd113e2ed..40f40b8a3b 100644 --- a/src/BPM/pair_bpm_spring.cpp +++ b/src/BPM/pair_bpm_spring.cpp @@ -253,13 +253,13 @@ void PairBPMSpring::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) fread(&setflag[i][j], sizeof(int), 1, fp); + if (me == 0) utils::sfread(FLERR, &setflag[i][j], sizeof(int), 1, fp, nullptr, error); MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world); if (setflag[i][j]) { if (me == 0) { - fread(&k[i][j], sizeof(double), 1, fp); - fread(&cut[i][j], sizeof(double), 1, fp); - fread(&gamma[i][j], sizeof(double), 1, fp); + utils::sfread(FLERR, &k[i][j], sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &cut[i][j], sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &gamma[i][j], sizeof(double), 1, fp, nullptr, error); } MPI_Bcast(&k[i][j], 1, MPI_DOUBLE, 0, world); MPI_Bcast(&cut[i][j], 1, MPI_DOUBLE, 0, world); diff --git a/src/EXTRA-PAIR/pair_coul_slater_long.cpp b/src/EXTRA-PAIR/pair_coul_slater_long.cpp index d30d346fa0..65619f0f65 100644 --- a/src/EXTRA-PAIR/pair_coul_slater_long.cpp +++ b/src/EXTRA-PAIR/pair_coul_slater_long.cpp @@ -45,7 +45,6 @@ using namespace LAMMPS_NS; PairCoulSlaterLong::PairCoulSlaterLong(LAMMPS *lmp) : Pair(lmp) { ewaldflag = pppmflag = 1; - //ftable = nullptr; qdist = 0.0; } @@ -117,7 +116,6 @@ void PairCoulSlaterLong::compute(int eflag, int vflag) if (rsq < cut_coulsq) { r2inv = 1.0/rsq; -// if (!ncoultablebits || rsq <= tabinnersq) { r = sqrt(rsq); grij = g_ewald * r; expm2 = exp(-grij*grij); @@ -127,22 +125,6 @@ void PairCoulSlaterLong::compute(int eflag, int vflag) prefactor = qqrd2e * scale[itype][jtype] * qtmp*q[j]/r; forcecoul = prefactor * (erfc + EWALD_F*grij*expm2 - slater_term); if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; -/* - } else { - union_int_float_t rsq_lookup; - rsq_lookup.f = rsq; - itable = rsq_lookup.i & ncoulmask; - itable >>= ncoulshiftbits; - fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable]; - table = ftable[itable] + fraction*dftable[itable]; - forcecoul = scale[itype][jtype] * qtmp*q[j] * table; - if (factor_coul < 1.0) { - table = ctable[itable] + fraction*dctable[itable]; - prefactor = scale[itype][jtype] * qtmp*q[j] * table; - forcecoul -= (1.0-factor_coul)*prefactor; - } - } -*/ fpair = forcecoul * r2inv; @@ -156,14 +138,7 @@ void PairCoulSlaterLong::compute(int eflag, int vflag) } if (eflag) { -// if (!ncoultablebits || rsq <= tabinnersq) ecoul = prefactor*(erfc - (1 + r/lamda)*exp(-2*r/lamda)); -/* - else { - table = etable[itable] + fraction*detable[itable]; - ecoul = scale[itype][jtype] * qtmp*q[j] * table; - } -*/ if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor; } @@ -296,10 +271,10 @@ void PairCoulSlaterLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp); + if (me == 0) utils::sfread(FLERR, &setflag[i][j],sizeof(int),1,fp, nullptr, error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - if (me == 0) fread(&scale[i][j],sizeof(double),1,fp); + if (me == 0) utils::sfread(FLERR, &scale[i][j],sizeof(double),1,fp, nullptr, error); MPI_Bcast(&scale[i][j],1,MPI_DOUBLE,0,world); } } @@ -315,8 +290,6 @@ void PairCoulSlaterLong::write_restart_settings(FILE *fp) fwrite(&lamda,sizeof(double),1,fp); fwrite(&offset_flag,sizeof(int),1,fp); fwrite(&mix_flag,sizeof(int),1,fp); - //fwrite(&ncoultablebits,sizeof(int),1,fp); - //fwrite(&tabinner,sizeof(double),1,fp); } /* ---------------------------------------------------------------------- @@ -326,71 +299,39 @@ void PairCoulSlaterLong::write_restart_settings(FILE *fp) void PairCoulSlaterLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - fread(&cut_coul,sizeof(double),1,fp); - fread(&lamda,sizeof(double),1,fp); - fread(&offset_flag,sizeof(int),1,fp); - fread(&mix_flag,sizeof(int),1,fp); - //fread(&ncoultablebits,sizeof(int),1,fp); - //fread(&tabinner,sizeof(double),1,fp); + utils::sfread(FLERR, &cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR, &lamda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR, &offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR, &mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); MPI_Bcast(&lamda,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); - //MPI_Bcast(&ncoultablebits,1,MPI_INT,0,world); - //MPI_Bcast(&tabinner,1,MPI_DOUBLE,0,world); } /* ---------------------------------------------------------------------- */ -double PairCoulSlaterLong::single(int i, int j, int /*itype*/, int /*jtype*/, - double rsq, - double factor_coul, double /*factor_lj*/, - double &fforce) +double PairCoulSlaterLong::single(int i, int j, int /*itype*/, int /*jtype*/, double rsq, + double factor_coul, double /*factor_lj*/, double &fforce) { double r2inv,r,grij,expm2,t,erfc,prefactor; double slater_term; -// double fraction,table; double forcecoul,phicoul; -// int itable; r2inv = 1.0/rsq; -// if (!ncoultablebits || rsq <= tabinnersq) { - r = sqrt(rsq); - grij = g_ewald * r; - expm2 = exp(-grij*grij); - t = 1.0 / (1.0 + EWALD_P*grij); - erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2; - slater_term = exp(-2*r/lamda)*(1 + (2*r/lamda*(1+r/lamda))); - prefactor = force->qqrd2e * atom->q[i]*atom->q[j]/r; - forcecoul = prefactor * (erfc + EWALD_F*grij*expm2 - slater_term); - if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; -/* - } else { - union_int_float_t rsq_lookup; - rsq_lookup.f = rsq; - itable = rsq_lookup.i & ncoulmask; - itable >>= ncoulshiftbits; - fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable]; - table = ftable[itable] + fraction*dftable[itable]; - forcecoul = atom->q[i]*atom->q[j] * table; - if (factor_coul < 1.0) { - table = ctable[itable] + fraction*dctable[itable]; - prefactor = atom->q[i]*atom->q[j] * table; - forcecoul -= (1.0-factor_coul)*prefactor; - } - } -*/ + r = sqrt(rsq); + grij = g_ewald * r; + expm2 = exp(-grij*grij); + t = 1.0 / (1.0 + EWALD_P*grij); + erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2; + slater_term = exp(-2*r/lamda)*(1 + (2*r/lamda*(1+r/lamda))); + prefactor = force->qqrd2e * atom->q[i]*atom->q[j]/r; + forcecoul = prefactor * (erfc + EWALD_F*grij*expm2 - slater_term); + if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; fforce = forcecoul * r2inv; -// if (!ncoultablebits || rsq <= tabinnersq) - phicoul = prefactor*(erfc - (1 + r/lamda)*exp(-2*r/lamda)); -/* - else { - table = etable[itable] + fraction*detable[itable]; - phicoul = atom->q[i]*atom->q[j] * table; - } -*/ + phicoul = prefactor*(erfc - (1 + r/lamda)*exp(-2*r/lamda)); if (factor_coul < 1.0) phicoul -= (1.0-factor_coul)*prefactor; return phicoul; diff --git a/src/EXTRA-PAIR/pair_coul_slater_long.h b/src/EXTRA-PAIR/pair_coul_slater_long.h index 66002ca2fa..f9c1da5040 100644 --- a/src/EXTRA-PAIR/pair_coul_slater_long.h +++ b/src/EXTRA-PAIR/pair_coul_slater_long.h @@ -43,7 +43,6 @@ class PairCoulSlaterLong : public Pair { protected: double cut_coul, cut_coulsq, qdist; double lamda; - //double *cut_respa; double g_ewald; double **scale; diff --git a/src/EXTRA-PAIR/pair_wf_cut.cpp b/src/EXTRA-PAIR/pair_wf_cut.cpp index 2fb363a161..b25e519bcf 100644 --- a/src/EXTRA-PAIR/pair_wf_cut.cpp +++ b/src/EXTRA-PAIR/pair_wf_cut.cpp @@ -294,15 +294,15 @@ void PairWFCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp); + if (me == 0) utils::sfread(FLERR, &setflag[i][j],sizeof(int),1,fp, nullptr, error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - fread(&epsilon[i][j],sizeof(double),1,fp); - fread(&sigma[i][j],sizeof(double),1,fp); - fread(&nu[i][j],sizeof(int),1,fp); - fread(&mu[i][j],sizeof(int),1,fp); - fread(&cut[i][j],sizeof(double),1,fp); + utils::sfread(FLERR, &epsilon[i][j],sizeof(double),1,fp, nullptr, error); + utils::sfread(FLERR, &sigma[i][j],sizeof(double),1,fp, nullptr, error); + utils::sfread(FLERR, &nu[i][j],sizeof(int),1,fp, nullptr, error); + utils::sfread(FLERR, &mu[i][j],sizeof(int),1,fp, nullptr, error); + utils::sfread(FLERR, &cut[i][j],sizeof(double),1,fp, nullptr, error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -331,9 +331,9 @@ void PairWFCut::write_restart_settings(FILE *fp) void PairWFCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - fread(&cut_global,sizeof(double),1,fp); - fread(&offset_flag,sizeof(int),1,fp); - fread(&mix_flag,sizeof(int),1,fp); + utils::sfread(FLERR, &cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR, &offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR, &mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); From b7a3af7bd124f0e59c12034761b829ba74edef53 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 21 Apr 2022 11:54:27 -0400 Subject: [PATCH 11/20] update plumed version in containers and install python3-venv --- tools/singularity/ubuntu16.04.def | 2 +- tools/singularity/ubuntu18.04.def | 2 +- tools/singularity/ubuntu18.04_amd_rocm.def | 2 +- tools/singularity/ubuntu18.04_gpu.def | 2 +- tools/singularity/ubuntu18.04_intel_opencl.def | 2 +- tools/singularity/ubuntu18.04_nvidia.def | 2 +- tools/singularity/ubuntu20.04.def | 3 ++- tools/singularity/ubuntu20.04_amd_rocm.def | 3 ++- tools/singularity/ubuntu20.04_gpu.def | 3 ++- tools/singularity/ubuntu20.04_intel_opencl.def | 3 ++- tools/singularity/ubuntu20.04_nvidia.def | 3 ++- tools/singularity/ubuntu20.04_oneapi.def | 3 ++- 12 files changed, 18 insertions(+), 12 deletions(-) diff --git a/tools/singularity/ubuntu16.04.def b/tools/singularity/ubuntu16.04.def index 35e4e26138..f22826cabd 100644 --- a/tools/singularity/ubuntu16.04.def +++ b/tools/singularity/ubuntu16.04.def @@ -14,7 +14,7 @@ From: ubuntu:16.04 libfftw3-dev libjpeg-dev libpng12-dev libblas-dev liblapack-dev \ python-dev libeigen3-dev libgsl-dev libopenblas-dev libreadline-dev \ virtualenv python3-dev python3-pip python3-pkg-resources \ - python3-setuptools python3-virtualenv \ + python3-setuptools python3-virtualenv python3-venv \ enchant # create missing readline pkgconfig file diff --git a/tools/singularity/ubuntu18.04.def b/tools/singularity/ubuntu18.04.def index ebea335d6b..456d3add56 100644 --- a/tools/singularity/ubuntu18.04.def +++ b/tools/singularity/ubuntu18.04.def @@ -107,7 +107,7 @@ From: ubuntu:18.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu18.04_amd_rocm.def b/tools/singularity/ubuntu18.04_amd_rocm.def index f1d327052d..e2a9adc9d9 100644 --- a/tools/singularity/ubuntu18.04_amd_rocm.def +++ b/tools/singularity/ubuntu18.04_amd_rocm.def @@ -137,7 +137,7 @@ From: ubuntu:18.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu18.04_gpu.def b/tools/singularity/ubuntu18.04_gpu.def index 452a3eaee8..6aa37ccf84 100644 --- a/tools/singularity/ubuntu18.04_gpu.def +++ b/tools/singularity/ubuntu18.04_gpu.def @@ -174,7 +174,7 @@ From: ubuntu:18.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu18.04_intel_opencl.def b/tools/singularity/ubuntu18.04_intel_opencl.def index fd7363dbae..1f7c136fac 100644 --- a/tools/singularity/ubuntu18.04_intel_opencl.def +++ b/tools/singularity/ubuntu18.04_intel_opencl.def @@ -108,7 +108,7 @@ From: ubuntu:18.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu18.04_nvidia.def b/tools/singularity/ubuntu18.04_nvidia.def index f834e1a91e..70f41708de 100644 --- a/tools/singularity/ubuntu18.04_nvidia.def +++ b/tools/singularity/ubuntu18.04_nvidia.def @@ -107,7 +107,7 @@ From: nvidia/cuda:11.4.2-devel-ubuntu18.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu20.04.def b/tools/singularity/ubuntu20.04.def index 53690fd1b9..5665546eda 100644 --- a/tools/singularity/ubuntu20.04.def +++ b/tools/singularity/ubuntu20.04.def @@ -52,6 +52,7 @@ From: ubuntu:20.04 python3-pkg-resources \ python3-setuptools \ python3-virtualenv \ + python3-venv \ rsync \ ssh \ texlive \ @@ -101,7 +102,7 @@ From: ubuntu:20.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu20.04_amd_rocm.def b/tools/singularity/ubuntu20.04_amd_rocm.def index e52ff02798..21f1ecc77b 100644 --- a/tools/singularity/ubuntu20.04_amd_rocm.def +++ b/tools/singularity/ubuntu20.04_amd_rocm.def @@ -82,6 +82,7 @@ From: ubuntu:20.04 python3-pkg-resources \ python3-setuptools \ python3-virtualenv \ + python3-venv \ rsync \ ssh \ vim-nox \ @@ -122,7 +123,7 @@ From: ubuntu:20.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu20.04_gpu.def b/tools/singularity/ubuntu20.04_gpu.def index abb43f46df..23bddeb14f 100644 --- a/tools/singularity/ubuntu20.04_gpu.def +++ b/tools/singularity/ubuntu20.04_gpu.def @@ -87,6 +87,7 @@ From: ubuntu:20.04 python3-pkg-resources \ python3-setuptools \ python3-virtualenv \ + python3-venv \ rsync \ ssh \ vim-nox \ @@ -160,7 +161,7 @@ From: ubuntu:20.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu20.04_intel_opencl.def b/tools/singularity/ubuntu20.04_intel_opencl.def index 0e3cae67d7..c02d2cd3a4 100644 --- a/tools/singularity/ubuntu20.04_intel_opencl.def +++ b/tools/singularity/ubuntu20.04_intel_opencl.def @@ -52,6 +52,7 @@ From: ubuntu:20.04 python3-pkg-resources \ python3-setuptools \ python3-virtualenv \ + python3-venv \ rsync \ ssh \ vim-nox \ @@ -100,7 +101,7 @@ From: ubuntu:20.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu20.04_nvidia.def b/tools/singularity/ubuntu20.04_nvidia.def index 274efecadc..e0995301f4 100644 --- a/tools/singularity/ubuntu20.04_nvidia.def +++ b/tools/singularity/ubuntu20.04_nvidia.def @@ -55,6 +55,7 @@ From: nvidia/cuda:11.4.2-devel-ubuntu20.04 python3-pkg-resources \ python3-setuptools \ python3-virtualenv \ + python3-venv \ rsync \ ssh \ vim-nox \ @@ -102,7 +103,7 @@ From: nvidia/cuda:11.4.2-devel-ubuntu20.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu20.04_oneapi.def b/tools/singularity/ubuntu20.04_oneapi.def index e5077fe184..a5d59efbc5 100644 --- a/tools/singularity/ubuntu20.04_oneapi.def +++ b/tools/singularity/ubuntu20.04_oneapi.def @@ -51,6 +51,7 @@ From: ubuntu:20.04 python3-pkg-resources \ python3-setuptools \ python3-virtualenv \ + python3-venv \ rsync \ ssh \ texlive \ @@ -139,7 +140,7 @@ From: ubuntu:20.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed From 1df430aef472298ff0bbeae765051f685593e1fa Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 21 Apr 2022 12:02:05 -0400 Subject: [PATCH 12/20] align with doc folder makefile --- cmake/Modules/Documentation.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/Documentation.cmake b/cmake/Modules/Documentation.cmake index 16dd5dd4fa..35661843a2 100644 --- a/cmake/Modules/Documentation.cmake +++ b/cmake/Modules/Documentation.cmake @@ -7,13 +7,13 @@ if(BUILD_DOC) # Sphinx 3.x requires at least Python 3.5 if(CMAKE_VERSION VERSION_LESS 3.12) find_package(PythonInterp 3.5 REQUIRED) - set(VIRTUALENV ${PYTHON_EXECUTABLE} -m virtualenv -p ${PYTHON_EXECUTABLE}) + set(VIRTUALENV ${PYTHON_EXECUTABLE} -m venv) else() find_package(Python3 REQUIRED COMPONENTS Interpreter) if(Python3_VERSION VERSION_LESS 3.5) message(FATAL_ERROR "Python 3.5 and up is required to build the HTML documentation") endif() - set(VIRTUALENV ${Python3_EXECUTABLE} -m virtualenv -p ${Python3_EXECUTABLE}) + set(VIRTUALENV ${Python3_EXECUTABLE} -m venv) endif() find_package(Doxygen 1.8.10 REQUIRED) From 04afec7771659c9d3702a7f9f5bbe90a12b7af73 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 21 Apr 2022 13:00:26 -0400 Subject: [PATCH 13/20] fix minor doc issues --- doc/src/thermo_modify.rst | 2 +- doc/src/thermo_style.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/thermo_modify.rst b/doc/src/thermo_modify.rst index ffdbf020a1..225dafdc33 100644 --- a/doc/src/thermo_modify.rst +++ b/doc/src/thermo_modify.rst @@ -252,6 +252,6 @@ flush = no, and temp/press = compute IDs defined by thermo_style. The defaults for the line and format options depend on the thermo style. For styles "one" and "custom", the line and format defaults are "one", -"%10d", and "%12.8g". For style "multi", the line and format defaults +"%10d", and "%14.8g". For style "multi", the line and format defaults are "multi", "%14d", and "%14.4f". For style "yaml", the line and format defaults are "%d" and "%.15g". diff --git a/doc/src/thermo_style.rst b/doc/src/thermo_style.rst index ff0e41ffb0..5d63ed81b6 100644 --- a/doc/src/thermo_style.rst +++ b/doc/src/thermo_style.rst @@ -10,7 +10,7 @@ Syntax thermo_style style args -* style = *one* or *multi* *yaml* or *custom* +* style = *one* or *multi* or *yaml* or *custom* * args = list of arguments for a particular style .. parsed-literal:: From 247c61c93faa9d86aa4965570b1fc6dd3c497dbb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 21 Apr 2022 13:01:13 -0400 Subject: [PATCH 14/20] make portable to ubuntu --- doc/Makefile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 58be62e712..113a64ec10 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -14,23 +14,22 @@ ANCHORCHECK = $(VENV)/bin/rst_anchor_check SPHINXCONFIG = $(BUILDDIR)/utils/sphinx-config MATHJAX = $(SPHINXCONFIG)/_static/mathjax -PYTHON = $(shell which python3) -DOXYGEN = $(shell which doxygen) -VIRTUALENV = virtualenv +PYTHON = $(word 3,$(shell type python3)) +DOXYGEN = $(word 3,$(shell type doxygen)) HAS_PYTHON3 = NO HAS_DOXYGEN = NO HAS_PDFLATEX = NO -ifeq ($(shell which python3 >/dev/null 2>&1; echo $$?), 0) +ifeq ($(shell type python3 >/dev/null 2>&1; echo $$?), 0) HAS_PYTHON3 = YES endif -ifeq ($(shell which doxygen >/dev/null 2>&1; echo $$?), 0) +ifeq ($(shell type doxygen >/dev/null 2>&1; echo $$?), 0) HAS_DOXYGEN = YES endif -ifeq ($(shell which pdflatex >/dev/null 2>&1; echo $$?), 0) -ifeq ($(shell which latexmk >/dev/null 2>&1; echo $$?), 0) +ifeq ($(shell type pdflatex >/dev/null 2>&1; echo $$?), 0) +ifeq ($(shell type latexmk >/dev/null 2>&1; echo $$?), 0) HAS_PDFLATEX = YES endif endif From 09187801c1c3a31ded85f42982338818428def0b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 21 Apr 2022 15:01:46 -0400 Subject: [PATCH 15/20] suppress nvcc unknown pragma warnings --- cmake/CMakeLists.txt | 5 +++++ src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 9b574d251c..99d51614c8 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -115,6 +115,11 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_CXX_COMPILER_ID STREQUAL " set(CMAKE_TUNE_DEFAULT "-Minform=severe") endif() +# silence nvcc warnings +if((PKG_KOKKOS) AND (Kokkos_ENABLE_CUDA)) + set(CMAKE_TUNE_DEFAULT "${CMAKE_TUNE_DEFAULT} -Xcudafe --diag_suppress=unrecognized_pragma") +endif() + # we require C++11 without extensions. Kokkos requires at least C++14 (currently) if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11) diff --git a/src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi b/src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi index 42a8236c7c..b73c441c71 100644 --- a/src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi +++ b/src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi @@ -10,7 +10,7 @@ KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) export MPICH_CXX = $(KOKKOS_ABSOLUTE_PATH)/bin/nvcc_wrapper export OMPI_CXX = $(KOKKOS_ABSOLUTE_PATH)/bin/nvcc_wrapper CC = mpicxx -CCFLAGS = -g -O3 -DNDEBUG +CCFLAGS = -g -O3 -DNDEBUG -Xcudafe --diag_suppress=unrecognized_pragma SHFLAGS = -fPIC DEPFLAGS = -M @@ -55,7 +55,7 @@ MPI_LIB = # PATH = path for FFT library # LIB = name of FFT library -FFT_INC = -DFFT_CUFFT +FFT_INC = -DFFT_CUFFT FFT_PATH = FFT_LIB = -lcufft From c6abc9e6822954af8b961e661e191235faef417b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 21 Apr 2022 16:15:42 -0400 Subject: [PATCH 16/20] need wheel module for modern install procedure --- doc/utils/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/utils/requirements.txt b/doc/utils/requirements.txt index 1f5711dd6b..9ff18b3652 100644 --- a/doc/utils/requirements.txt +++ b/doc/utils/requirements.txt @@ -6,3 +6,4 @@ breathe Pygments six pyyaml +wheel From 079d3ea067de17786434a2eeec5faa9d75ffaba6 Mon Sep 17 00:00:00 2001 From: megmcca <90424440+megmcca@users.noreply.github.com> Date: Fri, 22 Apr 2022 06:16:45 -0600 Subject: [PATCH 17/20] remove extraneous printf line --- src/ML-SNAP/pair_snap.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ML-SNAP/pair_snap.cpp b/src/ML-SNAP/pair_snap.cpp index 6a108ad3dd..3ba14c5872 100644 --- a/src/ML-SNAP/pair_snap.cpp +++ b/src/ML-SNAP/pair_snap.cpp @@ -703,7 +703,6 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) if (keywd == "rinner") { keyval = words[iword]; for (int ielem = 0; ielem < nelements; ielem++) { - printf("rinnerelem = %p ielem = %d nelements = %d iword = %d nwords = %d\n",rinnerelem, ielem, nelements, iword, nwords); rinnerelem[ielem] = utils::numeric(FLERR,keyval,false,lmp); iword++; } From 644b3f693364e19c072deab95faee1b37771de86 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 22 Apr 2022 09:32:10 -0400 Subject: [PATCH 18/20] clarify and remove redundant text --- doc/src/compute_rigid_local.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/doc/src/compute_rigid_local.rst b/doc/src/compute_rigid_local.rst index 574f3343be..6817f0ac1e 100644 --- a/doc/src/compute_rigid_local.rst +++ b/doc/src/compute_rigid_local.rst @@ -127,19 +127,16 @@ The *vx*, *vy*, *vz*, *fx*, *fy*, *fz* attributes are components of the COM velocity and force on the COM of the body. The *omegax*, *omegay*, and *omegaz* attributes are the angular -velocity components of the body around its COM. +velocity components of the body in the system frame around its COM. The *angmomx*, *angmomy*, and *angmomz* attributes are the angular -momentum components of the body around its COM. +momentum components of the body in the system frame around its COM. The *quatw*, *quati*, *quatj*, and *quatk* attributes are the components of the 4-vector quaternion representing the orientation of the rigid body. See the :doc:`set ` command for an explanation of the quaternion vector. -The *angmomx*, *angmomy*, and *angmomz* attributes are the angular -momentum components of the body around its COM. - The *tqx*, *tqy*, *tqz* attributes are components of the torque acting on the body around its COM. From 77b563a024a768a0b85274e028fe850230be8e7a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 22 Apr 2022 11:23:54 -0400 Subject: [PATCH 19/20] disable unknown pragma warnings for the summit machine when using CUDA --- src/MAKE/MACHINES/Makefile.summit_kokkos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MAKE/MACHINES/Makefile.summit_kokkos b/src/MAKE/MACHINES/Makefile.summit_kokkos index f22b27cc74..557ebd22b2 100644 --- a/src/MAKE/MACHINES/Makefile.summit_kokkos +++ b/src/MAKE/MACHINES/Makefile.summit_kokkos @@ -9,7 +9,7 @@ SHELL = /bin/sh KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) CC = $(KOKKOS_ABSOLUTE_PATH)/bin/nvcc_wrapper -CCFLAGS = -g -O3 -DNDEBUG +CCFLAGS = -g -O3 -DNDEBUG -Xcudafe --diag_suppress=unrecognized_pragma SHFLAGS = -fPIC DEPFLAGS = -M From 68d1c856b35344fe64e64d04e0fa39ded346c31c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 22 Apr 2022 11:27:08 -0400 Subject: [PATCH 20/20] fix typo --- doc/src/fix_ttm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/fix_ttm.rst b/doc/src/fix_ttm.rst index c2b4f2cf97..d146321395 100644 --- a/doc/src/fix_ttm.rst +++ b/doc/src/fix_ttm.rst @@ -217,7 +217,7 @@ units used. .. note:: The electronic temperature at each grid point must be a non-zero - positive value, both initially, and as the temperature evovles over + positive value, both initially, and as the temperature evolves over time. Thus you must use either the *set* or *infile* keyword or be restarting a simulation that used this fix previously.