Skip to content

Commit

Permalink
Toolchain: Add Plumed2
Browse files Browse the repository at this point in the history
  • Loading branch information
oschuett committed Oct 27, 2019
1 parent dd13ebc commit c7d4e6c
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 6 deletions.
15 changes: 10 additions & 5 deletions tools/toolchain/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ RUN apt-get update -qq && apt-get install -qq --no-install-recommends \
python \
unzip \
wget \
xxd \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -36,6 +37,8 @@ COPY ./scripts/VERSION \
./scripts/common_vars.sh \
./scripts/signal_trap.sh ./scripts/

# Dry-run leaves behind config files for the followup install scripts.
# This breaks up the lengthy installation into smaller docker build steps.
COPY ./install_cp2k_toolchain.sh .
RUN ./install_cp2k_toolchain.sh \
--install-all \
Expand All @@ -52,11 +55,10 @@ RUN ./scripts/install_cmake.sh && rm -rf ./build
COPY ./scripts/install_gcc.sh ./scripts/
RUN ./scripts/install_gcc.sh && rm -rf ./build

COPY \
./scripts/get_openblas_arch.sh \
./scripts/setup_buildtools.sh \
./scripts/openblas-0.3.6-disable-avx512.patch \
./scripts/
COPY ./scripts/get_openblas_arch.sh \
./scripts/setup_buildtools.sh \
./scripts/openblas-0.3.6-disable-avx512.patch \
./scripts/
RUN ./scripts/setup_buildtools.sh && rm -rf ./build

COPY ./scripts/install_mpich.sh ./scripts/
Expand Down Expand Up @@ -111,6 +113,9 @@ RUN ./scripts/install_pexsi.sh && rm -rf ./build
COPY ./scripts/install_quip.sh ./scripts/
RUN ./scripts/install_quip.sh && rm -rf ./build

COPY ./scripts/install_plumed.sh ./scripts/
RUN ./scripts/install_plumed.sh && rm -rf ./build

COPY ./scripts/install_gsl.sh ./scripts/
RUN ./scripts/install_gsl.sh && rm -rf ./build

Expand Down
8 changes: 7 additions & 1 deletion tools/toolchain/install_cp2k_toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ The --with-PKG options follow the rules:
Default = no
--with-quip Enable interface to QUIP library
Default = no
--with-plumed Enable interface to the PLUMED library.
Default = no
--with-sirius Enable interface to the plane wave SIRIUS library.
This package requires: gsl, libspg, elpa, scalapack, hdf5 and libxc.
Default = install
Expand Down Expand Up @@ -258,7 +260,7 @@ EOF
tool_list="valgrind cmake gcc"
mpi_list="mpich openmpi"
math_list="mkl acml openblas reflapack"
lib_list="fftw libint libxc libsmm libxsmm scalapack elpa \
lib_list="fftw libint libxc libsmm libxsmm scalapack elpa plumed \
ptscotch parmetis metis superlu pexsi quip gsl spglib hdf5 libvdwxc sirius"
package_list="$tool_list $mpi_list $math_list $lib_list"
# ------------------------------------------------------------------------
Expand Down Expand Up @@ -583,6 +585,9 @@ while [ $# -ge 1 ] ; do
--with-quip*)
with_quip=$(read_with $1)
;;
--with-plumed*)
with_plumed=$(read_with $1)
;;
--with-sirius*)
with_sirius=$(read_with $1)
;;
Expand Down Expand Up @@ -923,6 +928,7 @@ else
./scripts/install_superlu.sh
./scripts/install_pexsi.sh
./scripts/install_quip.sh
./scripts/install_plumed.sh
./scripts/install_gsl.sh
./scripts/install_spglib.sh
./scripts/install_hdf5.sh
Expand Down
89 changes: 89 additions & 0 deletions tools/toolchain/scripts/install_plumed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/bin/bash -e
[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")" && pwd -P)"

plumed_ver="2.5.2"
plumed_pkg="plumed-${plumed_ver}.tgz"
plumed_sha256="873b694ad3c480f7855cd4c02fe5fbee4759679db1604ef4056e0571c61b9979"

source "${SCRIPT_DIR}"/common_vars.sh
source "${SCRIPT_DIR}"/tool_kit.sh
source "${SCRIPT_DIR}"/signal_trap.sh
source "${INSTALLDIR}"/toolchain.conf
source "${INSTALLDIR}"/toolchain.env

[ -f "${BUILDDIR}/setup_plumed" ] && rm "${BUILDDIR}/setup_plumed"

PLUMED_LDFLAGS=''
PLUMED_LIBS=''

! [ -d "${BUILDDIR}" ] && mkdir -p "${BUILDDIR}"
cd "${BUILDDIR}"

case "$with_plumed" in
__INSTALL__)
echo "==================== Installing PLUMED ===================="
pkg_install_dir="${INSTALLDIR}/plumed-${plumed_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "plumed-${plumed_ver} is already installed, skipping it."
else
if [ -f ${plumed_pkg} ] ; then
echo "${plumed_pkg} is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${plumed_sha256} \
https://www.cp2k.org/static/downloads/${plumed_pkg}
fi

[ -d plumed-${plumed_ver} ] && rm -rf plumed-${plumed_ver}
tar -xzf ${plumed_pkg}

echo "Installing from scratch into ${pkg_install_dir}"
cd plumed-${plumed_ver}
CXX="${MPICXX}" ./configure --prefix=${pkg_install_dir} > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make install > install.log 2>&1
fi
PLUMED_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding PLUMED from system paths ===================="
check_lib -lplumed "PLUMED"
add_lib_from_paths PLUMED_LDFLAGS "libplumed*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking PLUMED to user paths ===================="
pkg_install_dir="$with_plumed"
check_dir "${pkg_install_dir}/lib"
PLUMED_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac

if [ "$with_plumed" != "__DONTUSE__" ] ; then
PLUMED_LIBS='-lplumed -ldl -lstdc++ -lz -ldl'
if [ "$with_plumed" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_plumed"
prepend_path LD_LIBRARY_PATH "$pkg_install_dir/lib"
prepend_path LD_RUN_PATH "$pkg_install_dir/lib"
prepend_path LIBRARY_PATH "$pkg_install_dir/lib"
EOF
cat "${BUILDDIR}/setup_plumed" >> $SETUPFILE
fi

cat <<EOF >> "${BUILDDIR}/setup_plumed"
export PLUMED_LDFLAGS="${PLUMED_LDFLAGS}"
export PLUMED_LIBS="${PLUMED_LIBS}"
export CP_DFLAGS="\${CP_DFLAGS} -D__PLUMED2"
export CP_LDFLAGS="\${CP_LDFLAGS} ${PLUMED_LDFLAGS}"
export CP_LIBS="${PLUMED_LIBS} \${CP_LIBS}"
EOF
fi

# update toolchain environment
load "${BUILDDIR}/setup_plumed"
export -p > "${INSTALLDIR}/toolchain.env"

cd "${ROOTDIR}"
report_timing "plumed"

0 comments on commit c7d4e6c

Please sign in to comment.