From 8301c5214cf6bda63eb76844c5d508e477cea80b Mon Sep 17 00:00:00 2001 From: Matthias Krack Date: Mon, 28 Feb 2022 13:59:16 +0100 Subject: [PATCH] Facilitate build of a (generic) statically linked CP2k binary --- ...atic.ssmp => Linux-gnu-x86_64-static.ssmp} | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) rename arch/{Linux-x86-64-gnu-static.ssmp => Linux-gnu-x86_64-static.ssmp} (76%) diff --git a/arch/Linux-x86-64-gnu-static.ssmp b/arch/Linux-gnu-x86_64-static.ssmp similarity index 76% rename from arch/Linux-x86-64-gnu-static.ssmp rename to arch/Linux-gnu-x86_64-static.ssmp index 9154f11a3e..6d1b9ff7fb 100644 --- a/arch/Linux-x86-64-gnu-static.ssmp +++ b/arch/Linux-gnu-x86_64-static.ssmp @@ -3,35 +3,38 @@ # 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 @@ -39,7 +42,7 @@ 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 @@ -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))