Skip to content

Commit

Permalink
Facilitate build of a (generic) statically linked CP2k binary
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrack committed Feb 28, 2022
1 parent 2e63670 commit 8301c52
Showing 1 changed file with 26 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,46 @@
# CP2K (GNU) arch file for a serial static x86_64 binary
#
# Tested with: GNU 11.2.0, FFTW 3.3.10, LIBINT 2.6.0, LIBBVORI 210412,
# LIBXC 5.1.7, OpenBLAS 0.3.19, SPGLIB 1.16.2
# LIBXC 5.2.2, OpenBLAS 0.3.19, SPGLIB 1.16.2
#
# Usage: Source this arch file and then run make as instructed after a
# CP2K toolchain installation has been performed successfully with
# > cd tools/toolchain
# > ./install_cp2k_toolchain.sh --mpi-mode=no --with-gcc=install
# or for a generic target with
# > ./install_cp2k_toolchain.sh --generic --mpi-mode=no --with-gcc=install
# Usage: Source this arch file and then run make as instructed.
# Add "generic" as argument to compile for a generic x86_64 target.
#
# Author: Matthias Krack (matthias.krack@psi.ch, PSI, December 2021)
# Author: Matthias Krack (28.02.2022)
#
# \
if [[ "${0}" == "${BASH_SOURCE}" ]]; then \
if [[ "${0}" == "${BASH_SOURCE}" ]]; then \
echo "ERROR: Script ${0##*/} must be sourced"; \
echo "Usage: source ${0##*/}"; \
exit 1; \
fi; \
this_file=${BASH_SOURCE##*/}; \
if [[ -f "${PWD}/tools/toolchain/install/setup" ]]; then \
printf "Sourcing ${PWD}/tools/toolchain/install/setup ... "; \
source ${PWD}/tools/toolchain/install/setup; \
printf "done\n"; \
fi; \
echo "Check the output above for error messages and consistency!"; \
echo "If everything is OK, you can build a CP2K production binary with"; \
echo " make -j ARCH=${this_file%%.*} VERSION=${this_file##*.}"; \
echo "or build a CP2K binary for a generic target using"; \
echo " make -j ARCH=${this_file%%.*} VERSION=${this_file##*.} GENERIC=yes"; \
return
cd tools/toolchain; \
if [[ "${1}" == "generic" ]]; then \
./install_cp2k_toolchain.sh -j 16 --generic --mpi-mode=no --with-gcc=install; \
else \
./install_cp2k_toolchain.sh -j 16 --mpi-mode=no --with-gcc=install; \
fi; \
source ./install/setup; \
cd ../..; \
echo; \
echo "Check the output above for error messages and consistency!"; \
echo "If everything is OK, you can build a CP2K production binary with"; \
if [[ "${1}" == "generic" ]]; then \
echo " make -j 16 ARCH=${this_file%%.*} VERSION=${this_file##*.} GENERIC=yes"; \
else \
echo " make -j 16 ARCH=${this_file%%.*} VERSION=${this_file##*.}"; \
fi; \
echo "Further checks are performed, if DO_CHECKS=yes is added."; \
return

# Set options
DO_CHECKS := no
GENERIC := no
USE_FFTW := 3.3.10
USE_LIBINT := 2.6.0
USE_LIBVORI := 210412
USE_LIBXC := 5.1.7
USE_LIBXC := 5.2.2
USE_OPENBLAS := 0.3.19
USE_SPGLIB := 1.16.2

Expand All @@ -53,9 +56,9 @@ LD := gfortran
AR := ar -r

ifeq ($(GENERIC), yes)
CFLAGS := -O2 -fopenmp -g -mtune=generic
CFLAGS := -O2 -fopenmp -fopenmp-simd -ftree-vectorize -funroll-loops -g -mtune=generic
else
CFLAGS := -O3 -fopenmp -funroll-loops -g -march=native -mtune=native
CFLAGS := -O2 -fopenmp -fopenmp-simd -ftree-vectorize -funroll-loops -g -mtune=native
endif

DFLAGS += -D__MAX_CONTR=$(strip $(MAX_CONTR))
Expand Down

0 comments on commit 8301c52

Please sign in to comment.