From 87c34fb144a8ca37807fb66415b6c6e04ea52b0d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 14 May 2020 19:27:26 -0400 Subject: [PATCH 01/13] dihedral base class did not initialize suffix_flag member. --- src/dihedral.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/dihedral.cpp b/src/dihedral.cpp index 7c6f6aad5e..ac2d432cfb 100644 --- a/src/dihedral.cpp +++ b/src/dihedral.cpp @@ -18,6 +18,7 @@ #include "atom_masks.h" #include "memory.h" #include "error.h" +#include "suffix.h" using namespace LAMMPS_NS; @@ -32,6 +33,7 @@ Dihedral::Dihedral(LAMMPS *lmp) : Pointers(lmp) writedata = 0; allocated = 0; + suffix_flag = Suffix::NONE; maxeatom = maxvatom = maxcvatom = 0; eatom = NULL; From e36d2ce3e62414307b91665b2664259d552af012 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 14 May 2020 00:43:43 -0400 Subject: [PATCH 02/13] Do not use -ffast-math by default. Too large a chance of miscompiled code. --- cmake/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 557b1ea06b..a7f92c0672 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -60,11 +60,11 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel") endif() if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") - set(CMAKE_TUNE_DEFAULT "-ffast-math -march=native") + set(CMAKE_TUNE_DEFAULT "-march=native") endif() if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") - set(CMAKE_TUNE_DEFAULT "-ffast-math -march=native") + set(CMAKE_TUNE_DEFAULT "-march=native") endif() # we require C++11 without extensions From 37442ca5cf1034cf90da9bdbdf84415e11e78946 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 15 May 2020 08:05:32 -0400 Subject: [PATCH 03/13] fix bug in USER-OMP with "pair_modify compute no" and "kspace_modify compute no" --- src/USER-OMP/fix_omp.cpp | 12 +++++++++--- src/USER-OMP/fix_omp.h | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/USER-OMP/fix_omp.cpp b/src/USER-OMP/fix_omp.cpp index d7216a4571..51e65d24ed 100644 --- a/src/USER-OMP/fix_omp.cpp +++ b/src/USER-OMP/fix_omp.cpp @@ -63,7 +63,8 @@ static int get_tid() FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), thr(NULL), last_omp_style(NULL), last_pair_hybrid(NULL), - _nthr(-1), _neighbor(true), _mixed(false), _reduced(true) + _nthr(-1), _neighbor(true), _mixed(false), _reduced(true), + _pair_compute_flag(false), _kspace_compute_flag(false) { if (narg < 4) error->all(FLERR,"Illegal package omp command"); @@ -207,6 +208,11 @@ void FixOMP::init() && (strstr(update->integrate_style,"respa/omp") == NULL)) error->all(FLERR,"Need to use respa/omp for r-RESPA with /omp styles"); + if (force->pair && force->pair->compute_flag) _pair_compute_flag = true; + else _pair_compute_flag = false; + if (force->kspace && force->kspace->compute_flag) _kspace_compute_flag = true; + else _kspace_compute_flag = false; + int check_hybrid, kspace_split; last_pair_hybrid = NULL; last_omp_style = NULL; @@ -254,7 +260,7 @@ void FixOMP::init() } \ } - if (kspace_split <= 0) { + if (_pair_compute_flag && (kspace_split <= 0)) { CheckStyleForOMP(pair); CheckHybridForOMP(pair,Pair); if (check_hybrid) { @@ -275,7 +281,7 @@ void FixOMP::init() CheckHybridForOMP(improper,Improper); } - if (kspace_split >= 0) { + if (_kspace_compute_flag && (kspace_split >= 0)) { CheckStyleForOMP(kspace); } diff --git a/src/USER-OMP/fix_omp.h b/src/USER-OMP/fix_omp.h index 55e042dd52..3020a927fd 100644 --- a/src/USER-OMP/fix_omp.h +++ b/src/USER-OMP/fix_omp.h @@ -70,6 +70,8 @@ class FixOMP : public Fix { bool _neighbor; // en/disable threads for neighbor list construction bool _mixed; // whether to prefer mixed precision compute kernels bool _reduced; // whether forces have been reduced for this step + bool _pair_compute_flag; // whether pair_compute is called + bool _kspace_compute_flag; // whether kspace_compute is called void set_neighbor_omp(); }; From dc74fac4d372e02192cdcc1bc0a72796bafd5643 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 15 May 2020 20:04:49 -0400 Subject: [PATCH 04/13] silence compiler warning --- src/atom_vec.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index d0b5f42c06..ef276bcf6a 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -2279,7 +2279,7 @@ void AtomVec::write_improper(FILE *fp, int n, tagint **buf, int index) bigint AtomVec::memory_usage() { - int datatype,cols,index,maxcols; + int datatype,cols,maxcols; void *pdata; bigint bytes = 0; @@ -2296,7 +2296,6 @@ bigint AtomVec::memory_usage() pdata = mgrow.pdata[i]; datatype = mgrow.datatype[i]; cols = mgrow.cols[i]; - index = mgrow.index[i]; const int nthreads = threads[i] ? comm->nthreads : 1; if (datatype == DOUBLE) { if (cols == 0) { From 9ed2824de8eaecf40f1d6b74325c6f648a954f69 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 15 May 2020 22:13:43 -0400 Subject: [PATCH 05/13] add missing coulomb tabulation to pair style lj/class2/coul/long --- src/USER-OMP/pair_lj_class2_coul_long_omp.cpp | 42 ++++++++++++++----- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp b/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp index c0734e39d6..480e2adae0 100644 --- a/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp @@ -39,6 +39,7 @@ PairLJClass2CoulLongOMP::PairLJClass2CoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; + cut_respa = NULL; } /* ---------------------------------------------------------------------- */ @@ -85,8 +86,9 @@ void PairLJClass2CoulLongOMP::compute(int eflag, int vflag) template void PairLJClass2CoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) { - int i,j,ii,jj,jnum,itype,jtype; + int i,j,ii,jj,jnum,itype,jtype,itable; double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair; + double fraction,table; double r,rsq,rinv,r2inv,r3inv,r6inv,forcecoul,forcelj,factor_coul,factor_lj; double grij,expm2,prefactor,t,erfc; int *ilist,*jlist,*numneigh,**firstneigh; @@ -137,14 +139,29 @@ void PairLJClass2CoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) r2inv = 1.0/rsq; if (rsq < cut_coulsq) { - 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; - prefactor = qqrd2e * qtmp*q[j]/r; - forcecoul = prefactor * (erfc + EWALD_F*grij*expm2); - if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; + 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; + prefactor = qqrd2e * qtmp*q[j]/r; + forcecoul = prefactor * (erfc + EWALD_F*grij*expm2); + 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 = qtmp*q[j] * table; + if (factor_coul < 1.0) { + table = ctable[itable] + fraction*dctable[itable]; + prefactor = qtmp*q[j] * table; + forcecoul -= (1.0-factor_coul)*prefactor; + } + } } else forcecoul = 0.0; if (rsq < cut_ljsq[itype][jtype]) { @@ -168,7 +185,12 @@ void PairLJClass2CoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) if (EFLAG) { if (rsq < cut_coulsq) { - ecoul = prefactor*erfc; + if (!ncoultablebits || rsq <= tabinnersq) + ecoul = prefactor*erfc; + else { + table = etable[itable] + fraction*detable[itable]; + ecoul = qtmp*q[j] * table; + } if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor; } else ecoul = 0.0; From 8395ec9e43e6c5821d3b9870d951822a48b37ec8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 18 May 2020 14:31:31 -0400 Subject: [PATCH 06/13] avoid segfault with eam/intel when using it with a hybrid pair style --- src/USER-INTEL/pair_eam_intel.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/USER-INTEL/pair_eam_intel.cpp b/src/USER-INTEL/pair_eam_intel.cpp index 984823f07e..994f0d3910 100644 --- a/src/USER-INTEL/pair_eam_intel.cpp +++ b/src/USER-INTEL/pair_eam_intel.cpp @@ -711,6 +711,8 @@ void PairEAMIntel::pack_force_const(ForceConst &fc, if (type2rhor[i][j] >= 0) { const int joff = ioff + j * fc.rhor_jstride(); for (int k = 0; k < nr + 1; k++) { + if ((type2rhor[j][i] < 0) || (type2rhor[i][j] < 0)) + continue; if (type2rhor[j][i] != type2rhor[i][j]) _onetype = 0; else if (_onetype < 0) From 93fe33553ae9bbfd0506d1b3c53939377070c453 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 18 May 2020 17:50:28 -0400 Subject: [PATCH 07/13] need to set CMake policy CMP0074 to NEW behavior also for finding TBB Malloc --- cmake/Modules/FindTBB_MALLOC.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/Modules/FindTBB_MALLOC.cmake b/cmake/Modules/FindTBB_MALLOC.cmake index 776c2c4749..64bd8c0cf3 100644 --- a/cmake/Modules/FindTBB_MALLOC.cmake +++ b/cmake/Modules/FindTBB_MALLOC.cmake @@ -6,7 +6,9 @@ # TBB_MALLOC_FOUND - True if tbb found. # - +if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12) + cmake_policy(SET CMP0074 NEW) +endif() ######################################################## # TBB Malloc From 6b1dbe2393ececcf712cd7e457586362df2f4b27 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 18 May 2020 18:14:52 -0400 Subject: [PATCH 08/13] the first argument to Bond::extract() should be `const char *` not `char *`. --- src/CLASS2/bond_class2.cpp | 2 +- src/CLASS2/bond_class2.h | 2 +- src/MOLECULE/bond_fene.cpp | 2 +- src/MOLECULE/bond_fene.h | 2 +- src/MOLECULE/bond_gromos.cpp | 4 ++-- src/MOLECULE/bond_gromos.h | 2 +- src/MOLECULE/bond_harmonic.cpp | 4 ++-- src/MOLECULE/bond_harmonic.h | 2 +- src/MOLECULE/bond_morse.cpp | 2 +- src/MOLECULE/bond_morse.h | 2 +- src/MOLECULE/bond_nonlinear.cpp | 2 +- src/MOLECULE/bond_nonlinear.h | 2 +- src/bond.h | 2 +- 13 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/CLASS2/bond_class2.cpp b/src/CLASS2/bond_class2.cpp index 097c8fe387..7feec1a4b3 100644 --- a/src/CLASS2/bond_class2.cpp +++ b/src/CLASS2/bond_class2.cpp @@ -224,7 +224,7 @@ double BondClass2::single(int type, double rsq, int /*i*/, int /*j*/, double &ff /* ---------------------------------------------------------------------- */ -void *BondClass2::extract( char *str, int &dim ) +void *BondClass2::extract(const char *str, int &dim) { dim = 1; if (strcmp(str,"r0")==0) return (void*) r0; diff --git a/src/CLASS2/bond_class2.h b/src/CLASS2/bond_class2.h index fb7eb884df..f83fecfce0 100644 --- a/src/CLASS2/bond_class2.h +++ b/src/CLASS2/bond_class2.h @@ -35,7 +35,7 @@ class BondClass2 : public Bond { virtual void read_restart(FILE *); void write_data(FILE *); double single(int, double, int, int, double &); - virtual void *extract(char *, int &); + virtual void *extract(const char *, int &); protected: double *r0,*k2,*k3,*k4; diff --git a/src/MOLECULE/bond_fene.cpp b/src/MOLECULE/bond_fene.cpp index e3c47b6241..91c0877478 100644 --- a/src/MOLECULE/bond_fene.cpp +++ b/src/MOLECULE/bond_fene.cpp @@ -276,7 +276,7 @@ double BondFENE::single(int type, double rsq, int /*i*/, int /*j*/, /* ---------------------------------------------------------------------- */ -void *BondFENE::extract( char *str, int &dim ) +void *BondFENE::extract(const char *str, int &dim) { dim = 1; if (strcmp(str,"kappa")==0) return (void*) k; diff --git a/src/MOLECULE/bond_fene.h b/src/MOLECULE/bond_fene.h index 77c7db1200..78ce169870 100644 --- a/src/MOLECULE/bond_fene.h +++ b/src/MOLECULE/bond_fene.h @@ -36,7 +36,7 @@ class BondFENE : public Bond { void read_restart(FILE *); void write_data(FILE *); double single(int, double, int, int, double &); - virtual void *extract(char *, int &); + virtual void *extract(const char *, int &); protected: double TWO_1_3; diff --git a/src/MOLECULE/bond_gromos.cpp b/src/MOLECULE/bond_gromos.cpp index 6732cc4457..27447d7298 100644 --- a/src/MOLECULE/bond_gromos.cpp +++ b/src/MOLECULE/bond_gromos.cpp @@ -189,7 +189,7 @@ void BondGromos::write_data(FILE *fp) /* ---------------------------------------------------------------------- */ double BondGromos::single(int type, double rsq, int /*i*/, int /*j*/, - double &fforce) + double &fforce) { double dr = rsq - r0[type]*r0[type]; fforce = -4.0*k[type] * dr; @@ -199,7 +199,7 @@ double BondGromos::single(int type, double rsq, int /*i*/, int /*j*/, /* ---------------------------------------------------------------------- Return ptr to internal members upon request. ------------------------------------------------------------------------ */ -void *BondGromos::extract( char *str, int &dim ) +void *BondGromos::extract(const char *str, int &dim) { dim = 1; if (strcmp(str,"kappa")==0) return (void*) k; diff --git a/src/MOLECULE/bond_gromos.h b/src/MOLECULE/bond_gromos.h index 966b914437..95ecf8db10 100644 --- a/src/MOLECULE/bond_gromos.h +++ b/src/MOLECULE/bond_gromos.h @@ -35,7 +35,7 @@ class BondGromos : public Bond { void read_restart(FILE *); void write_data(FILE *); double single(int, double, int, int, double &); - virtual void *extract(char *, int &); + virtual void *extract(const char *, int &); protected: double *k,*r0; diff --git a/src/MOLECULE/bond_harmonic.cpp b/src/MOLECULE/bond_harmonic.cpp index 569c92f99d..5ea60cda46 100644 --- a/src/MOLECULE/bond_harmonic.cpp +++ b/src/MOLECULE/bond_harmonic.cpp @@ -190,7 +190,7 @@ void BondHarmonic::write_data(FILE *fp) /* ---------------------------------------------------------------------- */ double BondHarmonic::single(int type, double rsq, int /*i*/, int /*j*/, - double &fforce) + double &fforce) { double r = sqrt(rsq); double dr = r - r0[type]; @@ -203,7 +203,7 @@ double BondHarmonic::single(int type, double rsq, int /*i*/, int /*j*/, /* ---------------------------------------------------------------------- Return ptr to internal members upon request. ------------------------------------------------------------------------ */ -void *BondHarmonic::extract( char *str, int &dim ) +void *BondHarmonic::extract(const char *str, int &dim) { dim = 1; if (strcmp(str,"kappa")==0) return (void*) k; diff --git a/src/MOLECULE/bond_harmonic.h b/src/MOLECULE/bond_harmonic.h index 576e63629b..39b4f68af5 100644 --- a/src/MOLECULE/bond_harmonic.h +++ b/src/MOLECULE/bond_harmonic.h @@ -35,7 +35,7 @@ class BondHarmonic : public Bond { virtual void read_restart(FILE *); void write_data(FILE *); double single(int, double, int, int, double &); - virtual void *extract(char *, int &); + virtual void *extract(const char *, int &); protected: double *k,*r0; diff --git a/src/MOLECULE/bond_morse.cpp b/src/MOLECULE/bond_morse.cpp index 0a92229879..c644d2be1c 100644 --- a/src/MOLECULE/bond_morse.cpp +++ b/src/MOLECULE/bond_morse.cpp @@ -209,7 +209,7 @@ double BondMorse::single(int type, double rsq, int /*i*/, int /*j*/, /* ---------------------------------------------------------------------- */ -void *BondMorse::extract(char *str, int &dim ) +void *BondMorse::extract(const char *str, int &dim) { dim = 1; if (strcmp(str,"r0")==0) return (void*) r0; diff --git a/src/MOLECULE/bond_morse.h b/src/MOLECULE/bond_morse.h index cbab0aed1d..6d7ec8f8aa 100644 --- a/src/MOLECULE/bond_morse.h +++ b/src/MOLECULE/bond_morse.h @@ -35,7 +35,7 @@ class BondMorse : public Bond { void read_restart(FILE *); void write_data(FILE *); double single(int, double, int, int, double &); - virtual void *extract(char *, int &); + virtual void *extract(const char *, int &); protected: double *d0,*alpha,*r0; diff --git a/src/MOLECULE/bond_nonlinear.cpp b/src/MOLECULE/bond_nonlinear.cpp index 8f0616e03e..1451fa29c2 100644 --- a/src/MOLECULE/bond_nonlinear.cpp +++ b/src/MOLECULE/bond_nonlinear.cpp @@ -206,7 +206,7 @@ double BondNonlinear::single(int type, double rsq, int /*i*/, int /*j*/, /* ---------------------------------------------------------------------- */ -void *BondNonlinear::extract( char *str, int &dim ) +void *BondNonlinear::extract(const char *str, int &dim) { dim = 1; if (strcmp(str,"epsilon")==0) return (void*) epsilon; diff --git a/src/MOLECULE/bond_nonlinear.h b/src/MOLECULE/bond_nonlinear.h index 76dffdba31..29191698d3 100644 --- a/src/MOLECULE/bond_nonlinear.h +++ b/src/MOLECULE/bond_nonlinear.h @@ -35,7 +35,7 @@ class BondNonlinear : public Bond { void read_restart(FILE *); void write_data(FILE *); double single(int, double, int, int, double &); - virtual void *extract(char *, int &); + virtual void *extract(const char *, int &); protected: double *epsilon,*r0,*lamda; diff --git a/src/bond.h b/src/bond.h index b558a2a35e..8d7585b388 100644 --- a/src/bond.h +++ b/src/bond.h @@ -52,7 +52,7 @@ class Bond : protected Pointers { virtual void write_data(FILE *) {} virtual double single(int, double, int, int, double &) = 0; virtual double memory_usage(); - virtual void *extract(char *, int &) {return NULL;} + virtual void *extract(const char *, int &) {return NULL;} virtual void reinit(); void write_file(int, char**); From 4ac7a26fe13e68a640a455a0d828f4e662ff23ee Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 18 May 2020 19:35:50 -0400 Subject: [PATCH 09/13] add support for extracting r0 array to bond style zero --- src/bond_zero.cpp | 11 +++++++++-- src/bond_zero.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/bond_zero.cpp b/src/bond_zero.cpp index 428fd0ace2..cb336ddd67 100644 --- a/src/bond_zero.cpp +++ b/src/bond_zero.cpp @@ -144,8 +144,6 @@ void BondZero::write_data(FILE *fp) fprintf(fp,"%d %g\n",i,r0[i]); } - - /* ---------------------------------------------------------------------- */ double BondZero::single(int /*type*/, double /*rsq*/, int /*i*/, int /*j*/, @@ -153,3 +151,12 @@ double BondZero::single(int /*type*/, double /*rsq*/, int /*i*/, int /*j*/, { return 0.0; } + +/* ---------------------------------------------------------------------- */ + +void *BondZero::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str,"r0")==0) return (void*) r0; + return NULL; +} diff --git a/src/bond_zero.h b/src/bond_zero.h index 7cbd2b9a96..b31e89edf7 100644 --- a/src/bond_zero.h +++ b/src/bond_zero.h @@ -38,6 +38,7 @@ class BondZero : public Bond { void write_data(FILE *); double single(int, double, int, int, double &); + virtual void *extract(const char *, int &); protected: double *r0; From ffaa77af6be3294d7963eab06a58d56a89a64a25 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 19 May 2020 09:02:17 -0400 Subject: [PATCH 10/13] reintroduce bugfix for bessel function distributed random numbers --- src/random_mars.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/random_mars.cpp b/src/random_mars.cpp index 66c12f8ff5..64d6808e43 100644 --- a/src/random_mars.cpp +++ b/src/random_mars.cpp @@ -151,7 +151,7 @@ double RanMars::besselexp(double theta, double alpha, double cp) { double first,v1,v2; - if (theta < 0.0 || alpha < 0.0 || alpha < 1.0) + if (theta < 0.0 || alpha < 0.0 || alpha > 1.0) error->all(FLERR,"Invalid Bessel exponential distribution parameters"); v1 = uniform(); From 16db223d0307f7b8609ed07d59c262cf880cb1d7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 19 May 2020 11:53:47 -0400 Subject: [PATCH 11/13] update test for whether to set CMake policy CMP0074 is needed. --- cmake/Modules/FindTBB_MALLOC.cmake | 3 ++- cmake/Modules/Packages/USER-H5MD.cmake | 4 +++- cmake/Modules/Packages/USER-NETCDF.cmake | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cmake/Modules/FindTBB_MALLOC.cmake b/cmake/Modules/FindTBB_MALLOC.cmake index 64bd8c0cf3..f837932ba8 100644 --- a/cmake/Modules/FindTBB_MALLOC.cmake +++ b/cmake/Modules/FindTBB_MALLOC.cmake @@ -6,7 +6,8 @@ # TBB_MALLOC_FOUND - True if tbb found. # -if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12) +# silence warning about ignoring _ROOT and use it. +if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) endif() ######################################################## diff --git a/cmake/Modules/Packages/USER-H5MD.cmake b/cmake/Modules/Packages/USER-H5MD.cmake index 6e8e425673..274c0914e2 100644 --- a/cmake/Modules/Packages/USER-H5MD.cmake +++ b/cmake/Modules/Packages/USER-H5MD.cmake @@ -1,8 +1,10 @@ enable_language(C) -if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12) +# silence warning about ignoring _ROOT and use it. +if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) endif() + find_package(HDF5 REQUIRED) target_link_libraries(h5md PRIVATE ${HDF5_LIBRARIES}) target_include_directories(h5md PUBLIC ${HDF5_INCLUDE_DIRS}) diff --git a/cmake/Modules/Packages/USER-NETCDF.cmake b/cmake/Modules/Packages/USER-NETCDF.cmake index 1bcbcadc35..36c5a06385 100644 --- a/cmake/Modules/Packages/USER-NETCDF.cmake +++ b/cmake/Modules/Packages/USER-NETCDF.cmake @@ -1,8 +1,12 @@ # USER-NETCDF can use NetCDF, Parallel NetCDF (PNetCDF), or both. At least one necessary. # NetCDF library enables dump style "netcdf", while PNetCDF enables dump style "netcdf/mpiio" -if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12) + +# silence warning about ignoring _ROOT and use it. +if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) endif() + +# may use NetCDF or PNetCDF with MPI, but must have NetCDF without if(NOT BUILD_MPI) find_package(NetCDF REQUIRED) else() From 48a9e0d73212657c6f5300cbfffa5b85c4e5b375 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 19 May 2020 15:20:41 -0400 Subject: [PATCH 12/13] consolidate setting CMake policy CMP0074 into main cmake file --- cmake/CMakeLists.txt | 5 +++++ cmake/Modules/FindTBB_MALLOC.cmake | 4 ---- cmake/Modules/Packages/USER-H5MD.cmake | 5 ----- cmake/Modules/Packages/USER-NETCDF.cmake | 5 ----- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index a7f92c0672..8d7003b467 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -3,6 +3,11 @@ # This file is part of LAMMPS # Created by Christoph Junghans and Richard Berger cmake_minimum_required(VERSION 3.10) +# set policy to silence warnings about ignoring _ROOT but use it +if(POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif() +######################################## project(lammps CXX) set(SOVERSION 0) diff --git a/cmake/Modules/FindTBB_MALLOC.cmake b/cmake/Modules/FindTBB_MALLOC.cmake index f837932ba8..d34b946ad3 100644 --- a/cmake/Modules/FindTBB_MALLOC.cmake +++ b/cmake/Modules/FindTBB_MALLOC.cmake @@ -6,10 +6,6 @@ # TBB_MALLOC_FOUND - True if tbb found. # -# silence warning about ignoring _ROOT and use it. -if(POLICY CMP0074) - cmake_policy(SET CMP0074 NEW) -endif() ######################################################## # TBB Malloc diff --git a/cmake/Modules/Packages/USER-H5MD.cmake b/cmake/Modules/Packages/USER-H5MD.cmake index 274c0914e2..4fcae93027 100644 --- a/cmake/Modules/Packages/USER-H5MD.cmake +++ b/cmake/Modules/Packages/USER-H5MD.cmake @@ -1,10 +1,5 @@ enable_language(C) -# silence warning about ignoring _ROOT and use it. -if(POLICY CMP0074) - cmake_policy(SET CMP0074 NEW) -endif() - find_package(HDF5 REQUIRED) target_link_libraries(h5md PRIVATE ${HDF5_LIBRARIES}) target_include_directories(h5md PUBLIC ${HDF5_INCLUDE_DIRS}) diff --git a/cmake/Modules/Packages/USER-NETCDF.cmake b/cmake/Modules/Packages/USER-NETCDF.cmake index 36c5a06385..d63e9773c3 100644 --- a/cmake/Modules/Packages/USER-NETCDF.cmake +++ b/cmake/Modules/Packages/USER-NETCDF.cmake @@ -1,11 +1,6 @@ # USER-NETCDF can use NetCDF, Parallel NetCDF (PNetCDF), or both. At least one necessary. # NetCDF library enables dump style "netcdf", while PNetCDF enables dump style "netcdf/mpiio" -# silence warning about ignoring _ROOT and use it. -if(POLICY CMP0074) - cmake_policy(SET CMP0074 NEW) -endif() - # may use NetCDF or PNetCDF with MPI, but must have NetCDF without if(NOT BUILD_MPI) find_package(NetCDF REQUIRED) From 5827f69da5048f24fac6a0b0243310a6a3e3bd93 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 19 May 2020 20:25:53 -0400 Subject: [PATCH 13/13] OpenMPI's "sm" transport layer has gone from some newer versions. use "tcp" as lowest common denominator --- tools/singularity/centos7.def | 2 +- tools/singularity/centos8.def | 2 +- tools/singularity/fedora32_mingw.def | 2 +- 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 | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/singularity/centos7.def b/tools/singularity/centos7.def index 0051f4cee2..7803f3f386 100644 --- a/tools/singularity/centos7.def +++ b/tools/singularity/centos7.def @@ -46,7 +46,7 @@ EOF . /etc/profile module load mpi # restrict OpenMPI to shared memory comm by default - OMPI_MCA_btl="sm,self" + OMPI_MCA_btl="tcp,self" # do not warn about unused components as this messes up testing OMPI_MCA_btl_base_warn_component_unused="0" export OMPI_MCA_btl OMPI_MCA_btl_base_warn_component_unused diff --git a/tools/singularity/centos8.def b/tools/singularity/centos8.def index 75162a17af..87b4aab0f2 100644 --- a/tools/singularity/centos8.def +++ b/tools/singularity/centos8.def @@ -51,7 +51,7 @@ EOF . /etc/profile module load mpi # restrict OpenMPI to shared memory comm by default - OMPI_MCA_btl="sm,self" + OMPI_MCA_btl="tcp,self" # do not warn about unused components as this messes up testing OMPI_MCA_btl_base_warn_component_unused="0" export OMPI_MCA_btl OMPI_MCA_btl_base_warn_component_unused diff --git a/tools/singularity/fedora32_mingw.def b/tools/singularity/fedora32_mingw.def index 5e6d987c92..7c6c463243 100644 --- a/tools/singularity/fedora32_mingw.def +++ b/tools/singularity/fedora32_mingw.def @@ -66,7 +66,7 @@ EOF . /etc/profile module load mpi # restrict OpenMPI to shared memory comm by default - OMPI_MCA_btl="sm,self" + OMPI_MCA_btl="tcp,self" # do not warn about unused components as this messes up testing OMPI_MCA_btl_base_warn_component_unused="0" export OMPI_MCA_btl OMPI_MCA_btl_base_warn_component_unused diff --git a/tools/singularity/ubuntu16.04.def b/tools/singularity/ubuntu16.04.def index 0152c8bf44..7f8e3a6b0d 100644 --- a/tools/singularity/ubuntu16.04.def +++ b/tools/singularity/ubuntu16.04.def @@ -29,7 +29,7 @@ EOF LC_ALL=C export LC_ALL # restrict OpenMPI to shared memory comm by default - OMPI_MCA_btl="sm,self" + OMPI_MCA_btl="tcp,self" # do not warn about unused components as this messes up testing OMPI_MCA_btl_base_warn_component_unused="0" export OMPI_MCA_btl OMPI_MCA_btl_base_warn_component_unused diff --git a/tools/singularity/ubuntu18.04.def b/tools/singularity/ubuntu18.04.def index 7713c650ca..48b64d815b 100644 --- a/tools/singularity/ubuntu18.04.def +++ b/tools/singularity/ubuntu18.04.def @@ -84,7 +84,7 @@ EOF export LC_ALL export PATH=/usr/lib/ccache:$PATH # restrict OpenMPI to shared memory comm by default - OMPI_MCA_btl="sm,self" + OMPI_MCA_btl="tcp,self" # do not warn about unused components as this messes up testing OMPI_MCA_btl_base_warn_component_unused="0" export OMPI_MCA_btl OMPI_MCA_btl_base_warn_component_unused diff --git a/tools/singularity/ubuntu18.04_amd_rocm.def b/tools/singularity/ubuntu18.04_amd_rocm.def index 4705739093..538d9ee772 100644 --- a/tools/singularity/ubuntu18.04_amd_rocm.def +++ b/tools/singularity/ubuntu18.04_amd_rocm.def @@ -90,7 +90,7 @@ EOF LC_ALL=C export LC_ALL # restrict OpenMPI to shared memory comm by default - OMPI_MCA_btl="sm,self" + OMPI_MCA_btl="tcp,self" # do not warn about unused components as this messes up testing OMPI_MCA_btl_base_warn_component_unused="0" export OMPI_MCA_btl OMPI_MCA_btl_base_warn_component_unused diff --git a/tools/singularity/ubuntu18.04_gpu.def b/tools/singularity/ubuntu18.04_gpu.def index e55a3522da..b06cb08b74 100644 --- a/tools/singularity/ubuntu18.04_gpu.def +++ b/tools/singularity/ubuntu18.04_gpu.def @@ -117,7 +117,7 @@ EOF LC_ALL=C export LC_ALL # restrict OpenMPI to shared memory comm by default - OMPI_MCA_btl="sm,self" + OMPI_MCA_btl="tcp,self" # do not warn about unused components as this messes up testing OMPI_MCA_btl_base_warn_component_unused="0" export OMPI_MCA_btl OMPI_MCA_btl_base_warn_component_unused diff --git a/tools/singularity/ubuntu18.04_intel_opencl.def b/tools/singularity/ubuntu18.04_intel_opencl.def index 20239c417e..39842764c4 100644 --- a/tools/singularity/ubuntu18.04_intel_opencl.def +++ b/tools/singularity/ubuntu18.04_intel_opencl.def @@ -83,7 +83,7 @@ EOF LC_ALL=C export LC_ALL # restrict OpenMPI to shared memory comm by default - OMPI_MCA_btl="sm,self" + OMPI_MCA_btl="tcp,self" # do not warn about unused components as this messes up testing OMPI_MCA_btl_base_warn_component_unused="0" export OMPI_MCA_btl OMPI_MCA_btl_base_warn_component_unused diff --git a/tools/singularity/ubuntu18.04_nvidia.def b/tools/singularity/ubuntu18.04_nvidia.def index c673f9cd30..02162954c3 100644 --- a/tools/singularity/ubuntu18.04_nvidia.def +++ b/tools/singularity/ubuntu18.04_nvidia.def @@ -82,7 +82,7 @@ EOF LC_ALL=C export LC_ALL # restrict OpenMPI to shared memory comm by default - OMPI_MCA_btl="sm,self" + OMPI_MCA_btl="tcp,self" # do not warn about unused components as this messes up testing OMPI_MCA_btl_base_warn_component_unused="0" export OMPI_MCA_btl OMPI_MCA_btl_base_warn_component_unused diff --git a/tools/singularity/ubuntu20.04.def b/tools/singularity/ubuntu20.04.def index 8074dddc8a..0922bc5e86 100644 --- a/tools/singularity/ubuntu20.04.def +++ b/tools/singularity/ubuntu20.04.def @@ -80,7 +80,7 @@ EOF LC_ALL=C export LC_ALL # restrict OpenMPI to shared memory comm by default - OMPI_MCA_btl="sm,self" + OMPI_MCA_btl="tcp,self" # do not warn about unused components as this messes up testing OMPI_MCA_btl_base_warn_component_unused="0" export OMPI_MCA_btl OMPI_MCA_btl_base_warn_component_unused