From ba817b6e8de64744b4178510244eb08b345ba124 Mon Sep 17 00:00:00 2001 From: Daniele Date: Sun, 14 May 2023 21:48:54 +0200 Subject: [PATCH 01/10] New warnings for METAD adn WALKERS_MPI (#931) * Test with and without MPI * WALKERS_MPI now throws without MPI initializated * test and error message now are more clear * clearer comments in the tests * added the last newline to the new files * PlumedHasMPI is now a function * camelCased plumedHasMPI * style aligned * moved files * created compiledtest type * compiled tests now support align with the other tests * Moved the new test in the basic directory * now the new test is completely aligned with the old ones * removed compiled test * updated the reference --------- Co-authored-by: Daniele Rapetti --- regtest/basic/rt-errormessages/Makefile | 1 + regtest/basic/rt-errormessages/config | 3 + .../basic/rt-errormessages/output.reference | 1 + .../rt-errormessages/testWALKERS_MPI.cpp | 77 +++++++++++++++++++ regtest/scripts/run | 2 + src/bias/MetaD.cpp | 6 ++ src/tools/Communicator.cpp | 8 ++ src/tools/Communicator.h | 3 + 8 files changed, 101 insertions(+) create mode 100644 regtest/basic/rt-errormessages/Makefile create mode 100644 regtest/basic/rt-errormessages/config create mode 100644 regtest/basic/rt-errormessages/output.reference create mode 100644 regtest/basic/rt-errormessages/testWALKERS_MPI.cpp diff --git a/regtest/basic/rt-errormessages/Makefile b/regtest/basic/rt-errormessages/Makefile new file mode 100644 index 0000000000..3703b27cea --- /dev/null +++ b/regtest/basic/rt-errormessages/Makefile @@ -0,0 +1 @@ +include ../../scripts/test.make diff --git a/regtest/basic/rt-errormessages/config b/regtest/basic/rt-errormessages/config new file mode 100644 index 0000000000..bd3d307e4a --- /dev/null +++ b/regtest/basic/rt-errormessages/config @@ -0,0 +1,3 @@ +type=make +# this is needed because we are explicitly checking some exception message +export PLUMED_STACK_TRACE=no diff --git a/regtest/basic/rt-errormessages/output.reference b/regtest/basic/rt-errormessages/output.reference new file mode 100644 index 0000000000..63481a5d3a --- /dev/null +++ b/regtest/basic/rt-errormessages/output.reference @@ -0,0 +1 @@ +METAD WALKER_MPI : Exception thrown, correct message diff --git a/regtest/basic/rt-errormessages/testWALKERS_MPI.cpp b/regtest/basic/rt-errormessages/testWALKERS_MPI.cpp new file mode 100644 index 0000000000..243ab79849 --- /dev/null +++ b/regtest/basic/rt-errormessages/testWALKERS_MPI.cpp @@ -0,0 +1,77 @@ +#include + +#include "plumed/wrapper/Plumed.h" +#include "plumed/tools/Communicator.h" + +constexpr unsigned nat=10; +//it is a struct because we don't need getter/setters (for now) +struct plumedThrowChecker{ + unsigned natoms=nat; + std::vector positions=[](unsigned natoms){ + std::vector toret(natoms*3,0.0); + for(unsigned i=0; i<3*natoms; i++) toret[i]=i; + return toret; + }(nat); + std::vector masses{nat,1.0}; + std::vector forces{3*nat,0.0}; + std::vector box{9,0.0}; + std::vector virial{9,0.0}; + ///This initializes a new plumed to test each throw in the cleanliest way possible + int checkThrow (std::ostream& out,std::string name, std::string cmd, std::string expectedMessage){ + //GIVEN an initialized Plumed interface + PLMD::Plumed plumed; + + plumed.cmd("setNatoms",&natoms); + int step=0; + plumed.cmd("setLogFile","test.log"); + plumed.cmd("init"); + plumed.cmd("setStep",&step); + plumed.cmd("setPositions",positions.data()); + plumed.cmd("setBox",box.data()); + plumed.cmd("setForces",forces.data()); + plumed.cmd("setVirial",virial.data()); + plumed.cmd("setMasses",masses.data()); + + plumed.cmd("readInputLine","d: DISTANCE ATOMS=1,2"); + plumed.cmd("readInputLine","d1: DISTANCE ATOMS={1 2}"); + ///TODO: expand with a "readInputLines" to give the possibility to test in more situations + try { + //WHEN the user ask for the given input + plumed.cmd("readInputLine",cmd.c_str()); + //THEN plumed should gracefully exit with a clear error message + } catch(PLMD::Plumed::ExceptionError &e) { //correct throw, we are happy + std::string exceptionText{e.what()}; + out << name << " : "; + if (exceptionText.find(expectedMessage) != std::string::npos) { + out << "Exception thrown, correct message\n"; + return 0; + } + + out << "Exception thrown, wrong message: " + << e.what() ; + out << "\tExpected message should contain: \"" + << expectedMessage << "\"\n"; + return 1; + } + out << "Exception not thrown\n"; + return 1; + } +}; + +int main(int, char**) { + std::ofstream out("output"); + plumedThrowChecker ptc; + //When the user aks for a WALKERS_MPI in the METAD action, + //if MPI is not installed then the user must be informed + //if MPI is installed then the comunications must be already set up + //WHEN PLUMED is not compiled with MPI or the MPI routines are not initialized + std::string expectedMessage="WALKERS_MPI flag requires MPI compilation"; + if (PLMD::Communicator::plumedHasMPI()) { + expectedMessage="WALKERS_MPI needs the communicator correctly initialized"; + } + ptc.checkThrow(out,"METAD WALKER_MPI", + "METAD ARG=d,d1 SIGMA=0.1,0.2 HEIGHT=0.1 PACE=2 RESTART=YES WALKERS_MPI", + expectedMessage); + + //add other throw messages checks +} diff --git a/regtest/scripts/run b/regtest/scripts/run index 4d3915fef4..eb1b1bdd82 100755 --- a/regtest/scripts/run +++ b/regtest/scripts/run @@ -172,8 +172,10 @@ fi if $plumed --is-installed ; then export PLUMED_KERNEL="$root/../lib${PLUMED_PROGRAM_NAME:-plumed}Kernel.$($plumed info --soext)" + export PLUMED_LIB="$root/../lib${PLUMED_PROGRAM_NAME:-plumed}.$($plumed info --soext)" else export PLUMED_KERNEL="$root/src/lib/libplumedKernel.$($plumed info --soext)" + export PLUMED_LIB="$root/src/lib/libplumed.$($plumed info --soext)" fi if type -t plumed_regtest_before 1>/dev/null ; then plumed_regtest_before diff --git a/src/bias/MetaD.cpp b/src/bias/MetaD.cpp index 5bee48ac35..0f1e75533e 100644 --- a/src/bias/MetaD.cpp +++ b/src/bias/MetaD.cpp @@ -878,6 +878,12 @@ MetaD::MetaD(const ActionOptions& ao): // MPI version parseFlag("WALKERS_MPI",walkers_mpi_); + //If this Action is not compiled with MPI the user is informed and we exit gracefully + if(walkers_mpi_) { + plumed_assert(Communicator::plumedHasMPI()) << "Invalid walkers configuration: WALKERS_MPI flag requires MPI compilation"; + plumed_assert(Communicator::initialized()) << "Invalid walkers configuration: WALKERS_MPI needs the communicator correctly initialized."; + } + // Flying Gaussian parseFlag("FLYING_GAUSSIAN", flying_); diff --git a/src/tools/Communicator.cpp b/src/tools/Communicator.cpp index 025ebfbdf3..b1432938d3 100644 --- a/src/tools/Communicator.cpp +++ b/src/tools/Communicator.cpp @@ -28,6 +28,14 @@ namespace PLMD { +bool Communicator::plumedHasMPI() { +#ifdef __PLUMED_HAS_MPI + return true; +#else + return false; +#endif +} + Communicator::Communicator() #ifdef __PLUMED_HAS_MPI : communicator(MPI_COMM_SELF) diff --git a/src/tools/Communicator.h b/src/tools/Communicator.h index 464fbcae2a..aff4771852 100644 --- a/src/tools/Communicator.h +++ b/src/tools/Communicator.h @@ -121,6 +121,9 @@ class Communicator { } }; public: + ///Runtime acces to the __PLUMED_HAS_MPI definition + static bool plumedHasMPI(); + /// Wrapper class for MPI_Status class Status { int Get_count(MPI_Datatype)const; From 22c2a3d48fc282e9afebd21ca633807b6037a458 Mon Sep 17 00:00:00 2001 From: Daniele Date: Sun, 14 May 2023 21:48:54 +0200 Subject: [PATCH 02/10] New warnings for METAD adn WALKERS_MPI (#931) * Test with and without MPI * WALKERS_MPI now throws without MPI initializated * test and error message now are more clear * clearer comments in the tests * added the last newline to the new files * PlumedHasMPI is now a function * camelCased plumedHasMPI * style aligned * moved files * created compiledtest type * compiled tests now support align with the other tests * Moved the new test in the basic directory * now the new test is completely aligned with the old ones * removed compiled test * updated the reference --------- Co-authored-by: Daniele Rapetti --- regtest/basic/rt-errormessages/Makefile | 1 + regtest/basic/rt-errormessages/config | 3 + .../basic/rt-errormessages/output.reference | 1 + .../rt-errormessages/testWALKERS_MPI.cpp | 77 +++++++++++++++++++ regtest/scripts/run | 2 + src/bias/MetaD.cpp | 6 ++ src/tools/Communicator.cpp | 8 ++ src/tools/Communicator.h | 3 + 8 files changed, 101 insertions(+) create mode 100644 regtest/basic/rt-errormessages/Makefile create mode 100644 regtest/basic/rt-errormessages/config create mode 100644 regtest/basic/rt-errormessages/output.reference create mode 100644 regtest/basic/rt-errormessages/testWALKERS_MPI.cpp diff --git a/regtest/basic/rt-errormessages/Makefile b/regtest/basic/rt-errormessages/Makefile new file mode 100644 index 0000000000..3703b27cea --- /dev/null +++ b/regtest/basic/rt-errormessages/Makefile @@ -0,0 +1 @@ +include ../../scripts/test.make diff --git a/regtest/basic/rt-errormessages/config b/regtest/basic/rt-errormessages/config new file mode 100644 index 0000000000..bd3d307e4a --- /dev/null +++ b/regtest/basic/rt-errormessages/config @@ -0,0 +1,3 @@ +type=make +# this is needed because we are explicitly checking some exception message +export PLUMED_STACK_TRACE=no diff --git a/regtest/basic/rt-errormessages/output.reference b/regtest/basic/rt-errormessages/output.reference new file mode 100644 index 0000000000..63481a5d3a --- /dev/null +++ b/regtest/basic/rt-errormessages/output.reference @@ -0,0 +1 @@ +METAD WALKER_MPI : Exception thrown, correct message diff --git a/regtest/basic/rt-errormessages/testWALKERS_MPI.cpp b/regtest/basic/rt-errormessages/testWALKERS_MPI.cpp new file mode 100644 index 0000000000..243ab79849 --- /dev/null +++ b/regtest/basic/rt-errormessages/testWALKERS_MPI.cpp @@ -0,0 +1,77 @@ +#include + +#include "plumed/wrapper/Plumed.h" +#include "plumed/tools/Communicator.h" + +constexpr unsigned nat=10; +//it is a struct because we don't need getter/setters (for now) +struct plumedThrowChecker{ + unsigned natoms=nat; + std::vector positions=[](unsigned natoms){ + std::vector toret(natoms*3,0.0); + for(unsigned i=0; i<3*natoms; i++) toret[i]=i; + return toret; + }(nat); + std::vector masses{nat,1.0}; + std::vector forces{3*nat,0.0}; + std::vector box{9,0.0}; + std::vector virial{9,0.0}; + ///This initializes a new plumed to test each throw in the cleanliest way possible + int checkThrow (std::ostream& out,std::string name, std::string cmd, std::string expectedMessage){ + //GIVEN an initialized Plumed interface + PLMD::Plumed plumed; + + plumed.cmd("setNatoms",&natoms); + int step=0; + plumed.cmd("setLogFile","test.log"); + plumed.cmd("init"); + plumed.cmd("setStep",&step); + plumed.cmd("setPositions",positions.data()); + plumed.cmd("setBox",box.data()); + plumed.cmd("setForces",forces.data()); + plumed.cmd("setVirial",virial.data()); + plumed.cmd("setMasses",masses.data()); + + plumed.cmd("readInputLine","d: DISTANCE ATOMS=1,2"); + plumed.cmd("readInputLine","d1: DISTANCE ATOMS={1 2}"); + ///TODO: expand with a "readInputLines" to give the possibility to test in more situations + try { + //WHEN the user ask for the given input + plumed.cmd("readInputLine",cmd.c_str()); + //THEN plumed should gracefully exit with a clear error message + } catch(PLMD::Plumed::ExceptionError &e) { //correct throw, we are happy + std::string exceptionText{e.what()}; + out << name << " : "; + if (exceptionText.find(expectedMessage) != std::string::npos) { + out << "Exception thrown, correct message\n"; + return 0; + } + + out << "Exception thrown, wrong message: " + << e.what() ; + out << "\tExpected message should contain: \"" + << expectedMessage << "\"\n"; + return 1; + } + out << "Exception not thrown\n"; + return 1; + } +}; + +int main(int, char**) { + std::ofstream out("output"); + plumedThrowChecker ptc; + //When the user aks for a WALKERS_MPI in the METAD action, + //if MPI is not installed then the user must be informed + //if MPI is installed then the comunications must be already set up + //WHEN PLUMED is not compiled with MPI or the MPI routines are not initialized + std::string expectedMessage="WALKERS_MPI flag requires MPI compilation"; + if (PLMD::Communicator::plumedHasMPI()) { + expectedMessage="WALKERS_MPI needs the communicator correctly initialized"; + } + ptc.checkThrow(out,"METAD WALKER_MPI", + "METAD ARG=d,d1 SIGMA=0.1,0.2 HEIGHT=0.1 PACE=2 RESTART=YES WALKERS_MPI", + expectedMessage); + + //add other throw messages checks +} diff --git a/regtest/scripts/run b/regtest/scripts/run index 4d3915fef4..eb1b1bdd82 100755 --- a/regtest/scripts/run +++ b/regtest/scripts/run @@ -172,8 +172,10 @@ fi if $plumed --is-installed ; then export PLUMED_KERNEL="$root/../lib${PLUMED_PROGRAM_NAME:-plumed}Kernel.$($plumed info --soext)" + export PLUMED_LIB="$root/../lib${PLUMED_PROGRAM_NAME:-plumed}.$($plumed info --soext)" else export PLUMED_KERNEL="$root/src/lib/libplumedKernel.$($plumed info --soext)" + export PLUMED_LIB="$root/src/lib/libplumed.$($plumed info --soext)" fi if type -t plumed_regtest_before 1>/dev/null ; then plumed_regtest_before diff --git a/src/bias/MetaD.cpp b/src/bias/MetaD.cpp index 5bee48ac35..0f1e75533e 100644 --- a/src/bias/MetaD.cpp +++ b/src/bias/MetaD.cpp @@ -878,6 +878,12 @@ MetaD::MetaD(const ActionOptions& ao): // MPI version parseFlag("WALKERS_MPI",walkers_mpi_); + //If this Action is not compiled with MPI the user is informed and we exit gracefully + if(walkers_mpi_) { + plumed_assert(Communicator::plumedHasMPI()) << "Invalid walkers configuration: WALKERS_MPI flag requires MPI compilation"; + plumed_assert(Communicator::initialized()) << "Invalid walkers configuration: WALKERS_MPI needs the communicator correctly initialized."; + } + // Flying Gaussian parseFlag("FLYING_GAUSSIAN", flying_); diff --git a/src/tools/Communicator.cpp b/src/tools/Communicator.cpp index 025ebfbdf3..b1432938d3 100644 --- a/src/tools/Communicator.cpp +++ b/src/tools/Communicator.cpp @@ -28,6 +28,14 @@ namespace PLMD { +bool Communicator::plumedHasMPI() { +#ifdef __PLUMED_HAS_MPI + return true; +#else + return false; +#endif +} + Communicator::Communicator() #ifdef __PLUMED_HAS_MPI : communicator(MPI_COMM_SELF) diff --git a/src/tools/Communicator.h b/src/tools/Communicator.h index 464fbcae2a..aff4771852 100644 --- a/src/tools/Communicator.h +++ b/src/tools/Communicator.h @@ -121,6 +121,9 @@ class Communicator { } }; public: + ///Runtime acces to the __PLUMED_HAS_MPI definition + static bool plumedHasMPI(); + /// Wrapper class for MPI_Status class Status { int Get_count(MPI_Datatype)const; From 1f3dba83e1dc39c58eef1a180df6a16a5dc89d96 Mon Sep 17 00:00:00 2001 From: Michele Invernizzi Date: Tue, 16 May 2023 21:24:17 +0200 Subject: [PATCH 03/10] V2.9 - add to OPES same MPI-related error messages of METAD (#940) * better doc * METAD-like MPI error --- src/opes/ECVmultiThermalBaric.cpp | 2 +- src/opes/OPESexpanded.cpp | 4 ++++ src/opes/OPESmetad.cpp | 10 +++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/opes/ECVmultiThermalBaric.cpp b/src/opes/ECVmultiThermalBaric.cpp index 17b3d07e31..056991a749 100644 --- a/src/opes/ECVmultiThermalBaric.cpp +++ b/src/opes/ECVmultiThermalBaric.cpp @@ -327,7 +327,7 @@ ECVmultiThermalBaric::ECVmultiThermalBaric(const ActionOptions&ao) log.printf(" and a pressure range from PRESSURE_MIN=%g to PRESSURE_MAX=%g\n",pres_min,pres_max); if(pres_min==pres_max) log.printf(" +++ WARNING +++ if you only need a multithermal simulation it is more efficient to set it up with ECV_MULTITHERMAL\n"); - if(geom_spacing_) + if(!geom_spacing_) log.printf(" -- NO_GEOM_SPACING: inverse temperatures will be linearly spaced\n"); if(coeff_!=0) log.printf(" -- CUT_CORNER: ignoring some high temperature and low pressure values\n"); diff --git a/src/opes/OPESexpanded.cpp b/src/opes/OPESexpanded.cpp index 53ccd8b4f9..f00e1d82f2 100644 --- a/src/opes/OPESexpanded.cpp +++ b/src/opes/OPESexpanded.cpp @@ -251,6 +251,10 @@ OPESexpanded::OPESexpanded(const ActionOptions&ao) parseFlag("WALKERS_MPI",walkers_mpi); if(walkers_mpi) { + //If this Action is not compiled with MPI the user is informed and we exit gracefully + plumed_massert(Communicator::plumedHasMPI(),"Invalid walkers configuration: WALKERS_MPI flag requires MPI compilation"); + plumed_massert(Communicator::initialized(),"Invalid walkers configuration: WALKERS_MPI needs the communicator correctly initialized."); + if(comm.Get_rank()==0) //multi_sim_comm works on first rank only { NumWalkers_=multi_sim_comm.Get_size(); diff --git a/src/opes/OPESmetad.cpp b/src/opes/OPESmetad.cpp index 570642fe0b..d74db94dcf 100644 --- a/src/opes/OPESmetad.cpp +++ b/src/opes/OPESmetad.cpp @@ -306,7 +306,11 @@ void OPESmetad::registerKeywords(Keywords& keys) keys.use("ARG"); keys.add("compulsory","TEMP","-1","temperature. If not set, it is taken from MD engine, but not all MD codes provide it"); keys.add("compulsory","PACE","the frequency for kernel deposition"); - keys.add("compulsory","SIGMA","ADAPTIVE","the initial widths of the kernels. If not set, adaptive sigma will be used with the given ADAPTIVE_SIGMA_STRIDE"); + std::string info_sigma("the initial widths of the kernels"); + if(mode::explore) + info_sigma+=", divided by \\f$\\sqrt{\\gamma}\\f$"; + info_sigma+=". If not set, an adaptive sigma will be used with the given ADAPTIVE_SIGMA_STRIDE"; + keys.add("compulsory","SIGMA","ADAPTIVE",info_sigma); keys.add("compulsory","BARRIER","the free energy barrier to be overcome. It is used to set BIASFACTOR, EPSILON, and KERNEL_CUTOFF to reasonable values"); keys.add("compulsory","COMPRESSION_THRESHOLD","1","merge kernels if closer than this threshold, in units of sigma"); //extra options @@ -554,6 +558,10 @@ OPESmetad::OPESmetad(const ActionOptions& ao) parseFlag("WALKERS_MPI",walkers_mpi); if(walkers_mpi) { + //If this Action is not compiled with MPI the user is informed and we exit gracefully + plumed_massert(Communicator::plumedHasMPI(),"Invalid walkers configuration: WALKERS_MPI flag requires MPI compilation"); + plumed_massert(Communicator::initialized(),"Invalid walkers configuration: WALKERS_MPI needs the communicator correctly initialized."); + if(comm.Get_rank()==0)//multi_sim_comm works on first rank only { NumWalkers_=multi_sim_comm.Get_size(); From 832a033738b96a06564ff8b5c9d05c6157e4313f Mon Sep 17 00:00:00 2001 From: Giovanni Bussi Date: Sun, 21 May 2023 19:02:20 +0200 Subject: [PATCH 04/10] Added GPUMD Reported by Zheyong Fan --- user-doc/Introduction.md | 1 + 1 file changed, 1 insertion(+) diff --git a/user-doc/Introduction.md b/user-doc/Introduction.md index be7498a8d3..93ee3b14e8 100644 --- a/user-doc/Introduction.md +++ b/user-doc/Introduction.md @@ -45,6 +45,7 @@ As far as we know, the following MD codes can be used with PLUMED out of the box - [DFTB+](https://www.dftbplus.org/), since release 20.1. - [Metalwalls](https://gitlab.com/ampere2/metalwalls) - [ASE](https://wiki.fysik.dtu.dk/ase/) +- [GPUMD](https://gpumd.org/) Please refer to the documentation of the MD code to know how to use it with the latest PLUMED release. If you maintain another MD code that is PLUMED-ready let us know and we will add it to this list. From 2d75ea171b00bcd9ff9ef149e50873122cddd0a9 Mon Sep 17 00:00:00 2001 From: Giovanni Date: Mon, 22 May 2023 12:15:28 +0200 Subject: [PATCH 05/10] It looks like this test does not really use MPI (#942) --- regtest/multicolvar/rt-link/config | 1 - regtest/multicolvar/rt-link/main.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/regtest/multicolvar/rt-link/config b/regtest/multicolvar/rt-link/config index abdecb652a..df1f95bf3e 100644 --- a/regtest/multicolvar/rt-link/config +++ b/regtest/multicolvar/rt-link/config @@ -1,2 +1 @@ -mpiprocs=2 type=make diff --git a/regtest/multicolvar/rt-link/main.cpp b/regtest/multicolvar/rt-link/main.cpp index 15702c0f00..5e3a505eac 100644 --- a/regtest/multicolvar/rt-link/main.cpp +++ b/regtest/multicolvar/rt-link/main.cpp @@ -1,4 +1,3 @@ -#include "mpi.h" #include "plumed/tools/Communicator.h" #include "plumed/tools/Tools.h" #include "plumed/tools/Vector.h" From 92609aee6ed13880e095196987866dbf96a2bbcf Mon Sep 17 00:00:00 2001 From: Giovanni Bussi Date: Mon, 22 May 2023 12:28:48 +0200 Subject: [PATCH 06/10] Removed useless command I think this remained from previous versions. --- regtest/scripts/run | 1 - 1 file changed, 1 deletion(-) diff --git a/regtest/scripts/run b/regtest/scripts/run index 4d3915fef4..60bd0b91cb 100755 --- a/regtest/scripts/run +++ b/regtest/scripts/run @@ -194,7 +194,6 @@ case "$type" in $mpi $valgrind $plumed sum_hills $arg > out 2> err ;; (make) - $plumed info --configuration > Makefile.conf $plumed --is-installed || ln -s "$root/src" plumed if test "$plumed_language" = fortran || test "$plumed_language" = fortran08 || test "$plumed_language" = c ; then cat <($plumed info --configuration) "$root/src/lib/Plumed.inc.shared" ../../../scripts/exe.make > Makefile From 95cc6ebff9b668138dd352bb08e4b8959173ce8c Mon Sep 17 00:00:00 2001 From: Giovanni Bussi Date: Mon, 22 May 2023 14:09:13 +0200 Subject: [PATCH 07/10] Made plumed calls in regtests more robust The executable called to inspect the configuration should always be called with the --no-mpi option. This solves the rockylinux problems reported here: https://github.com/plumed/plumed2/pull/933#issuecomment-1556302511 --- regtest/scripts/run | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/regtest/scripts/run b/regtest/scripts/run index 60bd0b91cb..375438458d 100755 --- a/regtest/scripts/run +++ b/regtest/scripts/run @@ -58,9 +58,14 @@ echo "++ Arguments: $arg" echo "++ Processors: $mpiprocs" mpi=env + +# this is the executable used for running the tests: plumed="${PLUMED_PROGRAM_NAME:-plumed}" -root=$($plumed --no-mpi info --root) +# this is the executable used for getting the configuration: +plumed_nompi="$plumed --no-mpi" + +root=$($plumed_nompi info --root) if test -z "$root" ; then echo "FAILURE: plumed executable not available" @@ -76,16 +81,16 @@ cd - if ((mpiprocs>0)); then mpi="" -if $plumed --no-mpi config -q mpiexec +if $plumed_nompi config -q mpiexec then - mpi="$($plumed --no-mpi config mpiexec)" + mpi="$($plumed_nompi config mpiexec)" fi if test -z "$mpi" ; then mpi="${PLUMED_MPIRUN:-mpirun}" fi mpi="$mpi -np $mpiprocs" -if ! $plumed config -q has mpi +if ! $plumed_nompi config -q has mpi then if [ "$TRAVIS" = true ] || [ "$GITHUB_ACTIONS" = true ] ; then if [ -z "$PLUMED_ALLOW_SKIP_ON_TRAVIS" ] ; then @@ -122,7 +127,7 @@ fi for need in $plumed_needs do echo "Checking for $need" - if ! $plumed config -q has $need + if ! $plumed_nompi config -q has $need then if [ "$TRAVIS" = true ] || [ "$GITHUB_ACTIONS" = true ] ; then if [ -z "$PLUMED_ALLOW_SKIP_ON_TRAVIS" ] ; then @@ -140,7 +145,7 @@ done for module in $plumed_modules do echo "Checking for $module" - if ! $plumed config -q module $module + if ! $plumed_nompi config -q module $module then if [ "$TRAVIS" = true ] || [ "$GITHUB_ACTIONS" = true ] ; then if [ -z "$PLUMED_ALLOW_SKIP_ON_TRAVIS" ] ; then @@ -170,10 +175,10 @@ if type -t plumed_custom_skip 1>/dev/null ; then fi fi -if $plumed --is-installed ; then - export PLUMED_KERNEL="$root/../lib${PLUMED_PROGRAM_NAME:-plumed}Kernel.$($plumed info --soext)" +if $plumed_nompi --is-installed ; then + export PLUMED_KERNEL="$root/../lib${PLUMED_PROGRAM_NAME:-plumed}Kernel.$($plumed_nompi info --soext)" else - export PLUMED_KERNEL="$root/src/lib/libplumedKernel.$($plumed info --soext)" + export PLUMED_KERNEL="$root/src/lib/libplumedKernel.$($plumed_nompi info --soext)" fi if type -t plumed_regtest_before 1>/dev/null ; then plumed_regtest_before @@ -194,11 +199,11 @@ case "$type" in $mpi $valgrind $plumed sum_hills $arg > out 2> err ;; (make) - $plumed --is-installed || ln -s "$root/src" plumed + $plumed_nompi --is-installed || ln -s "$root/src" plumed if test "$plumed_language" = fortran || test "$plumed_language" = fortran08 || test "$plumed_language" = c ; then - cat <($plumed info --configuration) "$root/src/lib/Plumed.inc.shared" ../../../scripts/exe.make > Makefile + cat <($plumed_nompi info --configuration) "$root/src/lib/Plumed.inc.shared" ../../../scripts/exe.make > Makefile else - cat <($plumed info --configuration) "$root/src/lib/Plumed.inc.static" ../../../scripts/exe.make > Makefile + cat <($plumed_nompi info --configuration) "$root/src/lib/Plumed.inc.static" ../../../scripts/exe.make > Makefile fi if test "$plumed_language" = fortran || test "$plumed_language" = fortran08 ; then if make print-fortran | grep "FC=$" 1>/dev/null ; then @@ -270,7 +275,7 @@ EOF ;; (python) # make sure the right python module is in the path based on plumed root - PYTHONPATH="$root/python:$PYTHONPATH" $($plumed config python_bin) $arg > out 2> err + PYTHONPATH="$root/python:$PYTHONPATH" $($plumed_nompi config python_bin) $arg > out 2> err ;; (*) echo "FAILURE: unknown test type" ; exit 1 ;; esac From 9018d9707f51bcfaebf1316bd770c363bde1810f Mon Sep 17 00:00:00 2001 From: Giovanni Bussi Date: Mon, 22 May 2023 14:59:51 +0200 Subject: [PATCH 08/10] Using better env var for openMPI Basically taken from here: https://github.com/conda-forge/plumed-feedstock/blob/0d057822a501fcc6490bd1b7e85e6ae48c363594/recipe/meta.yaml#L58-L60 --- .github/workflows/ci.yml | 4 +++- docker/centos7 | 4 ++++ docker/fedora34 | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ad8724f6f..eb9fe9370b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,7 +120,9 @@ jobs: echo "CXX=mpic++" >> $GITHUB_ENV echo "OMPI_MCA_btl_base_warn_component_unused=0" >> $GITHUB_ENV echo "OMPI_MCA_btl_base_verbose=0" >> $GITHUB_ENV - echo "MPIEXEC=mpirun --oversubscribe" >> $GITHUB_ENV + echo "OMPI_MCA_plm=isolated" >> $GITHUB_ENV + echo "OMPI_MCA_btl_vader_single_copy_mechanism=none" >> $GITHUB_ENV + echo "OMPI_MCA_rmaps_base_oversubscribe=yes" >> $GITHUB_ENV pip install --user mpi4py python -c "import mpi4py" - name: Build PLUMED diff --git a/docker/centos7 b/docker/centos7 index 898d991a90..c197a5aacb 100644 --- a/docker/centos7 +++ b/docker/centos7 @@ -24,6 +24,10 @@ COPY plumed2.tgz /home/plumed RUN . /etc/bashrc \ && module load mpi \ && export OMPI_MCA_btl_base_warn_component_unused=0 \ + && export OMPI_MCA_btl_base_verbose=0 \ + && export OMPI_MCA_plm=isolated \ + && export OMPI_MCA_btl_vader_single_copy_mechanism=none \ + && export OMPI_MCA_rmaps_base_oversubscribe=yes \ && export PATH=$HOME/opt/bin:$PATH \ && export CPATH=$HOME/opt/include:$CPATH \ && export INCLUDE=$HOME/opt/include:$INCLUDE \ diff --git a/docker/fedora34 b/docker/fedora34 index 67da7def97..b5acba1286 100644 --- a/docker/fedora34 +++ b/docker/fedora34 @@ -24,7 +24,10 @@ COPY plumed2.tgz /home/plumed RUN . /etc/bashrc \ && module load mpi \ && export OMPI_MCA_btl_base_warn_component_unused=0 \ - && export MPIEXEC="mpirun --oversubscribe" \ + && export OMPI_MCA_btl_base_verbose=0 \ + && export OMPI_MCA_plm=isolated \ + && export OMPI_MCA_btl_vader_single_copy_mechanism=none \ + && export OMPI_MCA_rmaps_base_oversubscribe=yes \ && export PATH=$HOME/opt/bin:$PATH \ && export CPATH=$HOME/opt/include:$CPATH \ && export INCLUDE=$HOME/opt/include:$INCLUDE \ From 5db452a72e2322b90bdcc3c23ce6babbbc5a923a Mon Sep 17 00:00:00 2001 From: Giovanni Bussi Date: Mon, 24 Apr 2023 12:10:29 +0200 Subject: [PATCH 09/10] fedora38 (gcc 13) Fix 95cc6ebff9b668138dd352bb08e4b8959173ce8c / 6ac01e2c6d15e398156407e0a6cc8f48055eb25b also allows me to include this update that was still blocked. --- .github/workflows/ci.yml | 6 +++--- docker/Makefile | 6 +++--- docker/{fedora37 => fedora38} | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) rename docker/{fedora37 => fedora38} (99%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0110a3528..e6eb81371d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -217,14 +217,14 @@ jobs: run: | make -C docker centos7 - # We test on fedora37 to make sure we have compatibility with newer compilers (gcc 12) - fedora37: + # We test on fedora38 to make sure we have compatibility with newer compilers (gcc 13) + fedora38: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 - name: Build and run tests run: | - make -C docker fedora37 + make -C docker fedora38 # We test on rockylinux8 as well rocky8: diff --git a/docker/Makefile b/docker/Makefile index 9251bb7a8a..96af12d47e 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -1,5 +1,5 @@ -.PHONY: ubuntu plumed2.tgz clean centos7 fedora37 rocky8 +.PHONY: ubuntu plumed2.tgz clean centos7 fedora38 rocky8 ubuntu: plumed2.tgz docker build -t plumed . @@ -7,8 +7,8 @@ ubuntu: plumed2.tgz centos7: plumed2.tgz docker build -t plumed -f centos7 . -fedora37: plumed2.tgz - docker build -t plumed -f fedora37 . +fedora38: plumed2.tgz + docker build -t plumed -f fedora38 . rocky8: plumed2.tgz docker build -t plumed -f rocky8 . diff --git a/docker/fedora37 b/docker/fedora38 similarity index 99% rename from docker/fedora37 rename to docker/fedora38 index c779569ea0..9b59b82285 100644 --- a/docker/fedora37 +++ b/docker/fedora38 @@ -1,4 +1,4 @@ -FROM fedora:37 +FROM fedora:38 # note: at variance with centos7, here we have to explicitly install gcc # mdtraj 1.9.7 does not compile with python 3.11 unless installed from source From f99433e181f5b19289e0e8ff6bbdf86b96c05f90 Mon Sep 17 00:00:00 2001 From: Giovanni Bussi Date: Mon, 22 May 2023 15:17:28 +0200 Subject: [PATCH 10/10] simplified docker jobs using matrix --- .github/workflows/ci.yml | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6eb81371d..0dbbc43a2e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -208,32 +208,23 @@ jobs: make -C src/lib/ dirslinks make codecheck - # We test on centos7 to make sure we have compatibility with older compilers (gcc 4.8) - centos7: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - name: Build and run tests - run: | - make -C docker centos7 - - # We test on fedora38 to make sure we have compatibility with newer compilers (gcc 13) - fedora38: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - name: Build and run tests - run: | - make -C docker fedora38 - - # We test on rockylinux8 as well - rocky8: - runs-on: ubuntu-20.04 + docker: + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + # centos7 (gcc 4.8) + # fedora38 (gcc 13) + # rockylinux8 + variant: + - centos7 + - fedora38 + - rocky8 steps: - uses: actions/checkout@v3 - name: Build and run tests run: | - make -C docker rocky8 + make -C docker ${{ matrix.variant }} macports: runs-on: macos-11