diff --git a/CHANGES/v2.4.md b/CHANGES/v2.4.md index dc72c16919462ae05cd9ecb45e61c8d90880d491..bd96c721fdfaadff1d3fd572e4071018fa9afdc1 100644 --- a/CHANGES/v2.4.md +++ b/CHANGES/v2.4.md @@ -151,3 +151,9 @@ Fixes after beta release: - Fixed a bug in EDS module for restarts, where accumulated rate was not stored to restart file, leading to convergence problems. - (developers) `plumed config makefile_conf` can be used to retrieve `Makefile.conf` file a posteriori. - Added patch for Quantum ESPRESSO 6.2 (thanks to Ralf Meyer). + - (developers) Store `MPIEXEC` variable at configure time and use it later for running regtests. Notice that in case + `MPIEXEC` is not specified regtests will be run using the command stored in env var `PLUMED_MPIRUN` or, if this is + also not defined, using `mpirun`. + - (developers) Added canonical makefile targets `check` and `installcheck`. Notice that `check` runs checks with + non-installed plumed whereas `installcheck` uses the installed one, including its correct program name if it + was personalized (e.g. with suffixes). Notice that this modifies the previously available `check` target. diff --git a/Makefile b/Makefile index 7be10652df3890c81a10f56ed13952a9d775d74e..c367b7be5f073c0a1e8cccc986eaca0df8daabf1 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ SUBDIRS := $(SRCDIRS) user-doc developer-doc regtest macports vim astyle SUBDIRSCLEAN:=$(addsuffix .clean,$(SUBDIRS)) -.PHONY: all lib clean $(SRCDIRS) doc docclean check cppcheck distclean all_plus_docs macports codecheck plumedcheck astyle +.PHONY: all lib clean $(SRCDIRS) doc docclean check installcheck cppcheck distclean all_plus_docs macports codecheck plumedcheck astyle # if machine dependent configuration has been found: ifdef GCCDEP @@ -59,8 +59,15 @@ docs: $(MAKE) doc # regtests -check: src test - $(MAKE) -C regtest +# perform tests using non-installed plumed +check: + PLUMED_PREPEND_PATH="$(realpath .)/src/lib" $(MAKE) -C regtest + $(MAKE) -C regtest checkfail + +# perform tests using the installed version of plumed +installcheck: + PLUMED_PREPEND_PATH="$(bindir)" PLUMED_PROGRAM_NAME="$(program_name)" $(MAKE) -C regtest + $(MAKE) -C regtest checkfail else diff --git a/Makefile.conf.in b/Makefile.conf.in index 1ac40a4ca5e09e80914d39d3eb7be3ca1444df10..b196254e7870be239f794da06c017886f7a44f22 100644 --- a/Makefile.conf.in +++ b/Makefile.conf.in @@ -32,3 +32,4 @@ datarootdir=@datarootdir@ datadir=@datadir@ docdir=@docdir@ htmldir=@htmldir@ +mpiexec=@MPIEXEC@ diff --git a/README.md b/README.md index f65cb3c628b6f046e6cfe893e1647a8a47655714..a360b04fc2865f9b52e0ea15a0fff6decccacd5b 100644 --- a/README.md +++ b/README.md @@ -97,37 +97,30 @@ Quick compilation instructions ------------------------------ Extensive installation instructions are in the [user documentation](http://www.plumed.org/documentation). -Configure for your system +Quick instructions: ./configure --prefix=$HOME/opt - - -If necessary, edit `Makefile.conf`. -Configure your environment - - source ./sourceme.sh - -Compile plumed - make - -The `plumed` executable should be now in your execution path - - plumed help - -Compile the manuals. - - make doc + make doc # optional User documentation can be found at `user-doc/html/index.html`. Developer documentation can be found at `developer-doc/html/index.html`. [Pre-compiled documentation](http://www.plumed.org/documentation) is available online, so this is only required if you are working with a modified version of the code! -Install PLUMED in `$HOME/opt` (directory should be set during `./configure`): +In order to run PLUMED without installing it you should type `source sourceme.sh`. However, +we recomment installing PLUMED. +To install it in `$HOME/opt` (directory should be set during `./configure`): umask 022 make install +Now you will be able to run plumed using e.g. + + plumed help + +If you compiled your own documentation, paths to the installed documentation can be found with command `plumed info --user-doc`. + A sample modulefile with environment variable will be placed in -`$HOME/opt/lib/plumed/src/lib/modulefile`. If you compiled your own documentation, paths to the installed documentation can be found with command `plumed info --user-doc`. +`$HOME/opt/lib/plumed/src/lib/modulefile`. This can be useful if you want to +install multiple PLUMED versions side by side and select them with env modules. diff --git a/configure b/configure index abfc5c163c84546ace3a0ca095556549ec91b46f..0bfb79df8e1687327327be57b3009c2f2d4cc3b9 100755 --- a/configure +++ b/configure @@ -651,6 +651,7 @@ CPPFLAGS LDFLAGS CXXFLAGS CXX +MPIEXEC LDSHARED STATIC_LIBS SOEXT @@ -735,6 +736,7 @@ target_alias SOEXT STATIC_LIBS LDSHARED +MPIEXEC CXX CXXFLAGS LDFLAGS @@ -1409,6 +1411,9 @@ Some influential environment variables: configure will add here -ldl if necessary LDSHARED command for linking shared library - configure will use CXX plus the proper flags + MPIEXEC command to run mpi programs in tests - default not specified, + which means use PLUMED_MPIRUN env var at runtime for backward + compatibility CXX C++ compiler command CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a @@ -3009,6 +3014,7 @@ fi + # by default use -O flag # we override the autoconf default (-g) because in release build we do not want to # include symbol information (obj files are huge) @@ -8365,6 +8371,8 @@ $as_echo "#define _REENTRANT 1" >>confdefs.h # these are libraries that should be linked also to MD engines + + if test "$shared" == true ; then case `(uname)` in (Darwin) @@ -8755,6 +8763,16 @@ fi fi +if test $mpi_found == ok ; then + if test -n "$MPIEXEC" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Regtest suite will use $MPIEXEC command to run MPI tests" >&5 +$as_echo "$as_me: Regtest suite will use $MPIEXEC command to run MPI tests" >&6;} + else + { $as_echo "$as_me:${as_lineno-$LINENO}: Regtest suite will use env var PLUMED_MPIRUN to run MPI tests (default: mpirun)" >&5 +$as_echo "$as_me: Regtest suite will use env var PLUMED_MPIRUN to run MPI tests (default: mpirun)" >&6;} + fi +fi + #### This further tests are required to allow linking with non c++ compiler { $as_echo "$as_me:${as_lineno-$LINENO}: PLUMED seems to be configured properly!" >&5 $as_echo "$as_me: PLUMED seems to be configured properly!" >&6;} diff --git a/configure.ac b/configure.ac index 2f6df3a5eacf86dcd36049128205a3093f2a7f7a..08eddd60a8ca61ffde852e8c9a4064ef08ba818d 100644 --- a/configure.ac +++ b/configure.ac @@ -260,6 +260,7 @@ PLUMED_CONFIG_ENABLE([fftw],[search for fftw],[no]) AC_ARG_VAR(SOEXT,[extension of dynamic libraries (so/dylib)]) AC_ARG_VAR(STATIC_LIBS,[variables that should be linked statically directly to MD code - configure will add here -ldl if necessary ]) AC_ARG_VAR(LDSHARED,[command for linking shared library - configure will use CXX plus the proper flags ]) +AC_ARG_VAR(MPIEXEC,[command to run mpi programs in tests - default not specified, which means use PLUMED_MPIRUN env var at runtime for backward compatibility]) # by default use -O flag @@ -673,6 +674,8 @@ AC_SUBST(LDSHARED) # these are libraries that should be linked also to MD engines AC_SUBST(STATIC_LIBS) +AC_SUBST(MPIEXEC) + if test "$shared" == true ; then case `(uname)` in (Darwin) @@ -839,6 +842,14 @@ int main(int argc,char*argv[[]]){ ) fi +if test $mpi_found == ok ; then + if test -n "$MPIEXEC" ; then + AC_MSG_NOTICE([Regtest suite will use $MPIEXEC command to run MPI tests]) + else + AC_MSG_NOTICE([Regtest suite will use env var PLUMED_MPIRUN to run MPI tests (default: mpirun)]) + fi +fi + #### This further tests are required to allow linking with non c++ compiler AC_MSG_NOTICE([PLUMED seems to be configured properly!]) AC_MSG_NOTICE([**************************]) diff --git a/macports/Portfile.in b/macports/Portfile.in index a3624f60a734e3983fb3946679835fddd23aea0e..d08a91a3d86845428f8f9b6d0a7bc5ae1bb92b50 100644 --- a/macports/Portfile.in +++ b/macports/Portfile.in @@ -65,6 +65,11 @@ mpi.setup # To enable mpi, replace a configure flag if {[mpi_variant_isset]} { configure.args-replace --disable-mpi --enable-mpi + # command should be included in a pre-configure block to access properly the mpi.exec variable + pre-configure { + # MPIEXEC is stored so that it can be used to perform tests + configure.args-append MPIEXEC="${mpi.exec}" + } } # Libraries. diff --git a/regtest/scripts/run b/regtest/scripts/run index d1a21684a539b6abd5f594a48e98b7de8304409f..b95ad57bae53f79f8d32e485fd5005e7f4a0d89d 100755 --- a/regtest/scripts/run +++ b/regtest/scripts/run @@ -1,5 +1,9 @@ #!/bin/bash +if test -n "$PLUMED_PREPEND_PATH" ; then + PATH="$PLUMED_PREPEND_PATH:$PATH" +fi + export valgrind=env for opt in ${*} @@ -46,7 +50,7 @@ echo "++ Arguments: $arg" echo "++ Processors: $mpiprocs" mpi=env -plumed=plumed +plumed="${PLUMED_PROGRAM_NAME:-plumed}" root=$($plumed --no-mpi info --root) @@ -63,9 +67,17 @@ cd - if ((mpiprocs>0)); then -mpi="${PLUMED_MPIRUN:-mpirun} -np $mpiprocs" +mpi="" +if $plumed --no-mpi config -q mpiexec +then + mpi="$($plumed --no-mpi 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 config -q has mpi then echo "NOT_APPLICABLE (MPI NOT INSTALLED)" exit 0; @@ -73,7 +85,7 @@ fi else -plumed="plumed --no-mpi" +plumed="$plumed --no-mpi" fi diff --git a/scripts/config.sh b/scripts/config.sh index a5a0df583fa64892b5bc1576ec6f4c978edbfa82..197aa7a908b77636a6e1c987ac288352e8a78234 100755 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -50,6 +50,7 @@ do ;; (has) action=has ;; (module) action=module ;; + (mpiexec) action=mpiexec ;; (makefile_conf) echo "$configfile" | awk '{if($1=="makefile_conf") { gsub("^makefile_conf ",""); print} }' exit 0 @@ -95,5 +96,15 @@ case $action in git=$(echo "$configfile" | grep -v \# | awk '{ if($1=="version" && $2=="git") print $3 }') echo "Version: $long (git: $git)" ;; +(mpiexec) + mpi=$(echo "$configfile" | grep -v \# | awk '{ if($1=="mpiexec") print $2 }') + if test -n "$mpi" ; then + retval=0 + test "$quiet" = no && echo "$mpi" + else + retval=1 + test "$quiet" = no && echo "mpiexec not found" + fi + exit $retval esac diff --git a/src/config/Makefile b/src/config/Makefile index 815ca69729e14f97454b39cb44a3046bf390c5d5..2828e609940fe6ed786a6e934d1eeb87dca455eb 100644 --- a/src/config/Makefile +++ b/src/config/Makefile @@ -23,7 +23,9 @@ obj: all config.txt: ../../Makefile.conf @echo "Updating config.txt file" - @makefile_conf="$(realpath ../../Makefile.conf)" ../maketools/update-config-txt.sh config.txt $(CPPFLAGS) + @makefile_conf="$(realpath ../../Makefile.conf)" \ + mpiexec="$(mpiexec)" \ + ../maketools/update-config-txt.sh config.txt $(CPPFLAGS) version.h: @echo "Updating version.h" diff --git a/src/maketools/update-config-txt.sh b/src/maketools/update-config-txt.sh index 887e0c747b006f8fa0368d58dcff779dedddba37..7a604f6c9fd35c1963b1ddec97e1e44eebb21005 100755 --- a/src/maketools/update-config-txt.sh +++ b/src/maketools/update-config-txt.sh @@ -101,6 +101,8 @@ echo "# version strings" echo "# syntax: version short/long/git number" echo "$version" echo +echo "mpiexec $mpiexec" +echo echo "# list of 'has' options" echo "# syntax: has name on/of" echo "# if option xx is on then plumed has beeen compiled with -D__PLUMED_HAS_XX"