diff --git a/.github/workflows/gfortran.yml b/.github/workflows/gfortran.yml index ddce7a14..cf72037c 100644 --- a/.github/workflows/gfortran.yml +++ b/.github/workflows/gfortran.yml @@ -163,7 +163,10 @@ jobs: strategy: fail-fast: false matrix: - gcc_v: [7, 8, 9] + # Let's just test one version, we do not really + # use OpenMPI with ABIN, and we already test all GCC + # versions with MPICH + gcc_v: [7] env: ABIN_FFLAGS: -O0 -fopenmp # To speed-up OpenMPI build @@ -178,7 +181,7 @@ jobs: run: | sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \ --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} - - name: OpenMPI build Cache + - name: OpenMPI build cache id: openmpi-cache uses: actions/cache@v2 with: @@ -199,26 +202,40 @@ jobs: plumed_build: - # TODO: This is just a stub for now, need to figure out how to build Plumed - # Once that is done, remove the following line - if: false runs-on: ubuntu-latest needs: basic_build strategy: fail-fast: false matrix: - gcc_v: [7, 8, 9] + plumed_v: [2.5.3, 2.6.2] + env: - FFLAGS: -O2 -fopenmp + PLUMED_V: ${{ matrix.plumed_v}} + ABIN_FFLAGS: -O0 -fopenmp --coverage + # Speeding up the Plumed build + CFLAGS: -O0 + CXXLAGS: -O0 + steps: - uses: actions/checkout@v2 - - name: Download Plumed - run: mkdir ~/plumed && cd ~/plumed && wget plumed_url - - name: build Plumed - run: cd ~/plumed && ./configure && make && make install - # TODO: Cache plumed build - # TODO: Maybe try different Plumed versions? + - name: Plumed build cache + id: plumed-cache + uses: actions/cache@v2 + with: + path: ~/plumed/${{ env.PLUMED_V }}/install + key: ${{runner.os}}-plumed${{env.PLUMED_V}}-${{hashFiles('scripts/install_plumed.sh')}} + + - name: Build and Install PLUMED + if: steps.plumed-cache.outputs.cache-hit != 'true' + run: ./scripts/install_plumed.sh ${HOME}/plumed ${PLUMED_V} + - name: build ABIN - run: ./configure --plumed /path/to/plumed && make + run: | + export FFLAGS=${ABIN_FFLAGS} &&\ + ./configure --plumed "${HOME}/plumed/${PLUMED_V}/install" &&\ + make - name: test ABIN run: make test + + - name: Codecov upload + run: bash <(curl -s https://codecov.io/bash) diff --git a/TESTS/PLUMED/HILLS.ref b/TESTS/PLUMED/HILLS.ref index c71e4915..593c567e 100644 --- a/TESTS/PLUMED/HILLS.ref +++ b/TESTS/PLUMED/HILLS.ref @@ -1,6 +1,7 @@ #! FIELDS time d1 sigma_d1 height biasf #! SET multivariate false - 0.012094421632525 0.2783771737280517 0.15 5 1 - 0.02418884326505 0.3018492617845895 0.15 5 1 - 0.036283264897575 0.3146381586239277 0.15 5 1 - 0.0483776865301 0.3013179725350135 0.15 5 1 +#! SET kerneltype gaussian + 0.012094421632525 0.2783771737280517 0.15 5 -1 + 0.02418884326505 0.3018492617845895 0.15 5 -1 + 0.036283264897575 0.3146381586239277 0.15 5 -1 + 0.0483776865301 0.3013179725350135 0.15 5 -1 diff --git a/TESTS/test.sh b/TESTS/test.sh index fbace1e3..4082363c 100755 --- a/TESTS/test.sh +++ b/TESTS/test.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -uo pipefail + # Parameters passed from Makefile ABINEXE="$PWD/$1 -x mini.dat" @@ -19,6 +21,11 @@ CP2K="$6" ACTION="$7" # NOTE: For MPI tests, we rely on the fact that # MPI_PATH is exported in Makefile! +if [[ $MPI = "TRUE" && -z ${MPI_PATH:-} ]];then + echo "ERROR: \$MPI_PATH not set" + echo "Make sure to set MPI_PATH in make.vars" + exit 1 +fi cd TESTS || exit 1 TESTDIR=$PWD @@ -59,7 +66,7 @@ do if [[ -f $file.ref ]];then mv $file $file.ref else - echo "Something horrible happened during makeref" + echo "ERROR: Something horrible happened during makeref" exit 1 fi done @@ -120,7 +127,7 @@ else # Only one test selected, e.g. by running # make test TEST=CMD - folders=$2 + folders=${TESTS} fi diff --git a/configure b/configure index c1461deb..bc5edadd 100755 --- a/configure +++ b/configure @@ -135,8 +135,9 @@ CXX="c++" CXXFLAGS="-O2 -Wall -std=c++11" if [[ $PLUMED = "TRUE" ]];then - if [[ ! -f $PLUMED_PATH/lib/Plumed.inc ]];then - echo "File $PLUMED_PATH/lib/Plumed.inc does not exist!" + PLUMED_INC=${PLUMED_PATH}/lib/plumed/src/lib/Plumed.inc + if [[ ! -f ${PLUMED_INC} ]];then + echo "File $PLUMED_INC does not exist!" exit 1 fi fi @@ -169,7 +170,7 @@ MPI_PATH = $MPI_PATH # Compilation with Plumed library PLUMED = $PLUMED -PLUMED_INC = $PLUMED_PATH/lib/Plumed.inc +PLUMED_INC = ${PLUMED_INC:-} # FFTW library is typically shipped with your system # It is needed for normal mode coordinate transformation in PIMD diff --git a/scripts/install_mpich.sh b/scripts/install_mpich.sh index 43122591..824a0e04 100755 --- a/scripts/install_mpich.sh +++ b/scripts/install_mpich.sh @@ -5,7 +5,7 @@ # and MPI process manager (mpirun) # Exit script immediately upon error -set -eou pipefail +set -euo pipefail # Path as an optional first parameter MPICH_DIR="${1-/home/$USER/mpich}" diff --git a/scripts/install_plumed.sh b/scripts/install_plumed.sh new file mode 100755 index 00000000..ea107616 --- /dev/null +++ b/scripts/install_plumed.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +# Install OpenMPI implementation of Message Passing Interface (MPI) +# This script installs both the MPI compilers (mpifort,mpicc) +# and MPI process manager (mpirun) + +# Exit script immediately upon error +set -euo pipefail + +# Path as an optional first parameter +PLUMED_DIR="${1-/home/$USER/plumed}" +# We take the current stable version as default +# (as of 17 Dec 2020) +PLUMED_VERSION="${2-"2.6.2"}" +# Use two processors for the build +NPROC=2 + +TAR_FILE="plumed-src-${PLUMED_VERSION}.tgz" +DOWNLOAD_URL="https://github.com/plumed/plumed2/releases/download/v${PLUMED_VERSION}/${TAR_FILE}" +INSTALL_DIR="$PLUMED_DIR/$PLUMED_VERSION/install" + +if [[ -d $PLUMED_DIR/$PLUMED_VERSION ]];then + echo "Found existing Plumed installation in $PLUMED_DIR/$PLUMED_VERSION" + echo "Remove this folder if you want to reinstall" + exit 1 +fi + +mkdir -p $PLUMED_DIR/$PLUMED_VERSION/src +mkdir -p $PLUMED_DIR/$PLUMED_VERSION/pkg + +curl -L "$DOWNLOAD_URL" > $PLUMED_DIR/$PLUMED_VERSION/pkg/${TAR_FILE} +cd $PLUMED_DIR/$PLUMED_VERSION/src && tar -xzf ../pkg/${TAR_FILE} +cd plumed-${PLUMED_VERSION} + +# To keep things simple, we don't compile with MPI support +# We also disable the use of external BLAS and LAPACK +# to prevent Gfortran version conflicts +# According to the manual, Plumed should ship with their default +# BLAS and LAPACK, that will be fine for us for now. + +# --enable-static-patch is needed by ABIN integration +# It is the default, but let's be explicit +./configure CXX=g++ CC=gcc \ + --disable-mpi --disable-xdrfile \ + --disable-external-lapack --disable-external-blas \ + --enable-static-patch --enable-shared \ + --prefix=${INSTALL_DIR} 2>&1 |\ + tee configure.log + +make -j $NPROC 2>&1 | tee make.log + +make install 2>&1 | tee make_install.log + +echo " +Succesfully installed PLUMED! +Set the following in your ABIN make.vars + +PLUMED = TRUE +PLUMED_INC = ${INSTALL_DIR}/lib/plumed/src/lib/Plumed.inc + +or rerun configure as + +./configure --plumed ${INSTALL_DIR} +"