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/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/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"