Format all shell scripts

This commit is contained in:
Ole Schütt 2021-02-17 17:02:43 +01:00 committed by Ole Schütt
parent 2e2218d9a9
commit d59a3ad777
78 changed files with 4489 additions and 4475 deletions

View file

@ -3,9 +3,13 @@
rm -rf autom4te.cache
rm -f aclocal.m4 ltmain.sh
echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS -I m4 || exit 1
echo "Running autoheader..." ; autoheader || exit 1
echo "Running autoconf..." ; autoconf || exit 1
echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
echo "Running aclocal..."
aclocal $ACLOCAL_FLAGS -I m4 || exit 1
echo "Running autoheader..."
autoheader || exit 1
echo "Running autoconf..."
autoconf || exit 1
echo "Running libtoolize..."
(libtoolize --copy --automake || glibtoolize --automake) || exit 1
echo "Running automake..."
automake --add-missing --copy --gnu || exit 1

View file

@ -8,22 +8,19 @@
source config.in
(
echo FC_comp=$FC_comp
echo FCFLAGS_OPT=$FCFLAGS_OPT
echo FCFLAGS_NATIVE=$FCFLAGS_NATIVE
echo FC_tune=\$\(FC_comp\) \$\(FCFLAGS_OPT\)
echo FC_native=\$\(FC_comp\) \$\(FCFLAGS_NATIVE\)
echo FC_comp=$FC_comp
echo FCFLAGS_OPT=$FCFLAGS_OPT
echo FCFLAGS_NATIVE=$FCFLAGS_NATIVE
echo FC_tune=\$\(FC_comp\) \$\(FCFLAGS_OPT\)
echo FC_native=\$\(FC_comp\) \$\(FCFLAGS_NATIVE\)
) > config.mk
# Write a makefile to generate all different combinations
(
printf "########## DO NOT EDIT THIS FILE
printf "########## DO NOT EDIT THIS FILE
include config.mk
@ -52,7 +49,8 @@ objfiles: \$(OBJ_FILES)
libtest.a: objfiles
\tar r libtest.a \$(OBJ_FILES)
" ) > $makefile_name
"
) > $makefile_name
printf "
include ../config.mk
@ -73,37 +71,37 @@ test.x: main.o qs_integrate_potential.o qs_collocate_density.o integrate_fast.o
#7 ! generate up to l = l_max_a + l_max_b
#1 ! use the best of three timings
Ncomb=$(( 2**$Nopt ))
Ncomb=$((2 ** $Nopt))
TARGETS_EXE=""
TARGETS_RUN=""
# For each value of l and iopt
for l in `seq 0 $lmax`; do
# First optimisation starts at ONE (all_options[0] is not initialised and generate does not produces valid code)
for iopt in `seq 1 $Ncomb`;do
TARGETS_EXE="gen_${l}_${iopt}.exists $TARGETS_EXE"
TARGETS_RUN="run_${l}_${iopt}_0.exists run_${l}_${iopt}_1.exists $TARGETS_RUN"
DIRECTORIES="out_${l}_${iopt} $TMPBASE/TMP_${l}_${iopt} $DIRECTORIES"
for l in $(seq 0 $lmax); do
# First optimisation starts at ONE (all_options[0] is not initialised and generate does not produces valid code)
for iopt in $(seq 1 $Ncomb); do
TARGETS_EXE="gen_${l}_${iopt}.exists $TARGETS_EXE"
TARGETS_RUN="run_${l}_${iopt}_0.exists run_${l}_${iopt}_1.exists $TARGETS_RUN"
DIRECTORIES="out_${l}_${iopt} $TMPBASE/TMP_${l}_${iopt} $DIRECTORIES"
icollo=1
is_icollo_1=""
is_icollo_0=""
icollo=1
is_icollo_1=""
is_icollo_0=""
if [[ $icollo -eq 1 ]]; then
is_icollo_1="echo -1;"
fi
if [[ $icollo -eq 1 ]]; then
is_icollo_1="echo -1;"
fi
if [[ $icollo -eq 0 ]]; then
is_icollo_0="echo -1;"
fi
if [[ $icollo -eq 0 ]]; then
is_icollo_0="echo -1;"
fi
# Makefile entries for this case
printf "
# Makefile entries for this case
printf "
gen_${l}_${iopt}.exists: libtest.a generate.x
\t-mkdir out_${l}_${iopt}
\t(${is_icollo_1} printf \"${l}\\\n\"; yes ${iopt} | head -n $((${l}+1)); ${is_icollo_0}) > generate_${l}_${iopt}.in
\t(${is_icollo_1} printf \"${l}\\\n\"; yes ${iopt} | head -n $((${l} + 1)); ${is_icollo_0}) > generate_${l}_${iopt}.in
\t./generate.x < generate_${l}_${iopt}.in
\t(${is_icollo_0} printf \"${l}\\\n\"; yes ${iopt} | head -n $((${l}+1)); ${is_icollo_1}) > generate_${l}_${iopt}.in
\t(${is_icollo_0} printf \"${l}\\\n\"; yes ${iopt} | head -n $((${l} + 1)); ${is_icollo_1}) > generate_${l}_${iopt}.in
\t./generate.x < generate_${l}_${iopt}.in
\t-rm generate_${l}_${iopt}.in
\tcp qs_collocate_density.F qs_integrate_potential.F main.F out_${l}_${iopt}/
@ -114,13 +112,13 @@ gen_${l}_${iopt}.exists: libtest.a generate.x
\ttouch gen_${l}_${iopt}.exists
" >> $makefile_name
#printf """
#gen_${l}_${iopt}: libtest.a
#
#""" >> /dev/null # $makefile_name #/dev/null
#printf """
#gen_${l}_${iopt}: libtest.a
#
#""" >> /dev/null # $makefile_name #/dev/null
icollo=0
printf "
icollo=0
printf "
run_${l}_${iopt}_${icollo}.exists: gen_${l}_${iopt}.exists
\tprintf \" ${icollo}\\\\n T\\\\n ${l} 0 0 0\\\\n ${Nrun}\\\n\" > out_${l}_${iopt}/run_${l}_${iopt}_T_${icollo}.in
\ttest -f out_${l}_${iopt}/out_test_${l}_${iopt}_T_${icollo} || ./out_${l}_${iopt}/test.x < out_${l}_${iopt}/run_${l}_${iopt}_T_${icollo}.in > out_${l}_${iopt}/out_test_${l}_${iopt}_T_${icollo}
@ -129,8 +127,8 @@ run_${l}_${iopt}_${icollo}.exists: gen_${l}_${iopt}.exists
\ttouch run_${l}_${iopt}_${icollo}.exists
" >> $makefile_name
icollo=1
printf "
icollo=1
printf "
run_${l}_${iopt}_${icollo}.exists: run_${l}_${iopt}_0.exists
\tprintf \" ${icollo}\\\\n T\\\\n ${l} 0 0 0\\\\n ${Nrun}\\\n\" > out_${l}_${iopt}/run_${l}_${iopt}_T_${icollo}.in
\ttest -f out_${l}_${iopt}/out_test_${l}_${iopt}_T_${icollo} ||./out_${l}_${iopt}/test.x < out_${l}_${iopt}/run_${l}_${iopt}_T_${icollo}.in > out_${l}_${iopt}/out_test_${l}_${iopt}_T_${icollo}
@ -139,12 +137,12 @@ run_${l}_${iopt}_${icollo}.exists: run_${l}_${iopt}_0.exists
\ttouch run_${l}_${iopt}_${icollo}.exists
" >> $makefile_name
done
done
done
(
printf "
printf "
all: libgrid.a
generate.x:
@ -174,5 +172,5 @@ libgrid.a: gen_best xyz_to_vab.o
\tar r libgrid.a out_best/collocate_fast.o out_best/integrate_fast.o xyz_to_vab_optimised.o
"
) >> $makefile_name
) \
>> $makefile_name

View file

@ -10,73 +10,72 @@
source config.in
# Number of combinations with the existing options
Ncomb=$(( 2**$Nopt ))
Ncomb=$((2 ** $Nopt))
# Error tolerance
err_tol="1.0E-10"
# For both collocate (0) and integrate (1)
for icollo in 0 1; do
echo "$icollo"
echo "l - Time - Best Opt"
echo "l Time Opt" > best_timings
for l in `seq 0 $lmax`; do
bsf=999999.0
# First optimisation starts at ONE (all_options[0] is not initialised and generate does not produces valid code)
for iopt in `seq 1 $Ncomb`;do
# Extract the error
tmp=$(cat out_${l}_${iopt}/out_test_${l}_${iopt}_F_${icollo} | tr -s ' ' | grep "largest error" | cut -f 5 -d ' ')
test "$tmp" || continue
error=$(python -c "print $err_tol>$tmp")
# Skip if error is too big
if [[ $error == "False" ]]; then
# echo "($error) Error $tmp was too big for $iopt"
continue
fi
# echo "($error) Error was $tmp , accepted $iopt"
# Extract the time of the combination
tmp=$(cat out_${l}_${iopt}/out_test_${l}_${iopt}_T_${icollo} | tr -s ' ' | grep "best time" | cut -f 5 -d ' ')
echo "$icollo"
echo "l - Time - Best Opt"
echo "l Time Opt" > best_timings
for l in $(seq 0 $lmax); do
bsf=999999.0
# First optimisation starts at ONE (all_options[0] is not initialised and generate does not produces valid code)
for iopt in $(seq 1 $Ncomb); do
# Extract the error
tmp=$(cat out_${l}_${iopt}/out_test_${l}_${iopt}_F_${icollo} | tr -s ' ' | grep "largest error" | cut -f 5 -d ' ')
test "$tmp" || continue
error=$(python -c "print $err_tol>$tmp")
# Skip if error is too big
if [[ $error == "False" ]]; then
# echo "($error) Error $tmp was too big for $iopt"
continue
fi
# echo "($error) Error was $tmp , accepted $iopt"
# Extract the time of the combination
tmp=$(cat out_${l}_${iopt}/out_test_${l}_${iopt}_T_${icollo} | tr -s ' ' | grep "best time" | cut -f 5 -d ' ')
test "$tmp" || continue
dif=$(python -c "print $bsf>$tmp")
test "$tmp" || continue
dif=$(python -c "print $bsf>$tmp")
if [[ $dif == "True" ]]; then
# echo " New bsf is $tmp from $bsf "
bsf=$tmp
bsf_iopt=$iopt
#else
# echo " $bsf is lower than $tmp ($dif, print $bsf>$tmp)"
fi
done # for iopt
if [[ $dif == "True" ]]; then
# echo " New bsf is $tmp from $bsf "
bsf=$tmp
bsf_iopt=$iopt
#else
# echo " $bsf is lower than $tmp ($dif, print $bsf>$tmp)"
fi
done # for iopt
bsf_global[$l]=$bsf
bsf_iopt_global[$l]=$bsf_iopt
bsf_global[$l]=$bsf
bsf_iopt_global[$l]=$bsf_iopt
echo $l -- ${bsf_global[$l]} -- ${bsf_iopt_global[$l]}
echo $l ${bsf_global[$l]} ${bsf_iopt_global[$l]} >> best_timings
echo $l -- ${bsf_global[$l]} -- ${bsf_iopt_global[$l]}
echo $l ${bsf_global[$l]} ${bsf_iopt_global[$l]} >> best_timings
done # for l
done # for l
if [[ $icollo -eq 0 ]]; then
bsf_global_0=("${bsf_global[@]}")
bsf_iopt_global_0=("${bsf_iopt_global[@]}")
else
bsf_global_1=("${bsf_global[@]}")
bsf_iopt_global_1=("${bsf_iopt_global[@]}")
fi
if [[ $icollo -eq 0 ]]; then
bsf_global_0=("${bsf_global[@]}")
bsf_iopt_global_0=("${bsf_iopt_global[@]}")
else
bsf_global_1=("${bsf_global[@]}")
bsf_iopt_global_1=("${bsf_iopt_global[@]}")
fi
done # for icollo
# Generate the input file for generate.x with the optimal combinations for each problem size
echo " Generating optimal combination "
(
echo $lmax
for l in `seq 0 $lmax`; do
echo ${bsf_iopt_global_0[$l]}
done
echo $lmax
for l in `seq 0 $lmax`; do
echo ${bsf_iopt_global_1[$l]}
done
echo $lmax
for l in $(seq 0 $lmax); do
echo ${bsf_iopt_global_0[$l]}
done
echo $lmax
for l in $(seq 0 $lmax); do
echo ${bsf_iopt_global_1[$l]}
done
) > generate_best

View file

@ -13,24 +13,24 @@ date --utc --rfc-3339=seconds
set -e # abort if error is encountered
cd ../../
make -j ARCH=Linux-x86-64-gfortran VERSION="dumpast" > make_conventions1.out
make -j ARCH=local_warn VERSION="psmp" > make_conventions2.out
make -j ARCH=local_warn VERSION="psmp" > make_conventions2.out
)
MAKE_EXIT_CODE=$?
if (( $MAKE_EXIT_CODE )); then
cd ../../obj/local_warn/psmp/
echo ""
grep -B 2 Error *.warn
echo ""
echo "Summary: Compilation failed."
echo "Status: FAILED"
if (($MAKE_EXIT_CODE)); then
cd ../../obj/local_warn/psmp/
echo ""
grep -B 2 Error *.warn
echo ""
echo "Summary: Compilation failed."
echo "Status: FAILED"
else
rm -f *.issues
rm -f *.issues
set -o errexit
set -o errexit
./analyze_gfortran_ast.py ../../obj/Linux-x86-64-gfortran/dumpast/*.ast > ast.issues
./analyze_gfortran_warnings.py ../../obj/local_warn/psmp/*.warn > warn.issues
./analyze_src.py -b ../../ > src.issues
./summarize_issues.py --suppressions=conventions.supp *.issues
./analyze_gfortran_ast.py ../../obj/Linux-x86-64-gfortran/dumpast/*.ast > ast.issues
./analyze_gfortran_warnings.py ../../obj/local_warn/psmp/*.warn > warn.issues
./analyze_src.py -b ../../ > src.issues
./summarize_issues.py --suppressions=conventions.supp *.issues
fi

View file

@ -2,10 +2,10 @@
# author: Ole Schuett
if (( $# < 1 )); then
echo "usage: build_test.sh <test_name> [additional-args]"
echo "example: build_test.sh python"
exit 1
if (($# < 1)); then
echo "usage: build_test.sh <test_name> [additional-args]"
echo "example: build_test.sh python"
exit 1
fi
set -e

View file

@ -2,10 +2,10 @@
# author: Ole Schuett
if (( $# < 1 )); then
echo "usage: run_test.sh <test_name> [additional-docker-run-args]"
echo "example: run_test.sh python"
exit 1
if (($# < 1)); then
echo "usage: run_test.sh <test_name> [additional-docker-run-args]"
echo "example: run_test.sh python"
exit 1
fi
set -e

View file

@ -2,10 +2,10 @@
# author: Ole Schuett
if (( $# < 1 )); then
echo "usage: run_test_master.sh <test_name> [additional-docker-run-args]"
echo "example: run_test_master.sh python"
exit 1
if (($# < 1)); then
echo "usage: run_test_master.sh <test_name> [additional-docker-run-args]"
echo "example: run_test_master.sh python"
exit 1
fi
set -e
@ -23,5 +23,4 @@ ${DOCKER:-docker} run -i --init --rm --cap-add=SYS_PTRACE \
-e "GIT_BRANCH=${GIT_BRANCH}" -e "GIT_REF=${GIT_REF}" \
"$@" "img_cp2k_test_${TESTNAME}"
#EOF

View file

@ -7,9 +7,9 @@ set -o nounset
set -o pipefail
if [[ $# -lt 2 ]]; then
echo "usage: $0 <test_name> <pr_number> [optional-docker-run-arguments]"
echo "example: $0 python 506"
exit 1
echo "usage: $0 <test_name> <pr_number> [optional-docker-run-arguments]"
echo "example: $0 python 506"
exit 1
fi
TESTNAME=$1
@ -17,7 +17,7 @@ PR_NUMBER=$2
shift 2
GIT_BRANCH="pull/${PR_NUMBER}/merge"
GIT_REF=$(curl -s "https://api.github.com/repos/cp2k/cp2k/pulls/${PR_NUMBER}" | jq -r '.merge_commit_sha')
GIT_REF=$(curl -s "https://api.github.com/repos/cp2k/cp2k/pulls/${PR_NUMBER}" | jq -r '.merge_commit_sha')
echo "Running ${TESTNAME} on Branch ${GIT_BRANCH} (ref: ${GIT_REF})..."
@ -25,7 +25,7 @@ set -o xtrace
# SYS_PTRACE needed by LeakSanitizer.
${DOCKER:-docker} run -i --init --rm --cap-add=SYS_PTRACE \
-e "GIT_BRANCH=${GIT_BRANCH}" -e "GIT_REF=${GIT_REF}" \
"$@" "img_cp2k_test_${TESTNAME}"
-e "GIT_BRANCH=${GIT_BRANCH}" -e "GIT_REF=${GIT_REF}" \
"$@" "img_cp2k_test_${TESTNAME}"
#EOF

View file

@ -3,63 +3,63 @@
# author: Ole Schuett
set -eo pipefail
ulimit -c 0 # Disable core dumps as they can take a very long time to write.
ulimit -c 0 # Disable core dumps as they can take a very long time to write.
# Calculate checksums of critical files.
CHECKSUMS=/workspace/checksums.md5
shopt -s nullglob # ignore missing files
shopt -s nullglob # ignore missing files
md5sum /workspace/cp2k/Makefile \
/workspace/cp2k/tools/build_utils/* \
/workspace/cp2k/arch/local* \
> $CHECKSUMS
/workspace/cp2k/tools/build_utils/* \
/workspace/cp2k/arch/local* \
> $CHECKSUMS
shopt -u nullglob
# Get cp2k sources.
if [ -n "${GIT_REF}" ]; then
echo -e "\n========== Fetching Git Commit =========="
cd /workspace/cp2k
git fetch --quiet origin "${GIT_BRANCH}"
git reset --quiet --hard "${GIT_REF}"
git submodule update --init --recursive
git --no-pager log -1 --pretty='%nCommitSHA: %H%nCommitTime: %ci%nCommitAuthor: %an%nCommitSubject: %s%n'
echo -e "\n========== Fetching Git Commit =========="
cd /workspace/cp2k
git fetch --quiet origin "${GIT_BRANCH}"
git reset --quiet --hard "${GIT_REF}"
git submodule update --init --recursive
git --no-pager log -1 --pretty='%nCommitSHA: %H%nCommitTime: %ci%nCommitAuthor: %an%nCommitSubject: %s%n'
elif [ -d /mnt/cp2k ]; then
echo -e "\n========== Copying Changed Files =========="
# We can't rely on timestamps as they depend on the git checkout time.
# Hence, we use checksums despite the IO because a full rebuild would be even more costly.
rsync --checksum \
--delete \
--executability \
--verbose \
--recursive \
--exclude="*~" \
--exclude=".*/" \
--exclude="*.py[cod]" \
--exclude="__pycache__" \
--exclude="/obj/" \
--exclude="/lib/" \
--exclude="/exe/" \
--exclude="/regtesting/" \
--exclude="/arch/local*" \
--exclude="/tools/toolchain/build/" \
--exclude="/tools/toolchain/install/" \
/mnt/cp2k/ /workspace/cp2k/
elif [ -d /mnt/cp2k ]; then
echo -e "\n========== Copying Changed Files =========="
# We can't rely on timestamps as they depend on the git checkout time.
# Hence, we use checksums despite the IO because a full rebuild would be even more costly.
rsync --checksum \
--delete \
--executability \
--verbose \
--recursive \
--exclude="*~" \
--exclude=".*/" \
--exclude="*.py[cod]" \
--exclude="__pycache__" \
--exclude="/obj/" \
--exclude="/lib/" \
--exclude="/exe/" \
--exclude="/regtesting/" \
--exclude="/arch/local*" \
--exclude="/tools/toolchain/build/" \
--exclude="/tools/toolchain/install/" \
/mnt/cp2k/ /workspace/cp2k/
else
echo "Neither GIT_REF nor /mnt/cp2k found - aborting."
exit 255
echo "Neither GIT_REF nor /mnt/cp2k found - aborting."
exit 255
fi
if ! md5sum --status --check ${CHECKSUMS}; then
echo -e "\n========== Cleaning Build Cache =========="
cd /workspace/cp2k
make distclean
echo -e "\n========== Cleaning Build Cache =========="
cd /workspace/cp2k
make distclean
fi
# Run actual test.
echo -e "\n========== Running Test =========="
cd /workspace
if ! "$@" ; then
echo -e "\nSummary: Test had non-zero exit status.\nStatus: FAILED"
if ! "$@"; then
echo -e "\nSummary: Test had non-zero exit status.\nStatus: FAILED"
fi
#EOF

View file

@ -7,14 +7,14 @@ apt-get update -qq
export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true
apt-get install -qq --no-install-recommends \
python3-setuptools \
python3-wheel \
python3-pip \
python3-dev \
postgresql \
rabbitmq-server \
sudo \
ssh
python3-setuptools \
python3-wheel \
python3-pip \
python3-dev \
postgresql \
rabbitmq-server \
sudo \
ssh
rm -rf /var/lib/apt/lists/*
# install dependencies of aiida-cp2k
@ -25,14 +25,14 @@ pip3 uninstall --quiet --yes aiida-cp2k
# create ubuntu user with sudo powers
adduser --disabled-password --gecos "" ubuntu
echo "ubuntu ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
echo "ubuntu ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# shellcheck disable=SC1091
source /opt/cp2k-toolchain/install/setup
# link mpi executables into path
MPI_INSTALL_DIR=$(dirname "$(command -v mpirun)")
for i in "${MPI_INSTALL_DIR}"/* ; do ln -sf "$i" /usr/bin/; done
for i in "${MPI_INSTALL_DIR}"/*; do ln -sf "$i" /usr/bin/; done
# setup arch files
cd /workspace/cp2k/arch
@ -41,10 +41,10 @@ ln -vs /opt/cp2k-toolchain/install/arch/local* .
# pre-build cp2k
cd /workspace/cp2k
echo -n "Warming cache by trying to compile... "
if make -j VERSION=pdbg &> /dev/null ; then
echo "done."
if make -j VERSION=pdbg &> /dev/null; then
echo "done."
else
echo "failed."
echo "failed."
fi
rm -rf lib exe

View file

@ -5,12 +5,12 @@
# install python packages
apt-get update -qq
apt-get install -qq --no-install-recommends \
python3 \
python3-dev \
python3-pip \
python3-wheel \
python3-setuptools \
build-essential
python3 \
python3-dev \
python3-pip \
python3-wheel \
python3-setuptools \
build-essential
rm -rf /var/lib/apt/lists/*
# install python packages
@ -29,10 +29,10 @@ ln -vs /opt/cp2k-toolchain/install/arch/local* .
# pre-build cp2k
cd /workspace/cp2k
echo -n "Warming cache by trying to compile... "
if make -j VERSION=pdbg &> /dev/null ; then
echo "done."
if make -j VERSION=pdbg &> /dev/null; then
echo "done."
else
echo "failed."
echo "failed."
fi
rm -rf lib exe

View file

@ -2,36 +2,36 @@
# author: Ole Schuett
if grep -q -e "Ubuntu" -e "Debian" /etc/os-release ; then
echo -n "Installing Ubuntu packages... "
apt-get update -qq
apt-get install -qq --no-install-recommends \
ca-certificates \
git \
less \
nano \
python3 \
rsync \
wget
rm -rf /var/lib/apt/lists/*
echo "done."
if grep -q -e "Ubuntu" -e "Debian" /etc/os-release; then
echo -n "Installing Ubuntu packages... "
apt-get update -qq
apt-get install -qq --no-install-recommends \
ca-certificates \
git \
less \
nano \
python3 \
rsync \
wget
rm -rf /var/lib/apt/lists/*
echo "done."
elif grep -q "Fedora" /etc/os-release ; then
echo -n "Installing Fedora packages... "
dnf -qy install \
ca-certificates \
git \
less \
nano \
python3 \
rsync \
wget
dnf -q clean all
echo "done."
elif grep -q "Fedora" /etc/os-release; then
echo -n "Installing Fedora packages... "
dnf -qy install \
ca-certificates \
git \
less \
nano \
python3 \
rsync \
wget
dnf -q clean all
echo "done."
else
echo "Unknown Linux distribution."
exit 1
echo "Unknown Linux distribution."
exit 1
fi

View file

@ -12,10 +12,10 @@ ln -vs /opt/cp2k-toolchain/install/arch/local* .
# pre-build cp2k
cd /workspace/cp2k/tools/conventions
echo -n "Warming cache by trying to run test_conventions.sh... "
if ./test_conventions.sh &> /dev/null ; then
echo "done."
if ./test_conventions.sh &> /dev/null; then
echo "done."
else
echo "failed."
echo "failed."
fi
rm -rf ../lib/ ../exe/

View file

@ -8,8 +8,8 @@ lcov_sha256="c1cda2fa33bec9aa2c2c73c87226cfe97de0831887176b45ee523c5e30f8053a"
# LCOV dependencies
apt-get update -qq
apt-get install -qq --no-install-recommends \
libperlio-gzip-perl \
libjson-perl
libperlio-gzip-perl \
libjson-perl
rm -rf /var/lib/apt/lists/*
cd /tmp

View file

@ -5,13 +5,13 @@
# install Ubuntu packages
apt-get update -qq
apt-get install -qq --no-install-recommends \
libfindbin-libs-perl \
build-essential \
make \
perl \
python3-{pip,setuptools,wheel,dev} \
nodejs \
clang-format
libfindbin-libs-perl \
build-essential \
make \
perl \
python3-{pip,setuptools,wheel,dev} \
nodejs \
clang-format
rm -rf /var/lib/apt/lists/*

View file

@ -5,10 +5,10 @@
# install Ubuntu packages
apt-get update -qq
apt-get install -qq --no-install-recommends \
python3 \
python3-pip \
python3-wheel \
python3-setuptools
python3 \
python3-pip \
python3-wheel \
python3-setuptools
rm -rf /var/lib/apt/lists/*
# install python packages
@ -27,10 +27,10 @@ ln -vs /opt/cp2k-toolchain/install/arch/local* .
# pre-build cp2k
cd /workspace/cp2k
echo -n "Warming cache by trying to compile... "
if make -j VERSION=pdbg &> /dev/null ; then
echo "done."
if make -j VERSION=pdbg &> /dev/null; then
echo "done."
else
echo "failed."
echo "failed."
fi
rm -rf lib exe

View file

@ -4,9 +4,9 @@
# install Ubuntu packages
apt-get update -qq
apt-get install -qq --no-install-recommends \
default-jre-headless \
libsaxonhe-java
apt-get install -qq --no-install-recommends \
default-jre-headless \
libsaxonhe-java
rm -rf /var/lib/apt/lists/*
# shellcheck disable=SC1091
@ -19,10 +19,10 @@ ln -vs /opt/cp2k-toolchain/install/arch/local* .
# pre-build cp2k
cd /workspace/cp2k
echo -n "Warming cache by trying to compile... "
if make -j VERSION=psmp &> /dev/null ; then
echo "done."
if make -j VERSION=psmp &> /dev/null; then
echo "done."
else
echo "failed."
echo "failed."
fi
rm -rf lib exe

View file

@ -5,13 +5,13 @@
# install Ubuntu packages
apt-get update -qq
apt-get install -qq --no-install-recommends \
libpython3-stdlib \
python3 \
python3-pip \
python3-wheel \
python3-setuptools \
python3-dev \
build-essential
libpython3-stdlib \
python3 \
python3-pip \
python3-wheel \
python3-setuptools \
python3-dev \
build-essential
rm -rf /var/lib/apt/lists/*
# install python packages

View file

@ -2,9 +2,9 @@
# author: Ole Schuett
if (( $# != 2 )) ; then
echo "Usage: install_regtest.sh <ARCH> <VERSION>"
exit 1
if (($# != 2)); then
echo "Usage: install_regtest.sh <ARCH> <VERSION>"
exit 1
fi
ARCH=$1
@ -18,18 +18,18 @@ ln -vs /opt/cp2k-toolchain/install/arch/local* .
source /opt/cp2k-toolchain/install/setup
# Make OpenMPI happy.
if command -v ompi_info &> /dev/null ; then
TESTOPTS="-mpiexec 'mpiexec --bind-to none --allow-run-as-root' ${TESTOPTS}"
export OMPI_MCA_plm_rsh_agent=/bin/false
if command -v ompi_info &> /dev/null; then
TESTOPTS="-mpiexec 'mpiexec --bind-to none --allow-run-as-root' ${TESTOPTS}"
export OMPI_MCA_plm_rsh_agent=/bin/false
fi
# pre-build cp2k
cd /workspace/cp2k || exit 1
echo -n "Warming cache by trying to compile... "
if make -j ARCH="${ARCH}" VERSION="${VERSION}" &> /dev/null ; then
echo "done."
if make -j ARCH="${ARCH}" VERSION="${VERSION}" &> /dev/null; then
echo "done."
else
echo "failed."
echo "failed."
fi
# remove binaries to reduce image size

View file

@ -17,12 +17,12 @@ source /opt/cp2k-toolchain/install/setup
# pre-build cp2k
cd /workspace/cp2k
for VERSION in 'psmp' 'ssmp'; do
echo -n "Warming cache by trying to compile cp2k.${VERSION}... "
if make -j VERSION="${VERSION}" &> /dev/null ; then
echo 'done.'
else
echo 'failed.'
fi
echo -n "Warming cache by trying to compile cp2k.${VERSION}... "
if make -j VERSION="${VERSION}" &> /dev/null; then
echo 'done.'
else
echo 'failed.'
fi
done
rm -rf lib exe

View file

@ -8,14 +8,14 @@ source /opt/cp2k-toolchain/install/setup
echo -e "\n========== Compiling CP2K =========="
cd /workspace/cp2k
echo -n "Compiling cp2k... "
if make -j VERSION=pdbg &> make.out ; then
echo "done."
if make -j VERSION=pdbg &> make.out; then
echo "done."
else
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
fi
echo -e "\n========== Installing AiiDA-CP2K plugin =========="
@ -44,13 +44,13 @@ EndOfMessage
chmod +x /usr/bin/cp2k
echo -e "\n========== Running AiiDA-CP2K Tests =========="
cd /opt/aiida-cp2k/
cd /opt/aiida-cp2k/
set +e # disable error trapping for remainder of script
(
set -e # abort on error
ulimit -t 1800 # abort after 30 minutes
$AS_UBUNTU_USER py.test
set -e # abort on error
ulimit -t 1800 # abort after 30 minutes
$AS_UBUNTU_USER py.test
)
EXIT_CODE=$?
@ -58,12 +58,12 @@ EXIT_CODE=$?
echo ""
AIIDA_COMMIT=$(git rev-parse --short HEAD)
if (( EXIT_CODE )); then
echo "Summary: Something is wrong with aiida-cp2k commit ${AIIDA_COMMIT}."
echo "Status: FAILED"
if ((EXIT_CODE)); then
echo "Summary: Something is wrong with aiida-cp2k commit ${AIIDA_COMMIT}."
echo "Status: FAILED"
else
echo "Summary: aiida-cp2k commit ${AIIDA_COMMIT} works fine."
echo "Status: OK"
echo "Summary: aiida-cp2k commit ${AIIDA_COMMIT} works fine."
echo "Status: OK"
fi
#EOF

View file

@ -7,14 +7,14 @@ source /opt/cp2k-toolchain/install/setup
cd /workspace/cp2k
echo -n "Compiling cp2k... "
if make -j VERSION=pdbg &> make.out ; then
echo "done."
if make -j VERSION=pdbg &> make.out; then
echo "done."
else
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
fi
echo -e "\n========== Installing CP2K =========="
@ -48,12 +48,12 @@ echo -e "\n========== Running ASE Tests =========="
cd /opt/ase/
ASE_REVISION=$(git rev-parse --short HEAD)
if ase test -j 0 -c cp2k calculator/cp2k ; then
echo "Summary: ASE commit ${ASE_REVISION} works fine."
echo "Status: OK"
if ase test -j 0 -c cp2k calculator/cp2k; then
echo "Summary: ASE commit ${ASE_REVISION} works fine."
echo "Status: OK"
else
echo "Summary: Something is wrong with ASE commit ${ASE_REVISION}."
echo "Status: FAILED"
echo "Summary: Something is wrong with ASE commit ${ASE_REVISION}."
echo "Status: FAILED"
fi
#EOF

View file

@ -7,6 +7,6 @@ source /opt/cp2k-toolchain/install/setup
echo -e "\n========== Running Conventions Test =========="
cd /workspace/cp2k/tools/conventions
./test_conventions.sh #TODO port to Python3
./test_conventions.sh #TODO port to Python3
#EOF

View file

@ -2,9 +2,9 @@
# author: Ole Schuett
if (( $# != 1 )) ; then
echo "Usage: test_coverage.sh <VERSION>"
exit 1
if (($# != 1)); then
echo "Usage: test_coverage.sh <VERSION>"
exit 1
fi
ARCH=local_coverage
@ -16,7 +16,7 @@ source /opt/cp2k-toolchain/install/setup
echo -e "\n========== Running Regtests =========="
cd /workspace/cp2k || exit 1
CP2K_REVISION=$(./tools/build_utils/get_revision_number ./src)
rm -rf "obj/${ARCH}/${VERSION}"/*.gcda # remove old gcov statistics
rm -rf "obj/${ARCH}/${VERSION}"/*.gcda # remove old gcov statistics
make ARCH="${ARCH}" VERSION="${VERSION}" TESTOPTS="${TESTOPTS}" test
@ -26,11 +26,11 @@ make ARCH="${ARCH}" VERSION="${VERSION}" TESTOPTS="${TESTOPTS}" test
rm -f "/workspace/cp2k/obj/${ARCH}/${VERSION}"/exts/*/*.gcda
cd /tmp || exit 1
GCOV_TIMEOUT="10s"
for fn in "/workspace/cp2k/obj/${ARCH}/${VERSION}"/*.gcda ; do
if ! timeout "${GCOV_TIMEOUT}" gcov "$fn" &> /dev/null ; then
echo "Skipping ${fn} because gcov took longer than ${GCOV_TIMEOUT}."
rm "${fn}"
fi
for fn in "/workspace/cp2k/obj/${ARCH}/${VERSION}"/*.gcda; do
if ! timeout "${GCOV_TIMEOUT}" gcov "$fn" &> /dev/null; then
echo "Skipping ${fn} because gcov took longer than ${GCOV_TIMEOUT}."
rm "${fn}"
fi
done
# collect coverage stats

View file

@ -4,12 +4,12 @@
echo -e "\n========== Generating Doxygen =========="
cd /workspace/cp2k
if ! make doxygen &> make.out ; then
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Doxygen generation failed."
echo -e "Status: FAILED\n"
exit 0
if ! make doxygen &> make.out; then
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Doxygen generation failed."
echo -e "Status: FAILED\n"
exit 0
fi
mkdir -p /workspace/artifacts

View file

@ -8,14 +8,14 @@ source /opt/cp2k-toolchain/install/setup
echo -e "\n========== Compiling CP2K =========="
cd /workspace/cp2k
echo -n "Compiling cp2k... "
if make -j VERSION=pdbg &> make.out ; then
echo "done."
if make -j VERSION=pdbg &> make.out; then
echo "done."
else
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
fi
echo -e "\n========== Installing i-Pi =========="
@ -25,11 +25,11 @@ pip3 install --quiet .
echo -e "\n========== Running i-Pi Tests =========="
cd /opt/i-pi/examples/cp2k/nvt-cl
cd /opt/i-pi/examples/cp2k/nvt-cl
set +e # disable error trapping for remainder of script
TIMEOUT_SEC="300"
ulimit -t ${TIMEOUT_SEC} # Limit cpu time.
ulimit -t ${TIMEOUT_SEC} # Limit cpu time.
# launch cp2k
(
@ -56,12 +56,12 @@ echo "CP2K exit code: ${CP2K_EXIT_CODE}"
echo "i-Pi exit code: ${IPI_EXIT_CODE}"
IPI_REVISION=$(git rev-parse --short HEAD)
if (( IPI_EXIT_CODE )) || (( CP2K_EXIT_CODE )) ; then
echo "Summary: Something is wrong with i-Pi commit ${IPI_REVISION}."
echo "Status: FAILED"
if ((IPI_EXIT_CODE)) || ((CP2K_EXIT_CODE)); then
echo "Summary: Something is wrong with i-Pi commit ${IPI_REVISION}."
echo "Status: FAILED"
else
echo "Summary: i-Pi commit ${IPI_REVISION} works fine."
echo "Status: OK"
echo "Summary: i-Pi commit ${IPI_REVISION} works fine."
echo "Status: OK"
fi
#EOF

View file

@ -7,16 +7,16 @@ source /opt/cp2k-toolchain/install/setup
echo -e "\n========== Compiling CP2K =========="
cd /workspace/cp2k
touch src/cp2k_info.F # ensure latest REVISION is picked up.
touch src/cp2k_info.F # ensure latest REVISION is picked up.
echo -n "Compiling cp2k... "
if make -j VERSION=psmp &> make.out ; then
echo "done."
if make -j VERSION=psmp &> make.out; then
echo "done."
else
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
fi
echo -e "\n========== Generating Manual =========="
@ -33,21 +33,21 @@ cp ${TOOLS}/manual/toggle_folding.js .
set +e # disable error trapping for remainder of script
(
set -e # abort if error is encountered
sed -i 's/\x0/?/g' cp2k_input.xml # replace null bytes which would crash saxon
SAXON="java -jar /usr/share/java/Saxon-HE.jar"
$SAXON -o:index.html ./cp2k_input.xml ${TOOLS}/manual/cp2k_input.xsl add_edit_links=yes
$SAXON -o:cp2k.vim ./cp2k_input.xml ${TOOLS}/input_editing/vim/vim.xsl
set -e # abort if error is encountered
sed -i 's/\x0/?/g' cp2k_input.xml # replace null bytes which would crash saxon
SAXON="java -jar /usr/share/java/Saxon-HE.jar"
$SAXON -o:index.html ./cp2k_input.xml ${TOOLS}/manual/cp2k_input.xsl add_edit_links=yes
$SAXON -o:cp2k.vim ./cp2k_input.xml ${TOOLS}/input_editing/vim/vim.xsl
)
EXIT_CODE=$?
echo ""
if (( EXIT_CODE )); then
echo "Summary: Something is wrong."
echo "Status: FAILED"
if ((EXIT_CODE)); then
echo "Summary: Something is wrong."
echo "Status: FAILED"
else
echo "Summary: Manual generation works fine."
echo "Status: OK"
echo "Summary: Manual generation works fine."
echo "Status: OK"
fi
#EOF

View file

@ -3,34 +3,34 @@
# author: Ole Schuett
function run_tests {
PYTHON=$1
SCRIPTS=$2
BASEDIR=$(pwd)
VERSION=$(${PYTHON} -V 2>&1 | tr -d '\n')
echo ""
echo "========== Running ${VERSION} Tests =========="
#find ./src/ ./tools/ -name "*.pyc" -exec rm {} \;
for i in $SCRIPTS ; do
set +e #disable error trapping
echo "Running $i"
cd "$(dirname "$i")"
SCRIPT=$(basename "$i")
if ! $PYTHON -B "./${SCRIPT}" ; then
echo "Test $i failed"
ERRORS=$((ERRORS+1))
fi
set -e #re-enable error trapping
cd "$BASEDIR"
done
PYTHON=$1
SCRIPTS=$2
BASEDIR=$(pwd)
VERSION=$(${PYTHON} -V 2>&1 | tr -d '\n')
echo ""
echo "========== Running ${VERSION} Tests =========="
#find ./src/ ./tools/ -name "*.pyc" -exec rm {} \;
for i in $SCRIPTS; do
set +e #disable error trapping
echo "Running $i"
cd "$(dirname "$i")"
SCRIPT=$(basename "$i")
if ! $PYTHON -B "./${SCRIPT}"; then
echo "Test $i failed"
ERRORS=$((ERRORS + 1))
fi
set -e #re-enable error trapping
cd "$BASEDIR"
done
}
function run_pre_commit {
set +e #disable error trapping
if ! pre-commit run --all-files --hook-stage manual check-ast ; then
echo "Syntax check failed."
ERRORS=$((ERRORS+1))
fi
set -e #re-enable error trapping
set +e #disable error trapping
if ! pre-commit run --all-files --hook-stage manual check-ast; then
echo "Syntax check failed."
ERRORS=$((ERRORS + 1))
fi
set -e #re-enable error trapping
}
#===============================================================================
@ -39,7 +39,7 @@ ERRORS=0
cd /workspace/cp2k
# find executable python scripts
ALL_TEST_SCRIPTS=$(find ./src/ ./tools/ -name "*_test.py" -executable)
ALL_TEST_SCRIPTS=$(find ./src/ ./tools/ -name "*_test.py" -executable)
# python 3.x
run_tests python3 "${ALL_TEST_SCRIPTS}"
@ -48,11 +48,11 @@ run_tests python3 "${ALL_TEST_SCRIPTS}"
run_pre_commit
# print report
NUM_TEST_SCRIPTS=$(( $(wc -w <<< "${ALL_TEST_SCRIPTS}") + 1 ))
NUM_TEST_SCRIPTS=$(($(wc -w <<< "${ALL_TEST_SCRIPTS}") + 1))
echo ""
echo "Summary: Run ${NUM_TEST_SCRIPTS} Python test scripts, found ${ERRORS} errors."
if [ $ERRORS == 0 ]; then
echo "Status: OK"
echo "Status: OK"
else
echo "Status: FAILED"
echo "Status: FAILED"
fi

View file

@ -2,9 +2,9 @@
# author: Ole Schuett
if (( $# != 2 )) ; then
echo "Usage: test_regtest.sh <ARCH> <VERSION>"
exit 1
if (($# != 2)); then
echo "Usage: test_regtest.sh <ARCH> <VERSION>"
exit 1
fi
ARCH=$1
@ -14,43 +14,43 @@ VERSION=$2
source /opt/cp2k-toolchain/install/setup
# Make OpenMPI happy.
if command -v ompi_info &> /dev/null ; then
TESTOPTS="-mpiexec 'mpiexec --bind-to none --allow-run-as-root' ${TESTOPTS}"
export OMPI_MCA_plm_rsh_agent=/bin/false
if command -v ompi_info &> /dev/null; then
TESTOPTS="-mpiexec 'mpiexec --bind-to none --allow-run-as-root' ${TESTOPTS}"
export OMPI_MCA_plm_rsh_agent=/bin/false
fi
# Switch to stable DBCSR version if requested.
if [ -n "${USE_STABLE_DBCSR}" ] ; then
echo "Switching to stable DBCSR version..."
if ! git -C cp2k/exts/dbcsr checkout v2.1.0-rc16 ; then
echo -e "\nSummary: Could not checkout stable DBCSR version."
echo -e "Status: FAILED\n"
exit 0
fi
ln -fs python3 /usr/bin/python # DBCSR v2.1.0-rc16 needs the python binary.
if [ -n "${USE_STABLE_DBCSR}" ]; then
echo "Switching to stable DBCSR version..."
if ! git -C cp2k/exts/dbcsr checkout v2.1.0-rc16; then
echo -e "\nSummary: Could not checkout stable DBCSR version."
echo -e "Status: FAILED\n"
exit 0
fi
ln -fs python3 /usr/bin/python # DBCSR v2.1.0-rc16 needs the python binary.
fi
# Compile cp2k.
echo -en "\nCompiling cp2k... "
cd /workspace/cp2k || exit 1
if make -j ARCH="${ARCH}" VERSION="${VERSION}" &> make.out ; then
echo "done."
if make -j ARCH="${ARCH}" VERSION="${VERSION}" &> make.out; then
echo "done."
else
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
fi
# Check benchmark files for input errors.
if [[ "${ARCH}" == "local" ]] ; then
echo -en "\nChecking benchmarks... "
if ! ./tools/regtesting/check_inputs.py "./exe/${ARCH}/cp2k.${VERSION}" "./benchmarks/" ; then
echo -e "\nSummary: Some benchmark inputs could not be parsed."
echo -e "Status: FAILED\n"
exit 0
fi
if [[ "${ARCH}" == "local" ]]; then
echo -en "\nChecking benchmarks... "
if ! ./tools/regtesting/check_inputs.py "./exe/${ARCH}/cp2k.${VERSION}" "./benchmarks/"; then
echo -e "\nSummary: Some benchmark inputs could not be parsed."
echo -e "Status: FAILED\n"
exit 0
fi
fi
# Run regtests.

View file

@ -7,17 +7,17 @@ source /opt/cp2k-toolchain/install/setup
echo -e '\n========== Compiling CP2K =========='
cd /workspace/cp2k
for VERSION in 'psmp' 'ssmp' ; do
echo -n "Compiling cp2k.${VERSION}... "
if make -j VERSION="${VERSION}" &> make.out ; then
echo "done."
else
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
fi
for VERSION in 'psmp' 'ssmp'; do
echo -n "Compiling cp2k.${VERSION}... "
if make -j VERSION="${VERSION}" &> make.out; then
echo "done."
else
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
fi
done
echo -e '\n========== Running Scaling Test =========='

View file

@ -3,38 +3,41 @@
set -eo pipefail
ARGS=${ARGS:-} # Set to "-v" for debugging
SCRIPTDIR=$(cd $(dirname "$0"); pwd) # Pick up full path to scripts from wherever doxify.sh lives
SCRIPTDIR=$(
cd $(dirname "$0")
pwd
) # Pick up full path to scripts from wherever doxify.sh lives
nwarnings=0
for file in "$@"; do
"${SCRIPTDIR}/is_fypp.py" "${file}" && continue
"${SCRIPTDIR}/is_fypp.py" "${file}" && continue
# generate temp-file names
tmp_file=`mktemp`
# generate temp-file names
tmp_file=$(mktemp)
# * Run the fixcomments.pl script. This adds comment blocks to any subroutine/function
# definitions that don't have any and checks that existing comments are complete,
# fixing these if required.
# * After adding comments, remove any double comment header lines
"${SCRIPTDIR}/fixcomments.pl" ${ARGS} "${file}" \
| "${SCRIPTDIR}/remove_extra_comments.pl" ${ARGS} > "${tmp_file}"
# * Run the fixcomments.pl script. This adds comment blocks to any subroutine/function
# definitions that don't have any and checks that existing comments are complete,
# fixing these if required.
# * After adding comments, remove any double comment header lines
"${SCRIPTDIR}/fixcomments.pl" ${ARGS} "${file}" |
"${SCRIPTDIR}/remove_extra_comments.pl" ${ARGS} > "${tmp_file}"
# Copy the final modified source file on top of the original file
if ! cmp -s "${file}" "${tmp_file}" ; then
cp "${tmp_file}" "${file}"
fi
# Copy the final modified source file on top of the original file
if ! cmp -s "${file}" "${tmp_file}"; then
cp "${tmp_file}" "${file}"
fi
# Remove temp-file
rm -f "${tmp_file}"
# Remove temp-file
rm -f "${tmp_file}"
if grep -e "UNMATCHED_PROCEDURE_ARGUMENT" \
-e "UNKNOWN_DOXYGEN_COMMENT" \
-e "UNKNOWN_COMMENT" \
"${file}" ; then
echo "Found doxify warnings in ${file}"
((nwarnings++))
fi
if grep -e "UNMATCHED_PROCEDURE_ARGUMENT" \
-e "UNKNOWN_DOXYGEN_COMMENT" \
-e "UNKNOWN_COMMENT" \
"${file}"; then
echo "Found doxify warnings in ${file}"
((nwarnings++))
fi
done
exit ${nwarnings}

View file

@ -4,15 +4,15 @@
DOXYGENDIR="./doxygen"
for SRC_FN in $(find ./src/ -type f) ; do
echo "Preprocessing ${SRC_FN}"
DEST_FN="${DOXYGENDIR}/${SRC_FN}"
mkdir -p $(dirname "${DEST_FN}")
if [[ "${SRC_FN}" == *.F ]] ; then
./tools/build_utils/fypp "${SRC_FN}" "${DEST_FN}" &> /dev/null
else
cp "${SRC_FN}" "${DEST_FN}"
fi
for SRC_FN in $(find ./src/ -type f); do
echo "Preprocessing ${SRC_FN}"
DEST_FN="${DOXYGENDIR}/${SRC_FN}"
mkdir -p $(dirname "${DEST_FN}")
if [[ "${SRC_FN}" == *.F ]]; then
./tools/build_utils/fypp "${SRC_FN}" "${DEST_FN}" &> /dev/null
else
cp "${SRC_FN}" "${DEST_FN}"
fi
done
cp tools/logo/cp2k_logo_100.png ${DOXYGENDIR}/cp2k_logo.png

View file

@ -10,29 +10,29 @@ find ./src/ -type f -not -path "*/preprettify/*" -not -path "*/.git/*" -print0 |
md5sum ./data/POTENTIAL >> checksums.md5
make -j 16 pretty
make -j 16 pretty # run twice to ensure consistency with doxify
make -j 16 pretty # run twice to ensure consistency with doxify
cd data
cat GTH_POTENTIALS HF_POTENTIALS NLCC_POTENTIALS ALL_POTENTIALS > POTENTIAL
cd ..
nfiles=`wc -l checksums.md5 | cut -f 1 -d " "`
nfiles=$(wc -l checksums.md5 | cut -f 1 -d " ")
summary="Checked $nfiles files."
status="OK"
echo "Searching for doxify warnings ..."
if grep -r -e "UNMATCHED_PROCEDURE_ARGUMENT" \
-e "UNKNOWN_DOXYGEN_COMMENT" \
-e "UNKNOWN_COMMENT" \
--exclude-dir=".git" \
--exclude-dir="preprettify" \
./src/* ; then
-e "UNKNOWN_DOXYGEN_COMMENT" \
-e "UNKNOWN_COMMENT" \
--exclude-dir=".git" \
--exclude-dir="preprettify" \
./src/*; then
summary="Found doxify warnings"
status="FAILED"
fi
echo "Comparing MD5-sums ..."
if ! md5sum --quiet --check checksums.md5 ; then
if ! md5sum --quiet --check checksums.md5; then
summary='Code not invariant under "make pretty"'
status="FAILED"
fi

View file

@ -33,25 +33,31 @@ TR=$(command -v tr)
if [ "" != "${HOME}" ]; then
CONFIGFILE=${HOME}/.xconfigure-cp2k-plan
else
HERE=$(cd $(dirname $0); pwd -P)
HERE=$(
cd $(dirname $0)
pwd -P
)
CONFIGFILE=${HERE}/.xconfigure-cp2k-plan
fi
function isqrt {
s=1073741824; x=$1; y=0
s=1073741824
x=$1
y=0
while [ "0" != "$((0 < s))" ]; do
b=$((y | s)); y=$((y >> 1))
b=$((y | s))
y=$((y >> 1))
if [ "0" != "$((b <= x))" ]; then
x=$((x - b)); y=$((y | s))
x=$((x - b))
y=$((y | s))
fi
s=$((s >> 2))
done
echo "${y}"
}
if [ "" != "${GREP}" ] && [ "" != "${SORT}" ] && [ "" != "${HEAD}" ] && \
[ "" != "${SEQ}" ] && [ "" != "${CUT}" ] && [ "" != "${TR}" ];
then
if [ "" != "${GREP}" ] && [ "" != "${SORT}" ] && [ "" != "${HEAD}" ] &&
[ "" != "${SEQ}" ] && [ "" != "${CUT}" ] && [ "" != "${TR}" ]; then
HELP=0
if [ "--help" = "$1" ] || [ "-help" = "$1" ] || [ "-h" = "$1" ]; then
HELP=1
@ -60,10 +66,9 @@ then
TOTALNUMNODES=$1
shift
fi
if [ -e /proc/cpuinfo ] && [ "" != "$(command -v wc)" ];
then
if [ -e /proc/cpuinfo ] && [ "" != "$(command -v wc)" ]; then
NS=$(${GREP} "physical id" /proc/cpuinfo | ${SORT} -u | wc -l | ${TR} -d " ")
NC=$((NS*$(${GREP} -m1 "cpu cores" /proc/cpuinfo | ${TR} -d " " | ${CUT} -d: -f2)))
NC=$((NS * $(${GREP} -m1 "cpu cores" /proc/cpuinfo | ${TR} -d " " | ${CUT} -d: -f2)))
NT=$(${GREP} "core id" /proc/cpuinfo | wc -l | ${TR} -d " ")
elif [ "Darwin" = "$(uname)" ] && [ "" != "$(command -v sysctl)" ]; then
NS=$(sysctl hw.packages | ${CUT} -d: -f2 | ${TR} -d " ")
@ -71,11 +76,11 @@ then
NT=$(sysctl hw.logicalcpu | ${CUT} -d: -f2 | ${TR} -d " ")
fi
if [ "" != "${NC}" ] && [ "" != "${NT}" ]; then
HT=$((NT/NC))
HT=$((NT / NC))
fi
OUTPUT=0
if [ "" = "$1" ]; then
if [ -e ${CONFIGFILE} ]; then # remind configuration
if [ -e ${CONFIGFILE} ]; then # remind configuration
NCORESPERNODE=$(${CUT} -d" " -f1 ${CONFIGFILE})
elif [ "" != "${NC}" ]; then
NCORESPERNODE=${NC}
@ -86,7 +91,7 @@ then
shift
fi
if [ "" = "$1" ]; then
if [ -e ${CONFIGFILE} ]; then # remind configuration
if [ -e ${CONFIGFILE} ]; then # remind configuration
NTHREADSPERCORE=$(${CUT} -d" " -f2 ${CONFIGFILE})
elif [ "" != "${HT}" ]; then
NTHREADSPERCORE=${HT}
@ -97,7 +102,7 @@ then
shift
fi
if [ "" = "$1" ]; then
if [ -e ${CONFIGFILE} ]; then # remind configuration
if [ -e ${CONFIGFILE} ]; then # remind configuration
NPROCSPERNODE=$(${CUT} -d" " -f3 ${CONFIGFILE})
elif [ "" != "${NS}" ]; then
NPROCSPERNODE=${NS}
@ -120,31 +125,30 @@ then
exit 0
fi
# min. number of ranks per node
MIN_NRANKS=$((PENALTY_MIN*NPROCSPERNODE))
MIN_NRANKS=$((PENALTY_MIN * NPROCSPERNODE))
# remember system configuration
if [ "0" != "${OUTPUT}" ]; then
echo "${NCORESPERNODE} ${NTHREADSPERCORE} ${NPROCSPERNODE}" > ${CONFIGFILE} 2> /dev/null
fi
NCORESTOTAL=$((TOTALNUMNODES*NCORESPERNODE))
NCORESOCKET=$((NCORESPERNODE/NPROCSPERNODE))
NCORESTOTAL=$((TOTALNUMNODES * NCORESPERNODE))
NCORESOCKET=$((NCORESPERNODE / NPROCSPERNODE))
echo "================================================================================"
echo "${NCORESTOTAL} cores: ${TOTALNUMNODES} node(s) with ${NPROCSPERNODE}x${NCORESOCKET} core(s) per node and ${NTHREADSPERCORE} thread(s) per core"
echo "================================================================================"
NRANKSMIN=$((TOTALNUMNODES*NPROCSPERNODE))
NRANKSMIN=$((TOTALNUMNODES * NPROCSPERNODE))
NSQRT_MIN=$(isqrt ${NRANKSMIN})
NSQRT_MAX=$(isqrt ${NCORESTOTAL})
for NSQRT in $(${SEQ} ${NSQRT_MIN} ${NSQRT_MAX}); do
NSQR=$((NSQRT*NSQRT))
NRANKSPERNODE=$((NSQR/TOTALNUMNODES))
if [ "${NSQR}" = "$((TOTALNUMNODES*NRANKSPERNODE))" ]; then
REST=$((NCORESPERNODE%NRANKSPERNODE))
ODD=$(((NRANKSPERNODE%NPROCSPERNODE)!=0))
NSQR=$((NSQRT * NSQRT))
NRANKSPERNODE=$((NSQR / TOTALNUMNODES))
if [ "${NSQR}" = "$((TOTALNUMNODES * NRANKSPERNODE))" ]; then
REST=$((NCORESPERNODE % NRANKSPERNODE))
ODD=$(((NRANKSPERNODE % NPROCSPERNODE) != 0))
# criterion to add penalty in case of unbalanced load
if [ "0" != "$((PENALTY_ODD*MIN_NRANKS*REST <= NCORESPERNODE))" ] || [ "0" = "${ODD}" ]; then
if [ "0" != "$((MIN_NRANKS*REST <= NCORESPERNODE))" ] && \
[ "0" != "$((MIN_NRANKS <= NRANKSPERNODE))" ];
then
PENALTY=$(((100*REST+ODD*PENALTY_ODD+NCORESPERNODE-1)/NCORESPERNODE))
if [ "0" != "$((PENALTY_ODD * MIN_NRANKS * REST <= NCORESPERNODE))" ] || [ "0" = "${ODD}" ]; then
if [ "0" != "$((MIN_NRANKS * REST <= NCORESPERNODE))" ] &&
[ "0" != "$((MIN_NRANKS <= NRANKSPERNODE))" ]; then
PENALTY=$(((100 * REST + ODD * PENALTY_ODD + NCORESPERNODE - 1) / NCORESPERNODE))
RESULTS+="${NRANKSPERNODE};${PENALTY};${NSQRT}\n"
fi
fi
@ -152,28 +156,27 @@ then
done
RESULTS=$(echo -e "${RESULTS}" | ${GREP} -v "^$" | ${SORT} -t";" -u -k2n -k1nr)
NRANKSPERNODE_TOP=$(echo "${RESULTS}" | ${CUT} -d";" -f1 | ${HEAD} -n1)
NTHREADSPERNODE=$((NCORESPERNODE*NTHREADSPERCORE))
NSQR_MAX=$((NSQRT_MAX*NSQRT_MAX))
PENALTY_NCORES=$((NCORESTOTAL-NSQR_MAX))
PENALTY_TOP=$(((100*PENALTY_NCORES+NCORESTOTAL-1)/NCORESTOTAL))
NTHREADSPERNODE=$((NCORESPERNODE * NTHREADSPERCORE))
NSQR_MAX=$((NSQRT_MAX * NSQRT_MAX))
PENALTY_NCORES=$((NCORESTOTAL - NSQR_MAX))
PENALTY_TOP=$(((100 * PENALTY_NCORES + NCORESTOTAL - 1) / NCORESTOTAL))
NRANKSPERNODE=${NCORESPERNODE}
OUTPUT_POT=0
while [ "0" != "$((NRANKSPERNODE_TOP < NRANKSPERNODE))" ]; do
# criterion to add penalty in case of unbalanced load
ODD=$(((NRANKSPERNODE%NPROCSPERNODE)!=0))
if [ "0" != "$((PENALTY_ODD*MIN_NRANKS*PENALTY_NCORES <= NCORESTOTAL))" ] || [ "0" = "${ODD}" ]; then
NTHREADSPERRANK=$((NTHREADSPERNODE/NRANKSPERNODE))
if [ "0" != "$((MIN_NRANKS*PENALTY_NCORES <= NCORESTOTAL))" ] && \
[ "0" != "$((MIN_NRANKS <= NRANKSPERNODE))" ];
then
NRANKS_CUR=$((TOTALNUMNODES*NRANKSPERNODE))
ODD=$(((NRANKSPERNODE % NPROCSPERNODE) != 0))
if [ "0" != "$((PENALTY_ODD * MIN_NRANKS * PENALTY_NCORES <= NCORESTOTAL))" ] || [ "0" = "${ODD}" ]; then
NTHREADSPERRANK=$((NTHREADSPERNODE / NRANKSPERNODE))
if [ "0" != "$((MIN_NRANKS * PENALTY_NCORES <= NCORESTOTAL))" ] &&
[ "0" != "$((MIN_NRANKS <= NRANKSPERNODE))" ]; then
NRANKS_CUR=$((TOTALNUMNODES * NRANKSPERNODE))
SQRTNRANKS=$(isqrt $((NRANKS_CUR)))
NRANKS_SQR=$((SQRTNRANKS*SQRTNRANKS))
NRANKS_COM=$((NRANKSPERNODE<NRANKS_SQR?(NRANKS_SQR/NRANKSPERNODE*NRANKSPERNODE):NRANKS_SQR))
PENALTY=$((100*(NRANKS_CUR+ODD*PENALTY_ODD-NRANKS_COM)/NRANKS_COM))
NRANKS_SQR=$((SQRTNRANKS * SQRTNRANKS))
NRANKS_COM=$((NRANKSPERNODE < NRANKS_SQR ? (NRANKS_SQR / NRANKSPERNODE * NRANKSPERNODE) : NRANKS_SQR))
PENALTY=$((100 * (NRANKS_CUR + ODD * PENALTY_ODD - NRANKS_COM) / NRANKS_COM))
echo "[${NRANKSPERNODE}x${NTHREADSPERRANK}]: ${NRANKSPERNODE} ranks per node with ${NTHREADSPERRANK} thread(s) per rank (${PENALTY}% penalty)"
if [ "0" != "$((PENALTY_TOP < PENALTY))" ]; then PENALTY_TOP=${PENALTY}; fi
OUTPUT_POT=$((OUTPUT_POT+1))
OUTPUT_POT=$((OUTPUT_POT + 1))
fi
fi
NRANKSPERNODE=$((NRANKSPERNODE >> 1))
@ -186,59 +189,56 @@ then
RESULTS=$(echo -e "${RESULTS}" | ${TR} " " "\n" | ${SORT} -t";" -k1nr -k2n)
for RESULT in ${RESULTS}; do
NRANKSPERNODE=$(echo "${RESULT}" | ${CUT} -d";" -f1)
NTHREADSPERRANK=$((NTHREADSPERNODE/NRANKSPERNODE))
NTHREADSPERRANK=$((NTHREADSPERNODE / NRANKSPERNODE))
PENALTY=$(echo "${RESULT}" | ${CUT} -d";" -f2)
if [ "0" != "$((OUTPUT_SQR < OUTPUT_POT))" ] || \
[ "0" != "$((PENALTY <= PENALTY_TOP))" ];
then
if [ "0" != "$((OUTPUT_SQR < OUTPUT_POT))" ] ||
[ "0" != "$((PENALTY <= PENALTY_TOP))" ]; then
NSQRT=$(echo "${RESULT}" | ${CUT} -d";" -f3)
echo "[${NRANKSPERNODE}x${NTHREADSPERRANK}]: ${NRANKSPERNODE} ranks per node with ${NTHREADSPERRANK} thread(s) per rank (${PENALTY}% penalty) -> ${NSQRT}x${NSQRT}"
OUTPUT_SQR=$((OUTPUT_SQR+1))
OUTPUT_SQR=$((OUTPUT_SQR + 1))
fi
done
if [ "0" != "${OUTPUT_SQR}" ]; then
echo "--------------------------------------------------------------------------------"
fi
for NRANKSPERNODE in $(${SEQ} ${MIN_NRANKS} ${NCORESPERNODE}); do
REST=$((NCORESPERNODE%NRANKSPERNODE))
PENALTY=$(((100*REST+NCORESPERNODE-1)/NCORESPERNODE))
REST=$((NCORESPERNODE % NRANKSPERNODE))
PENALTY=$(((100 * REST + NCORESPERNODE - 1) / NCORESPERNODE))
# criterion to add penalty in case of unbalanced load
ODD=$(((NRANKSPERNODE%NPROCSPERNODE)!=0))
if [ "0" != "$((PENALTY_ODD*MIN_NRANKS*REST <= NCORESPERNODE))" ] || [ "0" = "${ODD}" ];
then
if [ "0" != "$((MIN_NRANKS*REST <= NCORESPERNODE))" ] && \
[ "0" != "$((MIN_NRANKS <= NRANKSPERNODE))" ];
then
SQRT=$(isqrt $((TOTALNUMNODES*NRANKSPERNODE)))
NUMCORES=$((SQRT*SQRT))
NUMNODES=$((NUMCORES/NRANKSPERNODE))
if [ "0" = "$((NUMCORES-NUMNODES*NRANKSPERNODE))" ]; then
ODD=$(((NRANKSPERNODE % NPROCSPERNODE) != 0))
if [ "0" != "$((PENALTY_ODD * MIN_NRANKS * REST <= NCORESPERNODE))" ] || [ "0" = "${ODD}" ]; then
if [ "0" != "$((MIN_NRANKS * REST <= NCORESPERNODE))" ] &&
[ "0" != "$((MIN_NRANKS <= NRANKSPERNODE))" ]; then
SQRT=$(isqrt $((TOTALNUMNODES * NRANKSPERNODE)))
NUMCORES=$((SQRT * SQRT))
NUMNODES=$((NUMCORES / NRANKSPERNODE))
if [ "0" = "$((NUMCORES - NUMNODES * NRANKSPERNODE))" ]; then
SUGGEST_LO+="${NUMNODES}\n"
fi
NUMCORES=$(((SQRT-1)*(SQRT-1)))
NUMNODES=$((NUMCORES/NRANKSPERNODE))
if [ "0" = "$((NUMCORES-NUMNODES*NRANKSPERNODE))" ]; then
NUMCORES=$(((SQRT - 1) * (SQRT - 1)))
NUMNODES=$((NUMCORES / NRANKSPERNODE))
if [ "0" = "$((NUMCORES - NUMNODES * NRANKSPERNODE))" ]; then
SUGGEST_LO+="${NUMNODES}\n"
fi
NUMCORES=$(((SQRT+1)*(SQRT+1)))
NUMNODES=$((NUMCORES/NRANKSPERNODE))
if [ "0" = "$((NUMCORES-NUMNODES*NRANKSPERNODE))" ]; then
NUMCORES=$(((SQRT + 1) * (SQRT + 1)))
NUMNODES=$((NUMCORES / NRANKSPERNODE))
if [ "0" = "$((NUMCORES - NUMNODES * NRANKSPERNODE))" ]; then
SUGGEST_HI+="${NUMNODES}\n"
fi
NUMCORES=$(((SQRT+2)*(SQRT+2)))
NUMNODES=$((NUMCORES/NRANKSPERNODE))
if [ "0" = "$((NUMCORES-NUMNODES*NRANKSPERNODE))" ] && [ "" = "${SUGGEST_HI}" ]; then
NUMCORES=$(((SQRT + 2) * (SQRT + 2)))
NUMNODES=$((NUMCORES / NRANKSPERNODE))
if [ "0" = "$((NUMCORES - NUMNODES * NRANKSPERNODE))" ] && [ "" = "${SUGGEST_HI}" ]; then
SUGGEST_HI+="${NUMNODES}\n"
fi
fi
fi
done
SUGGEST_LO=$(echo -e "${SUGGEST_LO}" \
| ${GREP} -vw "${TOTALNUMNODES}" \
| ${SORT} -nr | ${GREP} -v "^$" -m1)
SUGGEST_HI=$(echo -e "${SUGGEST_HI}" \
| ${GREP} -vw "${TOTALNUMNODES}" \
| ${SORT} -n | ${GREP} -v "^$" -m1)
SUGGEST_LO=$(echo -e "${SUGGEST_LO}" |
${GREP} -vw "${TOTALNUMNODES}" |
${SORT} -nr | ${GREP} -v "^$" -m1)
SUGGEST_HI=$(echo -e "${SUGGEST_HI}" |
${GREP} -vw "${TOTALNUMNODES}" |
${SORT} -n | ${GREP} -v "^$" -m1)
if [ "0" != "${SUGGEST_LO}" ]; then
echo "Try also the following node counts: ${SUGGEST_LO} ${SUGGEST_HI}"
else
@ -248,4 +248,3 @@ else
echo "Error: missing prerequisites!"
exit 1
fi

View file

@ -7,9 +7,9 @@ set -o nounset
PYTHON=$(command -v python3 || true)
if [ -z "${PYTHON}" ] ; then
echo "ERROR: the python3 executable could not be found, but is required for the complete build process"
exit 1
if [ -z "${PYTHON}" ]; then
echo "ERROR: the python3 executable could not be found, but is required for the complete build process"
exit 1
fi
SCRIPTDIR=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
@ -17,16 +17,16 @@ SCRIPTDIR=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
# here we assume that this script is located in the tools/ subfolder
ENVDIR="${SCRIPTDIR}/../.pre-commit-env"
if [ -f "${ENVDIR}/bootstrap_done" ] ; then
echo "The environment in <CP2K-SRC-DIR>/.pre-commit-env/ is ready to use..."
exit 0
if [ -f "${ENVDIR}/bootstrap_done" ]; then
echo "The environment in <CP2K-SRC-DIR>/.pre-commit-env/ is ready to use..."
exit 0
fi
echo "Installing all required tools to run pre-commit in <CP2K-SRC-DIR>/.pre-commit-env/"
echo "Creating the virtualenv for pre-commit..."
if [ ! -d "${ENVDIR}" ] ; then
"${PYTHON}" -m venv "${ENVDIR}"
if [ ! -d "${ENVDIR}" ]; then
"${PYTHON}" -m venv "${ENVDIR}"
fi
# resolve the relative path now that we have it:
@ -39,28 +39,28 @@ ENVDIR=$(CDPATH='' cd -- "${ENVDIR}" && pwd)
PYTHON=$(command -v python)
PIP=$(command -v pip || true)
if [ -z "${PIP}" ] ; then
echo "Bootstrapping the pip command inside the virtual environment..."
if [ -z "${PIP}" ]; then
echo "Bootstrapping the pip command inside the virtual environment..."
FETCHER="$(command -v curl || true)"
FETCHER_OPTS=""
FETCHER="$(command -v curl || true)"
FETCHER_OPTS=""
if [ -z "${FETCHER}" ] ; then
FETCHER="$(command -v wget || true)"
FETCHER_OPTS="-O-"
fi
if [ -z "${FETCHER}" ]; then
FETCHER="$(command -v wget || true)"
FETCHER_OPTS="-O-"
fi
if [ -z "${FETCHER}" ] ; then
echo "ERROR: neither wget nor curl seem to be available, please download"
echo " https://bootstrap.pypa.io/get-pip.py"
echo "manually and run:"
echo " python3 get-pip.py"
echo "to install the pip command, then rerun this script."
rm -rf "${ENVDIR}" # cleaning up to avoid picking up the unprefixed pip on the rerun
exit 1
fi
if [ -z "${FETCHER}" ]; then
echo "ERROR: neither wget nor curl seem to be available, please download"
echo " https://bootstrap.pypa.io/get-pip.py"
echo "manually and run:"
echo " python3 get-pip.py"
echo "to install the pip command, then rerun this script."
rm -rf "${ENVDIR}" # cleaning up to avoid picking up the unprefixed pip on the rerun
exit 1
fi
"${FETCHER}" ${FETCHER_OPTS} "https://bootstrap.pypa.io/get-pip.py" | "${PYTHON}"
"${FETCHER}" ${FETCHER_OPTS} "https://bootstrap.pypa.io/get-pip.py" | "${PYTHON}"
fi
PIP=$(command -v pip)

View file

@ -13,6 +13,6 @@ docker push gcr.io/cp2k-org-project/img_cp2kprecommit:${SHORT_SHA}
docker push gcr.io/cp2k-org-project/img_cp2kprecommit:latest
gcloud run deploy cp2k-precommit --platform=managed --region=us-central1 \
--image=gcr.io/cp2k-org-project/img_cp2kprecommit:${SHORT_SHA}
--image=gcr.io/cp2k-org-project/img_cp2kprecommit:${SHORT_SHA}
#EOF

View file

@ -5,27 +5,27 @@
trap "exit" INT
if [ -z "${GIT_REF}" ]; then
# Server mode.
gunicorn --bind=:8080 --workers=1 --threads=8 --timeout=0 precommit_server:app &
wait # Can be interrupted with ctrl-C.
# Server mode.
gunicorn --bind=:8080 --workers=1 --threads=8 --timeout=0 precommit_server:app &
wait # Can be interrupted with ctrl-C.
else
# CI mode.
echo -e "\n========== Fetching Git Commit =========="
cd /workspace/cp2k
git fetch --quiet origin "${GIT_BRANCH}"
git reset --quiet --hard "${GIT_REF}"
git submodule update --init --recursive
git --no-pager log -1 --pretty='%nCommitSHA: %H%nCommitTime: %ci%nCommitAuthor: %an%nCommitSubject: %s%n'
# CI mode.
echo -e "\n========== Fetching Git Commit =========="
cd /workspace/cp2k
git fetch --quiet origin "${GIT_BRANCH}"
git reset --quiet --hard "${GIT_REF}"
git submodule update --init --recursive
git --no-pager log -1 --pretty='%nCommitSHA: %H%nCommitTime: %ci%nCommitAuthor: %an%nCommitSubject: %s%n'
echo -e "\n========== Starting Precommit Server =========="
cd ./tools/precommit/
gunicorn --bind=:8080 --workers=1 --threads=8 --timeout=0 precommit_server:app &> server.logs &
sleep 3
cat server.logs
echo -e "\n========== Starting Precommit Server =========="
cd ./tools/precommit/
gunicorn --bind=:8080 --workers=1 --threads=8 --timeout=0 precommit_server:app &> server.logs &
sleep 3
cat server.logs
echo -e "\n========== Running Precommit Checks =========="
export CP2K_PRECOMMIT_SERVER="http://127.0.0.1:8080"
./precommit.py --no-cache --progressbar-wait=10 || true
echo -e "\n========== Running Precommit Checks =========="
export CP2K_PRECOMMIT_SERVER="http://127.0.0.1:8080"
./precommit.py --no-cache --progressbar-wait=10 || true
fi
#EOF

View file

@ -6,21 +6,21 @@ set -o errexit
set -o nounset
PYTHON=$(command -v python3 || true)
if [ -z "${PYTHON}" ] ; then
echo "ERROR: the python3 executable could not be found, but is required for the complete build process"
exit 1
if [ -z "${PYTHON}" ]; then
echo "ERROR: the python3 executable could not be found, but is required for the complete build process"
exit 1
fi
CURL="$(command -v curl || true)"
if [ -z "${CURL}" ] ; then
echo "ERROR: curl is missing, but required by Spack"
exit 1
if [ -z "${CURL}" ]; then
echo "ERROR: curl is missing, but required by Spack"
exit 1
fi
GIT="$(command -v git || true)"
if [ -z "${GIT}" ] ; then
echo "ERROR: the git command is missing, but required by Spack"
exit 1
if [ -z "${GIT}" ]; then
echo "ERROR: the git command is missing, but required by Spack"
exit 1
fi
SCRIPTDIR=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
@ -49,33 +49,33 @@ smm_driver="libxsmm"
libint_lmax=5
nprocs=$(nproc 2>/dev/null || echo 1)
nprocs=$(nproc 2> /dev/null || echo 1)
no_check_certificates=0
parse_with_arg() {
# shellcheck disable=SC2039
# ... non-posix but almost all shells support it
local input_var="${1#--with*=}"
case "${input_var}" in
"$1"|install)
# lone --with-<kw> treated as --with-<kw>=install
echo "__INSTALL__"
;;
system)
echo "__SYSTEM__"
;;
no)
echo "__DONTUSE__"
;;
*)
echo "${input_var}"
;;
esac
# shellcheck disable=SC2039
# ... non-posix but almost all shells support it
local input_var="${1#--with*=}"
case "${input_var}" in
"$1" | install)
# lone --with-<kw> treated as --with-<kw>=install
echo "__INSTALL__"
;;
system)
echo "__SYSTEM__"
;;
no)
echo "__DONTUSE__"
;;
*)
echo "${input_var}"
;;
esac
}
usage() {
cat << eof
cat << eof
install_cp2k_toolchain.sh: [args]
Install Spack environments with CP2K dependencies and generate corresponding CP2K arch files
@ -92,319 +92,320 @@ eof
}
usage_error() {
echo "ERROR: $1"
usage
exit 1
echo "ERROR: $1"
usage
exit 1
}
configure_spack_env() {
# shellcheck disable=SC2039
local env="$1"
shift
# shellcheck disable=SC2039
local env="$1"
shift
# add all the other settings
while [ "$#" -ge 1 ]; do
"${SPACK}" --env-dir "${SPACKENVDIR}/${env}" config add "$1"
shift
done
# add all the other settings
while [ "$#" -ge 1 ]; do
"${SPACK}" --env-dir "${SPACKENVDIR}/${env}" config add "$1"
shift
done
}
while [ "$#" -ge 1 ] ; do
case "$1" in
-j|--jobs)
nprocs=$1
shift
;;
--no-check-certificate)
no_check_certificates=1
;;
--install-all)
# enable (almost) all variants
for variant in ${AVAILABLE_VARIANTS} ; do
eval "with_${variant}=__INSTALL__"
done
mpi_provider="mpich"
;;
--mpi-mode=*)
case "${1#*=}" in
mpich)
mpi_provider="mpich"
;;
openmpi)
mpi_provider="openmpi"
;;
intelmpi)
mpi_provider="intel-mpi"
;;
no)
mpi_provider="none"
;;
*)
usage_error "'$1' is not supported"
;;
esac
break
;;
--math-mode=*)
case "${1#*=}" in
cray)
lapack_provider="cray-libsci"
fftw_provider="cray-libsci"
scalapack_provider="cray-libsci"
;;
mkl)
lapack_provider="intel-mkl"
fftw_provider="intel-mkl"
scalapack_provider="intel-mkl"
;;
openblas)
lapack_provider="openblas"
;;
reflapack)
lapack_provider="netlib-lapack"
;;
*)
usage_error "'$1' is not supported"
esac
break
;;
#--gpu-ver=*)
# case "${1#*=}" in
# K20X)
# gpuver="K20X"
# ;;
# K40)
# gpuver="K40"
# ;;
# K80)
# gpuver="K80"
# ;;
# P100)
# gpuver="P100"
# ;;
# V100)
# gpuver="V100"
# ;;
# no)
# gpuver="no"
# ;;
# *)
# usage_error "'$1' is not supported"
# esac
# ;;
--libint-lmax=*)
libint_lmax="${1#*=}"
;;
--with-mpich*)
with_mpich=$(parse_with_arg "$1")
if [ "${with_mpich}" != __DONTUSE__ ] ; then
mpi_provider="mpich"
fi
;;
--with-openmpi*)
with_openmpi=$(parse_with_arg "$1")
if [ "${with_openmpi}" = __INSTALL__ ] ; then
mpi_provider="openmpi"
elif [ "${with_openmpi}" = __DONTUSE__ ] ; then
if [ "${mpi_provider}" = none ] || [ "${mpi_provider}" = openmpi ] ; then
echo "ERROR: an MPI library is required to build CP2K since you didn't pass --mpi-mode=no"
mpi_provider="openmpi"
fi
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for $1)"
exit 1
fi
;;
--with-intelmpi*)
with_intelmpi=$(parse_with_arg "$1")
if [ "${with_intelmpi}" = __INSTALL__ ] ; then
mpi_provider="intel-mpi"
elif [ "${with_intelmpi}" = __DONTUSE__ ] ; then
if [ "${mpi_provider}" = "intel-mpi" ] ; then
mpi_provider="openmpi"
fi
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for $1)"
exit 1
fi
;;
--with-fftw*)
with_fftw=$(parse_with_arg "$1")
if [ "${with_fftw}" = __INSTALL__ ] ; then
fftw_provider="fftw"
elif [ "${with_fftw}" = __DONTUSE__ ] ; then
if [ "${fftw_provider}" = "fftw" ] ; then
echo "ERROR: an FFTW library is required to build CP2K, please use --math-mode to switch the provider."
exit 1
fi
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for $1)"
exit 1
fi
;;
--with-reflapack*)
with_reflapack=$(parse_with_arg "$1")
if [ "${with_reflapack}" = __INSTALL__ ] ; then
lapack_provider="netlib-lapack"
elif [ "${with_reflapack}" = __DONTUSE__ ] ; then
if [ "${lapack_provider}" = "netlib-lapack" ] ; then
echo "ERROR: a BLAS/LAPACK implementation is required to build CP2K, please use --math-mode"
echo " or one of the --with-mkl/openblas options to switch the provider."
exit 1
fi
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for $1)"
exit 1
fi
;;
--with-mkl*)
with_mkl=$(parse_with_arg "$1")
if [ "${with_mkl}" = __INSTALL__ ] ; then
lapack_provider="intel-mkl"
scalapack_provider="intel-mkl"
fftw_provider="intel-mkl"
elif [ "${with_mkl}" = __DONTUSE__ ] ; then
if [ "${lapack_provider}" = "intel-mkl" ] || [ "${fftw_provider}" = "intel-mkl" ] || [ "${scalapack_provider}" = "intel-mkl" ] ; then
echo "ERROR: please use --math-mode to switch to a different math provider (MKL is specified for at least one of LAPACK, FFTW, ScaLAPACK)."
exit 1
fi
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for $1)"
exit 1
fi
;;
--with-openblas*)
with_openblas=$(parse_with_arg "$1")
if [ "${with_openblas}" = __INSTALL__ ] ; then
lapack_provider="openblas"
elif [ "${with_openblas}" = __DONTUSE__ ] ; then
if [ "${lapack_provider}" = "openblas" ] ; then
echo "ERROR: a BLAS/LAPACK implementation is required to build CP2K, please use --math-mode"
echo " or one of the --with-mkl/reflapack options to switch the provider."
exit 1
fi
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for $1)"
exit 1
fi
;;
--with-scalapack*)
with_scalapack=$(parse_with_arg "$1")
if [ "${with_scalapack}" = __INSTALL__ ] ; then
scalapack_provider="netlib-scalapack"
elif [ "${with_scalapack}" = __DONTUSE__ ] ; then
if [ "${scalapack_provider}" = "netlib-scalapack" ] && [ "${mpi_provider}" != "none" ] ; then
echo "ERROR: a ScaLAPACK implementation is required to build CP2K with MPI, use --mpi-mode=no"
echo " to disable MPI or the --with-mkl option to switch the provider."
exit 1
fi
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for $1)"
exit 1
fi
;;
--with-libxsmm*)
with_libxsmm=$(parse_with_arg "$1")
if [ "${with_libxsmm}" = "__DONTUSE__" ] ; then
smm_driver="libxsmm"
elif [ "${with_libxsmm}" = "__INSTALL__" ] ; then
smm_driver="blas"
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for $1)"
exit 1
fi
;;
--with-libint*)
# shellcheck disable=SC2034
with_libint=$(parse_with_arg "$1")
;;
--with-libxc*)
# shellcheck disable=SC2034
with_libxc=$(parse_with_arg "$1")
;;
--with-elpa*)
# shellcheck disable=SC2034
with_elpa=$(parse_with_arg "$1")
;;
--with-pexsi*)
# shellcheck disable=SC2034
with_pexsi=$(parse_with_arg "$1")
;;
--with-plumed*)
# shellcheck disable=SC2034
with_plumed=$(parse_with_arg "$1")
;;
--with-sirius*)
# shellcheck disable=SC2034
with_sirius=$(parse_with_arg "$1")
;;
--with-cosma*)
# shellcheck disable=SC2034
with_cosma=$(parse_with_arg "$1")
;;
--verbose)
set -x
;;
-h|--help|-*)
usage
exit 0
;;
while [ "$#" -ge 1 ]; do
case "$1" in
-j | --jobs)
nprocs=$1
shift
;;
--no-check-certificate)
no_check_certificates=1
;;
--install-all)
# enable (almost) all variants
for variant in ${AVAILABLE_VARIANTS}; do
eval "with_${variant}=__INSTALL__"
done
mpi_provider="mpich"
;;
--mpi-mode=*)
case "${1#*=}" in
mpich)
mpi_provider="mpich"
;;
openmpi)
mpi_provider="openmpi"
;;
intelmpi)
mpi_provider="intel-mpi"
;;
no)
mpi_provider="none"
;;
*)
break
;;
# --with-gcc*) # TODO: bootstrapping the compiler (and possibly also the binutils) needs more work
#--with-cmake*) # TODO: implement ignoring installed CMake and manually setting up an external
# TODO: separate tools need additional installation steps:
# --with-valgrind*)
#--enable-cuda*)
#--enable-cray*)
#--with-spglib*) # not a variant for CP2K in spack
#--with-quip*) # not available in Spack
esac
shift
usage_error "'$1' is not supported"
;;
esac
break
;;
--math-mode=*)
case "${1#*=}" in
cray)
lapack_provider="cray-libsci"
fftw_provider="cray-libsci"
scalapack_provider="cray-libsci"
;;
mkl)
lapack_provider="intel-mkl"
fftw_provider="intel-mkl"
scalapack_provider="intel-mkl"
;;
openblas)
lapack_provider="openblas"
;;
reflapack)
lapack_provider="netlib-lapack"
;;
*)
usage_error "'$1' is not supported"
;;
esac
break
;;
#--gpu-ver=*)
# case "${1#*=}" in
# K20X)
# gpuver="K20X"
# ;;
# K40)
# gpuver="K40"
# ;;
# K80)
# gpuver="K80"
# ;;
# P100)
# gpuver="P100"
# ;;
# V100)
# gpuver="V100"
# ;;
# no)
# gpuver="no"
# ;;
# *)
# usage_error "'$1' is not supported"
# esac
# ;;
--libint-lmax=*)
libint_lmax="${1#*=}"
;;
--with-mpich*)
with_mpich=$(parse_with_arg "$1")
if [ "${with_mpich}" != __DONTUSE__ ]; then
mpi_provider="mpich"
fi
;;
--with-openmpi*)
with_openmpi=$(parse_with_arg "$1")
if [ "${with_openmpi}" = __INSTALL__ ]; then
mpi_provider="openmpi"
elif [ "${with_openmpi}" = __DONTUSE__ ]; then
if [ "${mpi_provider}" = none ] || [ "${mpi_provider}" = openmpi ]; then
echo "ERROR: an MPI library is required to build CP2K since you didn't pass --mpi-mode=no"
mpi_provider="openmpi"
fi
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for $1)"
exit 1
fi
;;
--with-intelmpi*)
with_intelmpi=$(parse_with_arg "$1")
if [ "${with_intelmpi}" = __INSTALL__ ]; then
mpi_provider="intel-mpi"
elif [ "${with_intelmpi}" = __DONTUSE__ ]; then
if [ "${mpi_provider}" = "intel-mpi" ]; then
mpi_provider="openmpi"
fi
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for $1)"
exit 1
fi
;;
--with-fftw*)
with_fftw=$(parse_with_arg "$1")
if [ "${with_fftw}" = __INSTALL__ ]; then
fftw_provider="fftw"
elif [ "${with_fftw}" = __DONTUSE__ ]; then
if [ "${fftw_provider}" = "fftw" ]; then
echo "ERROR: an FFTW library is required to build CP2K, please use --math-mode to switch the provider."
exit 1
fi
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for $1)"
exit 1
fi
;;
--with-reflapack*)
with_reflapack=$(parse_with_arg "$1")
if [ "${with_reflapack}" = __INSTALL__ ]; then
lapack_provider="netlib-lapack"
elif [ "${with_reflapack}" = __DONTUSE__ ]; then
if [ "${lapack_provider}" = "netlib-lapack" ]; then
echo "ERROR: a BLAS/LAPACK implementation is required to build CP2K, please use --math-mode"
echo " or one of the --with-mkl/openblas options to switch the provider."
exit 1
fi
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for $1)"
exit 1
fi
;;
--with-mkl*)
with_mkl=$(parse_with_arg "$1")
if [ "${with_mkl}" = __INSTALL__ ]; then
lapack_provider="intel-mkl"
scalapack_provider="intel-mkl"
fftw_provider="intel-mkl"
elif [ "${with_mkl}" = __DONTUSE__ ]; then
if [ "${lapack_provider}" = "intel-mkl" ] || [ "${fftw_provider}" = "intel-mkl" ] || [ "${scalapack_provider}" = "intel-mkl" ]; then
echo "ERROR: please use --math-mode to switch to a different math provider (MKL is specified for at least one of LAPACK, FFTW, ScaLAPACK)."
exit 1
fi
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for $1)"
exit 1
fi
;;
--with-openblas*)
with_openblas=$(parse_with_arg "$1")
if [ "${with_openblas}" = __INSTALL__ ]; then
lapack_provider="openblas"
elif [ "${with_openblas}" = __DONTUSE__ ]; then
if [ "${lapack_provider}" = "openblas" ]; then
echo "ERROR: a BLAS/LAPACK implementation is required to build CP2K, please use --math-mode"
echo " or one of the --with-mkl/reflapack options to switch the provider."
exit 1
fi
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for $1)"
exit 1
fi
;;
--with-scalapack*)
with_scalapack=$(parse_with_arg "$1")
if [ "${with_scalapack}" = __INSTALL__ ]; then
scalapack_provider="netlib-scalapack"
elif [ "${with_scalapack}" = __DONTUSE__ ]; then
if [ "${scalapack_provider}" = "netlib-scalapack" ] && [ "${mpi_provider}" != "none" ]; then
echo "ERROR: a ScaLAPACK implementation is required to build CP2K with MPI, use --mpi-mode=no"
echo " to disable MPI or the --with-mkl option to switch the provider."
exit 1
fi
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for $1)"
exit 1
fi
;;
--with-libxsmm*)
with_libxsmm=$(parse_with_arg "$1")
if [ "${with_libxsmm}" = "__DONTUSE__" ]; then
smm_driver="libxsmm"
elif [ "${with_libxsmm}" = "__INSTALL__" ]; then
smm_driver="blas"
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for $1)"
exit 1
fi
;;
--with-libint*)
# shellcheck disable=SC2034
with_libint=$(parse_with_arg "$1")
;;
--with-libxc*)
# shellcheck disable=SC2034
with_libxc=$(parse_with_arg "$1")
;;
--with-elpa*)
# shellcheck disable=SC2034
with_elpa=$(parse_with_arg "$1")
;;
--with-pexsi*)
# shellcheck disable=SC2034
with_pexsi=$(parse_with_arg "$1")
;;
--with-plumed*)
# shellcheck disable=SC2034
with_plumed=$(parse_with_arg "$1")
;;
--with-sirius*)
# shellcheck disable=SC2034
with_sirius=$(parse_with_arg "$1")
;;
--with-cosma*)
# shellcheck disable=SC2034
with_cosma=$(parse_with_arg "$1")
;;
--verbose)
set -x
;;
-h | --help | -*)
usage
exit 0
;;
*)
break
;;
# --with-gcc*) # TODO: bootstrapping the compiler (and possibly also the binutils) needs more work
#--with-cmake*) # TODO: implement ignoring installed CMake and manually setting up an external
# TODO: separate tools need additional installation steps:
# --with-valgrind*)
#--enable-cuda*)
#--enable-cray*)
#--with-spglib*) # not a variant for CP2K in spack
#--with-quip*) # not available in Spack
esac
shift
done
cp2k_variants="lmax=${libint_lmax} smm=${smm_driver}"
cp2k_variants_mpi_only=""
for variant in ${AVAILABLE_VARIANTS} ; do
val=$(eval "echo \${with_${variant}}")
for variant in ${AVAILABLE_VARIANTS}; do
val=$(eval "echo \${with_${variant}}")
if [ "${val}" = "__INSTALL__" ] ; then
prefix="+"
elif [ "${val}" = "__DONTUSE__" ] ; then
prefix="~"
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for --with-${variant})"
exit 1
fi
if [ "${val}" = "__INSTALL__" ]; then
prefix="+"
elif [ "${val}" = "__DONTUSE__" ]; then
prefix="~"
else
echo "ERROR: explicitly requesting a system library or setting a path is not yet supported (for --with-${variant})"
exit 1
fi
if [ "${VARIANTS_REQUIRING_MPI#*${variant}}" = "${VARIANTS_REQUIRING_MPI}" ] ; then
cp2k_variants="${cp2k_variants} ${prefix}${variant}"
else
cp2k_variants_mpi_only="${cp2k_variants_mpi_only} ${prefix}${variant}"
fi
if [ "${VARIANTS_REQUIRING_MPI#*${variant}}" = "${VARIANTS_REQUIRING_MPI}" ]; then
cp2k_variants="${cp2k_variants} ${prefix}${variant}"
else
cp2k_variants_mpi_only="${cp2k_variants_mpi_only} ${prefix}${variant}"
fi
done
if [ "${lapack_provider}" = "netlib-lapack" ] ; then
blas_provider="netlib-xblas"
if [ "${lapack_provider}" = "netlib-lapack" ]; then
blas_provider="netlib-xblas"
else
blas_provider="${lapack_provider}"
blas_provider="${lapack_provider}"
fi
if [ -d "${SPACKDIR}" ] ; then
echo "Found a Spack installation, updating..."
# -C was introduced in git 1.8.5 (Q4 2013)
git -C "${SPACKDIR}" pull
if [ -d "${SPACKDIR}" ]; then
echo "Found a Spack installation, updating..."
# -C was introduced in git 1.8.5 (Q4 2013)
git -C "${SPACKDIR}" pull
else
git clone --depth=1 https://github.com/spack/spack.git "${SPACKDIR}"
git clone --depth=1 https://github.com/spack/spack.git "${SPACKDIR}"
fi
SPACK=$(PATH="${SPACKDIR}/bin:${PATH}" command -v spack)
SPACK_ARGS=""
if [ ${no_check_certificates} -eq 1 ] ; then
SPACK_ARGS="${SPACK_ARGS} --insecure"
if [ ${no_check_certificates} -eq 1 ]; then
SPACK_ARGS="${SPACK_ARGS} --insecure"
fi
echo "Let 'spack' detect system-packages to be used..."
@ -412,31 +413,31 @@ echo "Let 'spack' detect system-packages to be used..."
# also, if there is a user/system-provided Spack, do not run this
"${SPACK}" external find --scope site
# workaround Spack issue https://github.com/spack/spack/issues/4635
# workaround Spack issue https://github.com/spack/spack/issues/4635
"${SPACK}" config --scope site rm packages:cmake
# TODO: if there is already a Spack environment/command avvailable, we should setup a chained installation instead
echo "Installing non-MPI environment..."
if [ ! -d "${SPACKENVDIR}/ssmp" ] ; then
"${SPACK}" env create -d "${SPACKENVDIR}/ssmp"
if [ ! -d "${SPACKENVDIR}/ssmp" ]; then
"${SPACK}" env create -d "${SPACKENVDIR}/ssmp"
else
echo "Existing environment found, reconfiguring..."
echo "Existing environment found, reconfiguring..."
fi
configure_spack_env "ssmp" \
"config:build_language:C.UTF-8" \
"packages:all:providers:fftw-api:[${fftw_provider}]" \
"packages:all:providers:blas:[${blas_provider}]" \
"packages:all:providers:lapack:[${lapack_provider}]" \
"packages:cp2k:variants:${cp2k_variants} ~mpi" \
"packages:fftw:variants:+openmp" \
"packages:openblas:variants:threads=openmp"
"config:build_language:C.UTF-8" \
"packages:all:providers:fftw-api:[${fftw_provider}]" \
"packages:all:providers:blas:[${blas_provider}]" \
"packages:all:providers:lapack:[${lapack_provider}]" \
"packages:cp2k:variants:${cp2k_variants} ~mpi" \
"packages:fftw:variants:+openmp" \
"packages:openblas:variants:threads=openmp"
if [ "${mpi_provider}" = none ] ; then
# avoid installing MPI also in the non-MPI environment if fftw is pulled-in
# note: fftw builds 2 sets of libs with +mpi
configure_spack_env "ssmp" \
"packages:fftw:variants:+openmp ~mpi"
if [ "${mpi_provider}" = none ]; then
# avoid installing MPI also in the non-MPI environment if fftw is pulled-in
# note: fftw builds 2 sets of libs with +mpi
configure_spack_env "ssmp" \
"packages:fftw:variants:+openmp ~mpi"
fi
echo "Installing packages..."
@ -444,28 +445,28 @@ echo "Installing packages..."
echo "Generating environment setup file..."
"${SPACK}" --env-dir "${SPACKENVDIR}/ssmp" build-env --dump "${SPACKENVDIR}/ssmp/setup" cp2k@master --
if [ "${mpi_provider}" != none ] ; then
echo "Installing MPI environment..."
if [ ! -d "${SPACKENVDIR}/psmp" ] ; then
"${SPACK}" env create -d "${SPACKENVDIR}/psmp"
else
echo "Existing environment found, reconfiguring..."
fi
configure_spack_env "psmp" \
"config:build_language:C.UTF-8" \
"packages:all:providers:fftw-api:[${fftw_provider}]" \
"packages:all:providers:blas:[${lapack_provider}]" \
"packages:all:providers:lapack:[${blas_provider}]" \
"packages:all:providers:mpi:[${mpi_provider}]" \
"packages:all:providers:scalapack:[${scalapack_provider}]" \
"packages:cp2k:variants:${cp2k_variants} ${cp2k_variants_mpi_only} ${cp2k_variants_mpi_only}" \
"packages:fftw:variants:+openmp" \
"packages:openblas:variants:threads=openmp"
if [ "${mpi_provider}" != none ]; then
echo "Installing MPI environment..."
if [ ! -d "${SPACKENVDIR}/psmp" ]; then
"${SPACK}" env create -d "${SPACKENVDIR}/psmp"
else
echo "Existing environment found, reconfiguring..."
fi
configure_spack_env "psmp" \
"config:build_language:C.UTF-8" \
"packages:all:providers:fftw-api:[${fftw_provider}]" \
"packages:all:providers:blas:[${lapack_provider}]" \
"packages:all:providers:lapack:[${blas_provider}]" \
"packages:all:providers:mpi:[${mpi_provider}]" \
"packages:all:providers:scalapack:[${scalapack_provider}]" \
"packages:cp2k:variants:${cp2k_variants} ${cp2k_variants_mpi_only} ${cp2k_variants_mpi_only}" \
"packages:fftw:variants:+openmp" \
"packages:openblas:variants:threads=openmp"
echo "Installing packages..."
"${SPACK}" --env-dir "${SPACKENVDIR}/psmp" dev-build -j "${nprocs}" -d "${CP2KDIR}" --quiet --until edit cp2k@master
echo "Generating environment setup file..."
"${SPACK}" --env-dir "${SPACKENVDIR}/psmp" build-env --dump "${SPACKENVDIR}/psmp/setup" cp2k@master --
echo "Installing packages..."
"${SPACK}" --env-dir "${SPACKENVDIR}/psmp" dev-build -j "${nprocs}" -d "${CP2KDIR}" --quiet --until edit cp2k@master
echo "Generating environment setup file..."
"${SPACK}" --env-dir "${SPACKENVDIR}/psmp" build-env --dump "${SPACKENVDIR}/psmp/setup" cp2k@master --
fi
# shellcheck disable=SC2016
@ -476,10 +477,10 @@ echo "To build the single-node implementation of CP2K, run:"
echo ""
echo " source \"${SPACKENVDIR}/ssmp/setup\""
echo " make -j${nprocs} ARCH=${ARCH} VERSION=ssmp"
if [ "${mpi_provider}" != none ] ; then
echo ""
echo "To build the multi-node (MPI) implementation of CP2K, run:"
echo ""
echo " source \"${SPACKENVDIR}/psmp/setup\""
echo " make -j${nprocs} ARCH=${ARCH} VERSION=psmp"
if [ "${mpi_provider}" != none ]; then
echo ""
echo "To build the multi-node (MPI) implementation of CP2K, run:"
echo ""
echo " source \"${SPACKENVDIR}/psmp/setup\""
echo " make -j${nprocs} ARCH=${ARCH} VERSION=psmp"
fi

File diff suppressed because it is too large Load diff

View file

@ -2,22 +2,22 @@
# author: Ole Schuett
if (( $# != 1 )) ; then
echo "Usage: install_requirements.sh <BASE_IMAGE>"
exit 1
if (($# != 1)); then
echo "Usage: install_requirements.sh <BASE_IMAGE>"
exit 1
fi
BASE_IMAGE=$1
if [[ ${BASE_IMAGE} == ubuntu* ]] ; then
./install_requirements_ubuntu.sh
if [[ ${BASE_IMAGE} == ubuntu* ]]; then
./install_requirements_ubuntu.sh
elif [[ ${BASE_IMAGE} == fedora* ]] ; then
./install_requirements_fedora.sh
elif [[ ${BASE_IMAGE} == fedora* ]]; then
./install_requirements_fedora.sh
else
echo "Unknown base image: ${BASE_IMAGE}"
exit 1
echo "Unknown base image: ${BASE_IMAGE}"
exit 1
fi
#EOF

View file

@ -6,29 +6,29 @@
echo "Installing Fedora packages..."
dnf -qy install \
autoconf \
autogen \
automake \
bzip2 \
ca-certificates \
diffutils \
g++ \
git \
less \
libtool \
make \
nano \
patch \
perl-open \
perl-FindBin \
pkg-config \
python3 \
unzip \
vim-common \
wget \
which \
zlib-devel
dnf -qy install \
autoconf \
autogen \
automake \
bzip2 \
ca-certificates \
diffutils \
g++ \
git \
less \
libtool \
make \
nano \
patch \
perl-open \
perl-FindBin \
pkg-config \
python3 \
unzip \
vim-common \
wget \
which \
zlib-devel
dnf clean -q all

View file

@ -12,26 +12,26 @@ export DEBCONF_NONINTERACTIVE_SEEN=true
apt-get update -qq
apt-get install -qq --no-install-recommends \
autoconf \
autogen \
automake \
autotools-dev \
bzip2 \
ca-certificates \
g++ \
git \
less \
libtool \
libtool-bin \
make \
nano \
patch \
pkg-config \
python3 \
unzip \
wget \
xxd \
zlib1g-dev
autoconf \
autogen \
automake \
autotools-dev \
bzip2 \
ca-certificates \
g++ \
git \
less \
libtool \
libtool-bin \
make \
nano \
patch \
pkg-config \
python3 \
unzip \
wget \
xxd \
zlib1g-dev
rm -rf /var/lib/apt/lists/*

View file

@ -60,20 +60,20 @@ IEEE_EXCEPTIONS_DFLAGS="-D__HAS_IEEE_EXCEPTIONS"
# check all of the above flags, filter out incompatible flags for the
# current version of gcc in use
BASEFLAGS=$(allowed_gfortran_flags $BASEFLAGS)
OPT_FLAGS=$(allowed_gfortran_flags $OPT_FLAGS)
NOOPT_FLAGS=$(allowed_gfortran_flags $NOOPT_FLAGS)
FCDEB_FLAGS=$(allowed_gfortran_flags $FCDEB_FLAGS)
BASEFLAGS=$(allowed_gfortran_flags $BASEFLAGS)
OPT_FLAGS=$(allowed_gfortran_flags $OPT_FLAGS)
NOOPT_FLAGS=$(allowed_gfortran_flags $NOOPT_FLAGS)
FCDEB_FLAGS=$(allowed_gfortran_flags $FCDEB_FLAGS)
FCDEB_FLAGS_DEBUG=$(allowed_gfortran_flags $FCDEB_FLAGS_DEBUG)
COVERAGE_FLAGS=$(allowed_gfortran_flags $COVERAGE_FLAGS)
WFLAGS_ERROR=$(allowed_gfortran_flags $WFLAGS_ERROR)
WFLAGS_WARN=$(allowed_gfortran_flags $WFLAGS_WARN)
WFLAGS_WARNALL=$(allowed_gfortran_flags $WFLAGS_WARNALL)
COVERAGE_FLAGS=$(allowed_gfortran_flags $COVERAGE_FLAGS)
WFLAGS_ERROR=$(allowed_gfortran_flags $WFLAGS_ERROR)
WFLAGS_WARN=$(allowed_gfortran_flags $WFLAGS_WARN)
WFLAGS_WARNALL=$(allowed_gfortran_flags $WFLAGS_WARNALL)
# check if ieee_exeptions module is available for the current version
# of gfortran being used
if ! (check_gfortran_module ieee_exceptions) ; then
IEEE_EXCEPTIONS_DFLAGS=""
if ! (check_gfortran_module ieee_exceptions); then
IEEE_EXCEPTIONS_DFLAGS=""
fi
# concatenate the above flags into WFLAGS, FCDEBFLAGS, DFLAGS and
@ -102,32 +102,32 @@ LIBS="${CP_LIBS} -lstdc++"
# CUDA handling
CUDA_LIBS="-lcudart -lnvrtc -lcuda -lcufft -lcublas -lrt IF_DEBUG(-lnvToolsExt|)"
CUDA_DFLAGS="-D__GRID_CUDA -D__ACC -D__DBCSR_ACC -D__PW_CUDA IF_DEBUG(-D__CUDA_PROFILING|)"
if [ "${ENABLE_CUDA}" = __TRUE__ ] && [ "${GPUVER}" != no ] ; then
LIBS="${LIBS} IF_CUDA(${CUDA_LIBS}|)"
DFLAGS="IF_CUDA(${CUDA_DFLAGS}|) ${DFLAGS}"
NVFLAGS="-arch sm_${ARCH_NUM} -O3 -Xcompiler='-fopenmp' --std=c++11 \$(DFLAGS)"
check_command nvcc "cuda"
check_lib -lcudart "cuda"
check_lib -lnvrtc "cuda"
check_lib -lcuda "cuda"
check_lib -lcufft "cuda"
check_lib -lcublas "cuda"
if [ "${ENABLE_CUDA}" = __TRUE__ ] && [ "${GPUVER}" != no ]; then
LIBS="${LIBS} IF_CUDA(${CUDA_LIBS}|)"
DFLAGS="IF_CUDA(${CUDA_DFLAGS}|) ${DFLAGS}"
NVFLAGS="-arch sm_${ARCH_NUM} -O3 -Xcompiler='-fopenmp' --std=c++11 \$(DFLAGS)"
check_command nvcc "cuda"
check_lib -lcudart "cuda"
check_lib -lnvrtc "cuda"
check_lib -lcuda "cuda"
check_lib -lcufft "cuda"
check_lib -lcublas "cuda"
# Set include flags
CUDA_CFLAGS=''
add_include_from_paths CUDA_CFLAGS "cuda.h" $INCLUDE_PATHS
export CUDA_CFLAGS="${CUDA_CFLAGS}"
CFLAGS+=" ${CUDA_CFLAGS}"
# Set include flags
CUDA_CFLAGS=''
add_include_from_paths CUDA_CFLAGS "cuda.h" $INCLUDE_PATHS
export CUDA_CFLAGS="${CUDA_CFLAGS}"
CFLAGS+=" ${CUDA_CFLAGS}"
# Set LD-flags
CUDA_LDFLAGS=''
add_lib_from_paths CUDA_LDFLAGS "libcudart.*" $LIB_PATHS
add_lib_from_paths CUDA_LDFLAGS "libnvrtc.*" $LIB_PATHS
add_lib_from_paths CUDA_LDFLAGS "libcuda.*" $LIB_PATHS
add_lib_from_paths CUDA_LDFLAGS "libcufft.*" $LIB_PATHS
add_lib_from_paths CUDA_LDFLAGS "libcublas.*" $LIB_PATHS
export CUDA_LDFLAGS="${CUDA_LDFLAGS}"
LDFLAGS+=" ${CUDA_LDFLAGS}"
# Set LD-flags
CUDA_LDFLAGS=''
add_lib_from_paths CUDA_LDFLAGS "libcudart.*" $LIB_PATHS
add_lib_from_paths CUDA_LDFLAGS "libnvrtc.*" $LIB_PATHS
add_lib_from_paths CUDA_LDFLAGS "libcuda.*" $LIB_PATHS
add_lib_from_paths CUDA_LDFLAGS "libcufft.*" $LIB_PATHS
add_lib_from_paths CUDA_LDFLAGS "libcublas.*" $LIB_PATHS
export CUDA_LDFLAGS="${CUDA_LDFLAGS}"
LDFLAGS+=" ${CUDA_LDFLAGS}"
fi
# -------------------------
@ -136,27 +136,27 @@ fi
# generator for CP2K ARCH files
gen_arch_file() {
# usage: gen_arch_file file_name flags
#
# If the flags are present they are assumed to be on, otherwise
# they switched off
require_env ARCH_FILE_TEMPLATE
local __filename=$1
shift
local __flags=$@
local __full_flag_list="MPI DEBUG CUDA WARNALL VALGRIND COVERAGE"
local __flag=''
for __flag in $__full_flag_list ; do
eval "local __${__flag}=off"
done
for __flag in $__flags ; do
eval "__${__flag}=on"
done
# generate initial arch file
cat $ARCH_FILE_TEMPLATE > $__filename
# add additional parts
if [ "$__CUDA" = "on" ] ; then
cat <<EOF >> $__filename
# usage: gen_arch_file file_name flags
#
# If the flags are present they are assumed to be on, otherwise
# they switched off
require_env ARCH_FILE_TEMPLATE
local __filename=$1
shift
local __flags=$@
local __full_flag_list="MPI DEBUG CUDA WARNALL VALGRIND COVERAGE"
local __flag=''
for __flag in $__full_flag_list; do
eval "local __${__flag}=off"
done
for __flag in $__flags; do
eval "__${__flag}=on"
done
# generate initial arch file
cat $ARCH_FILE_TEMPLATE > $__filename
# add additional parts
if [ "$__CUDA" = "on" ]; then
cat << EOF >> $__filename
#
CXX = \${CC}
CXXFLAGS = \${CXXFLAGS} -I\\\${CUDA_PATH}/include -std=c++11 -fopenmp
@ -165,25 +165,25 @@ GPUVER = \${GPUVER}
NVCC = \${NVCC}
NVFLAGS = \${NVFLAGS}
EOF
fi
if [ "$__WARNALL" = "on" ] ; then
cat <<EOF >> $__filename
fi
if [ "$__WARNALL" = "on" ]; then
cat << EOF >> $__filename
#
FCLOGPIPE = 2>&1 | tee \\\$(notdir \\\$<).warn
EOF
fi
if [ "$with_gcc" != "__DONTUSE__" ] ; then
cat <<EOF >> $__filename
fi
if [ "$with_gcc" != "__DONTUSE__" ]; then
cat << EOF >> $__filename
#
FYPPFLAGS = -n --line-marker-format=gfortran5
EOF
fi
# replace variable values in output file using eval
local __TMPL=$(cat $__filename)
eval "printf \"${__TMPL}\n\"" > $__filename
# pass this to parsers to replace all of the IF_XYZ statements
"${SCRIPTDIR}/parse_if.py" -i -f "${__filename}" $__flags
echo "Wrote ${INSTALLDIR}/arch/$__filename"
fi
# replace variable values in output file using eval
local __TMPL=$(cat $__filename)
eval "printf \"${__TMPL}\n\"" > $__filename
# pass this to parsers to replace all of the IF_XYZ statements
"${SCRIPTDIR}/parse_if.py" -i -f "${__filename}" $__flags
echo "Wrote ${INSTALLDIR}/arch/$__filename"
}
rm -f ${INSTALLDIR}/arch/local*
@ -192,32 +192,32 @@ gen_arch_file "local.ssmp"
gen_arch_file "local.sdbg" DEBUG
arch_vers="ssmp sdbg"
if [ "$MPI_MODE" != no ] ; then
gen_arch_file "local.psmp" MPI
gen_arch_file "local.pdbg" MPI DEBUG
gen_arch_file "local_warn.psmp" MPI WARNALL
gen_arch_file "local_coverage.pdbg" MPI COVERAGE
arch_vers="${arch_vers} psmp pdbg"
if [ "$MPI_MODE" != no ]; then
gen_arch_file "local.psmp" MPI
gen_arch_file "local.pdbg" MPI DEBUG
gen_arch_file "local_warn.psmp" MPI WARNALL
gen_arch_file "local_coverage.pdbg" MPI COVERAGE
arch_vers="${arch_vers} psmp pdbg"
fi
# cuda enabled arch files
if [ "$ENABLE_CUDA" = __TRUE__ ] ; then
gen_arch_file "local_cuda.ssmp" CUDA
gen_arch_file "local_cuda.sdbg" CUDA DEBUG
if [ "$MPI_MODE" != no ] ; then
gen_arch_file "local_cuda.psmp" CUDA MPI
gen_arch_file "local_cuda.pdbg" CUDA MPI DEBUG
gen_arch_file "local_cuda_warn.psmp" CUDA MPI WARNALL
gen_arch_file "local_coverage_cuda.pdbg" CUDA MPI COVERAGE
fi
if [ "$ENABLE_CUDA" = __TRUE__ ]; then
gen_arch_file "local_cuda.ssmp" CUDA
gen_arch_file "local_cuda.sdbg" CUDA DEBUG
if [ "$MPI_MODE" != no ]; then
gen_arch_file "local_cuda.psmp" CUDA MPI
gen_arch_file "local_cuda.pdbg" CUDA MPI DEBUG
gen_arch_file "local_cuda_warn.psmp" CUDA MPI WARNALL
gen_arch_file "local_coverage_cuda.pdbg" CUDA MPI COVERAGE
fi
fi
# valgrind enabled arch files
if [ "$ENABLE_VALGRIND" = __TRUE__ ] ; then
gen_arch_file "local_valgrind.ssmp" VALGRIND
if [ "$MPI_MODE" != no ] ; then
gen_arch_file "local_valgrind.psmp" VALGRIND MPI
fi
if [ "$ENABLE_VALGRIND" = __TRUE__ ]; then
gen_arch_file "local_valgrind.ssmp" VALGRIND
if [ "$MPI_MODE" != no ]; then
gen_arch_file "local_valgrind.psmp" VALGRIND MPI
fi
fi
cd "${ROOTDIR}"
@ -226,7 +226,7 @@ cd "${ROOTDIR}"
# print out user instructions
# -------------------------
cat <<EOF
cat << EOF
========================== usage =========================
Done!
Now copy:

View file

@ -13,14 +13,14 @@ source "${INSTALLDIR}"/toolchain.conf
source "${INSTALLDIR}"/toolchain.env
find_openblas_dir() {
local __dir=''
for __dir in *OpenBLAS* ; do
if [ -d "$__dir" ] ; then
echo "$__dir"
return 0
fi
done
echo ''
local __dir=''
for __dir in *OpenBLAS*; do
if [ -d "$__dir" ]; then
echo "$__dir"
return 0
fi
done
echo ''
}
! [ -d "${BUILDDIR}" ] && mkdir -p "${BUILDDIR}"
@ -30,29 +30,29 @@ echo "==================== Getting proc arch info using OpenBLAS tools =========
# find existing openblas source dir
openblas_dir="$(find_openblas_dir)"
# if cannot find openblas source dir, try download one
if ! [ "$openblas_dir" ] ; then
if [ -f ${openblas_pkg} ] ; then
echo "${openblas_pkg} is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${openblas_sha256} \
https://www.cp2k.org/static/downloads/${openblas_pkg}
fi
tar -xzf ${openblas_pkg}
openblas_dir="$(find_openblas_dir)"
if ! [ "$openblas_dir" ]; then
if [ -f ${openblas_pkg} ]; then
echo "${openblas_pkg} is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${openblas_sha256} \
https://www.cp2k.org/static/downloads/${openblas_pkg}
fi
tar -xzf ${openblas_pkg}
openblas_dir="$(find_openblas_dir)"
fi
openblas_conf="${openblas_dir}/Makefile.conf"
# try find Makefile.config, if not then generate one with make lapack_prebuild
if ! [ -f "$openblas_conf" ] ; then
cd "$openblas_dir"
make lapack_prebuild
cd ..
if ! [ -f "$openblas_conf" ]; then
cd "$openblas_dir"
make lapack_prebuild
cd ..
fi
OPENBLAS_LIBCORE="$(grep 'LIBCORE=' $openblas_conf | cut -f2 -d=)"
OPENBLAS_ARCH="$(grep 'ARCH=' $openblas_conf | cut -f2 -d=)"
echo "OpenBLAS detected LIBCORE = $OPENBLAS_LIBCORE"
echo "OpenBLAS detected ARCH = $OPENBLAS_ARCH"
# output setup file
cat <<EOF > "${BUILDDIR}/openblas_arch"
cat << EOF > "${BUILDDIR}/openblas_arch"
export OPENBLAS_LIBCORE="${OPENBLAS_LIBCORE}"
export OPENBLAS_ARCH="${OPENBLAS_ARCH}"
EOF

View file

@ -16,57 +16,57 @@ source "${INSTALLDIR}"/toolchain.env
cd "${BUILDDIR}"
case "$with_cmake" in
__INSTALL__)
echo "==================== Installing CMake ===================="
pkg_install_dir="${INSTALLDIR}/cmake-${cmake_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "cmake-${cmake_ver} is already installed, skipping it."
else
if [ -f cmake-${cmake_ver}.tar.gz ] ; then
echo "cmake-${cmake_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${cmake_sha256} \
https://github.com/Kitware/CMake/releases/download/v${cmake_ver}/cmake-${cmake_ver}.tar.gz
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d cmake-${cmake_ver} ] && rm -rf cmake-${cmake_ver}
tar -xzf cmake-${cmake_ver}.tar.gz
cd cmake-${cmake_ver}
# on ARCHER (cray system), ccmake cannot compile without
# -ldl, but was not sure how to link -ldl in the CMake
# bootstrap scripts. As GUI are not really needed, we just
# disable it here
if [ "$ENABLE_CRAY" = "__TRUE__" ] ; then
cp CMakeLists.txt CMakeLists.txt.orig
sed -i 's/option(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" ON)/option(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" OFF)/g' CMakeLists.txt
fi
./bootstrap --prefix="${pkg_install_dir}" --parallel="${NPROCS}" -- -DCMAKE_USE_OPENSSL=OFF > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage0/$(basename ${SCRIPT_NAME})"
fi
;;
__SYSTEM__)
echo "==================== Finding CMake from system paths ===================="
check_command cmake "cmake"
;;
__DONTUSE__)
;;
*)
echo "==================== Linking CMake to user paths ===================="
pkg_install_dir="$with_cmake"
check_dir "${with_cmake}/bin"
;;
__INSTALL__)
echo "==================== Installing CMake ===================="
pkg_install_dir="${INSTALLDIR}/cmake-${cmake_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "cmake-${cmake_ver} is already installed, skipping it."
else
if [ -f cmake-${cmake_ver}.tar.gz ]; then
echo "cmake-${cmake_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${cmake_sha256} \
https://github.com/Kitware/CMake/releases/download/v${cmake_ver}/cmake-${cmake_ver}.tar.gz
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d cmake-${cmake_ver} ] && rm -rf cmake-${cmake_ver}
tar -xzf cmake-${cmake_ver}.tar.gz
cd cmake-${cmake_ver}
# on ARCHER (cray system), ccmake cannot compile without
# -ldl, but was not sure how to link -ldl in the CMake
# bootstrap scripts. As GUI are not really needed, we just
# disable it here
if [ "$ENABLE_CRAY" = "__TRUE__" ]; then
cp CMakeLists.txt CMakeLists.txt.orig
sed -i 's/option(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" ON)/option(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" OFF)/g' CMakeLists.txt
fi
./bootstrap --prefix="${pkg_install_dir}" --parallel="${NPROCS}" -- -DCMAKE_USE_OPENSSL=OFF > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage0/$(basename ${SCRIPT_NAME})"
fi
;;
__SYSTEM__)
echo "==================== Finding CMake from system paths ===================="
check_command cmake "cmake"
;;
__DONTUSE__) ;;
*)
echo "==================== Linking CMake to user paths ===================="
pkg_install_dir="$with_cmake"
check_dir "${with_cmake}/bin"
;;
esac
if [ "$with_cmake" != "__DONTUSE__" ] ; then
if [ "$with_cmake" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_cmake"
if [ "$with_cmake" != "__DONTUSE__" ]; then
if [ "$with_cmake" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_cmake"
prepend_path PATH "$pkg_install_dir/bin"
EOF
cat "${BUILDDIR}/setup_cmake" >> $SETUPFILE
fi
cat "${BUILDDIR}/setup_cmake" >> $SETUPFILE
fi
fi
load "${BUILDDIR}/setup_cmake"

View file

@ -6,8 +6,8 @@ gcc_ver="10.2.0"
gcc_sha256="27e879dccc639cd7b0cc08ed575c1669492579529b53c9ff27b0b96265fa867d"
patches=(
"${SCRIPT_DIR}/stage0/gcc-${gcc_ver}-cpp-__has_include.patch"
)
"${SCRIPT_DIR}/stage0/gcc-${gcc_ver}-cpp-__has_include.patch"
)
source "${SCRIPT_DIR}"/common_vars.sh
source "${SCRIPT_DIR}"/tool_kit.sh
@ -24,113 +24,113 @@ TSANFLAGS=""
cd "${BUILDDIR}"
case "$with_gcc" in
__INSTALL__)
echo "==================== Installing GCC ===================="
pkg_install_dir="${INSTALLDIR}/gcc-${gcc_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "gcc-${gcc_ver} is already installed, skipping it."
__INSTALL__)
echo "==================== Installing GCC ===================="
pkg_install_dir="${INSTALLDIR}/gcc-${gcc_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "gcc-${gcc_ver} is already installed, skipping it."
else
if [ "${gcc_ver}" == "master" ]; then
[ -d gcc-master ] && rm -rf gcc-master
svn checkout svn://gcc.gnu.org/svn/gcc/trunk gcc-master > svn-gcc.log 2>&1
else
if [ -f gcc-${gcc_ver}.tar.gz ]; then
echo "gcc-${gcc_ver}.tar.gz is found"
else
if [ "${gcc_ver}" == "master" ]; then
[ -d gcc-master ] && rm -rf gcc-master
svn checkout svn://gcc.gnu.org/svn/gcc/trunk gcc-master > svn-gcc.log 2>&1
else
if [ -f gcc-${gcc_ver}.tar.gz ] ; then
echo "gcc-${gcc_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${gcc_sha256} \
"https://www.cp2k.org/static/downloads/gcc-${gcc_ver}.tar.gz"
fi
[ -d gcc-${gcc_ver} ] && rm -rf gcc-${gcc_ver}
tar -xzf gcc-${gcc_ver}.tar.gz
fi
echo "Installing GCC from scratch into ${pkg_install_dir}"
cd gcc-${gcc_ver}
for patch in "${patches[@]}" ; do
patch -p1 < "${patch}"
done
./contrib/download_prerequisites > prereq.log 2>&1
GCCROOT=${PWD}
mkdir obj
cd obj
${GCCROOT}/configure --prefix="${pkg_install_dir}" \
--libdir="${pkg_install_dir}/lib" \
--enable-languages=c,c++,fortran \
--disable-multilib --disable-bootstrap \
--enable-lto \
--enable-plugins \
> configure.log 2>&1
make -j $NPROCS \
CFLAGS="-fPIC $CFLAGS"\
CXXFLAGS="-fPIC $CXXFLAGS"\
> make.log 2>&1
make -j $NPROCS install > install.log 2>&1
# thread sanitizer
if [ $ENABLE_TSAN = "__TRUE__" ] ; then
# now the tricky bit... we need to recompile in particular
# libgomp with -fsanitize=thread.. there is not configure
# option for this (as far as I know). we need to go in
# the build tree and recompile / reinstall with proper
# options... this is likely to break for later version of
# gcc, tested with 5.1.0 based on
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55374#c10
cd x86_64*/libgfortran
make clean > clean.log 2>&1
make -j $NPROCS \
CFLAGS="-std=gnu99 -g -O2 -fsanitize=thread " \
FCFLAGS="-g -O2 -fsanitize=thread" \
CXXFLAGS="-std=gnu99 -g -O2 -fsanitize=thread " \
LDFLAGS="-B`pwd`/../libsanitizer/tsan/.libs/ -Wl,-rpath,`pwd`/../libsanitizer/tsan/.libs/ -fsanitize=thread" \
> make.log 2>&1
make install > install.log 2>&1
cd ../libgomp
make clean > clean.log 2>&1
make -j $NPROCS \
CFLAGS="-std=gnu99 -g -O2 -fsanitize=thread " \
FCFLAGS="-g -O2 -fsanitize=thread" \
CXXFLAGS="-std=gnu99 -g -O2 -fsanitize=thread " \
LDFLAGS="-B`pwd`/../libsanitizer/tsan/.libs/ -Wl,-rpath,`pwd`/../libsanitizer/tsan/.libs/ -fsanitize=thread" \
> make.log 2>&1
make install > install.log 2>&1
cd $GCCROOT/obj/
fi
cd ../..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage0/$(basename ${SCRIPT_NAME})"
download_pkg ${DOWNLOADER_FLAGS} ${gcc_sha256} \
"https://www.cp2k.org/static/downloads/gcc-${gcc_ver}.tar.gz"
fi
GCC_CFLAGS="-I'${pkg_install_dir}/include'"
GCC_LDFLAGS="-L'${pkg_install_dir}/lib64' -L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib64' -Wl,-rpath='${pkg_install_dir}/lib64'"
;;
__SYSTEM__)
echo "==================== Finding GCC from system paths ===================="
check_command gcc "gcc"
check_command g++ "gcc"
check_command gfortran "gcc"
add_include_from_paths -p GCC_CFLAGS "c++" $INCLUDE_PATHS
add_lib_from_paths GCC_LDFLAGS "libgfortran.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking GCC to user paths ===================="
pkg_install_dir="$with_gcc"
check_dir "${pkg_install_dir}/bin"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/lib64"
check_dir "${pkg_install_dir}/include"
GCC_CFLAGS="-I'${pkg_install_dir}/include'"
GCC_LDFLAGS="-L'${pkg_install_dir}/lib64' -L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib64' -Wl,-rpath='${pkg_install_dir}/lib64'"
;;
[ -d gcc-${gcc_ver} ] && rm -rf gcc-${gcc_ver}
tar -xzf gcc-${gcc_ver}.tar.gz
fi
echo "Installing GCC from scratch into ${pkg_install_dir}"
cd gcc-${gcc_ver}
for patch in "${patches[@]}"; do
patch -p1 < "${patch}"
done
./contrib/download_prerequisites > prereq.log 2>&1
GCCROOT=${PWD}
mkdir obj
cd obj
${GCCROOT}/configure --prefix="${pkg_install_dir}" \
--libdir="${pkg_install_dir}/lib" \
--enable-languages=c,c++,fortran \
--disable-multilib --disable-bootstrap \
--enable-lto \
--enable-plugins \
> configure.log 2>&1
make -j $NPROCS \
CFLAGS="-fPIC $CFLAGS" \
CXXFLAGS="-fPIC $CXXFLAGS" \
> make.log 2>&1
make -j $NPROCS install > install.log 2>&1
# thread sanitizer
if [ $ENABLE_TSAN = "__TRUE__" ]; then
# now the tricky bit... we need to recompile in particular
# libgomp with -fsanitize=thread.. there is not configure
# option for this (as far as I know). we need to go in
# the build tree and recompile / reinstall with proper
# options... this is likely to break for later version of
# gcc, tested with 5.1.0 based on
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55374#c10
cd x86_64*/libgfortran
make clean > clean.log 2>&1
make -j $NPROCS \
CFLAGS="-std=gnu99 -g -O2 -fsanitize=thread " \
FCFLAGS="-g -O2 -fsanitize=thread" \
CXXFLAGS="-std=gnu99 -g -O2 -fsanitize=thread " \
LDFLAGS="-B$(pwd)/../libsanitizer/tsan/.libs/ -Wl,-rpath,$(pwd)/../libsanitizer/tsan/.libs/ -fsanitize=thread" \
> make.log 2>&1
make install > install.log 2>&1
cd ../libgomp
make clean > clean.log 2>&1
make -j $NPROCS \
CFLAGS="-std=gnu99 -g -O2 -fsanitize=thread " \
FCFLAGS="-g -O2 -fsanitize=thread" \
CXXFLAGS="-std=gnu99 -g -O2 -fsanitize=thread " \
LDFLAGS="-B$(pwd)/../libsanitizer/tsan/.libs/ -Wl,-rpath,$(pwd)/../libsanitizer/tsan/.libs/ -fsanitize=thread" \
> make.log 2>&1
make install > install.log 2>&1
cd $GCCROOT/obj/
fi
cd ../..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage0/$(basename ${SCRIPT_NAME})"
fi
GCC_CFLAGS="-I'${pkg_install_dir}/include'"
GCC_LDFLAGS="-L'${pkg_install_dir}/lib64' -L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib64' -Wl,-rpath='${pkg_install_dir}/lib64'"
;;
__SYSTEM__)
echo "==================== Finding GCC from system paths ===================="
check_command gcc "gcc"
check_command g++ "gcc"
check_command gfortran "gcc"
add_include_from_paths -p GCC_CFLAGS "c++" $INCLUDE_PATHS
add_lib_from_paths GCC_LDFLAGS "libgfortran.*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking GCC to user paths ===================="
pkg_install_dir="$with_gcc"
check_dir "${pkg_install_dir}/bin"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/lib64"
check_dir "${pkg_install_dir}/include"
GCC_CFLAGS="-I'${pkg_install_dir}/include'"
GCC_LDFLAGS="-L'${pkg_install_dir}/lib64' -L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib64' -Wl,-rpath='${pkg_install_dir}/lib64'"
;;
esac
if [ "$ENABLE_TSAN" = "__TRUE__" ] ; then
TSANFLAGS="-fsanitize=thread"
if [ "$ENABLE_TSAN" = "__TRUE__" ]; then
TSANFLAGS="-fsanitize=thread"
else
TSANFLAGS=""
TSANFLAGS=""
fi
if [ "$with_gcc" != "__DONTUSE__" ] ; then
if [ "$with_gcc" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_gcc"
if [ "$with_gcc" != "__DONTUSE__" ]; then
if [ "$with_gcc" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_gcc"
# needs full path for mpich/openmpi builds, triggers openblas bug
export CC="${pkg_install_dir}/bin/gcc"
export CXX="${pkg_install_dir}/bin/g++"
@ -146,9 +146,9 @@ prepend_path LIBRARY_PATH "${pkg_install_dir}/lib"
prepend_path LIBRARY_PATH "${pkg_install_dir}/lib64"
prepend_path CPATH "${pkg_install_dir}/include"
EOF
cat "${BUILDDIR}/setup_gcc" >> $SETUPFILE
fi
cat <<EOF >> "${BUILDDIR}/setup_gcc"
cat "${BUILDDIR}/setup_gcc" >> $SETUPFILE
fi
cat << EOF >> "${BUILDDIR}/setup_gcc"
export GCC_CFLAGS="${GCC_CFLAGS}"
export GCC_LDFLAGS="${GCC_LDFLAGS}"
export TSANFLAGS="${TSANFLAGS}"
@ -162,7 +162,7 @@ cd "${ROOTDIR}"
# this might need to be adjusted for the versions of the software
# employed
cat <<EOF >> ${INSTALLDIR}/lsan.supp
cat << EOF >> ${INSTALLDIR}/lsan.supp
# known leak either related to mpi or scalapack (e.g. showing randomly for Fist/regtest-7-2/UO2-2x2x2-genpot_units.inp)
leak:__cp_fm_types_MOD_cp_fm_write_unformatted
# leak related to mpi or scalapack triggers sometimes for regtest-kp-2/cc2.inp
@ -188,7 +188,7 @@ race:__dbcsr_transformations_MOD_dbcsr_make_untransposed_blocks
EOF
# need to also link to the .supp file in setup file
cat <<EOF >> ${SETUPFILE}
cat << EOF >> ${SETUPFILE}
export LSAN_OPTIONS=suppressions=${INSTALLDIR}/lsan.supp
export TSAN_OPTIONS=suppressions=${INSTALLDIR}/tsan.supp
EOF

View file

@ -9,8 +9,8 @@ source "${SCRIPT_DIR}"/signal_trap.sh
source "${INSTALLDIR}"/toolchain.conf
source "${INSTALLDIR}"/toolchain.env
for ii in $tool_list ; do
load "${BUILDDIR}/setup_${ii}"
for ii in $tool_list; do
load "${BUILDDIR}/setup_${ii}"
done
# ------------------------------------------------------------------------
@ -35,7 +35,8 @@ export CXXFLAGS=$(allowed_gxx_flags ${CXXFLAGS})
export LDFLAGS="${TSANFLAGS}"
# get system arch information using OpenBLAS prebuild
"${SCRIPTDIR}"/get_openblas_arch.sh; load "${BUILDDIR}/openblas_arch"
"${SCRIPTDIR}"/get_openblas_arch.sh
load "${BUILDDIR}/openblas_arch"
write_toolchain_env "${INSTALLDIR}"

View file

@ -18,49 +18,49 @@ mkdir -p "${BUILDDIR}"
cd "${BUILDDIR}"
case "$with_intelmpi" in
__INSTALL__)
echo '__INSTALL__ is not supported; please manually install Intel MPI'
exit 1
;;
__SYSTEM__)
echo "==================== Finding Intel MPI from system paths ===================="
check_command mpirun "intelmpi"
check_command mpiicc "intelmpi"
check_command mpiifort "intelmpi"
check_command mpiicpc "intelmpi"
add_include_from_paths INTELMPI_CFLAGS "mpi.h" $INCLUDE_PATHS
add_lib_from_paths INTELMPI_LDFLAGS "libmpi.*" $LIB_PATHS
check_lib -lmpi "intelmpi"
check_lib -lmpicxx "intelmpi"
;;
__DONTUSE__)
;;
*)
echo "==================== Linking INTELMPI to user paths ===================="
pkg_install_dir="$with_intelmpi"
check_dir "${pkg_install_dir}/bin"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
INTELMPI_CFLAGS="-I'${pkg_install_dir}/include'"
INTELMPI_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__INSTALL__)
echo '__INSTALL__ is not supported; please manually install Intel MPI'
exit 1
;;
__SYSTEM__)
echo "==================== Finding Intel MPI from system paths ===================="
check_command mpirun "intelmpi"
check_command mpiicc "intelmpi"
check_command mpiifort "intelmpi"
check_command mpiicpc "intelmpi"
add_include_from_paths INTELMPI_CFLAGS "mpi.h" $INCLUDE_PATHS
add_lib_from_paths INTELMPI_LDFLAGS "libmpi.*" $LIB_PATHS
check_lib -lmpi "intelmpi"
check_lib -lmpicxx "intelmpi"
;;
__DONTUSE__) ;;
*)
echo "==================== Linking INTELMPI to user paths ===================="
pkg_install_dir="$with_intelmpi"
check_dir "${pkg_install_dir}/bin"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
INTELMPI_CFLAGS="-I'${pkg_install_dir}/include'"
INTELMPI_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac
if [ "$with_intelmpi" != "__DONTUSE__" ] ; then
INTELMPI_LIBS="-lmpi -lmpicxx"
if [ "$with_intelmpi" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_intelmpi"
if [ "$with_intelmpi" != "__DONTUSE__" ]; then
INTELMPI_LIBS="-lmpi -lmpicxx"
if [ "$with_intelmpi" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_intelmpi"
prepend_path PATH "$pkg_install_dir/bin"
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"
prepend_path CPATH "$pkg_install_dir/include"
EOF
cat "${BUILDDIR}/setup_intelmpi" >> $SETUPFILE
mpi_bin="$pkg_install_dir/bin/mpirun"
else
mpi_bin=mpirun
fi
cat <<EOF >> "${BUILDDIR}/setup_intelmpi"
cat "${BUILDDIR}/setup_intelmpi" >> $SETUPFILE
mpi_bin="$pkg_install_dir/bin/mpirun"
else
mpi_bin=mpirun
fi
cat << EOF >> "${BUILDDIR}/setup_intelmpi"
export MPI_MODE="${MPI_MODE}"
export INTELMPI_CFLAGS="${INTELMPI_CFLAGS}"
export INTELMPI_LDFLAGS="${INTELMPI_LDFLAGS}"

View file

@ -22,87 +22,87 @@ MPICH_LIBS=''
cd "${BUILDDIR}"
case "$with_mpich" in
__INSTALL__)
echo "==================== Installing MPICH ===================="
pkg_install_dir="${INSTALLDIR}/mpich-${mpich_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "mpich-${mpich_ver} is already installed, skipping it."
else
if [ -f ${mpich_pkg} ] ; then
echo "${mpich_pkg} is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${mpich_sha256}\
https://www.cp2k.org/static/downloads/${mpich_pkg}
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d mpich-${mpich_ver} ] && rm -rf mpich-${mpich_ver}
tar -xzf ${mpich_pkg}
cd mpich-${mpich_ver}
unset F90
unset F90FLAGS
__INSTALL__)
echo "==================== Installing MPICH ===================="
pkg_install_dir="${INSTALLDIR}/mpich-${mpich_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "mpich-${mpich_ver} is already installed, skipping it."
else
if [ -f ${mpich_pkg} ]; then
echo "${mpich_pkg} is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${mpich_sha256} \
https://www.cp2k.org/static/downloads/${mpich_pkg}
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d mpich-${mpich_ver} ] && rm -rf mpich-${mpich_ver}
tar -xzf ${mpich_pkg}
cd mpich-${mpich_ver}
unset F90
unset F90FLAGS
# workaround for compilation with GCC-10, until properly fixed:
# https://github.com/pmodels/mpich/issues/4300
( "${FC}" --version | grep -Eq 'GNU.+\s10\.') && compat_flag="-fallow-argument-mismatch" || compat_flag=""
./configure --prefix="${pkg_install_dir}" --libdir="${pkg_install_dir}/lib" MPICC="" FFLAGS="${FCFLAGS} ${compat_flag}" FCFLAGS="${FCFLAGS} ${compat_flag}" --without-x --enable-gl=no > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage1/$(basename ${SCRIPT_NAME})"
fi
MPICH_CFLAGS="-I'${pkg_install_dir}/include'"
MPICH_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding MPICH from system paths ===================="
check_command mpirun "mpich"
check_command mpicc "mpich"
check_command mpif90 "mpich"
check_command mpic++ "mpich"
check_lib -lmpi "mpich"
check_lib -lmpicxx "mpich"
add_include_from_paths MPICH_CFLAGS "mpi.h" $INCLUDE_PATHS
add_lib_from_paths MPICH_LDFLAGS "libmpi.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking MPICH to user paths ===================="
pkg_install_dir="$with_mpich"
check_dir "${pkg_install_dir}/bin"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
MPICH_CFLAGS="-I'${pkg_install_dir}/include'"
MPICH_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
# workaround for compilation with GCC-10, until properly fixed:
# https://github.com/pmodels/mpich/issues/4300
("${FC}" --version | grep -Eq 'GNU.+\s10\.') && compat_flag="-fallow-argument-mismatch" || compat_flag=""
./configure --prefix="${pkg_install_dir}" --libdir="${pkg_install_dir}/lib" MPICC="" FFLAGS="${FCFLAGS} ${compat_flag}" FCFLAGS="${FCFLAGS} ${compat_flag}" --without-x --enable-gl=no > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage1/$(basename ${SCRIPT_NAME})"
fi
MPICH_CFLAGS="-I'${pkg_install_dir}/include'"
MPICH_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding MPICH from system paths ===================="
check_command mpirun "mpich"
check_command mpicc "mpich"
check_command mpif90 "mpich"
check_command mpic++ "mpich"
check_lib -lmpi "mpich"
check_lib -lmpicxx "mpich"
add_include_from_paths MPICH_CFLAGS "mpi.h" $INCLUDE_PATHS
add_lib_from_paths MPICH_LDFLAGS "libmpi.*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking MPICH to user paths ===================="
pkg_install_dir="$with_mpich"
check_dir "${pkg_install_dir}/bin"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
MPICH_CFLAGS="-I'${pkg_install_dir}/include'"
MPICH_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac
if [ "$with_mpich" != "__DONTUSE__" ] ; then
MPICH_LIBS="-lmpi -lmpicxx"
if [ "$with_mpich" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_mpich"
if [ "$with_mpich" != "__DONTUSE__" ]; then
MPICH_LIBS="-lmpi -lmpicxx"
if [ "$with_mpich" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_mpich"
prepend_path PATH "$pkg_install_dir/bin"
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"
prepend_path CPATH "$pkg_install_dir/include"
EOF
cat "${BUILDDIR}/setup_mpich" >> $SETUPFILE
mpi_bin="$pkg_install_dir/bin/mpirun"
else
mpi_bin=mpirun
fi
# check MPICH version, versions less than 3.0 will get -D__MPI_VERSION=2 flag
raw_version=$($mpi_bin --version | \
grep "Version:" | awk '{print $2}')
major_version=$(echo $raw_version | cut -d '.' -f 1)
minor_version=$(echo $raw_version | cut -d '.' -f 2)
if [ $major_version -lt 3 ] ; then
mpi2_dflags="-D__MPI_VERSION=2"
else
mpi2_dflags=''
fi
cat <<EOF >> "${BUILDDIR}/setup_mpich"
cat "${BUILDDIR}/setup_mpich" >> $SETUPFILE
mpi_bin="$pkg_install_dir/bin/mpirun"
else
mpi_bin=mpirun
fi
# check MPICH version, versions less than 3.0 will get -D__MPI_VERSION=2 flag
raw_version=$($mpi_bin --version |
grep "Version:" | awk '{print $2}')
major_version=$(echo $raw_version | cut -d '.' -f 1)
minor_version=$(echo $raw_version | cut -d '.' -f 2)
if [ $major_version -lt 3 ]; then
mpi2_dflags="-D__MPI_VERSION=2"
else
mpi2_dflags=''
fi
cat << EOF >> "${BUILDDIR}/setup_mpich"
export MPI_MODE="${MPI_MODE}"
export MPICH_CFLAGS="${MPICH_CFLAGS}"
export MPICH_LDFLAGS="${MPICH_LDFLAGS}"

View file

@ -22,102 +22,102 @@ OPENMPI_LIBS=''
cd "${BUILDDIR}"
case "$with_openmpi" in
__INSTALL__)
echo "==================== Installing OpenMPI ===================="
pkg_install_dir="${INSTALLDIR}/openmpi-${openmpi_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "openmpi-${openmpi_ver} is already installed, skipping it."
else
if [ -f ${openmpi_pkg} ] ; then
echo "${openmpi_pkg} is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${openmpi_sha256} \
"https://www.cp2k.org/static/downloads/${openmpi_pkg}"
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d openmpi-${openmpi_ver} ] && rm -rf openmpi-${openmpi_ver}
tar -xzf ${openmpi_pkg}
cd openmpi-${openmpi_ver}
# can have issue with older glibc libraries, in which case
# we need to add the -fgnu89-inline to CFLAGS. We can check
# the version of glibc using ldd --version, as ldd is part of
# glibc package
glibc_version=$(ldd --version | awk '/ldd/{print $NF}')
glibc_major_ver=${glibc_version%%.*}
glibc_minor_ver=${glibc_version##*.}
if [ $glibc_major_ver -lt 2 ] || \
[ $glibc_major_ver -eq 2 -a $glibc_minor_ver -lt 12 ] ; then
CFLAGS="${CFLAGS} -fgnu89-inline"
fi
./configure --prefix=${pkg_install_dir} --libdir="${pkg_install_dir}/lib" --enable-mpi1-compatibility CFLAGS="${CFLAGS}" > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make -j $NPROCS install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage1/$(basename ${SCRIPT_NAME})"
fi
OPENMPI_CFLAGS="-I'${pkg_install_dir}/include'"
OPENMPI_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding OpenMPI from system paths ===================="
check_command mpirun "openmpi"
check_command mpicc "openmpi"
check_command mpif90 "openmpi"
check_command mpic++ "openmpi"
# Fortran code in CP2K is built via the mpifort wrapper, but we may need additional
# libraries and linker flags for C/C++-based MPI codepaths, pull them in at this point.
OPENMPI_CFLAGS="$(mpicxx --showme:compile)"
OPENMPI_LDFLAGS="$(mpicxx --showme:link)"
;;
__DONTUSE__)
;;
*)
echo "==================== Linking OpenMPI to user paths ===================="
pkg_install_dir="$with_openmpi"
check_dir "${pkg_install_dir}/bin"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
OPENMPI_CFLAGS="-I'${pkg_install_dir}/include'"
OPENMPI_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__INSTALL__)
echo "==================== Installing OpenMPI ===================="
pkg_install_dir="${INSTALLDIR}/openmpi-${openmpi_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "openmpi-${openmpi_ver} is already installed, skipping it."
else
if [ -f ${openmpi_pkg} ]; then
echo "${openmpi_pkg} is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${openmpi_sha256} \
"https://www.cp2k.org/static/downloads/${openmpi_pkg}"
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d openmpi-${openmpi_ver} ] && rm -rf openmpi-${openmpi_ver}
tar -xzf ${openmpi_pkg}
cd openmpi-${openmpi_ver}
# can have issue with older glibc libraries, in which case
# we need to add the -fgnu89-inline to CFLAGS. We can check
# the version of glibc using ldd --version, as ldd is part of
# glibc package
glibc_version=$(ldd --version | awk '/ldd/{print $NF}')
glibc_major_ver=${glibc_version%%.*}
glibc_minor_ver=${glibc_version##*.}
if [ $glibc_major_ver -lt 2 ] ||
[ $glibc_major_ver -eq 2 -a $glibc_minor_ver -lt 12 ]; then
CFLAGS="${CFLAGS} -fgnu89-inline"
fi
./configure --prefix=${pkg_install_dir} --libdir="${pkg_install_dir}/lib" --enable-mpi1-compatibility CFLAGS="${CFLAGS}" > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make -j $NPROCS install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage1/$(basename ${SCRIPT_NAME})"
fi
OPENMPI_CFLAGS="-I'${pkg_install_dir}/include'"
OPENMPI_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding OpenMPI from system paths ===================="
check_command mpirun "openmpi"
check_command mpicc "openmpi"
check_command mpif90 "openmpi"
check_command mpic++ "openmpi"
# Fortran code in CP2K is built via the mpifort wrapper, but we may need additional
# libraries and linker flags for C/C++-based MPI codepaths, pull them in at this point.
OPENMPI_CFLAGS="$(mpicxx --showme:compile)"
OPENMPI_LDFLAGS="$(mpicxx --showme:link)"
;;
__DONTUSE__) ;;
*)
echo "==================== Linking OpenMPI to user paths ===================="
pkg_install_dir="$with_openmpi"
check_dir "${pkg_install_dir}/bin"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
OPENMPI_CFLAGS="-I'${pkg_install_dir}/include'"
OPENMPI_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac
if [ "$with_openmpi" != "__DONTUSE__" ] ; then
if [ "$with_openmpi" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_openmpi"
if [ "$with_openmpi" != "__DONTUSE__" ]; then
if [ "$with_openmpi" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_openmpi"
prepend_path PATH "$pkg_install_dir/bin"
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"
prepend_path CPATH "$pkg_install_dir/include"
EOF
cat "${BUILDDIR}/setup_openmpi" >> $SETUPFILE
mpi_bin="$pkg_install_dir/bin/mpirun"
mpicxx_bin="$pkg_install_dir/bin/mpicxx"
else
mpi_bin=mpirun
mpicxx_bin=mpicxx
fi
# check openmpi version as reported by mpirun
raw_version=$($mpi_bin --version 2>&1 | \
grep "(Open MPI)" | awk '{print $4}')
major_version=$(echo $raw_version | cut -d '.' -f 1)
minor_version=$(echo $raw_version | cut -d '.' -f 2)
OPENMPI_LIBS=""
# grab additional runtime libs (for C/C++) from the mpicxx wrapper,
# and remove them from the LDFLAGS if present
for lib in $("${mpicxx_bin}" --showme:libs) ; do
OPENMPI_LIBS+=" -l${lib}"
OPENMPI_LDFLAGS="${OPENMPI_LDFLAGS//-l${lib}}"
done
# old versions didn't support MPI 3, so adjust __MPI_VERSION accordingly (needed e.g. for pexsi)
if [[ "$major_version" =~ ^[0-9]+$ ]] && ( [ $major_version -lt 1 ] || \
[ $major_version -eq 1 -a $minor_version -lt 7 ] ) ; then
mpi2_dflags="-D__MPI_VERSION=2"
else
mpi2_dflags=''
fi
cat <<EOF >> "${BUILDDIR}/setup_openmpi"
cat "${BUILDDIR}/setup_openmpi" >> $SETUPFILE
mpi_bin="$pkg_install_dir/bin/mpirun"
mpicxx_bin="$pkg_install_dir/bin/mpicxx"
else
mpi_bin=mpirun
mpicxx_bin=mpicxx
fi
# check openmpi version as reported by mpirun
raw_version=$($mpi_bin --version 2>&1 |
grep "(Open MPI)" | awk '{print $4}')
major_version=$(echo $raw_version | cut -d '.' -f 1)
minor_version=$(echo $raw_version | cut -d '.' -f 2)
OPENMPI_LIBS=""
# grab additional runtime libs (for C/C++) from the mpicxx wrapper,
# and remove them from the LDFLAGS if present
for lib in $("${mpicxx_bin}" --showme:libs); do
OPENMPI_LIBS+=" -l${lib}"
OPENMPI_LDFLAGS="${OPENMPI_LDFLAGS//-l${lib}/}"
done
# old versions didn't support MPI 3, so adjust __MPI_VERSION accordingly (needed e.g. for pexsi)
if [[ "$major_version" =~ ^[0-9]+$ ]] && ([ $major_version -lt 1 ] ||
[ $major_version -eq 1 -a $minor_version -lt 7 ]); then
mpi2_dflags="-D__MPI_VERSION=2"
else
mpi2_dflags=''
fi
cat << EOF >> "${BUILDDIR}/setup_openmpi"
export OPENMPI_CFLAGS="${OPENMPI_CFLAGS}"
export OPENMPI_LDFLAGS="${OPENMPI_LDFLAGS}"
export OPENMPI_LIBS="${OPENMPI_LIBS}"
@ -132,11 +132,10 @@ EOF
fi
cd "${ROOTDIR}"
# ----------------------------------------------------------------------
# Suppress reporting of known leaks
# ----------------------------------------------------------------------
cat <<EOF >> ${INSTALLDIR}/valgrind.supp
cat << EOF >> ${INSTALLDIR}/valgrind.supp
{
<BuggyOpenMPI_1>
Memcheck:Leak
@ -183,7 +182,7 @@ cat <<EOF >> ${INSTALLDIR}/valgrind.supp
fun:ompi_comm_activate
}
EOF
cat <<EOF >> ${INSTALLDIR}/lsan.supp
cat << EOF >> ${INSTALLDIR}/lsan.supp
# leaks related to OpenMPI
leak:query_2_0_0
leak:ompi_init_f

View file

@ -16,60 +16,60 @@ source "${INSTALLDIR}"/toolchain.env
cd "${BUILDDIR}"
case "$with_valgrind" in
__INSTALL__)
echo "==================== Installing Valgrind ===================="
pkg_install_dir="${INSTALLDIR}/valgrind-${valgrind_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "valgrind-${valgrind_ver} is already installed, skipping it."
else
if [ -f valgrind-${valgrind_ver}.tar.bz2 ] ; then
echo "valgrind-${valgrind_ver}.tar.bz2 is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${valgrind_sha256} \
https://www.cp2k.org/static/downloads/valgrind-${valgrind_ver}.tar.bz2
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d valgrind-${valgrind_ver} ] && rm -rf valgrind-${valgrind_ver}
tar -xjf valgrind-${valgrind_ver}.tar.bz2
cd valgrind-${valgrind_ver}
./configure --prefix="${pkg_install_dir}" --libdir="${pkg_install_dir}/lib" > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make -j $NPROCS install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage1/$(basename ${SCRIPT_NAME})"
fi
;;
__SYSTEM__)
echo "==================== Finding Valgrind from system paths ===================="
check_command valgrind "valgrind"
;;
__DONTUSE__)
;;
*)
echo "==================== Linking Valgrind to user paths ===================="
pkg_install_dir="$with_valgrind"
check_dir "${with_valgrind}/bin"
check_dir "${with_valgrind}/lib"
check_dir "${with_valgrind}/include"
;;
__INSTALL__)
echo "==================== Installing Valgrind ===================="
pkg_install_dir="${INSTALLDIR}/valgrind-${valgrind_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "valgrind-${valgrind_ver} is already installed, skipping it."
else
if [ -f valgrind-${valgrind_ver}.tar.bz2 ]; then
echo "valgrind-${valgrind_ver}.tar.bz2 is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${valgrind_sha256} \
https://www.cp2k.org/static/downloads/valgrind-${valgrind_ver}.tar.bz2
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d valgrind-${valgrind_ver} ] && rm -rf valgrind-${valgrind_ver}
tar -xjf valgrind-${valgrind_ver}.tar.bz2
cd valgrind-${valgrind_ver}
./configure --prefix="${pkg_install_dir}" --libdir="${pkg_install_dir}/lib" > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make -j $NPROCS install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage1/$(basename ${SCRIPT_NAME})"
fi
;;
__SYSTEM__)
echo "==================== Finding Valgrind from system paths ===================="
check_command valgrind "valgrind"
;;
__DONTUSE__) ;;
*)
echo "==================== Linking Valgrind to user paths ===================="
pkg_install_dir="$with_valgrind"
check_dir "${with_valgrind}/bin"
check_dir "${with_valgrind}/lib"
check_dir "${with_valgrind}/include"
;;
esac
if [ "$with_valgrind" != "__DONTUSE__" ] ; then
if [ "$with_valgrind" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_valgrind"
if [ "$with_valgrind" != "__DONTUSE__" ]; then
if [ "$with_valgrind" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_valgrind"
prepend_path PATH "$pkg_install_dir/bin"
prepend_path PATH "$pkg_install_dir/lib"
prepend_path PATH "$pkg_install_dir/include"
EOF
cat "${BUILDDIR}/setup_valgrind" >> ${SETUPFILE}
fi
cat "${BUILDDIR}/setup_valgrind" >> ${SETUPFILE}
fi
fi
cd "${ROOTDIR}"
# ----------------------------------------------------------------------
# Suppress reporting of known leaks
# ----------------------------------------------------------------------
cat <<EOF >> ${INSTALLDIR}/valgrind.supp
cat << EOF >> ${INSTALLDIR}/valgrind.supp
{
BuggySUPERLU
Memcheck:Cond
@ -90,7 +90,7 @@ cat <<EOF >> ${INSTALLDIR}/valgrind.supp
}
EOF
# also need to give links to the .supp file in setup file
cat <<EOF >> ${SETUPFILE}
cat << EOF >> ${SETUPFILE}
export VALGRIND_OPTIONS="--suppressions=${INSTALLDIR}/valgrind.supp --max-stackframe=2168152 --error-exitcode=42"
EOF

View file

@ -17,39 +17,39 @@ ACML_LIBS=''
cd "${BUILDDIR}"
case "$with_acml" in
__INSTALL__)
echo "==================== Installing ACML ===================="
report_error $LINENO "To install ACML you should either contact your system administrator or go to https://developer.amd.com/tools-and-sdks/archive/amd-core-math-library-acml/acml-downloads-resources/ and download the correct version for your system."
exit 1
;;
__SYSTEM__)
echo "==================== Finding ACML from system paths ===================="
check_lib -lacml "ACML"
add_include_from_paths ACML_CFLAGS "acml.h" $INCLUDE_PATHS
add_lib_from_paths ACML_LDFLAGS "libacml.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking ACML to user paths ===================="
pkg_install_dir="$with_acml"
check_dir "${pkg_install_dir}/lib"
ACML_CFLAGS="-I'${pkg_install_dir}/include'"
ACML_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__INSTALL__)
echo "==================== Installing ACML ===================="
report_error $LINENO "To install ACML you should either contact your system administrator or go to https://developer.amd.com/tools-and-sdks/archive/amd-core-math-library-acml/acml-downloads-resources/ and download the correct version for your system."
exit 1
;;
__SYSTEM__)
echo "==================== Finding ACML from system paths ===================="
check_lib -lacml "ACML"
add_include_from_paths ACML_CFLAGS "acml.h" $INCLUDE_PATHS
add_lib_from_paths ACML_LDFLAGS "libacml.*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking ACML to user paths ===================="
pkg_install_dir="$with_acml"
check_dir "${pkg_install_dir}/lib"
ACML_CFLAGS="-I'${pkg_install_dir}/include'"
ACML_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac
if [ "$with_acml" != "__DONTUSE__" ] ; then
ACML_LIBS="-lacml"
if [ "$with_acml" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_acml"
if [ "$with_acml" != "__DONTUSE__" ]; then
ACML_LIBS="-lacml"
if [ "$with_acml" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_acml"
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"
prepend_path CPATH "$pkg_install_dir/include"
EOF
cat "${BUILDDIR}/setup_acml" >> $SETUPFILE
fi
cat <<EOF >> "${BUILDDIR}/setup_acml"
cat "${BUILDDIR}/setup_acml" >> $SETUPFILE
fi
cat << EOF >> "${BUILDDIR}/setup_acml"
export ACML_CFLAGS="${ACML_CFLAGS}"
export ACML_LDFLAGS="${ACML_LDFLAGS}"
export ACML_LIBS="${ACML_LIBS}"

View file

@ -21,72 +21,72 @@ FFTW_LIBS=''
cd "${BUILDDIR}"
case "$with_fftw" in
__INSTALL__)
require_env MPI_LIBS
echo "==================== Installing FFTW ===================="
pkg_install_dir="${INSTALLDIR}/fftw-${fftw_ver}"
install_lock_file="$pkg_install_dir/install_successful"
__INSTALL__)
require_env MPI_LIBS
echo "==================== Installing FFTW ===================="
pkg_install_dir="${INSTALLDIR}/fftw-${fftw_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "fftw-${fftw_ver} is already installed, skipping it."
else
if [ -f ${fftw_pkg} ] ; then
echo "${fftw_pkg} is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${fftw_sha256} \
"https://www.cp2k.org/static/downloads/${fftw_pkg}"
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d fftw-${fftw_ver} ] && rm -rf fftw-${fftw_ver}
tar -xzf ${fftw_pkg}
cd fftw-${fftw_ver}
FFTW_FLAGS="--enable-openmp --enable-shared --enable-static"
# fftw has mpi support but not compiled by default. so compile it if we build with mpi.
# it will create a second library to link with if needed
[ "$MPI_MODE" != "no" ] && FFTW_FLAGS="--enable-mpi ${FFTW_FLAGS}"
grep '\bavx\b' /proc/cpuinfo 1>/dev/null && FFTW_FLAGS="${FFTW_FLAGS} --enable-avx"
grep '\bavx2\b' /proc/cpuinfo 1>/dev/null && FFTW_FLAGS="${FFTW_FLAGS} --enable-avx2"
grep '\bavx512f\b' /proc/cpuinfo 1>/dev/null && FFTW_FLAGS="${FFTW_FLAGS} --enable-avx512"
./configure --prefix=${pkg_install_dir} --libdir="${pkg_install_dir}/lib" ${FFTW_FLAGS} > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage2/$(basename ${SCRIPT_NAME})"
fi
FFTW_CFLAGS="-I'${pkg_install_dir}/include'"
FFTW_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding FFTW from system paths ===================="
check_lib -lfftw3 "FFTW"
check_lib -lfftw3_omp "FFTW"
[ "$MPI_MODE" != "no" ] && check_lib -lfftw3_mpi "FFTW"
add_include_from_paths FFTW_CFLAGS "fftw3.h" $INCLUDE_PATHS
add_lib_from_paths FFTW_LDFLAGS "libfftw3.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking FFTW to user paths ===================="
pkg_install_dir="$with_fftw"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
FFTW_CFLAGS="-I'${pkg_install_dir}/include'"
FFTW_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
if verify_checksums "${install_lock_file}"; then
echo "fftw-${fftw_ver} is already installed, skipping it."
else
if [ -f ${fftw_pkg} ]; then
echo "${fftw_pkg} is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${fftw_sha256} \
"https://www.cp2k.org/static/downloads/${fftw_pkg}"
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d fftw-${fftw_ver} ] && rm -rf fftw-${fftw_ver}
tar -xzf ${fftw_pkg}
cd fftw-${fftw_ver}
FFTW_FLAGS="--enable-openmp --enable-shared --enable-static"
# fftw has mpi support but not compiled by default. so compile it if we build with mpi.
# it will create a second library to link with if needed
[ "$MPI_MODE" != "no" ] && FFTW_FLAGS="--enable-mpi ${FFTW_FLAGS}"
grep '\bavx\b' /proc/cpuinfo 1> /dev/null && FFTW_FLAGS="${FFTW_FLAGS} --enable-avx"
grep '\bavx2\b' /proc/cpuinfo 1> /dev/null && FFTW_FLAGS="${FFTW_FLAGS} --enable-avx2"
grep '\bavx512f\b' /proc/cpuinfo 1> /dev/null && FFTW_FLAGS="${FFTW_FLAGS} --enable-avx512"
./configure --prefix=${pkg_install_dir} --libdir="${pkg_install_dir}/lib" ${FFTW_FLAGS} > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage2/$(basename ${SCRIPT_NAME})"
fi
FFTW_CFLAGS="-I'${pkg_install_dir}/include'"
FFTW_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding FFTW from system paths ===================="
check_lib -lfftw3 "FFTW"
check_lib -lfftw3_omp "FFTW"
[ "$MPI_MODE" != "no" ] && check_lib -lfftw3_mpi "FFTW"
add_include_from_paths FFTW_CFLAGS "fftw3.h" $INCLUDE_PATHS
add_lib_from_paths FFTW_LDFLAGS "libfftw3.*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking FFTW to user paths ===================="
pkg_install_dir="$with_fftw"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
FFTW_CFLAGS="-I'${pkg_install_dir}/include'"
FFTW_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac
if [ "$with_fftw" != "__DONTUSE__" ] ; then
FFTW_LIBS="-lfftw3 -lfftw3_omp"
if [ "$with_fftw" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_fftw"
if [ "$with_fftw" != "__DONTUSE__" ]; then
FFTW_LIBS="-lfftw3 -lfftw3_omp"
if [ "$with_fftw" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_fftw"
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"
prepend_path CPATH "$pkg_install_dir/include"
EOF
fi
# we may also want to cover FFT_SG
cat <<EOF >> "${BUILDDIR}/setup_fftw"
fi
# we may also want to cover FFT_SG
cat << EOF >> "${BUILDDIR}/setup_fftw"
export FFTW_CFLAGS="${FFTW_CFLAGS}"
export FFTW_LDFLAGS="${FFTW_LDFLAGS}"
export FFTW_LIBS="${FFTW_LIBS}"
@ -98,15 +98,14 @@ prepend_path PKG_CONFIG_PATH "$pkg_install_dir/lib/pkgconfig"
export FFTW_ROOT="$pkg_install_dir"
EOF
cat "${BUILDDIR}/setup_fftw" >> $SETUPFILE
cat "${BUILDDIR}/setup_fftw" >> $SETUPFILE
fi
cd "${ROOTDIR}"
# ----------------------------------------------------------------------
# Suppress reporting of known leaks
# ----------------------------------------------------------------------
cat <<EOF >> ${INSTALLDIR}/valgrind.supp
cat << EOF >> ${INSTALLDIR}/valgrind.supp
{
<BuggyFFTW3>
Memcheck:Addr32

View file

@ -20,42 +20,46 @@ export FAST_MATH_LIBS=''
write_toolchain_env "${INSTALLDIR}"
"${SCRIPTDIR}"/stage2/install_reflapack.sh "${with_reflapack}"; load "${BUILDDIR}/setup_reflapack"
"${SCRIPTDIR}"/stage2/install_reflapack.sh "${with_reflapack}"
load "${BUILDDIR}/setup_reflapack"
case "$FAST_MATH_MODE" in
mkl)
"${SCRIPTDIR}"/stage2/install_mkl.sh "${with_mkl}"; load "${BUILDDIR}/setup_mkl"
;;
acml)
"${SCRIPTDIR}"/stage2/install_acml.sh "${with_acml}"; load "${BUILDDIR}/setup_acml"
;;
openblas)
"${SCRIPTDIR}"/stage2/install_openblas.sh "${with_openblas}"; load "${BUILDDIR}/setup_openblas"
;;
cray)
# note the space is intentional so that the variable is
# non-empty and can pass require_env checks
export FAST_MATH_LDFLAGS="${FAST_MATH_LDFLAGS} "
export FAST_MATH_LIBS="${FAST_MATH_LIBS} ${CRAY_EXTRA_LIBS}"
;;
mkl)
"${SCRIPTDIR}"/stage2/install_mkl.sh "${with_mkl}"
load "${BUILDDIR}/setup_mkl"
;;
acml)
"${SCRIPTDIR}"/stage2/install_acml.sh "${with_acml}"
load "${BUILDDIR}/setup_acml"
;;
openblas)
"${SCRIPTDIR}"/stage2/install_openblas.sh "${with_openblas}"
load "${BUILDDIR}/setup_openblas"
;;
cray)
# note the space is intentional so that the variable is
# non-empty and can pass require_env checks
export FAST_MATH_LDFLAGS="${FAST_MATH_LDFLAGS} "
export FAST_MATH_LIBS="${FAST_MATH_LIBS} ${CRAY_EXTRA_LIBS}"
;;
esac
if [ "$with_reflapack" = "__DONTUSE__" ] ; then
# if we don't build the refereence blas/lapack implementations,
# make sure we still link against a BLAS/LAPACK implementation in *dbg profiles
export REF_MATH_CFLAGS="${FAST_MATH_CFLAGS}"
export REF_MATH_LDFLAGS="${FAST_MATH_LDFLAGS}"
export REF_MATH_LIBS="${FAST_MATH_LIBS}"
if [ "$with_reflapack" = "__DONTUSE__" ]; then
# if we don't build the refereence blas/lapack implementations,
# make sure we still link against a BLAS/LAPACK implementation in *dbg profiles
export REF_MATH_CFLAGS="${FAST_MATH_CFLAGS}"
export REF_MATH_LDFLAGS="${FAST_MATH_LDFLAGS}"
export REF_MATH_LIBS="${FAST_MATH_LIBS}"
fi
if [ $ENABLE_VALGRIND = "__TRUE__" ] ; then
export MATH_CFLAGS="${REF_MATH_CFLAGS}"
export MATH_LDFLAGS="${REF_MATH_LDFLAGS}"
export MATH_LIBS="${REF_MATH_LIBS}"
if [ $ENABLE_VALGRIND = "__TRUE__" ]; then
export MATH_CFLAGS="${REF_MATH_CFLAGS}"
export MATH_LDFLAGS="${REF_MATH_LDFLAGS}"
export MATH_LIBS="${REF_MATH_LIBS}"
else
export MATH_CFLAGS="${FAST_MATH_CFLAGS}"
export MATH_LDFLAGS="${FAST_MATH_LDFLAGS}"
export MATH_LIBS="${FAST_MATH_LIBS}"
export MATH_CFLAGS="${FAST_MATH_CFLAGS}"
export MATH_LDFLAGS="${FAST_MATH_LDFLAGS}"
export MATH_LIBS="${FAST_MATH_LIBS}"
fi
export CP_CFLAGS="${CP_CFLAGS} IF_DEBUG(${REF_MATH_CFLAGS}|IF_VALGRIND(${REF_MATH_CFLAGS}|${FAST_MATH_CFLAGS}))"

View file

@ -17,96 +17,96 @@ MKL_LIBS=''
cd "${BUILDDIR}"
case "$with_mkl" in
__INSTALL__)
echo "==================== Installing MKL ===================="
report_error ${LINENO} "To install MKL you should contact your system administrator."
exit 1
;;
__SYSTEM__)
echo "==================== Finding MKL from system paths ===================="
if ! [ -z "${MKLROOT}" ] ; then
echo "MKLROOT is found to be ${MKLROOT}"
else
report_error ${LINENO} "Cannot find env variable MKLROOT, the script relies on it being set. Please check in MKL installation and use --with-mkl=<location> to pass the path to MKL root directory to this script."
exit 1
fi
check_lib -lm
check_lib -ldl
;;
__DONTUSE__)
;;
*)
echo "==================== Linking MKL to user paths ===================="
check_dir "$with_mkl"
MKLROOT="$with_mkl"
;;
__INSTALL__)
echo "==================== Installing MKL ===================="
report_error ${LINENO} "To install MKL you should contact your system administrator."
exit 1
;;
__SYSTEM__)
echo "==================== Finding MKL from system paths ===================="
if ! [ -z "${MKLROOT}" ]; then
echo "MKLROOT is found to be ${MKLROOT}"
else
report_error ${LINENO} "Cannot find env variable MKLROOT, the script relies on it being set. Please check in MKL installation and use --with-mkl=<location> to pass the path to MKL root directory to this script."
exit 1
fi
check_lib -lm
check_lib -ldl
;;
__DONTUSE__) ;;
*)
echo "==================== Linking MKL to user paths ===================="
check_dir "$with_mkl"
MKLROOT="$with_mkl"
;;
esac
if [ "$with_mkl" != "__DONTUSE__" ] ; then
case $OPENBLAS_ARCH in
x86_64)
mkl_arch_dir=intel64
MKL_CFLAGS="-m64"
;;
i386)
mkl_arch_dir=ia32
MKL_CFLAGS="-m32"
;;
*)
report_error $LINENO "MKL only supports intel64 (x86_64) and ia32 (i386) at the moment, and your arch obtained from OpenBLAS prebuild is $OPENBLAS_ARCH"
exit 1
;;
esac
mkl_lib_dir="${MKLROOT}/lib/${mkl_arch_dir}"
# check we have required libraries
mkl_required_libs="libmkl_gf_lp64.so libmkl_sequential.so libmkl_core.so"
for ii in $mkl_required_libs ; do
if [ ! -f "$mkl_lib_dir/${ii}" ] ; then
report_error $LINENO "missing MKL library ${ii}"
exit 1
fi
done
if [ "$with_mkl" != "__DONTUSE__" ]; then
case $OPENBLAS_ARCH in
x86_64)
mkl_arch_dir=intel64
MKL_CFLAGS="-m64"
;;
i386)
mkl_arch_dir=ia32
MKL_CFLAGS="-m32"
;;
*)
report_error $LINENO "MKL only supports intel64 (x86_64) and ia32 (i386) at the moment, and your arch obtained from OpenBLAS prebuild is $OPENBLAS_ARCH"
exit 1
;;
esac
mkl_lib_dir="${MKLROOT}/lib/${mkl_arch_dir}"
# check we have required libraries
mkl_required_libs="libmkl_gf_lp64.so libmkl_sequential.so libmkl_core.so"
for ii in $mkl_required_libs; do
if [ ! -f "$mkl_lib_dir/${ii}" ]; then
report_error $LINENO "missing MKL library ${ii}"
exit 1
fi
done
case $MPI_MODE in
mpich)
mkl_scalapack_lib="-lmkl_scalapack_lp64"
mkl_blacs_lib="-lmkl_blacs_intelmpi_lp64"
;;
openmpi)
mkl_scalapack_lib="-lmkl_scalapack_lp64"
mkl_blacs_lib="-lmkl_blacs_openmpi_lp64"
;;
*)
echo "Not using MKL provided ScaLAPACK and BLACS"
mkl_scalapack_lib=""
mkl_blacs_lib=""
;;
esac
case $MPI_MODE in
mpich)
mkl_scalapack_lib="-lmkl_scalapack_lp64"
mkl_blacs_lib="-lmkl_blacs_intelmpi_lp64"
;;
openmpi)
mkl_scalapack_lib="-lmkl_scalapack_lp64"
mkl_blacs_lib="-lmkl_blacs_openmpi_lp64"
;;
*)
echo "Not using MKL provided ScaLAPACK and BLACS"
mkl_scalapack_lib=""
mkl_blacs_lib=""
;;
esac
# set the correct lib flags from MLK link adviser
MKL_LIBS="-L${mkl_lib_dir} -Wl,-rpath=${mkl_lib_dir} ${mkl_scalapack_lib}"
MKL_LIBS+=" -Wl,--start-group -lmkl_gf_lp64 -lmkl_sequential -lmkl_core"
MKL_LIBS+=" ${mkl_blacs_lib} -Wl,--end-group -lpthread -lm -ldl"
# set the correct lib flags from MLK link adviser
MKL_LIBS="-L${mkl_lib_dir} -Wl,-rpath=${mkl_lib_dir} ${mkl_scalapack_lib}"
MKL_LIBS+=" -Wl,--start-group -lmkl_gf_lp64 -lmkl_sequential -lmkl_core"
MKL_LIBS+=" ${mkl_blacs_lib} -Wl,--end-group -lpthread -lm -ldl"
MKL_CFLAGS="${MKL_CFLAGS} -I${MKLROOT}/include -I${MKLROOT}/include/fftw"
MKL_CFLAGS="${MKL_CFLAGS} -I${MKLROOT}/include -I${MKLROOT}/include/fftw"
# write setup files
cat <<EOF > "${BUILDDIR}/setup_mkl"
# write setup files
cat << EOF > "${BUILDDIR}/setup_mkl"
export MKLROOT="${MKLROOT}"
EOF
cat "${BUILDDIR}/setup_mkl" >> ${SETUPFILE}
cat <<EOF >> "${BUILDDIR}/setup_mkl"
cat "${BUILDDIR}/setup_mkl" >> ${SETUPFILE}
cat << EOF >> "${BUILDDIR}/setup_mkl"
export MKL_CFLAGS="${MKL_CFLAGS}"
export MKL_LIBS="${MKL_LIBS}"
export FAST_MATH_CFLAGS="\${FAST_MATH_CFLAGS} ${MKL_CFLAGS}"
export FAST_MATH_LIBS="\${FAST_MATH_LIBS} ${MKL_LIBS}"
export CP_DFLAGS="\${CP_DFLAGS} -D__MKL"
EOF
if [ -n "${mkl_scalapack_lib}" ] ; then
cat <<EOF >> "${BUILDDIR}/setup_mkl"
if [ -n "${mkl_scalapack_lib}" ]; then
cat << EOF >> "${BUILDDIR}/setup_mkl"
export CP_DFLAGS="\${CP_DFLAGS} IF_MPI(-D__SCALAPACK|)"
export with_scalapack="__DONTUSE__"
EOF
fi
fi
fi
load "${BUILDDIR}/setup_mkl"

View file

@ -22,109 +22,110 @@ OPENBLASROOT=""
cd "${BUILDDIR}"
case "$with_openblas" in
__INSTALL__)
echo "==================== Installing OpenBLAS ===================="
pkg_install_dir="${INSTALLDIR}/openblas-${openblas_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "openblas-${openblas_ver} is already installed, skipping it."
else
if [ -f ${openblas_pkg} ] ; then
echo "${openblas_pkg} is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${openblas_sha256} \
https://www.cp2k.org/static/downloads/${openblas_pkg}
fi
__INSTALL__)
echo "==================== Installing OpenBLAS ===================="
pkg_install_dir="${INSTALLDIR}/openblas-${openblas_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "openblas-${openblas_ver} is already installed, skipping it."
else
if [ -f ${openblas_pkg} ]; then
echo "${openblas_pkg} is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${openblas_sha256} \
https://www.cp2k.org/static/downloads/${openblas_pkg}
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d OpenBLAS-${openblas_ver} ] && rm -rf OpenBLAS-${openblas_ver}
tar -zxf ${openblas_pkg}
cd OpenBLAS-${openblas_ver}
echo "Installing from scratch into ${pkg_install_dir}"
[ -d OpenBLAS-${openblas_ver} ] && rm -rf OpenBLAS-${openblas_ver}
tar -zxf ${openblas_pkg}
cd OpenBLAS-${openblas_ver}
# First attempt to make openblas using auto detected
# TARGET, if this fails, then make with forced
# TARGET=NEHALEM
#
# wrt NUM_THREADS=64: this is what the most common Linux distros seem to choose atm
# for a good compromise between memory usage and scalability
( make -j $NPROCS \
MAKE_NB_JOBS=0 \
NUM_THREADS=64 \
USE_THREAD=1 \
USE_OPENMP=1 \
CC="${CC}" \
FC="${FC}" \
PREFIX="${pkg_install_dir}" \
> make.log 2>&1 \
) || ( \
make -j $NPROCS \
MAKE_NB_JOBS=0 \
TARGET=NEHALEM \
NUM_THREADS=64 \
USE_THREAD=1 \
USE_OPENMP=1 \
CC="${CC}" \
FC="${FC}" \
PREFIX="${pkg_install_dir}" \
> make.nehalem.log 2>&1 \
)
make -j $NPROCS \
MAKE_NB_JOBS=0 \
NUM_THREADS=64 \
USE_THREAD=1 \
USE_OPENMP=1 \
CC="${CC}" \
FC="${FC}" \
PREFIX="${pkg_install_dir}" \
install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage2/$(basename ${SCRIPT_NAME})"
fi
OPENBLAS_CFLAGS="-I'${pkg_install_dir}/include'"
OPENBLAS_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
OPENBLASROOT='${pkg_install_dir}'
OPENBLAS_LIBS="-lopenblas"
;;
__SYSTEM__)
echo "==================== Finding LAPACK from system paths ===================="
# assume that system openblas is threaded
check_lib -lopenblas "OpenBLAS"
OPENBLAS_LIBS="-lopenblas"
# detect separate omp builds
check_lib -lopenblas_openmp 2>/dev/null && OPENBLAS_LIBS="-lopenblas_openmp"
check_lib -lopenblas_omp 2>/dev/null && OPENBLAS_LIBS="-lopenblas_omp"
add_include_from_paths OPENBLAS_CFLAGS "openblas_config.h" $INCLUDE_PATHS
add_lib_from_paths OPENBLAS_LDFLAGS "libopenblas.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking LAPACK to user paths ===================="
pkg_install_dir="$with_openblas"
check_dir "${pkg_install_dir}/include"
check_dir "${pkg_install_dir}/lib"
OPENBLAS_CFLAGS="-I'${pkg_install_dir}/include'"
OPENBLAS_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
OPENBLAS_LIBS="-lopenblas"
# detect separate omp builds
(__libdir="${pkg_install_dir}/lib" LIB_PATHS="__libdir" check_lib -lopenblas_openmp 2>/dev/null) && \
OPENBLAS_LIBS="-lopenblas_openmp"
(__libdir="${pkg_install_dir}/lib" LIB_PATHS="__libdir" check_lib -lopenblas_omp 2>/dev/null) && \
OPENBLAS_LIBS="-lopenblas_omp"
;;
# First attempt to make openblas using auto detected
# TARGET, if this fails, then make with forced
# TARGET=NEHALEM
#
# wrt NUM_THREADS=64: this is what the most common Linux distros seem to choose atm
# for a good compromise between memory usage and scalability
(
make -j $NPROCS \
MAKE_NB_JOBS=0 \
NUM_THREADS=64 \
USE_THREAD=1 \
USE_OPENMP=1 \
CC="${CC}" \
FC="${FC}" \
PREFIX="${pkg_install_dir}" \
> make.log 2>&1
) || (
make -j $NPROCS \
MAKE_NB_JOBS=0 \
TARGET=NEHALEM \
NUM_THREADS=64 \
USE_THREAD=1 \
USE_OPENMP=1 \
CC="${CC}" \
FC="${FC}" \
PREFIX="${pkg_install_dir}" \
> make.nehalem.log 2>&1
)
make -j $NPROCS \
MAKE_NB_JOBS=0 \
NUM_THREADS=64 \
USE_THREAD=1 \
USE_OPENMP=1 \
CC="${CC}" \
FC="${FC}" \
PREFIX="${pkg_install_dir}" \
install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage2/$(basename ${SCRIPT_NAME})"
fi
OPENBLAS_CFLAGS="-I'${pkg_install_dir}/include'"
OPENBLAS_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
OPENBLASROOT='${pkg_install_dir}'
OPENBLAS_LIBS="-lopenblas"
;;
__SYSTEM__)
echo "==================== Finding LAPACK from system paths ===================="
# assume that system openblas is threaded
check_lib -lopenblas "OpenBLAS"
OPENBLAS_LIBS="-lopenblas"
# detect separate omp builds
check_lib -lopenblas_openmp 2> /dev/null && OPENBLAS_LIBS="-lopenblas_openmp"
check_lib -lopenblas_omp 2> /dev/null && OPENBLAS_LIBS="-lopenblas_omp"
add_include_from_paths OPENBLAS_CFLAGS "openblas_config.h" $INCLUDE_PATHS
add_lib_from_paths OPENBLAS_LDFLAGS "libopenblas.*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking LAPACK to user paths ===================="
pkg_install_dir="$with_openblas"
check_dir "${pkg_install_dir}/include"
check_dir "${pkg_install_dir}/lib"
OPENBLAS_CFLAGS="-I'${pkg_install_dir}/include'"
OPENBLAS_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
OPENBLAS_LIBS="-lopenblas"
# detect separate omp builds
(__libdir="${pkg_install_dir}/lib" LIB_PATHS="__libdir" check_lib -lopenblas_openmp 2> /dev/null) &&
OPENBLAS_LIBS="-lopenblas_openmp"
(__libdir="${pkg_install_dir}/lib" LIB_PATHS="__libdir" check_lib -lopenblas_omp 2> /dev/null) &&
OPENBLAS_LIBS="-lopenblas_omp"
;;
esac
if [ "$with_openblas" != "__DONTUSE__" ] ; then
if [ "$with_openblas" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_openblas"
if [ "$with_openblas" != "__DONTUSE__" ]; then
if [ "$with_openblas" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_openblas"
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"
prepend_path CPATH "$pkg_install_dir/include"
export OPENBLASROOT=${pkg_install_dir}
EOF
cat "${BUILDDIR}/setup_openblas" >> $SETUPFILE
fi
cat <<EOF >> "${BUILDDIR}/setup_openblas"
cat "${BUILDDIR}/setup_openblas" >> $SETUPFILE
fi
cat << EOF >> "${BUILDDIR}/setup_openblas"
export OPENBLASROOT="${pkg_install_dir}"
export OPENBLAS_CFLAGS="${OPENBLAS_CFLAGS}"
export OPENBLAS_LDFLAGS="${OPENBLAS_LDFLAGS}"

View file

@ -19,24 +19,24 @@ REFLAPACK_LIBS=''
cd "${BUILDDIR}"
case "$with_reflapack" in
__INSTALL__)
echo "==================== Installing LAPACK ===================="
pkg_install_dir="${INSTALLDIR}/lapack-${reflapack_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "lapack-${reflapack_ver} is already installed, skipping it."
else
if [ -f lapack-${reflapack_ver}.tgz ] ; then
echo "reflapack-${reflapack_ver}.tgz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${reflapack_sha256} \
https://www.cp2k.org/static/downloads/lapack-${reflapack_ver}.tgz
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d lapack-${reflapack_ver} ] && rm -rf lapack-${reflapack_ver}
tar -xzf lapack-${reflapack_ver}.tgz
cd lapack-${reflapack_ver}
cat <<EOF > make.inc
__INSTALL__)
echo "==================== Installing LAPACK ===================="
pkg_install_dir="${INSTALLDIR}/lapack-${reflapack_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "lapack-${reflapack_ver} is already installed, skipping it."
else
if [ -f lapack-${reflapack_ver}.tgz ]; then
echo "reflapack-${reflapack_ver}.tgz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${reflapack_sha256} \
https://www.cp2k.org/static/downloads/lapack-${reflapack_ver}.tgz
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d lapack-${reflapack_ver} ] && rm -rf lapack-${reflapack_ver}
tar -xzf lapack-${reflapack_ver}.tgz
cd lapack-${reflapack_ver}
cat << EOF > make.inc
SHELL = /bin/sh
FORTRAN = $FC
OPTS = $FFLAGS -frecursive
@ -56,56 +56,56 @@ LAPACKLIB = liblapack.a
TMGLIB = libtmglib.a
LAPACKELIB = liblapacke.a
EOF
# lapack/blas build is *not* parallel safe (updates to the archive race)
# Run first in parallel which will result most likely in an incomplete library
make -j $NPROCS lib blaslib > make.log 2>&1
# Complete library in non-parallel mode
make -j 1 lib blaslib > make1.log 2>&1
# no make install, so have to do this manually
! [ -d "${pkg_install_dir}/lib" ] && mkdir -p "${pkg_install_dir}/lib"
cp libblas.a SRC/liblapack.a "${pkg_install_dir}/lib"
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage2/$(basename ${SCRIPT_NAME})"
fi
REFLAPACK_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding LAPACK from system paths ===================="
check_lib -lblas "lapack"
check_lib -llapack "lapack"
add_lib_from_paths REFLAPACK_LDFLAGS "liblapack.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking LAPACK to user paths ===================="
pkg_install_dir="$with_reflapack"
check_dir "${pkg_install_dir}/lib"
REFLAPACK_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
# lapack/blas build is *not* parallel safe (updates to the archive race)
# Run first in parallel which will result most likely in an incomplete library
make -j $NPROCS lib blaslib > make.log 2>&1
# Complete library in non-parallel mode
make -j 1 lib blaslib > make1.log 2>&1
# no make install, so have to do this manually
! [ -d "${pkg_install_dir}/lib" ] && mkdir -p "${pkg_install_dir}/lib"
cp libblas.a SRC/liblapack.a "${pkg_install_dir}/lib"
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage2/$(basename ${SCRIPT_NAME})"
fi
REFLAPACK_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding LAPACK from system paths ===================="
check_lib -lblas "lapack"
check_lib -llapack "lapack"
add_lib_from_paths REFLAPACK_LDFLAGS "liblapack.*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking LAPACK to user paths ===================="
pkg_install_dir="$with_reflapack"
check_dir "${pkg_install_dir}/lib"
REFLAPACK_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac
if [ "$with_reflapack" != "__DONTUSE__" ] ; then
REFLAPACK_LIBS="-llapack -lblas"
if [ "$with_reflapack" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_reflapack"
if [ "$with_reflapack" != "__DONTUSE__" ]; then
REFLAPACK_LIBS="-llapack -lblas"
if [ "$with_reflapack" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_reflapack"
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_reflapack" >> $SETUPFILE
fi
cat <<EOF >> "${BUILDDIR}/setup_reflapack"
cat "${BUILDDIR}/setup_reflapack" >> $SETUPFILE
fi
cat << EOF >> "${BUILDDIR}/setup_reflapack"
export REFLAPACK_LDFLAGS="${REFLAPACK_LDFLAGS}"
export REFLAPACK_LIBS="${REFLAPACK_LIBS}"
export REF_MATH_LDFLAGS="\${REF_MATH_LDFLAGS} ${REFLAPACK_LDFLAGS}"
export REF_MATH_LIBS="\${REF_MATH_LIBS} ${REFLAPACK_LIBS}"
EOF
if [ "$FAST_MATH_MODE" = reflapack ] ; then
cat <<EOF >> setup_reflapack
if [ "$FAST_MATH_MODE" = reflapack ]; then
cat << EOF >> setup_reflapack
export FAST_MATH_LDFLAGS="\${FAST_MATH_LDFLAGS} ${REFLAPACK_LDFLAGS}"
export FAST_MATH_LIBS="\${FAST_MATH_LIBS} ${REFLAPACK_LIBS}"
EOF
fi
fi
fi
load "${BUILDDIR}/setup_reflapack"

View file

@ -12,22 +12,22 @@ libint_ver="2.6.0"
libint_pkg="libint-v${libint_ver}-cp2k-lmax-${LIBINT_LMAX}.tgz"
case "$LIBINT_LMAX" in
4)
libint_sha256="7c8d28bfb03920936231228b79686ba0fd87ea922c267199789bc131cf21ac08"
;;
5)
libint_sha256="1cd72206afddb232bcf2179c6229fbf6e42e4ba8440e701e6aa57ff1e871e9db"
;;
6)
libint_sha256="bea76a433cd32bde280879f73b5fc8228c78b62e3ea57ace4c6d74b65910b8af"
;;
7)
libint_sha256="3bcdcc55e1dbafe38a785d4af171df8e300bb8b7775894b57186cdf35807c334"
;;
*)
report_error "Unsupported value --libint-lmax=${LIBINT_LMAX}."
exit 1
;;
4)
libint_sha256="7c8d28bfb03920936231228b79686ba0fd87ea922c267199789bc131cf21ac08"
;;
5)
libint_sha256="1cd72206afddb232bcf2179c6229fbf6e42e4ba8440e701e6aa57ff1e871e9db"
;;
6)
libint_sha256="bea76a433cd32bde280879f73b5fc8228c78b62e3ea57ace4c6d74b65910b8af"
;;
7)
libint_sha256="3bcdcc55e1dbafe38a785d4af171df8e300bb8b7775894b57186cdf35807c334"
;;
*)
report_error "Unsupported value --libint-lmax=${LIBINT_LMAX}."
exit 1
;;
esac
[ -f "${BUILDDIR}/setup_libint" ] && rm "${BUILDDIR}/setup_libint"
@ -39,85 +39,85 @@ LIBINT_LIBS=''
cd "${BUILDDIR}"
case "$with_libint" in
__INSTALL__)
echo "==================== Installing LIBINT ===================="
pkg_install_dir="${INSTALLDIR}/libint-v${libint_ver}-cp2k-lmax-${LIBINT_LMAX}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "libint-${libint_ver} is already installed, skipping it."
else
if [ -f ${libint_pkg} ] ; then
echo "${libint_pkg} is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${libint_sha256} \
https://github.com/cp2k/libint-cp2k/releases/download/v${libint_ver}/${libint_pkg}
fi
__INSTALL__)
echo "==================== Installing LIBINT ===================="
pkg_install_dir="${INSTALLDIR}/libint-v${libint_ver}-cp2k-lmax-${LIBINT_LMAX}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "libint-${libint_ver} is already installed, skipping it."
else
if [ -f ${libint_pkg} ]; then
echo "${libint_pkg} is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${libint_sha256} \
https://github.com/cp2k/libint-cp2k/releases/download/v${libint_ver}/${libint_pkg}
fi
[ -d libint-v${libint_ver}-cp2k-lmax-${LIBINT_LMAX} ] && rm -rf libint-v${libint_ver}-cp2k-lmax-${LIBINT_LMAX}
tar -xzf ${libint_pkg}
[ -d libint-v${libint_ver}-cp2k-lmax-${LIBINT_LMAX} ] && rm -rf libint-v${libint_ver}-cp2k-lmax-${LIBINT_LMAX}
tar -xzf ${libint_pkg}
echo "Installing from scratch into ${pkg_install_dir}"
cd libint-v${libint_ver}-cp2k-lmax-${LIBINT_LMAX}
echo "Installing from scratch into ${pkg_install_dir}"
cd libint-v${libint_ver}-cp2k-lmax-${LIBINT_LMAX}
# reduce debug information to level 1 since
# level 2 (default for -g flag) leads to very large binary size
LIBINT_CXXFLAGS="$CXXFLAGS -g1"
# reduce debug information to level 1 since
# level 2 (default for -g flag) leads to very large binary size
LIBINT_CXXFLAGS="$CXXFLAGS -g1"
# cmake build broken with libint 2.6, uncomment for libint 2.7 and above
#cmake . -DCMAKE_INSTALL_PREFIX=${pkg_install_dir} \
# -DCMAKE_CXX_COMPILER="$CXX" \
# -DLIBINT2_INSTALL_LIBDIR="${pkg_install_dir}/lib" \
# -DENABLE_FORTRAN=ON \
# -DCXXFLAGS="$LIBINT_CXXFLAGS" > configure.log 2>&1
#cmake --build . > cmake.log 2>&1
#cmake --build . --target install > install.log 2>&1
# cmake build broken with libint 2.6, uncomment for libint 2.7 and above
#cmake . -DCMAKE_INSTALL_PREFIX=${pkg_install_dir} \
# -DCMAKE_CXX_COMPILER="$CXX" \
# -DLIBINT2_INSTALL_LIBDIR="${pkg_install_dir}/lib" \
# -DENABLE_FORTRAN=ON \
# -DCXXFLAGS="$LIBINT_CXXFLAGS" > configure.log 2>&1
#cmake --build . > cmake.log 2>&1
#cmake --build . --target install > install.log 2>&1
./configure --prefix=${pkg_install_dir} \
--with-cxx="$CXX $LIBINT_CXXFLAGS" \
--with-cxx-optflags="$LIBINT_CXXFLAGS" \
--enable-fortran \
--libdir="${pkg_install_dir}/lib" \
> configure.log 2>&1
./configure --prefix=${pkg_install_dir} \
--with-cxx="$CXX $LIBINT_CXXFLAGS" \
--with-cxx-optflags="$LIBINT_CXXFLAGS" \
--enable-fortran \
--libdir="${pkg_install_dir}/lib" \
> configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make install > install.log 2>&1
make -j $NPROCS > make.log 2>&1
make install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage3/$(basename ${SCRIPT_NAME})"
fi
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage3/$(basename ${SCRIPT_NAME})"
fi
LIBINT_CFLAGS="-I'${pkg_install_dir}/include'"
LIBINT_LDFLAGS="-L'${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding LIBINT from system paths ===================="
check_lib -lint2 "libint"
add_include_from_paths -p LIBINT_CFLAGS "libint" $INCLUDE_PATHS
add_lib_from_paths LIBINT_LDFLAGS "libint2.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking LIBINT to user paths ===================="
pkg_install_dir="$with_libint"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
LIBINT_CFLAGS="-I'${pkg_install_dir}/include'"
LIBINT_LDFLAGS="-L'${pkg_install_dir}/lib'"
;;
LIBINT_CFLAGS="-I'${pkg_install_dir}/include'"
LIBINT_LDFLAGS="-L'${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding LIBINT from system paths ===================="
check_lib -lint2 "libint"
add_include_from_paths -p LIBINT_CFLAGS "libint" $INCLUDE_PATHS
add_lib_from_paths LIBINT_LDFLAGS "libint2.*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking LIBINT to user paths ===================="
pkg_install_dir="$with_libint"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
LIBINT_CFLAGS="-I'${pkg_install_dir}/include'"
LIBINT_LDFLAGS="-L'${pkg_install_dir}/lib'"
;;
esac
if [ "$with_libint" != "__DONTUSE__" ] ; then
LIBINT_LIBS="-lint2"
if [ "$with_libint" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_libint"
if [ "$with_libint" != "__DONTUSE__" ]; then
LIBINT_LIBS="-lint2"
if [ "$with_libint" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_libint"
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"
prepend_path CPATH "$pkg_install_dir/include"
EOF
cat "${BUILDDIR}/setup_libint" >> $SETUPFILE
fi
cat <<EOF >> "${BUILDDIR}/setup_libint"
cat "${BUILDDIR}/setup_libint" >> $SETUPFILE
fi
cat << EOF >> "${BUILDDIR}/setup_libint"
export LIBINT_CFLAGS="${LIBINT_CFLAGS}"
export LIBINT_LDFLAGS="${LIBINT_LDFLAGS}"
export LIBINT_LIBS="${LIBINT_LIBS}"

View file

@ -19,62 +19,62 @@ LIBXC_LIBS=''
cd "${BUILDDIR}"
case "$with_libxc" in
__INSTALL__)
echo "==================== Installing LIBXC ===================="
pkg_install_dir="${INSTALLDIR}/libxc-${libxc_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "libxc-${libxc_ver} is already installed, skipping it."
else
if [ -f libxc-${libxc_ver}.tar.gz ] ; then
echo "libxc-${libxc_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${libxc_sha256} \
https://www.cp2k.org/static/downloads/libxc-${libxc_ver}.tar.gz
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d libxc-${libxc_ver} ] && rm -rf libxc-${libxc_ver}
tar -xzf libxc-${libxc_ver}.tar.gz
cd libxc-${libxc_ver}
./configure --prefix="${pkg_install_dir}" --libdir="${pkg_install_dir}/lib" > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage3/$(basename ${SCRIPT_NAME})"
fi
LIBXC_CFLAGS="-I'${pkg_install_dir}/include'"
LIBXC_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding LIBXC from system paths ===================="
check_lib -lxcf03 "libxc"
check_lib -lxc "libxc"
add_include_from_paths LIBXC_CFLAGS "xc.h" $INCLUDE_PATHS
add_lib_from_paths LIBXC_LDFLAGS "libxc.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking LIBXC to user paths ===================="
pkg_install_dir="$with_libxc"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
LIBXC_CFLAGS="-I'${pkg_install_dir}/include'"
LIBXC_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__INSTALL__)
echo "==================== Installing LIBXC ===================="
pkg_install_dir="${INSTALLDIR}/libxc-${libxc_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "libxc-${libxc_ver} is already installed, skipping it."
else
if [ -f libxc-${libxc_ver}.tar.gz ]; then
echo "libxc-${libxc_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${libxc_sha256} \
https://www.cp2k.org/static/downloads/libxc-${libxc_ver}.tar.gz
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d libxc-${libxc_ver} ] && rm -rf libxc-${libxc_ver}
tar -xzf libxc-${libxc_ver}.tar.gz
cd libxc-${libxc_ver}
./configure --prefix="${pkg_install_dir}" --libdir="${pkg_install_dir}/lib" > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage3/$(basename ${SCRIPT_NAME})"
fi
LIBXC_CFLAGS="-I'${pkg_install_dir}/include'"
LIBXC_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding LIBXC from system paths ===================="
check_lib -lxcf03 "libxc"
check_lib -lxc "libxc"
add_include_from_paths LIBXC_CFLAGS "xc.h" $INCLUDE_PATHS
add_lib_from_paths LIBXC_LDFLAGS "libxc.*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking LIBXC to user paths ===================="
pkg_install_dir="$with_libxc"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
LIBXC_CFLAGS="-I'${pkg_install_dir}/include'"
LIBXC_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac
if [ "$with_libxc" != "__DONTUSE__" ] ; then
LIBXC_LIBS="-lxcf03 -lxc"
if [ "$with_libxc" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_libxc"
if [ "$with_libxc" != "__DONTUSE__" ]; then
LIBXC_LIBS="-lxcf03 -lxc"
if [ "$with_libxc" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_libxc"
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"
prepend_path CPATH "$pkg_install_dir/include"
EOF
cat "${BUILDDIR}/setup_libxc" >> $SETUPFILE
fi
cat <<EOF >> "${BUILDDIR}/setup_libxc"
cat "${BUILDDIR}/setup_libxc" >> $SETUPFILE
fi
cat << EOF >> "${BUILDDIR}/setup_libxc"
export LIBXC_CFLAGS="${LIBXC_CFLAGS}"
export LIBXC_LDFLAGS="${LIBXC_LDFLAGS}"
export LIBXC_LIBS="${LIBXC_LIBS}"

View file

@ -16,130 +16,130 @@ source "${INSTALLDIR}"/toolchain.env
cd "${BUILDDIR}"
case "$with_cosma" in
__INSTALL__)
require_env OPENBLASROOT
require_env SCALAPACKROOT
__INSTALL__)
require_env OPENBLASROOT
require_env SCALAPACKROOT
echo "==================== Installing cosma ===================="
pkg_install_dir="${INSTALLDIR}/cosma-${cosma_ver}"
install_lock_file="$pkg_install_dir/install_successful"
echo "==================== Installing cosma ===================="
pkg_install_dir="${INSTALLDIR}/cosma-${cosma_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "cosma-${cosma_ver} is already installed, skipping it."
else
if [ -f cosma-${cosma_ver}.tar.gz ] ; then
echo "cosma-${cosma_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${cosma_sha256} \
"https://github.com/eth-cscs/COSMA/releases/download/v${cosma_ver}/cosma.tar.gz" \
-o cosma-${cosma_ver}.tar.gz
if verify_checksums "${install_lock_file}"; then
echo "cosma-${cosma_ver} is already installed, skipping it."
else
if [ -f cosma-${cosma_ver}.tar.gz ]; then
echo "cosma-${cosma_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${cosma_sha256} \
"https://github.com/eth-cscs/COSMA/releases/download/v${cosma_ver}/cosma.tar.gz" \
-o cosma-${cosma_ver}.tar.gz
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d cosma-${cosma_ver} ] && rm -rf cosma-${cosma_ver}
tar -xzf cosma-${cosma_ver}.tar.gz
mv cosma cosma-${cosma_ver}
cd cosma-${cosma_ver}
mkdir build-cpu
cd build-cpu
case "$FAST_MATH_MODE" in
mkl)
cmake \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCOSMA_BLAS=MKL \
-DCOSMA_SCALAPACK=MKL \
-DCOSMA_WITH_TESTS=NO \
-DCOSMA_WITH_APPS=NO \
-DCOSMA_WITH_BENCHMARKS=NO .. > cmake.log 2>&1
;;
*)
cmake \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCOSMA_BLAS=OPENBLAS \
-DCOSMA_SCALAPACK=CUSTOM \
-DCOSMA_WITH_TESTS=NO \
-DCOSMA_WITH_APPS=NO \
-DCMAKE_WITH_BENCHMARKS=NO .. > cmake.log 2>&1
;;
esac
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d cosma-${cosma_ver} ] && rm -rf cosma-${cosma_ver}
tar -xzf cosma-${cosma_ver}.tar.gz
mv cosma cosma-${cosma_ver}
cd cosma-${cosma_ver}
mkdir build-cpu
cd build-cpu
case "$FAST_MATH_MODE" in
mkl)
cmake \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCOSMA_BLAS=MKL \
-DCOSMA_SCALAPACK=MKL \
-DCOSMA_WITH_TESTS=NO \
-DCOSMA_WITH_APPS=NO \
-DCOSMA_WITH_BENCHMARKS=NO .. > cmake.log 2>&1
;;
*)
cmake \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCOSMA_BLAS=OPENBLAS \
-DCOSMA_SCALAPACK=CUSTOM \
-DCOSMA_WITH_TESTS=NO \
-DCOSMA_WITH_APPS=NO \
-DCMAKE_WITH_BENCHMARKS=NO .. > cmake.log 2>&1
;;
esac
make -j $NPROCS > make.log 2>&1
make -j $NPROCS install > install.log 2>&1
cd ..
make -j $NPROCS > make.log 2>&1
make -j $NPROCS install > install.log 2>&1
cd ..
if [ "$ENABLE_CUDA" = "__TRUE__" ] ; then
[ -d build-cuda ] && rm -rf "build-cuda"
mkdir build-cuda
cd build-cuda
case "$FAST_MATH_MODE" in
mkl)
cmake \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCOSMA_BLAS=CUDA \
-DCOSMA_SCALAPACK=MKL \
-DCOSMA_WITH_TESTS=NO \
-DCOSMA_WITH_BENCHMARKS=NO \
-DCOSMA_WITH_APPS=NO .. > cmake.log 2>&1
;;
*)
cmake \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCOSMA_BLAS=CUDA \
-DCOSMA_SCALAPACK=CUSTOM \
-DCOSMA_WITH_TESTS=NO \
-DCOSMA_WITH_BENCHMARKS=NO \
-DCOSMA_WITH_APPS=NO .. > cmake.log 2>&1
;;
esac
make -j $NPROCS > make.log 2>&1
install -d ${pkg_install_dir}/lib/cuda
[ -f libs/grid2grid/src/grid2grid/*.a ] && install -m 644 libs/grid2grid/src/grid2grid/*.a ${pkg_install_dir}/lib/cuda >> install.log 2>&1
[ -f libs/options/*.so ] && install -m 644 libs/options/*.so ${pkg_install_dir}/lib/cuda >> install.log 2>&1
install -m 644 src/cosma/*.a ${pkg_install_dir}/lib/cuda >> install.log 2>&1
[ -f libs/Tiled-MM/src/Tiled-MM/*.a ] && install -m 644 libs/Tiled-MM/src/Tiled-MM/*.a ${pkg_install_dir}/lib/cuda >> install.log 2>&1
fi
if [ "$ENABLE_CUDA" = "__TRUE__" ]; then
[ -d build-cuda ] && rm -rf "build-cuda"
mkdir build-cuda
cd build-cuda
case "$FAST_MATH_MODE" in
mkl)
cmake \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCOSMA_BLAS=CUDA \
-DCOSMA_SCALAPACK=MKL \
-DCOSMA_WITH_TESTS=NO \
-DCOSMA_WITH_BENCHMARKS=NO \
-DCOSMA_WITH_APPS=NO .. > cmake.log 2>&1
;;
*)
cmake \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCOSMA_BLAS=CUDA \
-DCOSMA_SCALAPACK=CUSTOM \
-DCOSMA_WITH_TESTS=NO \
-DCOSMA_WITH_BENCHMARKS=NO \
-DCOSMA_WITH_APPS=NO .. > cmake.log 2>&1
;;
esac
make -j $NPROCS > make.log 2>&1
install -d ${pkg_install_dir}/lib/cuda
[ -f libs/grid2grid/src/grid2grid/*.a ] && install -m 644 libs/grid2grid/src/grid2grid/*.a ${pkg_install_dir}/lib/cuda >> install.log 2>&1
[ -f libs/options/*.so ] && install -m 644 libs/options/*.so ${pkg_install_dir}/lib/cuda >> install.log 2>&1
install -m 644 src/cosma/*.a ${pkg_install_dir}/lib/cuda >> install.log 2>&1
[ -f libs/Tiled-MM/src/Tiled-MM/*.a ] && install -m 644 libs/Tiled-MM/src/Tiled-MM/*.a ${pkg_install_dir}/lib/cuda >> install.log 2>&1
fi
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})"
fi
COSMA_ROOT="${pkg_install_dir}"
COSMA_CFLAGS="-I'${pkg_install_dir}/include'"
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})"
fi
COSMA_ROOT="${pkg_install_dir}"
COSMA_CFLAGS="-I'${pkg_install_dir}/include'"
# check if cosma is compiled with 64bits and set up COSMA_LIBDIR accordingly
COSMA_LIBDIR="${pkg_install_dir}/lib"
COSMA_LDFLAGS="-L'${COSMA_LIBDIR}' -Wl,-rpath='${COSMA_LIBDIR}'"
COSMA_CUDA_LDFLAGS="-L'${COSMA_LIBDIR}/cuda' -Wl,-rpath='${COSMA_LIBDIR}/cuda'"
;;
__SYSTEM__)
echo "==================== Finding cosma from system paths ===================="
check_command pkg-config --modversion cosma
add_include_from_paths COSMA_CFLAGS "cosma.h" $INCLUDE_PATHS
add_lib_from_paths COSMA_LDFLAGS "libcosma.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking cosma to user paths ===================="
pkg_install_dir="$with_cosma"
# check if cosma is compiled with 64bits and set up COSMA_LIBDIR accordingly
COSMA_LIBDIR="${pkg_install_dir}/lib"
COSMA_LDFLAGS="-L'${COSMA_LIBDIR}' -Wl,-rpath='${COSMA_LIBDIR}'"
COSMA_CUDA_LDFLAGS="-L'${COSMA_LIBDIR}/cuda' -Wl,-rpath='${COSMA_LIBDIR}/cuda'"
;;
__SYSTEM__)
echo "==================== Finding cosma from system paths ===================="
check_command pkg-config --modversion cosma
add_include_from_paths COSMA_CFLAGS "cosma.h" $INCLUDE_PATHS
add_lib_from_paths COSMA_LDFLAGS "libcosma.*" $LIB_PATHS
;;
__DONTUSE__) ;;
# use the lib64 directory if present (multi-abi distros may link lib/ to lib32/ instead)
COSMA_LIBDIR="${pkg_install_dir}/lib"
[ -d "${pkg_install_dir}/lib64" ] && COSMA_LIBDIR="${pkg_install_dir}/lib64"
*)
echo "==================== Linking cosma to user paths ===================="
pkg_install_dir="$with_cosma"
check_dir "$pkg_install_dir/lib"
check_dir "$pkg_install_dir/include"
# use the lib64 directory if present (multi-abi distros may link lib/ to lib32/ instead)
COSMA_LIBDIR="${pkg_install_dir}/lib"
[ -d "${pkg_install_dir}/lib64" ] && COSMA_LIBDIR="${pkg_install_dir}/lib64"
COSMA_CFLAGS="-I'${pkg_install_dir}/include'"
COSMA_LDFLAGS="-L'${COSMA_LIBDIR}' -Wl,-rpath='${COSMA_LIBDIR}'"
;;
check_dir "$pkg_install_dir/lib"
check_dir "$pkg_install_dir/include"
COSMA_CFLAGS="-I'${pkg_install_dir}/include'"
COSMA_LDFLAGS="-L'${COSMA_LIBDIR}' -Wl,-rpath='${COSMA_LIBDIR}'"
;;
esac
if [ "$with_cosma" != "__DONTUSE__" ] ; then
COSMA_LIBS="-lcosma_pxgemm -lcosma -lgrid2grid IF_CUDA(-lTiled-MM|)"
if [ "$with_cosma" != "__SYSTEM__" ] ; then
cat << EOF > "${BUILDDIR}/setup_cosma"
if [ "$with_cosma" != "__DONTUSE__" ]; then
COSMA_LIBS="-lcosma_pxgemm -lcosma -lgrid2grid IF_CUDA(-lTiled-MM|)"
if [ "$with_cosma" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_cosma"
prepend_path LD_LIBRARY_PATH "${COSMA_LIBDIR}"
prepend_path LD_RUN_PATH "${COSMA_LIBDIR}"
prepend_path LIBRARY_PATH "${COSMA_LIBDIR}"
@ -148,8 +148,8 @@ export COSMA_INCLUDE_DIR="$pkg_install_dir/include"
export COSMA_ROOT="${pkg_install_dir}"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${COSMA_LIBDIR}/pkgconfig"
EOF
fi
cat << EOF >> "${BUILDDIR}/setup_cosma"
fi
cat << EOF >> "${BUILDDIR}/setup_cosma"
export COSMA_CFLAGS="${COSMA_CFLAGS}"
export COSMA_LDFLAGS="${COSMA_LDFLAGS}"
export COSMA_CUDA_LDFLAGS="${COSMA_CUDA_LDFLAGS}"
@ -163,7 +163,7 @@ export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${COSMA_LIBDIR}/pkgconfig"
export COSMA_VERSION=${cosma_ver}
export CP_LIBS="IF_MPI(${COSMA_LIBS}|) \${CP_LIBS}"
EOF
cat "${BUILDDIR}/setup_cosma" >> $SETUPFILE
cat "${BUILDDIR}/setup_cosma" >> $SETUPFILE
fi
load "${BUILDDIR}/setup_cosma"

View file

@ -17,101 +17,101 @@ LIBSMM_LIBS=''
cd "${BUILDDIR}"
case "$with_libsmm" in
__INSTALL__)
echo "==================== Installing libsmm ===================="
pkg_install_dir="${INSTALLDIR}/libsmm"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "libsmm is already installed, skipping it."
__INSTALL__)
echo "==================== Installing libsmm ===================="
pkg_install_dir="${INSTALLDIR}/libsmm"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "libsmm is already installed, skipping it."
else
# Here we attempt to determine which precompiled libsmm binary
# to download, and do that if such binary exists on CP2K web
# repository. The binary is determined by the arch and
# libcore values obtained via OpenBLAS prebuild.
echo "Searching for an optimised libsmm binary from CP2K website"
case ${OPENBLAS_LIBCORE} in
haswell)
libsmm="libsmm_dnn_haswell-2015-11-10.a"
libsmm_sha256="a1cf9eb1bfb1bd3467024e47173a6e85881c3908961b7bb29f3348af9837018b"
echo "An optimized libsmm $libsmm is available"
;;
ivybridge)
libsmm="libsmm_dnn_ivybridge-2015-07-02.a"
libsmm_sha256="ef74fb7339979545f9583d9ecab52c640c4f98f9dd49f98d2b4580304d5fcf60"
echo "An optimized libsmm $libsmm is available"
;;
nehalem)
libsmm="libsmm_dnn_nehalem-2015-07-02.a"
libsmm_sha256="cc7e8c6623055fc6bc032dfda2d08b2201a8d86577ab72c3f66bee9b86cbebe9"
echo "An optimized libsmm $libsmm is available"
;;
sandybridge)
libsmm="libsmm_dnn_sandybridge-2015-11-10.a"
libsmm_sha256="56ffdafa715554ec87f20ff1e0150450209a7635b47b8a5b81970e88ec67687c"
echo "An optimized libsmm $libsmm is available"
;;
*)
echo "No optimised binary found ..."
echo "Searching for a generic libsmm binary from CP2K website"
if [ "${OPENBLAS_ARCH}" == "x86_64" ]; then
libsmm="libsmm_dnn_x86_64-latest.a"
libsmm_sha256="dd58aee2bc5505e23b0761835bf2b9a90e5f050c6708ef68c5028373970673f8"
echo "A generic libsmm $libsmm is available."
echo "Consider building and contributing to CP2K an optimized"
echo "libsmm for your $OPENBLAS_ARCH $OPENBLAS_LIBCORE using"
echo "the toolkit in tools/build_libsmm provided in cp2k package"
fi
;;
esac
# we know what to get, proceed with install
if [ "x$libsmm" != "x" ]; then
if [ -f $libsmm ]; then
echo "$libsmm has already been downloaded."
else
# Here we attempt to determine which precompiled libsmm binary
# to download, and do that if such binary exists on CP2K web
# repository. The binary is determined by the arch and
# libcore values obtained via OpenBLAS prebuild.
echo "Searching for an optimised libsmm binary from CP2K website"
case ${OPENBLAS_LIBCORE} in
haswell)
libsmm="libsmm_dnn_haswell-2015-11-10.a"
libsmm_sha256="a1cf9eb1bfb1bd3467024e47173a6e85881c3908961b7bb29f3348af9837018b"
echo "An optimized libsmm $libsmm is available"
;;
ivybridge)
libsmm="libsmm_dnn_ivybridge-2015-07-02.a"
libsmm_sha256="ef74fb7339979545f9583d9ecab52c640c4f98f9dd49f98d2b4580304d5fcf60"
echo "An optimized libsmm $libsmm is available"
;;
nehalem)
libsmm="libsmm_dnn_nehalem-2015-07-02.a"
libsmm_sha256="cc7e8c6623055fc6bc032dfda2d08b2201a8d86577ab72c3f66bee9b86cbebe9"
echo "An optimized libsmm $libsmm is available"
;;
sandybridge)
libsmm="libsmm_dnn_sandybridge-2015-11-10.a"
libsmm_sha256="56ffdafa715554ec87f20ff1e0150450209a7635b47b8a5b81970e88ec67687c"
echo "An optimized libsmm $libsmm is available"
;;
*)
echo "No optimised binary found ..."
echo "Searching for a generic libsmm binary from CP2K website"
if [ "${OPENBLAS_ARCH}" == "x86_64" ] ; then
libsmm="libsmm_dnn_x86_64-latest.a"
libsmm_sha256="dd58aee2bc5505e23b0761835bf2b9a90e5f050c6708ef68c5028373970673f8"
echo "A generic libsmm $libsmm is available."
echo "Consider building and contributing to CP2K an optimized"
echo "libsmm for your $OPENBLAS_ARCH $OPENBLAS_LIBCORE using"
echo "the toolkit in tools/build_libsmm provided in cp2k package"
fi
esac
# we know what to get, proceed with install
if [ "x$libsmm" != "x" ]; then
if [ -f $libsmm ]; then
echo "$libsmm has already been downloaded."
else
download_pkg ${DOWNLOADER_FLAGS} $libsmm_sha256\
https://www.cp2k.org/static/downloads/libsmm/$libsmm
fi
# install manually
! [ -d "${pkg_install_dir}/lib" ] && mkdir -p "${pkg_install_dir}/lib"
cp $libsmm "${pkg_install_dir}/lib"
ln -sf "${pkg_install_dir}/lib/$libsmm" "${pkg_install_dir}/lib/libsmm_dnn.a"
else
echo "No libsmm is available"
echo "Consider building an optimized libsmm on your system yourself"
echo "using the toolkid in tools/build_libsmm provided in cp2k package"
cat <<EOF > "${BUILDDIR}/setup_libsmm"
download_pkg ${DOWNLOADER_FLAGS} $libsmm_sha256 https://www.cp2k.org/static/downloads/libsmm/$libsmm
fi
# install manually
! [ -d "${pkg_install_dir}/lib" ] && mkdir -p "${pkg_install_dir}/lib"
cp $libsmm "${pkg_install_dir}/lib"
ln -sf "${pkg_install_dir}/lib/$libsmm" "${pkg_install_dir}/lib/libsmm_dnn.a"
else
echo "No libsmm is available"
echo "Consider building an optimized libsmm on your system yourself"
echo "using the toolkid in tools/build_libsmm provided in cp2k package"
cat << EOF > "${BUILDDIR}/setup_libsmm"
with_libsmm="__DONTUSE__"
EOF
exit 0
fi
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})"
fi
LIBSMM_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding Libsmm from system paths ===================="
check_lib -lsmm_dnn "libsmm"
add_lib_from_paths LIBSMM_LDFLAGS "libsmm_dnn.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking Libsmm to user paths ===================="
pkg_install_dir="$with_libsmm"
check_dir "${pkg_install_dir}/lib"
LIBSMM_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
exit 0
fi
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})"
fi
LIBSMM_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding Libsmm from system paths ===================="
check_lib -lsmm_dnn "libsmm"
add_lib_from_paths LIBSMM_LDFLAGS "libsmm_dnn.*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking Libsmm to user paths ===================="
pkg_install_dir="$with_libsmm"
check_dir "${pkg_install_dir}/lib"
LIBSMM_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac
if [ "$with_libsmm" != "__DONTUSE__" ] ; then
LIBSMM_LIBS="-lsmm_dnn"
if [ "$with_libsmm" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_libsmm"
if [ "$with_libsmm" != "__DONTUSE__" ]; then
LIBSMM_LIBS="-lsmm_dnn"
if [ "$with_libsmm" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_libsmm"
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_libsmm" >> $SETUPFILE
fi
cat <<EOF >> "${BUILDDIR}/setup_libsmm"
cat "${BUILDDIR}/setup_libsmm" >> $SETUPFILE
fi
cat << EOF >> "${BUILDDIR}/setup_libsmm"
export LIBSMM_LDFLAGS="${LIBSMM_LDFLAGS}"
export LIBSMM_LIBS="${LIBSMM_LIBS}"
export CP_DFLAGS="\${CP_DFLAGS} IF_VALGRIND(|-D__HAS_smm_dnn)"

View file

@ -19,98 +19,98 @@ LIBXSMM_LIBS=''
cd "${BUILDDIR}"
case "$with_libxsmm" in
__INSTALL__)
echo "==================== Installing Libxsmm ===================="
if [ "$OPENBLAS_ARCH" != "x86_64" ] ; then
report_warning $LINENO "libxsmm is not supported on arch ${OPENBLAS_ARCH}"
cat <<EOF > "${BUILDDIR}/setup_libxsmm"
__INSTALL__)
echo "==================== Installing Libxsmm ===================="
if [ "$OPENBLAS_ARCH" != "x86_64" ]; then
report_warning $LINENO "libxsmm is not supported on arch ${OPENBLAS_ARCH}"
cat << EOF > "${BUILDDIR}/setup_libxsmm"
with_libxsmm="__DONTUSE__"
EOF
exit 0
fi
pkg_install_dir="${INSTALLDIR}/libxsmm-${libxsmm_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "libxsmm-${libxsmm_ver} is already installed, skipping it."
exit 0
fi
pkg_install_dir="${INSTALLDIR}/libxsmm-${libxsmm_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "libxsmm-${libxsmm_ver} is already installed, skipping it."
else
if [ "$libxsmm_ver" = "master" ]; then
download_pkg_no_checksum ${DOWNLOADER_FLAGS} \
-o libxsmm-master.zip \
https://github.com/hfp/libxsmm/archive/master.zip
[ -d libxsmm-master ] && rm -rf libxsmm-master
unzip -q -o libxsmm-master.zip
else
if [ -f libxsmm-${libxsmm_ver}.tar.gz ]; then
echo "libxsmm-${libxsmm_ver}.tar.gz is found"
else
if [ "$libxsmm_ver" = "master" ] ; then
download_pkg_no_checksum ${DOWNLOADER_FLAGS} \
-o libxsmm-master.zip \
https://github.com/hfp/libxsmm/archive/master.zip
[ -d libxsmm-master ] && rm -rf libxsmm-master
unzip -q -o libxsmm-master.zip
else
if [ -f libxsmm-${libxsmm_ver}.tar.gz ] ; then
echo "libxsmm-${libxsmm_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${libxsmm_sha256} \
https://www.cp2k.org/static/downloads/libxsmm-${libxsmm_ver}.tar.gz
fi
[ -d libxsmm-${libxsmm_ver} ] && rm -rf libxsmm-${libxsmm_ver}
tar -xzf libxsmm-${libxsmm_ver}.tar.gz
fi
echo "Installing from scratch into ${pkg_install_dir}"
# note that we do not have to set -L flags to ld for the
# linked math libraries for the libxsmm build, as for a
# library this is not required, you just have to provide
# the appropriate -L flags (LDFLAGS) during the linking
# stage of building an executable that uses the libxsmm
# library
cd libxsmm-${libxsmm_ver}
make -j $NPROCS \
MALLOC=0 \
INTRINSICS=1 \
CXX=$CXX \
CC=$CC \
FC=$FC \
PREFIX=${pkg_install_dir} \
> make.log 2>&1
make -j $NPROCS \
MALLOC=0 \
INTRINSICS=1 \
CXX=$CXX \
CC=$CC \
FC=$FC \
PREFIX=${pkg_install_dir} \
install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})"
download_pkg ${DOWNLOADER_FLAGS} ${libxsmm_sha256} \
https://www.cp2k.org/static/downloads/libxsmm-${libxsmm_ver}.tar.gz
fi
LIBXSMM_CFLAGS="-I'${pkg_install_dir}/include'"
LIBXSMM_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding Libxsmm from system paths ===================="
check_command libxsmm_generator "libxsmm"
check_lib -lxsmm "libxsmm"
check_lib -lxsmmf "libxsmm"
add_include_from_paths LIBXSMM_CFLAGS "libxsmm.h" $INCLUDE_PATHS
add_lib_from_paths LIBXSMM_LDFLAGS "libxsmm.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking Libxsmm to user paths ===================="
pkg_install_dir="$with_libxsmm"
check_dir "${pkg_install_dir}/bin"
check_dir "${pkg_install_dir}/include"
check_dir "${pkg_install_dir}/lib"
LIBXSMM_CFLAGS="-I'${pkg_install_dir}/include'"
LIBXSMM_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
[ -d libxsmm-${libxsmm_ver} ] && rm -rf libxsmm-${libxsmm_ver}
tar -xzf libxsmm-${libxsmm_ver}.tar.gz
fi
echo "Installing from scratch into ${pkg_install_dir}"
# note that we do not have to set -L flags to ld for the
# linked math libraries for the libxsmm build, as for a
# library this is not required, you just have to provide
# the appropriate -L flags (LDFLAGS) during the linking
# stage of building an executable that uses the libxsmm
# library
cd libxsmm-${libxsmm_ver}
make -j $NPROCS \
MALLOC=0 \
INTRINSICS=1 \
CXX=$CXX \
CC=$CC \
FC=$FC \
PREFIX=${pkg_install_dir} \
> make.log 2>&1
make -j $NPROCS \
MALLOC=0 \
INTRINSICS=1 \
CXX=$CXX \
CC=$CC \
FC=$FC \
PREFIX=${pkg_install_dir} \
install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})"
fi
LIBXSMM_CFLAGS="-I'${pkg_install_dir}/include'"
LIBXSMM_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding Libxsmm from system paths ===================="
check_command libxsmm_generator "libxsmm"
check_lib -lxsmm "libxsmm"
check_lib -lxsmmf "libxsmm"
add_include_from_paths LIBXSMM_CFLAGS "libxsmm.h" $INCLUDE_PATHS
add_lib_from_paths LIBXSMM_LDFLAGS "libxsmm.*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking Libxsmm to user paths ===================="
pkg_install_dir="$with_libxsmm"
check_dir "${pkg_install_dir}/bin"
check_dir "${pkg_install_dir}/include"
check_dir "${pkg_install_dir}/lib"
LIBXSMM_CFLAGS="-I'${pkg_install_dir}/include'"
LIBXSMM_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac
if [ "$with_libxsmm" != "__DONTUSE__" ] ; then
LIBXSMM_LIBS="-lxsmmf -lxsmm -ldl -lpthread"
if [ "$with_libxsmm" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_libxsmm"
if [ "$with_libxsmm" != "__DONTUSE__" ]; then
LIBXSMM_LIBS="-lxsmmf -lxsmm -ldl -lpthread"
if [ "$with_libxsmm" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_libxsmm"
prepend_path PATH "${pkg_install_dir}/bin"
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_libxsmm" >> $SETUPFILE
fi
cat <<EOF >> "${BUILDDIR}/setup_libxsmm"
cat "${BUILDDIR}/setup_libxsmm" >> $SETUPFILE
fi
cat << EOF >> "${BUILDDIR}/setup_libxsmm"
export LIBXSMM_CFLAGS="${LIBXSMM_CFLAGS}"
export LIBXSMM_LDFLAGS="${LIBXSMM_LDFLAGS}"
export LIBXSMM_LIBS="${LIBXSMM_LIBS}"

View file

@ -6,8 +6,8 @@ scalapack_ver="2.1.0"
scalapack_sha256="61d9216cf81d246944720cfce96255878a3f85dec13b9351f1fa0fd6768220a6"
scalapack_pkg="scalapack-${scalapack_ver}.tgz"
patches=(
"${SCRIPT_DIR}/stage4/scalapack-${scalapack_ver}-gcc10.patch"
)
"${SCRIPT_DIR}/stage4/scalapack-${scalapack_ver}-gcc10.patch"
)
source "${SCRIPT_DIR}"/common_vars.sh
source "${SCRIPT_DIR}"/tool_kit.sh
@ -24,70 +24,70 @@ SCALAPACK_LIBS=''
cd "${BUILDDIR}"
case "$with_scalapack" in
__INSTALL__)
echo "==================== Installing ScaLAPACK ===================="
pkg_install_dir="${INSTALLDIR}/scalapack-${scalapack_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "scalapack-${scalapack_ver} is already installed, skipping it."
else
require_env MATH_LIBS
if [ -f ${scalapack_pkg} ] ; then
echo "${scalapack_pkg} is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${scalapack_sha256} \
https://www.cp2k.org/static/downloads/${scalapack_pkg}
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d scalapack-${scalapack_ver} ] && rm -rf scalapack-${scalapack_ver}
tar -xzf ${scalapack_pkg}
__INSTALL__)
echo "==================== Installing ScaLAPACK ===================="
pkg_install_dir="${INSTALLDIR}/scalapack-${scalapack_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "scalapack-${scalapack_ver} is already installed, skipping it."
else
require_env MATH_LIBS
if [ -f ${scalapack_pkg} ]; then
echo "${scalapack_pkg} is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${scalapack_sha256} \
https://www.cp2k.org/static/downloads/${scalapack_pkg}
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d scalapack-${scalapack_ver} ] && rm -rf scalapack-${scalapack_ver}
tar -xzf ${scalapack_pkg}
pushd "scalapack-${scalapack_ver}" >/dev/null
for patch in "${patches[@]}" ; do
patch -p1 < "${patch}"
done
popd >/dev/null
pushd "scalapack-${scalapack_ver}" > /dev/null
for patch in "${patches[@]}"; do
patch -p1 < "${patch}"
done
popd > /dev/null
mkdir -p "scalapack-${scalapack_ver}/build"
pushd "scalapack-${scalapack_ver}/build" >/dev/null
mkdir -p "scalapack-${scalapack_ver}/build"
pushd "scalapack-${scalapack_ver}/build" > /dev/null
cmake -DCMAKE_FIND_ROOT_PATH="$ROOTDIR" \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR="lib" \
-DCMAKE_BUILD_TYPE=Release .. > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make install >> make.log 2>&1
cmake -DCMAKE_FIND_ROOT_PATH="$ROOTDIR" \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR="lib" \
-DCMAKE_BUILD_TYPE=Release .. > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make install >> make.log 2>&1
popd >/dev/null
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})"
fi
SCALAPACK_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding ScaLAPACK from system paths ===================="
check_lib -lscalapack "ScaLAPACK"
add_lib_from_paths SCALAPACK_LDFLAGS "libscalapack.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking ScaLAPACK to user paths ===================="
pkg_install_dir="$with_scalapack"
check_dir "${pkg_install_dir}/lib"
SCALAPACK_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
popd > /dev/null
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage4/$(basename ${SCRIPT_NAME})"
fi
SCALAPACK_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding ScaLAPACK from system paths ===================="
check_lib -lscalapack "ScaLAPACK"
add_lib_from_paths SCALAPACK_LDFLAGS "libscalapack.*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking ScaLAPACK to user paths ===================="
pkg_install_dir="$with_scalapack"
check_dir "${pkg_install_dir}/lib"
SCALAPACK_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac
if [ "$with_scalapack" != "__DONTUSE__" ] ; then
SCALAPACK_LIBS="-lscalapack"
if [ "$with_scalapack" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_scalapack"
if [ "$with_scalapack" != "__DONTUSE__" ]; then
SCALAPACK_LIBS="-lscalapack"
if [ "$with_scalapack" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_scalapack"
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_scalapack" >> $SETUPFILE
fi
cat <<EOF >> "${BUILDDIR}/setup_scalapack"
cat "${BUILDDIR}/setup_scalapack" >> $SETUPFILE
fi
cat << EOF >> "${BUILDDIR}/setup_scalapack"
export SCALAPACK_LDFLAGS="${SCALAPACK_LDFLAGS}"
export SCALAPACK_LIBS="${SCALAPACK_LIBS}"
export SCALAPACKROOT="${pkg_install_dir}"
@ -101,7 +101,7 @@ cd "${ROOTDIR}"
# ----------------------------------------------------------------------
# Suppress reporting of known leaks
# ----------------------------------------------------------------------
cat <<EOF >> ${INSTALLDIR}/lsan.supp
cat << EOF >> ${INSTALLDIR}/lsan.supp
# leaks related to SCALAPACK
leak:pdpotrf_
EOF

View file

@ -5,8 +5,8 @@ SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)"
elpa_ver="2020.11.001"
elpa_sha256="15591f142eeaa98ab3201d27ca9ac328e21beabf0803b011a04183fcaf6efdde"
patches=(
"${SCRIPT_DIR}/stage5/elpa-${elpa_ver}-fix_nvcc_wrap.patch"
)
"${SCRIPT_DIR}/stage5/elpa-${elpa_ver}-fix_nvcc_wrap.patch"
)
source "${SCRIPT_DIR}"/common_vars.sh
source "${SCRIPT_DIR}"/tool_kit.sh
@ -26,157 +26,158 @@ ELPA_MAKEOPTS='-j1'
cd "${BUILDDIR}"
# elpa only works with MPI switched on
if [ $MPI_MODE = no ] ; then
report_warning $LINENO "MPI is disabled, skipping elpa installation"
cat <<EOF > "${BUILDDIR}/setup_elpa"
if [ $MPI_MODE = no ]; then
report_warning $LINENO "MPI is disabled, skipping elpa installation"
cat << EOF > "${BUILDDIR}/setup_elpa"
with_elpa="__FALSE__"
EOF
exit 0
exit 0
fi
case "$with_elpa" in
__INSTALL__)
echo "==================== Installing ELPA ===================="
pkg_install_dir="${INSTALLDIR}/elpa-${elpa_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "elpa-${elpa_ver} is already installed, skipping it."
else
require_env MATH_LIBS
if [ -f elpa-${elpa_ver}.tar.gz ] ; then
echo "elpa-${elpa_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${elpa_sha256} \
https://www.cp2k.org/static/downloads/elpa-${elpa_ver}.tar.gz
fi
[ -d elpa-${elpa_ver} ] && rm -rf elpa-${elpa_ver}
tar -xzf elpa-${elpa_ver}.tar.gz
__INSTALL__)
echo "==================== Installing ELPA ===================="
pkg_install_dir="${INSTALLDIR}/elpa-${elpa_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "elpa-${elpa_ver} is already installed, skipping it."
else
require_env MATH_LIBS
if [ -f elpa-${elpa_ver}.tar.gz ]; then
echo "elpa-${elpa_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${elpa_sha256} \
https://www.cp2k.org/static/downloads/elpa-${elpa_ver}.tar.gz
fi
[ -d elpa-${elpa_ver} ] && rm -rf elpa-${elpa_ver}
tar -xzf elpa-${elpa_ver}.tar.gz
# fix wrong dependency order (at least in elpa 2016.05.003)
# sed -i "s/build_lib = libelpa@SUFFIX@.la libelpatest@SUFFIX@.la/build_lib = libelpatest@SUFFIX@.la libelpa@SUFFIX@.la/g" elpa-${elpa_ver}/Makefile.in
# sed -i "s/build_lib = libelpa@SUFFIX@.la libelpatest@SUFFIX@.la/build_lib = libelpatest@SUFFIX@.la libelpa@SUFFIX@.la/g" elpa-${elpa_ver}/Makefile.am
# fix wrong dependency order (at least in elpa 2016.05.003)
# sed -i "s/build_lib = libelpa@SUFFIX@.la libelpatest@SUFFIX@.la/build_lib = libelpatest@SUFFIX@.la libelpa@SUFFIX@.la/g" elpa-${elpa_ver}/Makefile.in
# sed -i "s/build_lib = libelpa@SUFFIX@.la libelpatest@SUFFIX@.la/build_lib = libelpatest@SUFFIX@.la libelpa@SUFFIX@.la/g" elpa-${elpa_ver}/Makefile.am
# need both flavors ?
# need both flavors ?
# elpa expect FC to be an mpi fortran compiler that is happy
# with long lines, and that a bunch of libs can be found
cd elpa-${elpa_ver}
# elpa expect FC to be an mpi fortran compiler that is happy
# with long lines, and that a bunch of libs can be found
cd elpa-${elpa_ver}
for patch in "${patches[@]}" ; do
patch -p1 < "${patch}"
done
for patch in "${patches[@]}"; do
patch -p1 < "${patch}"
done
# specific settings needed on CRAY Linux Environment
if [ "$ENABLE_CRAY" = "__TRUE__" ] ; then
# extra LDFLAGS needed
cray_ldflags="-dynamic"
fi
# specific settings needed on CRAY Linux Environment
if [ "$ENABLE_CRAY" = "__TRUE__" ]; then
# extra LDFLAGS needed
cray_ldflags="-dynamic"
fi
# ELPA-2017xxxx enables AVX2 by default, switch off if machine doesn't support it.
has_AVX=`grep '\bavx\b' /proc/cpuinfo 1>/dev/null && echo 'yes' || echo 'no'`
[ "${has_AVX}" == "yes" ] && AVX_flag="-mavx" || AVX_flag=""
has_AVX2=`grep '\bavx2\b' /proc/cpuinfo 1>/dev/null && echo 'yes' || echo 'no'`
[ "${has_AVX2}" == "yes" ] && AVX_flag="-mavx2"
has_AVX512=`grep '\bavx512f\b' /proc/cpuinfo 1>/dev/null && echo 'yes' || echo 'no'`
[ "${has_AVX512}" == "yes" ] && AVX512_flags="-mavx512f"
if [ "$OPENBLAS_ARCH" == "x86_64" ] ; then
FMA_flag=`grep '\bfma\b' /proc/cpuinfo 1>/dev/null && echo '-mfma' || echo '-mno-fma'`
SSE4_flag=`grep '\bsse4_1\b' /proc/cpuinfo 1>/dev/null && echo '-msse4' || echo '-mno-sse4'`
grep '\bavx512dq\b' /proc/cpuinfo 1>/dev/null && AVX512_flags+=" -mavx512dq"
grep '\bavx512cd\b' /proc/cpuinfo 1>/dev/null && AVX512_flags+=" -mavx512cd"
grep '\bavx512bw\b' /proc/cpuinfo 1>/dev/null && AVX512_flags+=" -mavx512bw"
grep '\bavx512v1\b' /proc/cpuinfo 1>/dev/null && AVX512_flags+=" -mavx512v1"
config_flags="--enable-avx=${has_AVX} --enable-avx2=${has_AVX2} --enable-avx512=${has_AVX512}"
else
AVX_flag=""
AVX512_flags=""
FMA_flag=""
SSE4_flag=""
config_flags="--disable-avx --disable-avx2 --disable-avx512 --disable-sse --disable-sse-assembly"
fi
for TARGET in "cpu" "gpu" ; do
[ "$TARGET" == "gpu" ] && [ "$ENABLE_CUDA" != "__TRUE__" ] && continue
echo "Installing from scratch into ${pkg_install_dir}/${TARGET}"
# ELPA-2017xxxx enables AVX2 by default, switch off if machine doesn't support it.
has_AVX=$(grep '\bavx\b' /proc/cpuinfo 1> /dev/null && echo 'yes' || echo 'no')
[ "${has_AVX}" == "yes" ] && AVX_flag="-mavx" || AVX_flag=""
has_AVX2=$(grep '\bavx2\b' /proc/cpuinfo 1> /dev/null && echo 'yes' || echo 'no')
[ "${has_AVX2}" == "yes" ] && AVX_flag="-mavx2"
has_AVX512=$(grep '\bavx512f\b' /proc/cpuinfo 1> /dev/null && echo 'yes' || echo 'no')
[ "${has_AVX512}" == "yes" ] && AVX512_flags="-mavx512f"
if [ "$OPENBLAS_ARCH" == "x86_64" ]; then
FMA_flag=$(grep '\bfma\b' /proc/cpuinfo 1> /dev/null && echo '-mfma' || echo '-mno-fma')
SSE4_flag=$(grep '\bsse4_1\b' /proc/cpuinfo 1> /dev/null && echo '-msse4' || echo '-mno-sse4')
grep '\bavx512dq\b' /proc/cpuinfo 1> /dev/null && AVX512_flags+=" -mavx512dq"
grep '\bavx512cd\b' /proc/cpuinfo 1> /dev/null && AVX512_flags+=" -mavx512cd"
grep '\bavx512bw\b' /proc/cpuinfo 1> /dev/null && AVX512_flags+=" -mavx512bw"
grep '\bavx512v1\b' /proc/cpuinfo 1> /dev/null && AVX512_flags+=" -mavx512v1"
config_flags="--enable-avx=${has_AVX} --enable-avx2=${has_AVX2} --enable-avx512=${has_AVX512}"
else
AVX_flag=""
AVX512_flags=""
FMA_flag=""
SSE4_flag=""
config_flags="--disable-avx --disable-avx2 --disable-avx512 --disable-sse --disable-sse-assembly"
fi
for TARGET in "cpu" "gpu"; do
[ "$TARGET" == "gpu" ] && [ "$ENABLE_CUDA" != "__TRUE__" ] && continue
echo "Installing from scratch into ${pkg_install_dir}/${TARGET}"
mkdir -p "build_${TARGET}"; cd "build_${TARGET}"
../configure --prefix="${pkg_install_dir}/${TARGET}/" \
--libdir="${pkg_install_dir}/${TARGET}/lib" \
--enable-openmp=yes \
--enable-shared=no \
--enable-static=yes \
${config_flags} \
--enable-gpu=$([ "$TARGET" == "gpu" ] && echo "yes" || echo "no") \
--with-cuda-path=${CUDA_PATH} \
FC=${MPIFC} \
CC=${MPICC} \
CXX=${MPICXX} \
FCFLAGS="${FCFLAGS} ${MATH_CFLAGS} ${SCALAPACK_CFLAGS} -ffree-line-length-none ${AVX_flag} ${FMA_flag} ${SSE4_flag} ${AVX512_flags}" \
CFLAGS="${CFLAGS} ${MATH_CFLAGS} ${SCALAPACK_CFLAGS} ${AVX_flag} ${FMA_flag} ${SSE4_flag} ${AVX512_flags}" \
CXXFLAGS="${CXXFLAGS} ${MATH_CFLAGS} ${SCALAPACK_CFLAGS} ${AVX_flag} ${FMA_flag} ${SSE4_flag} ${AVX512_flags}" \
LDFLAGS="-Wl,--enable-new-dtags ${MATH_LDFLAGS} ${SCALAPACK_LDFLAGS} ${cray_ldflags}" \
LIBS="${SCALAPACK_LIBS} ${MATH_LIBS}" \
>configure.log 2>&1
make -j $NPROCS ${ELPA_MAKEOPTS} >make.log 2>&1
make install >install.log 2>&1
cd ..
done
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage5/$(basename ${SCRIPT_NAME})"
fi
ELPA_CFLAGS="-I'${pkg_install_dir}/IF_CUDA(gpu|cpu)/include/elpa_openmp-${elpa_ver}/modules' -I'${pkg_install_dir}/IF_CUDA(gpu|cpu)/include/elpa_openmp-${elpa_ver}/elpa'"
ELPA_LDFLAGS="-L'${pkg_install_dir}/IF_CUDA(gpu|cpu)/lib' -Wl,-rpath='${pkg_install_dir}/IF_CUDA(gpu|cpu)/lib'"
;;
__SYSTEM__)
echo "==================== Finding ELPA from system paths ===================="
check_lib -lelpa_openmp "ELPA"
# get the include paths
elpa_include="$(find_in_paths "elpa_openmp-*" $INCLUDE_PATHS)"
if [ "$elpa_include" != "__FALSE__" ] ; then
echo "ELPA include directory threaded version is found to be $elpa_include"
ELPA_CFLAGS="-I'$elpa_include/modules' -I'$elpa_include/elpa'"
else
echo "Cannot find elpa_openmp-${elpa_ver} from paths $INCLUDE_PATHS"
exit 1
fi
# get the lib paths
add_lib_from_paths ELPA_LDFLAGS "libelpa.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking ELPA to user paths ===================="
pkg_install_dir="$with_elpa"
check_dir "${pkg_install_dir}/include"
check_dir "${pkg_install_dir}/lib"
user_include_path="$pkg_install_dir/include"
elpa_include="$(find_in_paths "elpa_openmp-*" user_include_path)"
if [ "$elpa_include" != "__FALSE__" ] ; then
echo "ELPA include directory threaded version is found to be $elpa_include/modules"
check_dir "$elpa_include/modules"
ELPA_CFLAGS="-I'$elpa_include/modules' -I'$elpa_include/elpa'"
else
echo "Cannot find elpa_openmp-* from path $user_include_path"
exit 1
fi
ELPA_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
mkdir -p "build_${TARGET}"
cd "build_${TARGET}"
../configure --prefix="${pkg_install_dir}/${TARGET}/" \
--libdir="${pkg_install_dir}/${TARGET}/lib" \
--enable-openmp=yes \
--enable-shared=no \
--enable-static=yes \
${config_flags} \
--enable-gpu=$([ "$TARGET" == "gpu" ] && echo "yes" || echo "no") \
--with-cuda-path=${CUDA_PATH} \
FC=${MPIFC} \
CC=${MPICC} \
CXX=${MPICXX} \
FCFLAGS="${FCFLAGS} ${MATH_CFLAGS} ${SCALAPACK_CFLAGS} -ffree-line-length-none ${AVX_flag} ${FMA_flag} ${SSE4_flag} ${AVX512_flags}" \
CFLAGS="${CFLAGS} ${MATH_CFLAGS} ${SCALAPACK_CFLAGS} ${AVX_flag} ${FMA_flag} ${SSE4_flag} ${AVX512_flags}" \
CXXFLAGS="${CXXFLAGS} ${MATH_CFLAGS} ${SCALAPACK_CFLAGS} ${AVX_flag} ${FMA_flag} ${SSE4_flag} ${AVX512_flags}" \
LDFLAGS="-Wl,--enable-new-dtags ${MATH_LDFLAGS} ${SCALAPACK_LDFLAGS} ${cray_ldflags}" \
LIBS="${SCALAPACK_LIBS} ${MATH_LIBS}" \
> configure.log 2>&1
make -j $NPROCS ${ELPA_MAKEOPTS} > make.log 2>&1
make install > install.log 2>&1
cd ..
done
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage5/$(basename ${SCRIPT_NAME})"
fi
ELPA_CFLAGS="-I'${pkg_install_dir}/IF_CUDA(gpu|cpu)/include/elpa_openmp-${elpa_ver}/modules' -I'${pkg_install_dir}/IF_CUDA(gpu|cpu)/include/elpa_openmp-${elpa_ver}/elpa'"
ELPA_LDFLAGS="-L'${pkg_install_dir}/IF_CUDA(gpu|cpu)/lib' -Wl,-rpath='${pkg_install_dir}/IF_CUDA(gpu|cpu)/lib'"
;;
__SYSTEM__)
echo "==================== Finding ELPA from system paths ===================="
check_lib -lelpa_openmp "ELPA"
# get the include paths
elpa_include="$(find_in_paths "elpa_openmp-*" $INCLUDE_PATHS)"
if [ "$elpa_include" != "__FALSE__" ]; then
echo "ELPA include directory threaded version is found to be $elpa_include"
ELPA_CFLAGS="-I'$elpa_include/modules' -I'$elpa_include/elpa'"
else
echo "Cannot find elpa_openmp-${elpa_ver} from paths $INCLUDE_PATHS"
exit 1
fi
# get the lib paths
add_lib_from_paths ELPA_LDFLAGS "libelpa.*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking ELPA to user paths ===================="
pkg_install_dir="$with_elpa"
check_dir "${pkg_install_dir}/include"
check_dir "${pkg_install_dir}/lib"
user_include_path="$pkg_install_dir/include"
elpa_include="$(find_in_paths "elpa_openmp-*" user_include_path)"
if [ "$elpa_include" != "__FALSE__" ]; then
echo "ELPA include directory threaded version is found to be $elpa_include/modules"
check_dir "$elpa_include/modules"
ELPA_CFLAGS="-I'$elpa_include/modules' -I'$elpa_include/elpa'"
else
echo "Cannot find elpa_openmp-* from path $user_include_path"
exit 1
fi
ELPA_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac
if [ "$with_elpa" != "__DONTUSE__" ] ; then
ELPA_LIBS="-lelpa_openmp"
cat <<EOF > "${BUILDDIR}/setup_elpa"
if [ "$with_elpa" != "__DONTUSE__" ]; then
ELPA_LIBS="-lelpa_openmp"
cat << EOF > "${BUILDDIR}/setup_elpa"
prepend_path CPATH "$elpa_include"
EOF
if [ "$with_elpa" != "__SYSTEM__" ] ; then
cat <<EOF >> "${BUILDDIR}/setup_elpa"
if [ "$with_elpa" != "__SYSTEM__" ]; then
cat << EOF >> "${BUILDDIR}/setup_elpa"
prepend_path PATH "$pkg_install_dir/bin"
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"
export ELPAROOT="$pkg_install_dir"
EOF
fi
cat "${BUILDDIR}/setup_elpa" >> $SETUPFILE
cat <<EOF >> "${BUILDDIR}/setup_elpa"
fi
cat "${BUILDDIR}/setup_elpa" >> $SETUPFILE
cat << EOF >> "${BUILDDIR}/setup_elpa"
export ELPA_CFLAGS="${ELPA_CFLAGS}"
export ELPA_LDFLAGS="${ELPA_LDFLAGS}"
export ELPA_LIBS="${ELPA_LIBS}"
@ -189,7 +190,7 @@ export ELPAROOT="$pkg_install_dir"
export ELPAVERSION="${elpa_ver}"
EOF
cat <<EOF >> ${INSTALLDIR}/lsan.supp
cat << EOF >> ${INSTALLDIR}/lsan.supp
# leaks related to ELPA
leak:cublasXtDeviceSelect
EOF

View file

@ -19,101 +19,101 @@ PEXSI_LIBS=''
cd "${BUILDDIR}"
case "$with_pexsi" in
__INSTALL__)
echo "==================== Installing PEXSI ===================="
require_env SUPERLU_LDFLAGS
require_env SUPERLU_LIBS
require_env MATH_LIBS
require_env MPI_LDFLAGS
require_env MPI_LIBS
pkg_install_dir="${INSTALLDIR}/pexsi-${pexsi_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "pexsi_dist-${pexsi_ver} is already installed, skipping it."
else
if [ -f pexsi_v${pexsi_ver}.tar.gz ] ; then
echo "pexsi_v${pexsi_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${pexsi_sha256} \
https://www.cp2k.org/static/downloads/pexsi_v${pexsi_ver}.tar.gz
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d pexsi_v${pexsi_ver} ] && rm -rf pexsi_v${pexsi_ver}
tar -xzf pexsi_v${pexsi_ver}.tar.gz
cd pexsi_v${pexsi_ver}
cat config/make.inc.linux.gnu | \
sed -e "s|\(CC *=\).*|\1 ${MPICC}|g" \
-e "s|\(CXX *=\).*|\1 ${MPICXX}|g" \
-e "s|\(FC *=\).*|\1 ${MPIFC}|g" \
-e "s|\(LOADER *=\).*|\1 ${MPICXX}|g" \
-e "s|\(USE_SYMPACK *=\).*|\1 0|g" \
-e "s|\(PEXSI_DIR *=\).*|\1 ${PWD}|g" \
-e "s|\(PEXSI_BUILD_DIR *=\).*|\1 ${pkg_install_dir}|g" \
-e "s|\(CPP_LIB *=\).*|\1 -lstdc++ ${MPI_LDFLAGS} ${MPI_LIBS} |g" \
-e "s|\(LAPACK_LIB *=\).*|\1 ${MATH_LDFLAGS} $(resolve_string "${MATH_LIBS}")|g" \
-e "s|\(BLAS_LIB *=\).*|\1|g" \
-e "s|\(\bMETIS_LIB *=\).*|\1 ${METIS_LDFLAGS} ${METIS_LIBS}|g" \
-e "s|\(PARMETIS_LIB *=\).*|\1 |g" \
-e "s|\(DSUPERLU_LIB *=\).*|\1 ${SUPERLU_LDFLAGS} -lsuperlu_dist|g" \
-e "s|\(SCOTCH_LIB *=\).*|\1 ${SCOTCH_LDFLAGS} -lscotchmetis -lscotch -lscotcherr|g" \
-e "s|\(PTSCOTCH_LIB *=\).*|\1 ${SCOTCH_LDFLAGS} -lptscotchparmetis -lptscotch -lptscotcherr -lscotch|g" \
-e "s|\(DSUPERLU_INCLUDE *=\).*|\1 ${SUPERLU_CFLAGS}|g" \
-e "s|\(INCLUDES *=\).*|\1 ${MATH_CFLAGS} \${DSUPERLU_INCLUDE} \${PEXSI_INCLUDE}|g" \
-e "s|\(COMPILE_FLAG *=\).*|\1 ${CFLAGS}|g" \
-e "s|\(SUFFIX *=\).*|\1 ${OPENBLAS_ARCH}|g" \
-e "s|\(DSUPERLU_DIR *=\).*|\1|g" \
-e "s|\(METIS_DIR *=\).*|\1|g" \
-e "s|\(PARMETIS_DIR *=\).*|\1|g" \
-e "s|\(PTSCOTCH_DIR *=\).*|\1|g" \
-e "s|\(LAPACK_DIR *=\).*|\1|g" \
-e "s|\(BLAS_DIR *=\).*|\1|g" \
-e "s|-DCOREDUMPER||g" \
-e "s|\(COREDUMPER_LIB *=\).*||g" \
-e "s|\(GFORTRAN_LIB *=\).*|\1 -lgfortran|g" > make.inc
__INSTALL__)
echo "==================== Installing PEXSI ===================="
require_env SUPERLU_LDFLAGS
require_env SUPERLU_LIBS
require_env MATH_LIBS
require_env MPI_LDFLAGS
require_env MPI_LIBS
pkg_install_dir="${INSTALLDIR}/pexsi-${pexsi_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "pexsi_dist-${pexsi_ver} is already installed, skipping it."
else
if [ -f pexsi_v${pexsi_ver}.tar.gz ]; then
echo "pexsi_v${pexsi_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${pexsi_sha256} \
https://www.cp2k.org/static/downloads/pexsi_v${pexsi_ver}.tar.gz
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d pexsi_v${pexsi_ver} ] && rm -rf pexsi_v${pexsi_ver}
tar -xzf pexsi_v${pexsi_ver}.tar.gz
cd pexsi_v${pexsi_ver}
cat config/make.inc.linux.gnu |
sed -e "s|\(CC *=\).*|\1 ${MPICC}|g" \
-e "s|\(CXX *=\).*|\1 ${MPICXX}|g" \
-e "s|\(FC *=\).*|\1 ${MPIFC}|g" \
-e "s|\(LOADER *=\).*|\1 ${MPICXX}|g" \
-e "s|\(USE_SYMPACK *=\).*|\1 0|g" \
-e "s|\(PEXSI_DIR *=\).*|\1 ${PWD}|g" \
-e "s|\(PEXSI_BUILD_DIR *=\).*|\1 ${pkg_install_dir}|g" \
-e "s|\(CPP_LIB *=\).*|\1 -lstdc++ ${MPI_LDFLAGS} ${MPI_LIBS} |g" \
-e "s|\(LAPACK_LIB *=\).*|\1 ${MATH_LDFLAGS} $(resolve_string "${MATH_LIBS}")|g" \
-e "s|\(BLAS_LIB *=\).*|\1|g" \
-e "s|\(\bMETIS_LIB *=\).*|\1 ${METIS_LDFLAGS} ${METIS_LIBS}|g" \
-e "s|\(PARMETIS_LIB *=\).*|\1 |g" \
-e "s|\(DSUPERLU_LIB *=\).*|\1 ${SUPERLU_LDFLAGS} -lsuperlu_dist|g" \
-e "s|\(SCOTCH_LIB *=\).*|\1 ${SCOTCH_LDFLAGS} -lscotchmetis -lscotch -lscotcherr|g" \
-e "s|\(PTSCOTCH_LIB *=\).*|\1 ${SCOTCH_LDFLAGS} -lptscotchparmetis -lptscotch -lptscotcherr -lscotch|g" \
-e "s|\(DSUPERLU_INCLUDE *=\).*|\1 ${SUPERLU_CFLAGS}|g" \
-e "s|\(INCLUDES *=\).*|\1 ${MATH_CFLAGS} \${DSUPERLU_INCLUDE} \${PEXSI_INCLUDE}|g" \
-e "s|\(COMPILE_FLAG *=\).*|\1 ${CFLAGS}|g" \
-e "s|\(SUFFIX *=\).*|\1 ${OPENBLAS_ARCH}|g" \
-e "s|\(DSUPERLU_DIR *=\).*|\1|g" \
-e "s|\(METIS_DIR *=\).*|\1|g" \
-e "s|\(PARMETIS_DIR *=\).*|\1|g" \
-e "s|\(PTSCOTCH_DIR *=\).*|\1|g" \
-e "s|\(LAPACK_DIR *=\).*|\1|g" \
-e "s|\(BLAS_DIR *=\).*|\1|g" \
-e "s|-DCOREDUMPER||g" \
-e "s|\(COREDUMPER_LIB *=\).*||g" \
-e "s|\(GFORTRAN_LIB *=\).*|\1 -lgfortran|g" > make.inc
# Seemingly this should've been moved together with the other fortran files.
mv ./src/f_interface.f90 ./fortran/
# Seemingly this should've been moved together with the other fortran files.
mv ./src/f_interface.f90 ./fortran/
make finstall > make.log 2>&1 # still issues with parallel make (fortran_examples target)
make finstall > make.log 2>&1 # still issues with parallel make (fortran_examples target)
ln -sf "${pkg_install_dir}/lib/libpexsi_${OPENBLAS_ARCH}.a" \
"${pkg_install_dir}/lib/libpexsi.a"
ln -sf "${pkg_install_dir}/lib/libpexsi_${OPENBLAS_ARCH}.a" \
"${pkg_install_dir}/lib/libpexsi.a"
cp -r ./include/* ${pkg_install_dir}/include/ # bug: make install neglects most header files
cp -r ./include/* ${pkg_install_dir}/include/ # bug: make install neglects most header files
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage5/$(basename ${SCRIPT_NAME})"
fi
PEXSI_CFLAGS="-I'${pkg_install_dir}/include'"
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage5/$(basename ${SCRIPT_NAME})"
fi
PEXSI_CFLAGS="-I'${pkg_install_dir}/include'"
PEXSI_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding Pexsi_DIST from system paths ===================="
check_lib -lpexsi "PEXSI"
# add_include_from_paths PEXSI_CFLAGS "pexsi*" $INCLUDE_PATHS
add_lib_from_paths PEXSI_LDFLAGS "libpexsi.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking Pexsi_Dist to user paths ===================="
pkg_install_dir="$with_pexsi"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
;;
PEXSI_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding Pexsi_DIST from system paths ===================="
check_lib -lpexsi "PEXSI"
# add_include_from_paths PEXSI_CFLAGS "pexsi*" $INCLUDE_PATHS
add_lib_from_paths PEXSI_LDFLAGS "libpexsi.*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking Pexsi_Dist to user paths ===================="
pkg_install_dir="$with_pexsi"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
;;
esac
if [ "$with_pexsi" != "__DONTUSE__" ] ; then
PEXSI_LIBS="-lpexsi"
if [ "$with_pexsi" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_pexsi"
if [ "$with_pexsi" != "__DONTUSE__" ]; then
PEXSI_LIBS="-lpexsi"
if [ "$with_pexsi" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_pexsi"
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"
prepend_path CPATH "$pkg_install_dir/include"
EOF
cat "${BUILDDIR}/setup_pexsi" >> $SETUPFILE
fi
cat <<EOF >> "${BUILDDIR}/setup_pexsi"
cat "${BUILDDIR}/setup_pexsi" >> $SETUPFILE
fi
cat << EOF >> "${BUILDDIR}/setup_pexsi"
export PEXSI_CFLAGS="${PEXSI_CFLAGS}"
export PEXSI_LDFLAGS="${PEXSI_LDFLAGS}"
export PEXSI_LIBS="${PEXSI_LIBS}"

View file

@ -19,82 +19,82 @@ SCOTCH_LIBS=''
cd "${BUILDDIR}"
case "$with_ptscotch" in
__INSTALL__)
echo "==================== Installing PT-Scotch ===================="
pkg_install_dir="${INSTALLDIR}/scotch-${scotch_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "scotch-${scotch_ver} is already installed, skipping it."
else
if [ -f scotch_${scotch_ver}.tar.gz ] ; then
echo "scotch_${scotch_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${scotch_sha256} \
https://www.cp2k.org/static/downloads/scotch_${scotch_ver}.tar.gz
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d scotch_${scotch_ver} ] && rm -rf scotch_${scotch_ver}
tar -xzf scotch_${scotch_ver}.tar.gz
cd scotch_${scotch_ver}/src
cat Make.inc/Makefile.inc.x86-64_pc_linux2 | \
sed -e "s|\(^CCS\).*|\1 = $MPICC|g" \
-e "s|\(^CCP\).*|\1 = $MPICC|g" \
-e "s|\(^CCD\).*|\1 = $MPICC|g" \
-e "s|\(^CFLAGS\).*|\1 = $CFLAGS -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -Drestrict=__restrict -DIDXSIZE64 ${MPI_CFLAGS}|g" \
> Makefile.inc
make scotch -j $NPROCS > make.log 2>&1
make ptscotch -j $NROCS > make.log 2>&1
# PT-scotch make install is buggy in that it cannot create
# intermediate directories
! [ -d "${pkg_install_dir}" ] && mkdir -p "${pkg_install_dir}"
make install prefix=${pkg_install_dir} > install.log 2>&1
cd ..
__INSTALL__)
echo "==================== Installing PT-Scotch ===================="
pkg_install_dir="${INSTALLDIR}/scotch-${scotch_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "scotch-${scotch_ver} is already installed, skipping it."
else
if [ -f scotch_${scotch_ver}.tar.gz ]; then
echo "scotch_${scotch_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${scotch_sha256} \
https://www.cp2k.org/static/downloads/scotch_${scotch_ver}.tar.gz
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d scotch_${scotch_ver} ] && rm -rf scotch_${scotch_ver}
tar -xzf scotch_${scotch_ver}.tar.gz
cd scotch_${scotch_ver}/src
cat Make.inc/Makefile.inc.x86-64_pc_linux2 |
sed -e "s|\(^CCS\).*|\1 = $MPICC|g" \
-e "s|\(^CCP\).*|\1 = $MPICC|g" \
-e "s|\(^CCD\).*|\1 = $MPICC|g" \
-e "s|\(^CFLAGS\).*|\1 = $CFLAGS -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -Drestrict=__restrict -DIDXSIZE64 ${MPI_CFLAGS}|g" \
> Makefile.inc
make scotch -j $NPROCS > make.log 2>&1
make ptscotch -j $NROCS > make.log 2>&1
# PT-scotch make install is buggy in that it cannot create
# intermediate directories
! [ -d "${pkg_install_dir}" ] && mkdir -p "${pkg_install_dir}"
make install prefix=${pkg_install_dir} > install.log 2>&1
cd ..
# PEXSI also needs parmetis.h
cp ./include/parmetis.h "${pkg_install_dir}/include/"
sed -i "s|SCOTCH_Num|int|g" "${pkg_install_dir}/include/parmetis.h"
# PEXSI also needs parmetis.h
cp ./include/parmetis.h "${pkg_install_dir}/include/"
sed -i "s|SCOTCH_Num|int|g" "${pkg_install_dir}/include/parmetis.h"
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage5/$(basename ${SCRIPT_NAME})"
fi
SCOTCH_CFLAGS="-I'${pkg_install_dir}/include'"
SCOTCH_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding PT-Scotch from system paths ===================="
check_lib -lptscotchparmetis "PT-Scotch"
check_lib -lptscotch "PT-Scotch"
check_lib -lptscotcherr "PT-Scotch"
check_lib -lscotchmetis "PT-Scotch"
check_lib -lscotch "PT-Scotch"
check_lib -lscotcherr "PT-Scotch"
check_lib -lptscotchparmetis "PT-Scotch"
add_include_from_paths SCOTCH_CFLAGS "ptscotch.h" $INCLUDE_PATHS
add_lib_from_paths SCOTCH_LDFLAGS "libptscotch.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking PT-Scotch to user paths ===================="
pkg_install_dir="$with_ptscotch"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
SCOTCH_CFLAGS="-I'${pkg_install_dir}/include'"
SCOTCH_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage5/$(basename ${SCRIPT_NAME})"
fi
SCOTCH_CFLAGS="-I'${pkg_install_dir}/include'"
SCOTCH_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding PT-Scotch from system paths ===================="
check_lib -lptscotchparmetis "PT-Scotch"
check_lib -lptscotch "PT-Scotch"
check_lib -lptscotcherr "PT-Scotch"
check_lib -lscotchmetis "PT-Scotch"
check_lib -lscotch "PT-Scotch"
check_lib -lscotcherr "PT-Scotch"
check_lib -lptscotchparmetis "PT-Scotch"
add_include_from_paths SCOTCH_CFLAGS "ptscotch.h" $INCLUDE_PATHS
add_lib_from_paths SCOTCH_LDFLAGS "libptscotch.*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking PT-Scotch to user paths ===================="
pkg_install_dir="$with_ptscotch"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
SCOTCH_CFLAGS="-I'${pkg_install_dir}/include'"
SCOTCH_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac
if [ "$with_ptscotch" != "__DONTUSE__" ] ; then
SCOTCH_LIBS="-lptscotchparmetis -lptscotch -lptscotcherr -lscotchmetis -lscotch -lscotcherr"
if [ "$with_ptscotch" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_ptscotch"
if [ "$with_ptscotch" != "__DONTUSE__" ]; then
SCOTCH_LIBS="-lptscotchparmetis -lptscotch -lptscotcherr -lscotchmetis -lscotch -lscotcherr"
if [ "$with_ptscotch" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_ptscotch"
prepend_path PATH "$pkg_install_dir/bin"
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"
prepend_path CPATH "$pkg_install_dir/include"
EOF
cat "${BUILDDIR}/setup_ptscotch" >> $SETUPFILE
fi
cat <<EOF >> "${BUILDDIR}/setup_ptscotch"
cat "${BUILDDIR}/setup_ptscotch" >> $SETUPFILE
fi
cat << EOF >> "${BUILDDIR}/setup_ptscotch"
export SCOTCH_CFLAGS="${SCOTCH_CFLAGS}"
export SCOTCH_LDFLAGS="${SCOTCH_LDFLAGS}"
export SCOTCH_LIBS="${SCOTCH_LIBS}"

View file

@ -2,7 +2,7 @@
[ "${BASH_SOURCE[0]}" ] && SCRIPT_NAME="${BASH_SOURCE[0]}" || SCRIPT_NAME=$0
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)"
superlu_ver="6.1.0" # Newer versions don't work with PEXSI 1.2.0.
superlu_ver="6.1.0" # Newer versions don't work with PEXSI 1.2.0.
superlu_sha256="92c6d1424dd830ee2d1e7396a418a5f6645160aea8472e558c4e4bfe006593c4"
source "${SCRIPT_DIR}"/common_vars.sh
@ -20,71 +20,71 @@ SUPERLU_LIBS=''
cd "${BUILDDIR}"
case "$with_superlu" in
__INSTALL__)
echo "==================== Installing SuperLU_DIST ===================="
require_env MATH_LIBS
pkg_install_dir="${INSTALLDIR}/superlu_dist-${superlu_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "superlu_dist-${superlu_ver} is already installed, skipping it."
else
if [ -f superlu_dist_${superlu_ver}.tar.gz ] ; then
echo "superlu_dist_${superlu_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${superlu_sha256} \
https://www.cp2k.org/static/downloads/superlu_dist_${superlu_ver}.tar.gz
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d SuperLU_DIST_${superlu_ver} ] && rm -rf SuperLU_DIST_${superlu_ver}
tar -xzf superlu_dist_${superlu_ver}.tar.gz
cd superlu_dist-${superlu_ver}
cd build
# Explicitly set LIBDIR to "lib", otherwise it sometimes defaults to "lib64".
cmake -DTPL_ENABLE_PARMETISLIB=FALSE \
-DCMAKE_INSTALL_PREFIX=${pkg_install_dir} \
-DCMAKE_INSTALL_LIBDIR=${pkg_install_dir}/lib \
.. > cmake.log 2>&1
make -j $NPROCS > make.log 2>&1
make install > install.log 2>&1
cd ..
__INSTALL__)
echo "==================== Installing SuperLU_DIST ===================="
require_env MATH_LIBS
pkg_install_dir="${INSTALLDIR}/superlu_dist-${superlu_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "superlu_dist-${superlu_ver} is already installed, skipping it."
else
if [ -f superlu_dist_${superlu_ver}.tar.gz ]; then
echo "superlu_dist_${superlu_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${superlu_sha256} \
https://www.cp2k.org/static/downloads/superlu_dist_${superlu_ver}.tar.gz
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d SuperLU_DIST_${superlu_ver} ] && rm -rf SuperLU_DIST_${superlu_ver}
tar -xzf superlu_dist_${superlu_ver}.tar.gz
cd superlu_dist-${superlu_ver}
cd build
# Explicitly set LIBDIR to "lib", otherwise it sometimes defaults to "lib64".
cmake -DTPL_ENABLE_PARMETISLIB=FALSE \
-DCMAKE_INSTALL_PREFIX=${pkg_install_dir} \
-DCMAKE_INSTALL_LIBDIR=${pkg_install_dir}/lib \
.. > cmake.log 2>&1
make -j $NPROCS > make.log 2>&1
make install > install.log 2>&1
cd ..
# PEXSI needs some more headers.
cp SRC/*.h "${pkg_install_dir}/include"
# PEXSI needs some more headers.
cp SRC/*.h "${pkg_install_dir}/include"
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage5/$(basename ${SCRIPT_NAME})"
fi
SUPERLU_CFLAGS="-I'${pkg_install_dir}/include'"
SUPERLU_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding SuperLU_DIST from system paths ===================="
check_lib -lsuperlu_dist "SuperLU_DIST"
add_include_from_paths SUPERLU_CFLAGS "superlu*" $INCLUDE_PATHS
add_lib_from_paths SUPERLU_LDFLAGS "libsuperlu*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking Superlu_Dist to user paths ===================="
pkg_install_dir="$with_superlu"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
SUPERLU_CFLAGS="-I'${pkg_install_dir}/include'"
SUPERLU_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage5/$(basename ${SCRIPT_NAME})"
fi
SUPERLU_CFLAGS="-I'${pkg_install_dir}/include'"
SUPERLU_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding SuperLU_DIST from system paths ===================="
check_lib -lsuperlu_dist "SuperLU_DIST"
add_include_from_paths SUPERLU_CFLAGS "superlu*" $INCLUDE_PATHS
add_lib_from_paths SUPERLU_LDFLAGS "libsuperlu*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking Superlu_Dist to user paths ===================="
pkg_install_dir="$with_superlu"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
SUPERLU_CFLAGS="-I'${pkg_install_dir}/include'"
SUPERLU_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac
if [ "$with_superlu" != "__DONTUSE__" ] ; then
SUPERLU_LIBS="-lsuperlu_dist"
if [ "$with_superlu" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_superlu"
if [ "$with_superlu" != "__DONTUSE__" ]; then
SUPERLU_LIBS="-lsuperlu_dist"
if [ "$with_superlu" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_superlu"
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"
prepend_path CPATH "$pkg_install_dir/include"
EOF
cat "${BUILDDIR}/setup_superlu" >> $SETUPFILE
fi
cat <<EOF >> "${BUILDDIR}/setup_superlu"
cat "${BUILDDIR}/setup_superlu" >> $SETUPFILE
fi
cat << EOF >> "${BUILDDIR}/setup_superlu"
export SUPERLU_CFLAGS="${SUPERLU_CFLAGS}"
export SUPERLU_LDFLAGS="${SUPERLU_LDFLAGS}"
export SUPERLU_LIBS="${SUPERLU_LIBS}"

View file

@ -16,57 +16,57 @@ source "${INSTALLDIR}"/toolchain.env
cd "${BUILDDIR}"
case "$with_gsl" in
__INSTALL__)
echo "==================== Installing gsl ===================="
pkg_install_dir="${INSTALLDIR}/gsl-${gsl_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "gsl-${gsl_ver} is already installed, skipping it."
else
if [ -f gsl-${gsl_ver}.tar.gz ] ; then
echo "gsl-${gsl_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${gls_sha256} \
"https://www.cp2k.org/static/downloads/gsl-${gsl_ver}.tar.gz"
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d gsl-${gsl_ver} ] && rm -rf gsl-${gsl_ver}
tar -xzf gsl-${gsl_ver}.tar.gz
cd gsl-${gsl_ver}
./configure --prefix="${pkg_install_dir}" \
--libdir="${pkg_install_dir}/lib" \
--enable-shared \
--enable-static > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make -j $NPROCS install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage6/$(basename ${SCRIPT_NAME})"
fi
__INSTALL__)
echo "==================== Installing gsl ===================="
pkg_install_dir="${INSTALLDIR}/gsl-${gsl_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "gsl-${gsl_ver} is already installed, skipping it."
else
if [ -f gsl-${gsl_ver}.tar.gz ]; then
echo "gsl-${gsl_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${gls_sha256} \
"https://www.cp2k.org/static/downloads/gsl-${gsl_ver}.tar.gz"
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d gsl-${gsl_ver} ] && rm -rf gsl-${gsl_ver}
tar -xzf gsl-${gsl_ver}.tar.gz
cd gsl-${gsl_ver}
./configure --prefix="${pkg_install_dir}" \
--libdir="${pkg_install_dir}/lib" \
--enable-shared \
--enable-static > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make -j $NPROCS install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage6/$(basename ${SCRIPT_NAME})"
fi
GSL_CFLAGS="-I'${pkg_install_dir}/include'"
GSL_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding gsl from system paths ===================="
check_command pkg-config --modversion gsl
add_include_from_paths GSL_CFLAGS "gsl.h" $INCLUDE_PATHS
add_lib_from_paths GSL_LDFLAGS "libgsl.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking gsl to user paths ===================="
pkg_install_dir="$with_gsl"
check_dir "$pkg_install_dir/lib"
check_dir "$pkg_install_dir/include"
GSL_CFLAGS="-I'${pkg_install_dir}/include'"
GSL_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
GSL_CFLAGS="-I'${pkg_install_dir}/include'"
GSL_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding gsl from system paths ===================="
check_command pkg-config --modversion gsl
add_include_from_paths GSL_CFLAGS "gsl.h" $INCLUDE_PATHS
add_lib_from_paths GSL_LDFLAGS "libgsl.*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking gsl to user paths ===================="
pkg_install_dir="$with_gsl"
check_dir "$pkg_install_dir/lib"
check_dir "$pkg_install_dir/include"
GSL_CFLAGS="-I'${pkg_install_dir}/include'"
GSL_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac
if [ "$with_gsl" != "__DONTUSE__" ] ; then
GSL_LIBS="-lgsl -lgslcblas"
if [ "$with_gsl" != "__SYSTEM__" ] ; then
cat << EOF > "${BUILDDIR}/setup_gsl"
if [ "$with_gsl" != "__DONTUSE__" ]; then
GSL_LIBS="-lgsl -lgslcblas"
if [ "$with_gsl" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_gsl"
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"
@ -76,8 +76,8 @@ export GSL_LIBRARY="-lgsl"
export GSL_CBLAS_LIBRARY="-lgslcblas"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$pkg_install_dir/lib64/pkgconfig:$pkg_install_dir/lib/pkgconfig"
EOF
fi
cat << EOF >> "${BUILDDIR}/setup_gsl"
fi
cat << EOF >> "${BUILDDIR}/setup_gsl"
export GSL_CFLAGS="${GSL_CFLAGS}"
export GSL_LDFLAGS="${GSL_LDFLAGS}"
export CP_DFLAGS="\${CP_DFLAGS} IF_MPI(-D__GSL|)"
@ -99,7 +99,7 @@ export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$pkg_install_dir/lib64/pkgconfig:$pkg_i
export CP_LIBS="IF_MPI(${GSL_LIBS}|) \${CP_LIBS}"
EOF
cat "${BUILDDIR}/setup_gsl" >> $SETUPFILE
cat "${BUILDDIR}/setup_gsl" >> $SETUPFILE
fi
load "${BUILDDIR}/setup_gsl"

View file

@ -21,72 +21,72 @@ PLUMED_LIBS=''
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
__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}
[ -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}
# disable generating debugging infos for now to work around an issue in gcc-10.2:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96354
# note: some MPI wrappers carry a -g forward, thus stripping is not enough
echo "Installing from scratch into ${pkg_install_dir}"
cd plumed-${plumed_ver}
# disable generating debugging infos for now to work around an issue in gcc-10.2:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96354
# note: some MPI wrappers carry a -g forward, thus stripping is not enough
libs=""
[ -n "${MKL_LIBS}" ] && libs+="${MKL_LIBS}"
libs=""
[ -n "${MKL_LIBS}" ] && libs+="${MKL_LIBS}"
./configure \
CXX="${MPICXX}" \
CXXFLAGS="${CXXFLAGS//-g/-g0} ${GSL_CFLAGS}" \
LDFLAGS="${LDFLAGS} ${GSL_LDFLAGS}" \
LIBS="${libs}" \
--prefix=${pkg_install_dir} \
--libdir="${pkg_install_dir}/lib" > configure.log 2>&1
make VERBOSE=1 -j $NPROCS > make.log 2>&1
make install > install.log 2>&1
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage6/$(basename ${SCRIPT_NAME})"
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'"
;;
./configure \
CXX="${MPICXX}" \
CXXFLAGS="${CXXFLAGS//-g/-g0} ${GSL_CFLAGS}" \
LDFLAGS="${LDFLAGS} ${GSL_LDFLAGS}" \
LIBS="${libs}" \
--prefix=${pkg_install_dir} \
--libdir="${pkg_install_dir}/lib" > configure.log 2>&1
make VERBOSE=1 -j $NPROCS > make.log 2>&1
make install > install.log 2>&1
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage6/$(basename ${SCRIPT_NAME})"
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"
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 "${BUILDDIR}/setup_plumed" >> $SETUPFILE
fi
cat <<EOF >> "${BUILDDIR}/setup_plumed"
cat << EOF >> "${BUILDDIR}/setup_plumed"
export PLUMED_LDFLAGS="${PLUMED_LDFLAGS}"
export PLUMED_LIBS="${PLUMED_LIBS}"
export CP_DFLAGS="\${CP_DFLAGS} -D__PLUMED2"

View file

@ -13,12 +13,12 @@ source "${INSTALLDIR}"/toolchain.env
[ -f "${BUILDDIR}/setup_quip" ] && rm "${BUILDDIR}/setup_quip"
if [ "${ENABLE_TSAN}" = "__TRUE__" ] ; then
report_warning "QUIP is not combatiable with thread sanitizer, not installing..."
cat <<EOF > setup_quip
if [ "${ENABLE_TSAN}" = "__TRUE__" ]; then
report_warning "QUIP is not combatiable with thread sanitizer, not installing..."
cat << EOF > setup_quip
with_quip=__DONTUSE__
EOF
exit 0
exit 0
fi
QUIP_CFLAGS=''
@ -28,124 +28,124 @@ QUIP_LIBS=''
cd "${BUILDDIR}"
case "$with_quip" in
__INSTALL__)
echo "==================== Installing QUIP ===================="
require_env MATH_LIBS
pkg_install_dir="${INSTALLDIR}/quip-${quip_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "quip_dist-${quip_ver} is already installed, skipping it."
else
if [ -f QUIP-${quip_ver}.tar.gz ] ; then
echo "QUIP-${quip_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${quip_sha256} \
https://www.cp2k.org/static/downloads/QUIP-${quip_ver}.tar.gz
fi
[ -d QUIP-${quip_ver} ] && rm -rf QUIP-${quip_ver}
echo "Installing from scratch into ${pkg_install_dir}"
tar -xzf QUIP-${quip_ver}.tar.gz
cd QUIP-${quip_ver}
# translate OPENBLAS_ARCH
case $OPENBLAS_ARCH in
x86_64)
quip_arch=x86_64
;;
i386)
quip_arch=x86_32
;;
arm)
quip_arch=x86_64
;;
*)
report_error $LINENO "arch $OPENBLAS_ARCH is currently unsupported"
exit 1
;;
esac
# The ARCHER cd has a very annoying habbit of printing out
# dir names to stdout for any target directories that are
# more than one level deep, and one cannot seem to disable
# it. This unfortunately messes up the installation script
# for QUIP. So this hack will help to resolve the issue
if [ "$ENABLE_CRAY" = "__TRUE__" ] ; then
sed -i \
-e "s|\(cd build/.*\)|\1 >&- 2>&-|g" \
bin/find_sizeof_fortran_t
fi
sed -i \
-e "s|\(F77 *=\).*|\1 ${FC}|g" \
-e "s|\(F90 *=\).*|\1 ${FC}|g" \
-e "s|\(F95 *=\).*|\1 ${FC}|g" \
-e "s|\(CC *=\).*|\1 ${CC}|g" \
-e "s|\(CPLUSPLUS *=\).*|\1 ${CXX}|g" \
-e "s|\(LINKER *=\).*|\1 ${FC}|g" \
-e "s|\(FPP *=\).*|\1 ${FC} -E -x f95-cpp-input|g" \
-e "s|\(QUIPPY_FCOMPILER *=\).*|\1 ${FC}|g" \
-e "s|\(QUIPPY_CPP *=\).*|\1 ${FC} -E -x f95-cpp-input|g" \
arch/Makefile.linux_${quip_arch}_gfortran
__INSTALL__)
echo "==================== Installing QUIP ===================="
require_env MATH_LIBS
pkg_install_dir="${INSTALLDIR}/quip-${quip_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "quip_dist-${quip_ver} is already installed, skipping it."
else
if [ -f QUIP-${quip_ver}.tar.gz ]; then
echo "QUIP-${quip_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${quip_sha256} \
https://www.cp2k.org/static/downloads/QUIP-${quip_ver}.tar.gz
fi
[ -d QUIP-${quip_ver} ] && rm -rf QUIP-${quip_ver}
echo "Installing from scratch into ${pkg_install_dir}"
tar -xzf QUIP-${quip_ver}.tar.gz
cd QUIP-${quip_ver}
# translate OPENBLAS_ARCH
case $OPENBLAS_ARCH in
x86_64)
quip_arch=x86_64
;;
i386)
quip_arch=x86_32
;;
arm)
quip_arch=x86_64
;;
*)
report_error $LINENO "arch $OPENBLAS_ARCH is currently unsupported"
exit 1
;;
esac
# The ARCHER cd has a very annoying habbit of printing out
# dir names to stdout for any target directories that are
# more than one level deep, and one cannot seem to disable
# it. This unfortunately messes up the installation script
# for QUIP. So this hack will help to resolve the issue
if [ "$ENABLE_CRAY" = "__TRUE__" ]; then
sed -i \
-e "s|\(cd build/.*\)|\1 >&- 2>&-|g" \
bin/find_sizeof_fortran_t
fi
sed -i \
-e "s|\(F77 *=\).*|\1 ${FC}|g" \
-e "s|\(F90 *=\).*|\1 ${FC}|g" \
-e "s|\(F95 *=\).*|\1 ${FC}|g" \
-e "s|\(CC *=\).*|\1 ${CC}|g" \
-e "s|\(CPLUSPLUS *=\).*|\1 ${CXX}|g" \
-e "s|\(LINKER *=\).*|\1 ${FC}|g" \
-e "s|\(FPP *=\).*|\1 ${FC} -E -x f95-cpp-input|g" \
-e "s|\(QUIPPY_FCOMPILER *=\).*|\1 ${FC}|g" \
-e "s|\(QUIPPY_CPP *=\).*|\1 ${FC} -E -x f95-cpp-input|g" \
arch/Makefile.linux_${quip_arch}_gfortran
# workaround for compilation with GCC-10, until properly fixed:
# https://github.com/libAtoms/QUIP/issues/209
( "${FC}" --version | grep -Eq 'GNU.+\s10\.') && compat_flag="-fallow-argument-mismatch" || compat_flag=""
# workaround for compilation with GCC-10, until properly fixed:
# https://github.com/libAtoms/QUIP/issues/209
("${FC}" --version | grep -Eq 'GNU.+\s10\.') && compat_flag="-fallow-argument-mismatch" || compat_flag=""
# enable debug symbols
echo "F95FLAGS += -g ${compat_flag}" >> arch/Makefile.linux_${quip_arch}_gfortran
echo "F77FLAGS += -g ${compat_flag}" >> arch/Makefile.linux_${quip_arch}_gfortran
echo "CFLAGS += -g" >> arch/Makefile.linux_${quip_arch}_gfortran
echo "CPLUSPLUSFLAGS += -g" >> arch/Makefile.linux_${quip_arch}_gfortran
export QUIP_ARCH=linux_${quip_arch}_gfortran
# hit enter a few times to accept defaults
echo -e "${MATH_LDFLAGS} $(resolve_string "${MATH_LIBS}") \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" | make config > configure.log
# make -j does not work :-(
make > make.log 2>&1
! [ -d "${pkg_install_dir}/include" ] && mkdir -p "${pkg_install_dir}/include"
! [ -d "${pkg_install_dir}/lib" ] && mkdir -p "${pkg_install_dir}/lib"
cp build/linux_x86_64_gfortran/quip_unified_wrapper_module.mod \
"${pkg_install_dir}/include/"
cp build/linux_x86_64_gfortran/*.a \
"${pkg_install_dir}/lib/"
cp src/fox/objs.linux_${quip_arch}_gfortran/lib/*.a \
"${pkg_install_dir}/lib/"
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage6/$(basename ${SCRIPT_NAME})"
fi
QUIP_CFLAGS="-I'${pkg_install_dir}/include'"
QUIP_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding Quip_DIST from system paths ===================="
check_lib -lquip_core "QUIP"
check_lib -latoms "QUIP"
check_lib -lFoX_sax "QUIP"
check_lib -lFoX_common "QUIP"
check_lib -lFoX_utils "QUIP"
check_lib -lFoX_fsys "QUIP"
add_include_from_paths QUIP_CFLAGS "quip*" $INCLUDE_PATHS
add_lib_from_paths QUIP_LDFLAGS "libquip_core*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking Quip_Dist to user paths ===================="
pkg_install_dir="$with_quip"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
QUIP_CFLAGS="-I'${pkg_install_dir}/include'"
QUIP_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
# enable debug symbols
echo "F95FLAGS += -g ${compat_flag}" >> arch/Makefile.linux_${quip_arch}_gfortran
echo "F77FLAGS += -g ${compat_flag}" >> arch/Makefile.linux_${quip_arch}_gfortran
echo "CFLAGS += -g" >> arch/Makefile.linux_${quip_arch}_gfortran
echo "CPLUSPLUSFLAGS += -g" >> arch/Makefile.linux_${quip_arch}_gfortran
export QUIP_ARCH=linux_${quip_arch}_gfortran
# hit enter a few times to accept defaults
echo -e "${MATH_LDFLAGS} $(resolve_string "${MATH_LIBS}") \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" | make config > configure.log
# make -j does not work :-(
make > make.log 2>&1
! [ -d "${pkg_install_dir}/include" ] && mkdir -p "${pkg_install_dir}/include"
! [ -d "${pkg_install_dir}/lib" ] && mkdir -p "${pkg_install_dir}/lib"
cp build/linux_x86_64_gfortran/quip_unified_wrapper_module.mod \
"${pkg_install_dir}/include/"
cp build/linux_x86_64_gfortran/*.a \
"${pkg_install_dir}/lib/"
cp src/fox/objs.linux_${quip_arch}_gfortran/lib/*.a \
"${pkg_install_dir}/lib/"
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage6/$(basename ${SCRIPT_NAME})"
fi
QUIP_CFLAGS="-I'${pkg_install_dir}/include'"
QUIP_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding Quip_DIST from system paths ===================="
check_lib -lquip_core "QUIP"
check_lib -latoms "QUIP"
check_lib -lFoX_sax "QUIP"
check_lib -lFoX_common "QUIP"
check_lib -lFoX_utils "QUIP"
check_lib -lFoX_fsys "QUIP"
add_include_from_paths QUIP_CFLAGS "quip*" $INCLUDE_PATHS
add_lib_from_paths QUIP_LDFLAGS "libquip_core*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking Quip_Dist to user paths ===================="
pkg_install_dir="$with_quip"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/include"
QUIP_CFLAGS="-I'${pkg_install_dir}/include'"
QUIP_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac
if [ "$with_quip" != "__DONTUSE__" ] ; then
QUIP_LIBS="-lquip_core -latoms -lFoX_sax -lFoX_common -lFoX_utils -lFoX_fsys"
if [ "$with_quip" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_quip"
if [ "$with_quip" != "__DONTUSE__" ]; then
QUIP_LIBS="-lquip_core -latoms -lFoX_sax -lFoX_common -lFoX_utils -lFoX_fsys"
if [ "$with_quip" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_quip"
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"
prepend_path CPATH "$pkg_install_dir/include"
EOF
cat "${BUILDDIR}/setup_quip" >> $SETUPFILE
fi
cat <<EOF >> "${BUILDDIR}/setup_quip"
cat "${BUILDDIR}/setup_quip" >> $SETUPFILE
fi
cat << EOF >> "${BUILDDIR}/setup_quip"
export QUIP_CFLAGS="${QUIP_CFLAGS}"
export QUIP_LDFLAGS="${QUIP_LDFLAGS}"
export QUIP_LIBS="${QUIP_LIBS}"

View file

@ -17,59 +17,59 @@ source "${INSTALLDIR}"/toolchain.env
cd "${BUILDDIR}"
case "$with_hdf5" in
__INSTALL__)
echo "==================== Installing hdf5 ===================="
pkg_install_dir="${INSTALLDIR}/hdf5-${hdf5_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "hdf5-${hdf5_ver} is already installed, skipping it."
else
if [ -f hdf5-${hdf5_ver}.tar.bz2 ] ; then
echo "hdf5-${hdf5_ver}.tar.bz2 is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${hdf5_sha256} \
https://www.cp2k.org/static/downloads/hdf5-${hdf5_ver}.tar.bz2
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d hdf5-${hdf5_ver} ] && rm -rf hdf5-${hdf5_ver}
tar xf hdf5-${hdf5_ver}.tar.bz2
cd hdf5-${hdf5_ver}
./configure \
--prefix="${pkg_install_dir}" \
--libdir="${pkg_install_dir}/lib" \
--enable-shared \
> configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make -j $NPROCS install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage7/$(basename ${SCRIPT_NAME})"
fi
__INSTALL__)
echo "==================== Installing hdf5 ===================="
pkg_install_dir="${INSTALLDIR}/hdf5-${hdf5_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "hdf5-${hdf5_ver} is already installed, skipping it."
else
if [ -f hdf5-${hdf5_ver}.tar.bz2 ]; then
echo "hdf5-${hdf5_ver}.tar.bz2 is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${hdf5_sha256} \
https://www.cp2k.org/static/downloads/hdf5-${hdf5_ver}.tar.bz2
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d hdf5-${hdf5_ver} ] && rm -rf hdf5-${hdf5_ver}
tar xf hdf5-${hdf5_ver}.tar.bz2
cd hdf5-${hdf5_ver}
./configure \
--prefix="${pkg_install_dir}" \
--libdir="${pkg_install_dir}/lib" \
--enable-shared \
> configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make -j $NPROCS install > install.log 2>&1
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage7/$(basename ${SCRIPT_NAME})"
fi
HDF5_CFLAGS="-I${pkg_install_dir}/include"
HDF5_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding hdf5 from system paths ===================="
check_command pkg-config --modversion hdf5
add_include_from_paths HDF5_CFLAGS "hdf5.h" $INCLUDE_PATHS
add_lib_from_paths HDF5_LDFLAGS "libhdf5.*" $LIB_PATHS
;;
__DONTUSE__) ;;
*) ;;
HDF5_CFLAGS="-I${pkg_install_dir}/include"
HDF5_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding hdf5 from system paths ===================="
check_command pkg-config --modversion hdf5
add_include_from_paths HDF5_CFLAGS "hdf5.h" $INCLUDE_PATHS
add_lib_from_paths HDF5_LDFLAGS "libhdf5.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
;;
esac
if [ "$with_hdf5" != "__DONTUSE__" ] ; then
HDF5_LIBS="-lhdf5 -lhdf5_hl"
if [ "$with_hdf5" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_hdf5"
if [ "$with_hdf5" != "__DONTUSE__" ]; then
HDF5_LIBS="-lhdf5 -lhdf5_hl"
if [ "$with_hdf5" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_hdf5"
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"
prepend_path CPATH "$pkg_install_dir/include"
EOF
fi
cat <<EOF >> "${BUILDDIR}/setup_hdf5"
fi
cat << EOF >> "${BUILDDIR}/setup_hdf5"
export HDF5_CFLAGS="${HDF5_CFLAGS}"
export HDF5_LDFLAGS="${HDF5_LDFLAGS}"
export CP_DFLAGS="\${CP_DFLAGS} IF_MPI(-D__HDF5|)"
@ -89,7 +89,7 @@ export HDF5_HL_LIBRARIES="$HDF5_LIBS"
export HDF5_INCLUDE_DIRS="$pkg_install_dir/include"
EOF
cat "${BUILDDIR}/setup_hdf5" >> $SETUPFILE
cat "${BUILDDIR}/setup_hdf5" >> $SETUPFILE
fi
load "${BUILDDIR}/setup_hdf5"

View file

@ -12,111 +12,111 @@ source "${INSTALLDIR}"/toolchain.env
[ -f "${BUILDDIR}/setup_libvdwxc" ] && rm "${BUILDDIR}/setup_libvdwxc"
if [ "$MPI_MODE" = "no" ] && [ $with_sirius ="__FALSE__" ] ; then
report_warning $LINENO "MPI and SIRIUS are disabled, skipping libvdwxc installation"
exit 0
if [ "$MPI_MODE" = "no" ] && [ $with_sirius ="__FALSE__" ]; then
report_warning $LINENO "MPI and SIRIUS are disabled, skipping libvdwxc installation"
exit 0
fi
! [ -d "${BUILDDIR}" ] && mkdir -p "${BUILDDIR}"
cd "${BUILDDIR}"
case "$with_libvdwxc" in
__INSTALL__)
require_env MPI_CFLAGS
require_env MPI_LDFLAGS
require_env MPI_LIBS
require_env FFTW_ROOT
require_env FFTW_LDFLAGS
require_env FFTW_LIBS
require_env FFTW_CFLAGS
__INSTALL__)
require_env MPI_CFLAGS
require_env MPI_LDFLAGS
require_env MPI_LIBS
require_env FFTW_ROOT
require_env FFTW_LDFLAGS
require_env FFTW_LIBS
require_env FFTW_CFLAGS
echo "==================== Installing libvdwxc ===================="
pkg_install_dir="${INSTALLDIR}/libvdwxc-${libvdwxc_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "libvdwxc-${libvdwxc_ver} is already installed, skipping it."
echo "==================== Installing libvdwxc ===================="
pkg_install_dir="${INSTALLDIR}/libvdwxc-${libvdwxc_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "libvdwxc-${libvdwxc_ver} is already installed, skipping it."
else
if [ -f libvdwxc-${libvdwxc_ver}.tar.gz ]; then
echo "libvdwxc-${libvdwxc_ver}.tar.gz is found"
else
# do not remove this. They do not publish official version often
download_pkg ${DOWNLOADER_FLAGS} ${libvdwxc_sha256} \
"https://www.cp2k.org/static/downloads/libvdwxc-${libvdwxc_ver}.tar.gz"
fi
for patch in "${patches[@]}"; do
fname="${patch##*/}"
if [ -f "${fname}" ]; then
echo "${fname} is found"
else
if [ -f libvdwxc-${libvdwxc_ver}.tar.gz ] ; then
echo "libvdwxc-${libvdwxc_ver}.tar.gz is found"
else
# do not remove this. They do not publish official version often
download_pkg ${DOWNLOADER_FLAGS} ${libvdwxc_sha256} \
"https://www.cp2k.org/static/downloads/libvdwxc-${libvdwxc_ver}.tar.gz"
fi
for patch in "${patches[@]}" ; do
fname="${patch##*/}"
if [ -f "${fname}" ] ; then
echo "${fname} is found"
else
# parallel build patch
download_pkg ${DOWNLOADER_FLAGS} "${patch}"
fi
done
echo "Installing from scratch into ${pkg_install_dir}"
[ -d libvdwxc-${libvdwxc_ver} ] && rm -rf libvdwxc-${libvdwxc_ver}
tar -xzf libvdwxc-${libvdwxc_ver}.tar.gz
cd libvdwxc-${libvdwxc_ver}
for patch in "${patches[@]}" ; do
patch -p1 < ../"${patch##*/}"
done
unset MPICC MPICXX MPIF90 MPIFC MPIF77
if [ "$MPI_MODE" = "no" ]; then
# compile libvdwxc without mpi support since fftw (or mkl) do not have mpi support activated
./configure \
--prefix="${pkg_install_dir}" \
--libdir="${pkg_install_dir}/lib" \
--with-fftw3=${FFTW_ROOT} \
--disable-shared \
--without-mpi \
>> configure.log 2>&1
else
CC="${MPICC}" FC="${MPIFC}" ./configure \
--prefix="${pkg_install_dir}" \
--libdir="${pkg_install_dir}/lib" \
--with-fftw3=${FFTW_ROOT} \
--disable-shared \
--with-mpi \
>> configure.log 2>&1
fi
make -j $NPROCS > compile.log 2>&1
make install > compile.log 2>&1
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage7/$(basename ${SCRIPT_NAME})"
# parallel build patch
download_pkg ${DOWNLOADER_FLAGS} "${patch}"
fi
done
LIBVDWXC_CFLAGS="-I${pkg_install_dir}/include"
LIBVDWXC_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding libvdwxc from system paths ===================="
check_command pkg-config --modversion libvdwxc
add_include_from_paths LIBVDWXC_CFLAGS "vdwxc.h" $INCLUDE_PATHS
add_lib_from_paths LIBVDWXC_LDFLAGS "libvdwxc*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking libvdwxc to user paths ===================="
pkg_install_dir="$with_libvdwxc"
check_dir "$pkg_install_dir/lib"
check_dir "$pkg_install_dir/include"
LIBVDWXC_CFLAGS="-I'${pkg_install_dir}/include'"
LIBVDWXC_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
echo "Installing from scratch into ${pkg_install_dir}"
[ -d libvdwxc-${libvdwxc_ver} ] && rm -rf libvdwxc-${libvdwxc_ver}
tar -xzf libvdwxc-${libvdwxc_ver}.tar.gz
cd libvdwxc-${libvdwxc_ver}
for patch in "${patches[@]}"; do
patch -p1 < ../"${patch##*/}"
done
unset MPICC MPICXX MPIF90 MPIFC MPIF77
if [ "$MPI_MODE" = "no" ]; then
# compile libvdwxc without mpi support since fftw (or mkl) do not have mpi support activated
./configure \
--prefix="${pkg_install_dir}" \
--libdir="${pkg_install_dir}/lib" \
--with-fftw3=${FFTW_ROOT} \
--disable-shared \
--without-mpi \
>> configure.log 2>&1
else
CC="${MPICC}" FC="${MPIFC}" ./configure \
--prefix="${pkg_install_dir}" \
--libdir="${pkg_install_dir}/lib" \
--with-fftw3=${FFTW_ROOT} \
--disable-shared \
--with-mpi \
>> configure.log 2>&1
fi
make -j $NPROCS > compile.log 2>&1
make install > compile.log 2>&1
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage7/$(basename ${SCRIPT_NAME})"
fi
LIBVDWXC_CFLAGS="-I${pkg_install_dir}/include"
LIBVDWXC_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding libvdwxc from system paths ===================="
check_command pkg-config --modversion libvdwxc
add_include_from_paths LIBVDWXC_CFLAGS "vdwxc.h" $INCLUDE_PATHS
add_lib_from_paths LIBVDWXC_LDFLAGS "libvdwxc*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking libvdwxc to user paths ===================="
pkg_install_dir="$with_libvdwxc"
check_dir "$pkg_install_dir/lib"
check_dir "$pkg_install_dir/include"
LIBVDWXC_CFLAGS="-I'${pkg_install_dir}/include'"
LIBVDWXC_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac
if [ "$with_libvdwxc" != "__DONTUSE__" ] ; then
LIBVDWXC_LIBS="-lvdwxc"
if [ "$with_libvdwxc" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_libvdwxc"
if [ "$with_libvdwxc" != "__DONTUSE__" ]; then
LIBVDWXC_LIBS="-lvdwxc"
if [ "$with_libvdwxc" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_libvdwxc"
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"
prepend_path CPATH "$pkg_install_dir/include"
EOF
fi
cat <<EOF >> "${BUILDDIR}/setup_libvdwxc"
fi
cat << EOF >> "${BUILDDIR}/setup_libvdwxc"
export LIBVDWXC_CFLAGS="-I$pkg_install_dir/include ${LIBVDWXC_CFLAGS}"
export LIBVDWXC_LDFLAGS="${LIBVDWXC_LDFLAGS}"
export LIBVDWXC_LIBS="${LIBVDWXC_LIBS}"
@ -127,7 +127,7 @@ export CP_LIBS="IF_MPI(${LIBVDWXC_LIBS}|) \${CP_LIBS}"
export PKG_CONFIG_PATH="$pkg_install_dir/lib/pkgconfig:$PKG_CONFIG_PATH"
export VDWXC_DIR="$pkg_install_dir"
EOF
cat "${BUILDDIR}/setup_libvdwxc" >> $SETUPFILE
cat "${BUILDDIR}/setup_libvdwxc" >> $SETUPFILE
fi
load "${BUILDDIR}/setup_libvdwxc"

View file

@ -20,73 +20,73 @@ source "${INSTALLDIR}"/toolchain.env
cd "${BUILDDIR}"
case "${with_libvori:=__INSTALL__}" in
__INSTALL__)
echo "==================== Installing libvori ===================="
pkg_install_dir="${INSTALLDIR}/libvori-${libvori_ver}"
install_lock_file="${pkg_install_dir}/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "libvori-${libvori_ver} is already installed, skipping it."
else
if [ -f libvori-${libvori_ver}.tar.gz ] ; then
echo "libvori-${libvori_ver}.tar.gz is found"
else
# shellcheck disable=SC2086
download_pkg ${DOWNLOADER_FLAGS} ${libvori_sha256} \
"https://www.cp2k.org/static/downloads/libvori-${libvori_ver}.tar.gz"
fi
__INSTALL__)
echo "==================== Installing libvori ===================="
pkg_install_dir="${INSTALLDIR}/libvori-${libvori_ver}"
install_lock_file="${pkg_install_dir}/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "libvori-${libvori_ver} is already installed, skipping it."
else
if [ -f libvori-${libvori_ver}.tar.gz ]; then
echo "libvori-${libvori_ver}.tar.gz is found"
else
# shellcheck disable=SC2086
download_pkg ${DOWNLOADER_FLAGS} ${libvori_sha256} \
"https://www.cp2k.org/static/downloads/libvori-${libvori_ver}.tar.gz"
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d libvori-${libvori_ver} ] && rm -rf libvori-${libvori_ver}
tar -xzf libvori-${libvori_ver}.tar.gz
echo "Installing from scratch into ${pkg_install_dir}"
[ -d libvori-${libvori_ver} ] && rm -rf libvori-${libvori_ver}
tar -xzf libvori-${libvori_ver}.tar.gz
mkdir "libvori-${libvori_ver}/build"
cd "libvori-${libvori_ver}/build"
cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE \
.. > cmake.log 2>&1
CMAKE_BUILD_PARALLEL_LEVEL="${NPROCS}" cmake --build . > build.log 2>&1
CMAKE_BUILD_PARALLEL_LEVEL="${NPROCS}" cmake --build . --target test > test.log 2>&1
CMAKE_BUILD_PARALLEL_LEVEL="${NPROCS}" cmake --build . --target install > install.log 2>&1
mkdir "libvori-${libvori_ver}/build"
cd "libvori-${libvori_ver}/build"
cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE \
.. > cmake.log 2>&1
CMAKE_BUILD_PARALLEL_LEVEL="${NPROCS}" cmake --build . > build.log 2>&1
CMAKE_BUILD_PARALLEL_LEVEL="${NPROCS}" cmake --build . --target test > test.log 2>&1
CMAKE_BUILD_PARALLEL_LEVEL="${NPROCS}" cmake --build . --target install > install.log 2>&1
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage7/$(basename "${SCRIPT_NAME}")"
fi
LIBVORI_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding libvori from system paths ===================="
check_lib -lvori "libvori"
add_lib_from_paths LIBVORI_LDFLAGS "libvori.*" "$LIB_PATHS"
;;
__DONTUSE__)
;;
*)
echo "==================== Linking libvori to user paths ===================="
pkg_install_dir="${with_libvori}"
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage7/$(basename "${SCRIPT_NAME}")"
fi
LIBVORI_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
__SYSTEM__)
echo "==================== Finding libvori from system paths ===================="
check_lib -lvori "libvori"
add_lib_from_paths LIBVORI_LDFLAGS "libvori.*" "$LIB_PATHS"
;;
__DONTUSE__) ;;
# use the lib64 directory if present (multi-abi distros may link lib/ to lib32/ instead)
LIBVORI_LIBDIR="${pkg_install_dir}/lib"
[ -d "${pkg_install_dir}/lib64" ] && LIBVORI_LIBDIR="${pkg_install_dir}/lib64"
*)
echo "==================== Linking libvori to user paths ===================="
pkg_install_dir="${with_libvori}"
check_dir "${LIBVORI_LIBDIR}"
LIBVORI_LDFLAGS="-L'${LIBVORI_LIBDIR}' -Wl,-rpath='${LIBVORI_LIBDIR}'"
;;
# use the lib64 directory if present (multi-abi distros may link lib/ to lib32/ instead)
LIBVORI_LIBDIR="${pkg_install_dir}/lib"
[ -d "${pkg_install_dir}/lib64" ] && LIBVORI_LIBDIR="${pkg_install_dir}/lib64"
check_dir "${LIBVORI_LIBDIR}"
LIBVORI_LDFLAGS="-L'${LIBVORI_LIBDIR}' -Wl,-rpath='${LIBVORI_LIBDIR}'"
;;
esac
if [ "$with_libvori" != "__DONTUSE__" ] ; then
LIBVORI_LIBS="-lvori -lstdc++"
if [ "$with_libvori" != "__SYSTEM__" ] ; then
cat << EOF > "${BUILDDIR}/setup_libvori"
if [ "$with_libvori" != "__DONTUSE__" ]; then
LIBVORI_LIBS="-lvori -lstdc++"
if [ "$with_libvori" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_libvori"
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"
export LIBVORI_LIBS="${LIBVORI_LIBS}"
export LIBVORI_ROOT="${pkg_install_dir}"
EOF
fi
cat << EOF >> "${BUILDDIR}/setup_libvori"
fi
cat << EOF >> "${BUILDDIR}/setup_libvori"
export LIBVORI_ROOT="${pkg_install_dir}"
export LIBVORI_VERSION=${libvori_ver}
export LIBVORI_LDFLAGS="${LIBVORI_LDFLAGS}"
@ -95,7 +95,7 @@ export CP_DFLAGS="\${CP_DFLAGS} -D__LIBVORI"
export CP_LDFLAGS="\${CP_LDFLAGS} ${LIBVORI_LDFLAGS}"
export CP_LIBS="\${CP_LIBS} ${LIBVORI_LIBS}"
EOF
cat "${BUILDDIR}/setup_libvori" >> "${SETUPFILE}"
cat "${BUILDDIR}/setup_libvori" >> "${SETUPFILE}"
fi
load "${BUILDDIR}/setup_libvori"

View file

@ -16,72 +16,72 @@ source "${INSTALLDIR}"/toolchain.env
cd "${BUILDDIR}"
case "$with_spglib" in
__INSTALL__)
echo "==================== Installing spglib ===================="
pkg_install_dir="${INSTALLDIR}/spglib-${spglib_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "spglib-${spglib_ver} is already installed, skipping it."
else
if [ -f spglib-${spglib_ver}.tar.gz ] ; then
echo "spglib-${spglib_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${spglib_sha256} \
https://github.com/atztogo/spglib/archive/v${spglib_ver}.tar.gz \
-o spglib-${spglib_ver}.tar.gz
fi
__INSTALL__)
echo "==================== Installing spglib ===================="
pkg_install_dir="${INSTALLDIR}/spglib-${spglib_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "spglib-${spglib_ver} is already installed, skipping it."
else
if [ -f spglib-${spglib_ver}.tar.gz ]; then
echo "spglib-${spglib_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${spglib_sha256} \
https://github.com/atztogo/spglib/archive/v${spglib_ver}.tar.gz \
-o spglib-${spglib_ver}.tar.gz
fi
echo "Installing from scratch into ${pkg_install_dir}"
rm -rf spglib-${spglib_ver} "${pkg_install_dir}"
tar -xzf spglib-${spglib_ver}.tar.gz
cd spglib-${spglib_ver}
echo "Installing from scratch into ${pkg_install_dir}"
rm -rf spglib-${spglib_ver} "${pkg_install_dir}"
tar -xzf spglib-${spglib_ver}.tar.gz
cd spglib-${spglib_ver}
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" -DCMAKE_BUILD_TYPE=Release .. > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make install >> make.log 2>&1
mkdir ${pkg_install_dir}/include/spglib
cp ${pkg_install_dir}/include/{,spglib/}spglib.h
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage7/$(basename ${SCRIPT_NAME})"
fi
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" -DCMAKE_BUILD_TYPE=Release .. > configure.log 2>&1
make -j $NPROCS > make.log 2>&1
make install >> make.log 2>&1
mkdir ${pkg_install_dir}/include/spglib
cp ${pkg_install_dir}/include/{,spglib/}spglib.h
cd ..
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage7/$(basename ${SCRIPT_NAME})"
fi
SPGLIB_CFLAGS="-I${pkg_install_dir}/include"
SPGLIB_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
if [ -d "${pkg_install_dir}/lib64" ]; then
ln -sf lib64 ${pkg_install_dir}/lib
cd ${pkg_install_dir}
fi
;;
__SYSTEM__)
echo "==================== Finding spglib from system paths ===================="
check_command pkg-config --modversion spglib
add_include_from_paths SPGLIB_CFLAGS "spglib.h" $INCLUDE_PATHS
add_lib_from_paths SPGLIB_LDFLAGS "libspglib.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking spglib to user paths ===================="
pkg_install_dir="$with_spglib"
check_dir "$pkg_install_dir/lib"
check_dir "$pkg_install_dir/include"
SPGLIB_CFLAGS="-I'${pkg_install_dir}/include'"
SPGLIB_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
SPGLIB_CFLAGS="-I${pkg_install_dir}/include"
SPGLIB_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
if [ -d "${pkg_install_dir}/lib64" ]; then
ln -sf lib64 ${pkg_install_dir}/lib
cd ${pkg_install_dir}
fi
;;
__SYSTEM__)
echo "==================== Finding spglib from system paths ===================="
check_command pkg-config --modversion spglib
add_include_from_paths SPGLIB_CFLAGS "spglib.h" $INCLUDE_PATHS
add_lib_from_paths SPGLIB_LDFLAGS "libspglib.*" $LIB_PATHS
;;
__DONTUSE__) ;;
*)
echo "==================== Linking spglib to user paths ===================="
pkg_install_dir="$with_spglib"
check_dir "$pkg_install_dir/lib"
check_dir "$pkg_install_dir/include"
SPGLIB_CFLAGS="-I'${pkg_install_dir}/include'"
SPGLIB_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
;;
esac
if [ "$with_spglib" != "__DONTUSE__" ] ; then
SPGLIB_LIBS="-lsymspg"
if [ "$with_spglib" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_spglib"
if [ "$with_spglib" != "__DONTUSE__" ]; then
SPGLIB_LIBS="-lsymspg"
if [ "$with_spglib" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_spglib"
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"
prepend_path CPATH "$pkg_install_dir/include"
EOF
fi
cat <<EOF >> "${BUILDDIR}/setup_spglib"
fi
cat << EOF >> "${BUILDDIR}/setup_spglib"
export SPGLIB_CFLAGS="-I$pkg_install_dir/include ${SPGLIB_CFLAGS}"
export SPGLIB_LDFLAGS="${SPGLIB_LDFLAGS}"
export CP_DFLAGS="\${CP_DFLAGS} -D__SPGLIB"
@ -91,7 +91,7 @@ export CP_LIBS="${SPGLIB_LIBS} \${CP_LIBS}"
export LIBSPGROOT="$pkg_install_dir"
export LIBSPG_INCLUDE_DIR="$pkg_install_dir/include"
EOF
cat "${BUILDDIR}/setup_spglib" >> $SETUPFILE
cat "${BUILDDIR}/setup_spglib" >> $SETUPFILE
fi
load "${BUILDDIR}/setup_spglib"

View file

@ -11,10 +11,10 @@ source "${SCRIPT_DIR}"/signal_trap.sh
source "${INSTALLDIR}"/toolchain.conf
source "${INSTALLDIR}"/toolchain.env
if [ "$MPI_MODE" = "no" ] ; then
report_warning $LINENO "MPI is disabled, skipping sirius installation"
echo 'with_sirius="__FALSE__"' >> ${BUILDDIR}/setup_sirius
exit 0
if [ "$MPI_MODE" = "no" ]; then
report_warning $LINENO "MPI is disabled, skipping sirius installation"
echo 'with_sirius="__FALSE__"' >> ${BUILDDIR}/setup_sirius
exit 0
fi
[ -f "${BUILDDIR}/setup_sirius" ] && rm "${BUILDDIR}/setup_sirius"
@ -26,214 +26,213 @@ SIRIUS_LIBS=''
cd "${BUILDDIR}"
case "$with_sirius" in
__DONTUSE__)
;;
__INSTALL__)
echo "==================== Installing SIRIUS ===================="
require_env FFTW_LDFLAGS
require_env FFTW_LIBS
require_env FFTW_CFLAGS
require_env ELPAROOT
require_env ELPA_LDFLAGS
require_env ELPA_LIBS
require_env ELPA_CFLAGS
require_env GSL_LDFLAGS
require_env GSL_CFLAGS
require_env GSL_LIBS
require_env MATH_LIBS
require_env MPI_LDFLAGS
require_env MPI_LIBS
require_env SCALAPACKROOT
require_env SCALAPACK_LDFLAGS
require_env SCALAPACK_CFLAGS
require_env SCALAPACK_LIBS
require_env LIBXC_LIBS
require_env LIBXC_CFLAGS
require_env LIBXC_LDFLAGS
require_env SPGLIB_LIBS
require_env SPGLIB_CFLAGS
require_env SPGLIB_LDFLAGS
require_env HDF5_LIBS
require_env HDF5_CFLAGS
require_env HDF5_LDFLAGS
require_env LIBVDWXC_CFLAGS
require_env LIBVDWXC_LIBS
require_env LIBVDWXC_LDFLAGS
require_env GSL_INCLUDE_DIR
require_env GSL_LIBRARY
require_env GSL_CBLAS_LIBRARY
require_env SPFFT_ROOT
require_env SPFFT_CFLAGS
require_env SPFFT_LDFLAGS
require_env SPFFT_LIBS
require_env SPLA_ROOT
require_env SPLA_CFLAGS
require_env SPLA_LDFLAGS
require_env SPLA_LIBS
ARCH=`uname -m`
SIRIUS_OPT="-O3 -DNDEBUG -mtune=native -ftree-loop-vectorize ${MATH_CFLAGS}"
if [ "$ARCH" = "ppc64le" ]; then
SIRIUS_OPT="-O3 -DNDEBUG -mcpu=power8 -mtune=power8 -funroll-loops -ftree-vectorize -mvsx -maltivec -mpopcntd -mveclibabi=mass -fvect-cost-model -fpeel-loops -mcmodel=medium ${MATH_CFLAGS}"
SIRIUS_DBG="-O2 -g -mcpu=power8 -mtune=power8 -funroll-loops -ftree-vectorize -mvsx -maltivec -mpopcntd -mveclibabi=mass -fvect-cost-model -fpeel-loops -mcmodel=medium ${MATH_CFLAGS}"
fi
__DONTUSE__) ;;
if [ "$ARCH" = "x86_64" ]; then
SIRIUS_OPT="-O3 -DNDEBUG -mtune=native -ftree-loop-vectorize ${MATH_CFLAGS}"
SIRIUS_DBG="-O2 -g -mtune=native -ftree-loop-vectorize ${MATH_CFLAGS}"
fi
__INSTALL__)
echo "==================== Installing SIRIUS ===================="
require_env FFTW_LDFLAGS
require_env FFTW_LIBS
require_env FFTW_CFLAGS
require_env ELPAROOT
require_env ELPA_LDFLAGS
require_env ELPA_LIBS
require_env ELPA_CFLAGS
require_env GSL_LDFLAGS
require_env GSL_CFLAGS
require_env GSL_LIBS
require_env MATH_LIBS
require_env MPI_LDFLAGS
require_env MPI_LIBS
require_env SCALAPACKROOT
require_env SCALAPACK_LDFLAGS
require_env SCALAPACK_CFLAGS
require_env SCALAPACK_LIBS
require_env LIBXC_LIBS
require_env LIBXC_CFLAGS
require_env LIBXC_LDFLAGS
require_env SPGLIB_LIBS
require_env SPGLIB_CFLAGS
require_env SPGLIB_LDFLAGS
require_env HDF5_LIBS
require_env HDF5_CFLAGS
require_env HDF5_LDFLAGS
require_env LIBVDWXC_CFLAGS
require_env LIBVDWXC_LIBS
require_env LIBVDWXC_LDFLAGS
require_env GSL_INCLUDE_DIR
require_env GSL_LIBRARY
require_env GSL_CBLAS_LIBRARY
require_env SPFFT_ROOT
require_env SPFFT_CFLAGS
require_env SPFFT_LDFLAGS
require_env SPFFT_LIBS
require_env SPLA_ROOT
require_env SPLA_CFLAGS
require_env SPLA_LDFLAGS
require_env SPLA_LIBS
ARCH=$(uname -m)
SIRIUS_OPT="-O3 -DNDEBUG -mtune=native -ftree-loop-vectorize ${MATH_CFLAGS}"
if [ "$ARCH" = "ppc64le" ]; then
SIRIUS_OPT="-O3 -DNDEBUG -mcpu=power8 -mtune=power8 -funroll-loops -ftree-vectorize -mvsx -maltivec -mpopcntd -mveclibabi=mass -fvect-cost-model -fpeel-loops -mcmodel=medium ${MATH_CFLAGS}"
SIRIUS_DBG="-O2 -g -mcpu=power8 -mtune=power8 -funroll-loops -ftree-vectorize -mvsx -maltivec -mpopcntd -mveclibabi=mass -fvect-cost-model -fpeel-loops -mcmodel=medium ${MATH_CFLAGS}"
fi
pkg_install_dir="${INSTALLDIR}/sirius-${sirius_ver}"
install_lock_file="${pkg_install_dir}/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "sirius_dist-${sirius_ver} is already installed, skipping it."
else
if [ -f SIRIUS-${sirius_ver}.tar.gz ] ; then
echo "sirius_${sirius_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${sirius_sha256} \
"https://github.com/electronic-structure/SIRIUS/archive/v${sirius_ver}.tar.gz" \
-o SIRIUS-${sirius_ver}.tar.gz
fi
if [ "$ARCH" = "x86_64" ]; then
SIRIUS_OPT="-O3 -DNDEBUG -mtune=native -ftree-loop-vectorize ${MATH_CFLAGS}"
SIRIUS_DBG="-O2 -g -mtune=native -ftree-loop-vectorize ${MATH_CFLAGS}"
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d sirius-${sirius_ver} ] && rm -rf sirius-${sirius_ver}
tar -xzf SIRIUS-${sirius_ver}.tar.gz
cd SIRIUS-${sirius_ver}
rm -Rf build
mkdir build
cd build
COMPILATION_OPTIONS="-DHDF5_DIR=${HDF5_DIR}"
#if [ -n "$ELPA_LIBS" ] ; then
# if [ -s "$ELPAROOT" ] ; then
# export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$ELPAROOT/lib/pkgconfig:$ELPAROOT/lib64/pkgconfig
# fi
# COMPILATION_OPTIONS="-DUSE_ELPA=ON -DELPA_INCLUDE_DIR=${ELPAROOT}/include/elpa-${ELPAVERSION} $COMPILATION_OPTIONS"
#fi
pkg_install_dir="${INSTALLDIR}/sirius-${sirius_ver}"
install_lock_file="${pkg_install_dir}/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "sirius_dist-${sirius_ver} is already installed, skipping it."
else
if [ -f SIRIUS-${sirius_ver}.tar.gz ]; then
echo "sirius_${sirius_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${sirius_sha256} \
"https://github.com/electronic-structure/SIRIUS/archive/v${sirius_ver}.tar.gz" \
-o SIRIUS-${sirius_ver}.tar.gz
fi
if [ -n "$SCALAPACK_LIBS" ] ; then
export SCALAPACK_LIB="$SCALAPACK_LIBS"
if [ -s "$SCALAPACKROOT" ] ; then
COMPILATION_OPTIONS="-DUSE_SCALAPACK=ON -DSCALAPACK_INCLUDE_DIR=${SCALAPACKROOT}/include ${COMPILATION_OPTIONS}"
else
COMPILATION_OPTIONS="-DUSE_SCALAPACK=ON ${COMPILATION_OPTIONS}"
fi
fi
if [ -n "$HDF5_LIBS" ] ; then
COMPILATION_OPTIONS="-DUSE_HDF5=ON $COMPILATION_OPTIONS"
fi
if [ -n "$LIBVDWXC_LIBS" ] ; then
COMPILATION_OPTIONS="-DUSE_VDWXC=ON $COMPILATION_OPTIONS"
fi
if [ -n "$MKL_LIBS" ] ; then
COMPILATION_OPTIONS="-DUSE_MKL=ON -DUSE_SCALAPACK=ON $COMPILATION_OPTIONS"
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d sirius-${sirius_ver} ] && rm -rf sirius-${sirius_ver}
tar -xzf SIRIUS-${sirius_ver}.tar.gz
cd SIRIUS-${sirius_ver}
rm -Rf build
mkdir build
cd build
COMPILATION_OPTIONS="-DHDF5_DIR=${HDF5_DIR}"
#if [ -n "$ELPA_LIBS" ] ; then
# if [ -s "$ELPAROOT" ] ; then
# export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$ELPAROOT/lib/pkgconfig:$ELPAROOT/lib64/pkgconfig
# fi
# COMPILATION_OPTIONS="-DUSE_ELPA=ON -DELPA_INCLUDE_DIR=${ELPAROOT}/include/elpa-${ELPAVERSION} $COMPILATION_OPTIONS"
#fi
if [ -n "$SCALAPACK_LIBS" ]; then
export SCALAPACK_LIB="$SCALAPACK_LIBS"
if [ -s "$SCALAPACKROOT" ]; then
COMPILATION_OPTIONS="-DUSE_SCALAPACK=ON -DSCALAPACK_INCLUDE_DIR=${SCALAPACKROOT}/include ${COMPILATION_OPTIONS}"
else
COMPILATION_OPTIONS="-DUSE_SCALAPACK=ON ${COMPILATION_OPTIONS}"
fi
fi
if [ -n "$HDF5_LIBS" ]; then
COMPILATION_OPTIONS="-DUSE_HDF5=ON $COMPILATION_OPTIONS"
fi
if [ -n "$LIBVDWXC_LIBS" ]; then
COMPILATION_OPTIONS="-DUSE_VDWXC=ON $COMPILATION_OPTIONS"
fi
if [ -n "$MKL_LIBS" ]; then
COMPILATION_OPTIONS="-DUSE_MKL=ON -DUSE_SCALAPACK=ON $COMPILATION_OPTIONS"
fi
CMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}:${SPFFT_ROOT}/lib/cmake:${SPFFT_ROOT}/lib64/cmake" \
cmake -DCMAKE_INSTALL_PREFIX=${pkg_install_dir} \
-DCMAKE_CXXFLAGS_RELEASE="${SIRIUS_OPT}" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="${SIRIUS_DBG}" \
-DCMAKE_CXX_COMPILER="${MPICXX}" \
-DCMAKE_C_COMPILER="${MPICC}" \
-DBUILD_SHARED_LIBS=OFF \
-DUSE_ELPA=OFF \
${COMPILATION_OPTIONS} .. > compile.log 2>&1
CMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}:${SPFFT_ROOT}/lib/cmake:${SPFFT_ROOT}/lib64/cmake" \
cmake -DCMAKE_INSTALL_PREFIX=${pkg_install_dir} \
-DCMAKE_CXXFLAGS_RELEASE="${SIRIUS_OPT}" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="${SIRIUS_DBG}" \
-DCMAKE_CXX_COMPILER="${MPICXX}" \
-DCMAKE_C_COMPILER="${MPICC}" \
-DBUILD_SHARED_LIBS=OFF \
-DUSE_ELPA=OFF \
${COMPILATION_OPTIONS} .. > compile.log 2>&1
make -j $NPROCS -C src >> compile.log 2>&1
make -j $NPROCS -C src >> compile.log 2>&1
install -d ${pkg_install_dir}/include >> install.log 2>&1
install -d ${pkg_install_dir}/lib >> install.log 2>&1
cp -R ../src/* ${pkg_install_dir}/include >> install.log 2>&1
install -m 644 src/*.a ${pkg_install_dir}/lib >> install.log 2>&1
install -m 644 src/mod_files/*.mod ${pkg_install_dir}/include >> install.log 2>&1
cd ..
install -d ${pkg_install_dir}/include >> install.log 2>&1
install -d ${pkg_install_dir}/lib >> install.log 2>&1
cp -R ../src/* ${pkg_install_dir}/include >> install.log 2>&1
install -m 644 src/*.a ${pkg_install_dir}/lib >> install.log 2>&1
install -m 644 src/mod_files/*.mod ${pkg_install_dir}/include >> install.log 2>&1
cd ..
# now do we have cuda as well
# now do we have cuda as well
if [ "$ENABLE_CUDA" = "__TRUE__" ] ; then
[ -d build-cuda ] && rm -rf "build-cuda"
mkdir build-cuda
cd build-cuda
CMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}:${SPFFT_ROOT}/lib/cmake:${SPFFT_ROOT}/lib64/cmake" \
cmake -DCMAKE_INSTALL_PREFIX=${pkg_install_dir} \
-DCMAKE_CXXFLAGS_RELEASE="${SIRIUS_OPT}" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="${SIRIUS_DBG}" \
-DUSE_CUDA=ON \
-DUSE_ELPA=OFF \
-DGPU_MODEL=P100 \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_CXX_COMPILER="${MPICXX}" \
-DCMAKE_C_COMPILER="${MPICC}" ${COMPILATION_OPTIONS} .. >> compile.log 2>&1
make -j $NPROCS -C src >> compile.log 2>&1
install -d ${pkg_install_dir}/lib/cuda
install -d ${pkg_install_dir}/include/cuda
install -m 644 src/*.a ${pkg_install_dir}/lib/cuda >> install.log 2>&1
install -m 644 src/mod_files/*.mod ${pkg_install_dir}/include/cuda >> install.log 2>&1
SIRIUS_CUDA_LDFLAGS="-L'${pkg_install_dir}/lib/cuda' -Wl,-rpath='${pkg_install_dir}/lib/cuda'"
cd ..
fi
SIRIUS_CFLAGS="-I'${pkg_install_dir}/include/cuda'"
SIRIUS_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage8/$(basename ${SCRIPT_NAME})"
fi
;;
__SYSTEM__)
require_env FFTW_LDFLAGS
require_env FFTW_LIBS
require_env FFTW_CFLAGS
require_env ELPAROOT
require_env ELPA_LDFLAGS
require_env ELPA_LIBS
require_env ELPA_CFLAGS
require_env GSL_LDFLAGS
require_env GSL_CFLAGS
require_env GSL_LIBS
require_env MATH_LIBS
require_env MPI_LDFLAGS
require_env MPI_LIBS
require_env SCALAPACKROOT
require_env SCALAPACK_LDFLAGS
require_env SCALAPACK_CFLAGS
require_env SCALAPACK_LIBS
require_env LIBXC_LIBS
require_env LIBXC_CFLAGS
require_env LIBXC_LDFLAGS
require_env SPGLIB_LIBS
require_env SPGLIB_CFLAGS
require_env SPGLIB_LDFLAGS
require_env HDF5_LIBS
require_env HDF5_CFLAGS
require_env HDF5_LDFLAGS
require_env LIBVDWXC_CFLAGS
require_env LIBVDWXC_LDFLAGS
require_env LIBVDWXC_LIBS
require_env SPFFT_ROOT
require_env SPFFT_CFLAGS
require_env SPFFT_LDFLAGS
require_env SPFFT_LIBS
require_env SPLA_ROOT
require_env SPLA_CFLAGS
require_env SPLA_LDFLAGS
require_env SPLA_LIBS
check_lib -lsirius "sirius"
add_include_from_paths SIRIUS_CFLAGS "sirius*" $INCLUDE_PATHS
add_lib_from_paths SIRIUS_LDFLAGS "libsirius.*" $LIB_PATHS
;;
*)
echo "==================== Linking SIRIUS_Dist to user paths ===================="
pkg_install_dir="$with_sirius"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/lib64"
check_dir "${pkg_install_dir}/include"
;;
if [ "$ENABLE_CUDA" = "__TRUE__" ]; then
[ -d build-cuda ] && rm -rf "build-cuda"
mkdir build-cuda
cd build-cuda
CMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}:${SPFFT_ROOT}/lib/cmake:${SPFFT_ROOT}/lib64/cmake" \
cmake -DCMAKE_INSTALL_PREFIX=${pkg_install_dir} \
-DCMAKE_CXXFLAGS_RELEASE="${SIRIUS_OPT}" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="${SIRIUS_DBG}" \
-DUSE_CUDA=ON \
-DUSE_ELPA=OFF \
-DGPU_MODEL=P100 \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_CXX_COMPILER="${MPICXX}" \
-DCMAKE_C_COMPILER="${MPICC}" ${COMPILATION_OPTIONS} .. >> compile.log 2>&1
make -j $NPROCS -C src >> compile.log 2>&1
install -d ${pkg_install_dir}/lib/cuda
install -d ${pkg_install_dir}/include/cuda
install -m 644 src/*.a ${pkg_install_dir}/lib/cuda >> install.log 2>&1
install -m 644 src/mod_files/*.mod ${pkg_install_dir}/include/cuda >> install.log 2>&1
SIRIUS_CUDA_LDFLAGS="-L'${pkg_install_dir}/lib/cuda' -Wl,-rpath='${pkg_install_dir}/lib/cuda'"
cd ..
fi
SIRIUS_CFLAGS="-I'${pkg_install_dir}/include/cuda'"
SIRIUS_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage8/$(basename ${SCRIPT_NAME})"
fi
;;
__SYSTEM__)
require_env FFTW_LDFLAGS
require_env FFTW_LIBS
require_env FFTW_CFLAGS
require_env ELPAROOT
require_env ELPA_LDFLAGS
require_env ELPA_LIBS
require_env ELPA_CFLAGS
require_env GSL_LDFLAGS
require_env GSL_CFLAGS
require_env GSL_LIBS
require_env MATH_LIBS
require_env MPI_LDFLAGS
require_env MPI_LIBS
require_env SCALAPACKROOT
require_env SCALAPACK_LDFLAGS
require_env SCALAPACK_CFLAGS
require_env SCALAPACK_LIBS
require_env LIBXC_LIBS
require_env LIBXC_CFLAGS
require_env LIBXC_LDFLAGS
require_env SPGLIB_LIBS
require_env SPGLIB_CFLAGS
require_env SPGLIB_LDFLAGS
require_env HDF5_LIBS
require_env HDF5_CFLAGS
require_env HDF5_LDFLAGS
require_env LIBVDWXC_CFLAGS
require_env LIBVDWXC_LDFLAGS
require_env LIBVDWXC_LIBS
require_env SPFFT_ROOT
require_env SPFFT_CFLAGS
require_env SPFFT_LDFLAGS
require_env SPFFT_LIBS
require_env SPLA_ROOT
require_env SPLA_CFLAGS
require_env SPLA_LDFLAGS
require_env SPLA_LIBS
check_lib -lsirius "sirius"
add_include_from_paths SIRIUS_CFLAGS "sirius*" $INCLUDE_PATHS
add_lib_from_paths SIRIUS_LDFLAGS "libsirius.*" $LIB_PATHS
;;
*)
echo "==================== Linking SIRIUS_Dist to user paths ===================="
pkg_install_dir="$with_sirius"
check_dir "${pkg_install_dir}/lib"
check_dir "${pkg_install_dir}/lib64"
check_dir "${pkg_install_dir}/include"
;;
esac
if [ "$with_sirius" != "__DONTUSE__" ] ; then
SIRIUS_LIBS="-lsirius IF_CUDA(-lcusolver|)"
SIRIUS_CUDA_LDFLAGS="-L'${pkg_install_dir}/lib/cuda' -Wl,-rpath='${pkg_install_dir}/lib/cuda'"
SIRIUS_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
SIRIUS_CFLAGS="-I'${pkg_install_dir}/include'"
if [ "$with_sirius" != "__SYSTEM__" ] ; then
cat <<EOF > "${BUILDDIR}/setup_sirius"
if [ "$with_sirius" != "__DONTUSE__" ]; then
SIRIUS_LIBS="-lsirius IF_CUDA(-lcusolver|)"
SIRIUS_CUDA_LDFLAGS="-L'${pkg_install_dir}/lib/cuda' -Wl,-rpath='${pkg_install_dir}/lib/cuda'"
SIRIUS_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
SIRIUS_CFLAGS="-I'${pkg_install_dir}/include'"
if [ "$with_sirius" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_sirius"
prepend_path LD_LIBRARY_PATH "$pkg_install_dir/lib"
prepend_path LD_LIBRARY_PATH "$pkg_install_dir/lib/cuda"
prepend_path LD_RUN_PATH "$pkg_install_dir/lib"
@ -242,9 +241,9 @@ prepend_path LIBRARY_PATH "$pkg_install_dir/lib"
prepend_path LIBRARY_PATH "$pkg_install_dir/lib/cuda"
prepend_path CPATH "$pkg_install_dir/include"
EOF
cat "${BUILDDIR}/setup_sirius" >> $SETUPFILE
fi
cat <<EOF >> "${BUILDDIR}/setup_sirius"
cat "${BUILDDIR}/setup_sirius" >> $SETUPFILE
fi
cat << EOF >> "${BUILDDIR}/setup_sirius"
export SIRIUS_CFLAGS="IF_CUDA(-I${pkg_install_dir}/include/cuda|-I${pkg_install_dir}/include)"
export SIRIUS_FFLAGS="IF_CUDA(-I${pkg_install_dir}/include/cuda|-I${pkg_install_dir}/include)"
export SIRIUS_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"

View file

@ -16,90 +16,90 @@ source "${INSTALLDIR}"/toolchain.env
cd "${BUILDDIR}"
case "$with_spfft" in
__INSTALL__)
echo "==================== Installing spfft ===================="
pkg_install_dir="${INSTALLDIR}/SpFFT-${spfft_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "SpFFT-${spfft_ver} is already installed, skipping it."
else
if [ -f SpFFT-${spfft_ver}.tar.gz ] ; then
echo "SpFFT-${spfft_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${spfft_sha256} \
"https://github.com/eth-cscs/SpFFT/archive/v${spfft_ver}.tar.gz" \
-o SpFFT-${spfft_ver}.tar.gz
__INSTALL__)
echo "==================== Installing spfft ===================="
pkg_install_dir="${INSTALLDIR}/SpFFT-${spfft_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "SpFFT-${spfft_ver} is already installed, skipping it."
else
if [ -f SpFFT-${spfft_ver}.tar.gz ]; then
echo "SpFFT-${spfft_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${spfft_sha256} \
"https://github.com/eth-cscs/SpFFT/archive/v${spfft_ver}.tar.gz" \
-o SpFFT-${spfft_ver}.tar.gz
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d SpFFT-${spfft_ver} ] && rm -rf SpFFT-${spfft_ver}
tar -xzf SpFFT-${spfft_ver}.tar.gz
cd SpFFT-${spfft_ver}
mkdir build-cpu
cd build-cpu
cmake \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE \
-DSPFFT_OMP=ON \
-DSPFFT_MPI=ON \
-DSPFFT_INSTALL=ON \
.. > cmake.log 2>&1
make -j $NPROCS > make.log 2>&1
make -j $NPROCS install > install.log 2>&1
cd ..
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d SpFFT-${spfft_ver} ] && rm -rf SpFFT-${spfft_ver}
tar -xzf SpFFT-${spfft_ver}.tar.gz
cd SpFFT-${spfft_ver}
mkdir build-cpu
cd build-cpu
cmake \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE \
-DSPFFT_OMP=ON \
-DSPFFT_MPI=ON \
-DSPFFT_INSTALL=ON \
.. > cmake.log 2>&1
make -j $NPROCS > make.log 2>&1
make -j $NPROCS install > install.log 2>&1
cd ..
if [ "$ENABLE_CUDA" = "__TRUE__" ] ; then
[ -d build-cuda ] && rm -rf "build-cuda"
mkdir build-cuda
cd build-cuda
cmake \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE \
-DSPFFT_OMP=ON \
-DSPFFT_MPI=ON \
-DSPFFT_INSTALL=ON \
-DSPFFT_GPU_BACKEND=CUDA \
.. > cmake.log 2>&1
make -j $NPROCS > make.log 2>&1
install -d ${pkg_install_dir}/lib/cuda
[ -f src/libspfft.a ] && install -m 644 src/*.a ${pkg_install_dir}/lib/cuda >> install.log 2>&1
[ -f src/libspfft.so ] && install -m 644 src/*.so ${pkg_install_dir}/lib/cuda >> install.log 2>&1
fi
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage8/$(basename ${SCRIPT_NAME})"
fi
SPFFT_ROOT="${pkg_install_dir}"
SPFFT_CFLAGS="-I'${pkg_install_dir}/include'"
SPFFT_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
SPFFT_CUDA_LDFLAGS="-L'${pkg_install_dir}/lib/cuda' -Wl,-rpath='${pkg_install_dir}/lib/cuda'"
;;
__SYSTEM__)
echo "==================== Finding spfft from system paths ===================="
check_command pkg-config --modversion spfft
add_include_from_paths SPFFT_CFLAGS "spfft.h" $INCLUDE_PATHS
add_lib_from_paths SPFFT_LDFLAGS "libspfft.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking spfft to user paths ===================="
pkg_install_dir="$with_spfft"
if [ "$ENABLE_CUDA" = "__TRUE__" ]; then
[ -d build-cuda ] && rm -rf "build-cuda"
mkdir build-cuda
cd build-cuda
cmake \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE \
-DSPFFT_OMP=ON \
-DSPFFT_MPI=ON \
-DSPFFT_INSTALL=ON \
-DSPFFT_GPU_BACKEND=CUDA \
.. > cmake.log 2>&1
make -j $NPROCS > make.log 2>&1
install -d ${pkg_install_dir}/lib/cuda
[ -f src/libspfft.a ] && install -m 644 src/*.a ${pkg_install_dir}/lib/cuda >> install.log 2>&1
[ -f src/libspfft.so ] && install -m 644 src/*.so ${pkg_install_dir}/lib/cuda >> install.log 2>&1
fi
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage8/$(basename ${SCRIPT_NAME})"
fi
SPFFT_ROOT="${pkg_install_dir}"
SPFFT_CFLAGS="-I'${pkg_install_dir}/include'"
SPFFT_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
SPFFT_CUDA_LDFLAGS="-L'${pkg_install_dir}/lib/cuda' -Wl,-rpath='${pkg_install_dir}/lib/cuda'"
;;
__SYSTEM__)
echo "==================== Finding spfft from system paths ===================="
check_command pkg-config --modversion spfft
add_include_from_paths SPFFT_CFLAGS "spfft.h" $INCLUDE_PATHS
add_lib_from_paths SPFFT_LDFLAGS "libspfft.*" $LIB_PATHS
;;
__DONTUSE__) ;;
# use the lib64 directory if present (multi-abi distros may link lib/ to lib32/ instead)
SPFFT_LIBDIR="${pkg_install_dir}/lib"
[ -d "${pkg_install_dir}/lib64" ] && SPFFT_LIBDIR="${pkg_install_dir}/lib64"
*)
echo "==================== Linking spfft to user paths ===================="
pkg_install_dir="$with_spfft"
check_dir "${SPFFT_LIBDIR}"
check_dir "${pkg_install_dir}/include"
SPFFT_CFLAGS="-I'${pkg_install_dir}/include'"
SPFFT_LDFLAGS="-L'${SPFFT_LIBDIR}' -Wl,-rpath='${SPFFT_LIBDIR}'"
;;
# use the lib64 directory if present (multi-abi distros may link lib/ to lib32/ instead)
SPFFT_LIBDIR="${pkg_install_dir}/lib"
[ -d "${pkg_install_dir}/lib64" ] && SPFFT_LIBDIR="${pkg_install_dir}/lib64"
check_dir "${SPFFT_LIBDIR}"
check_dir "${pkg_install_dir}/include"
SPFFT_CFLAGS="-I'${pkg_install_dir}/include'"
SPFFT_LDFLAGS="-L'${SPFFT_LIBDIR}' -Wl,-rpath='${SPFFT_LIBDIR}'"
;;
esac
if [ "$with_spfft" != "__DONTUSE__" ] ; then
SPFFT_LIBS="-lspfft"
if [ "$with_spfft" != "__SYSTEM__" ] ; then
cat << EOF > "${BUILDDIR}/setup_spfft"
if [ "$with_spfft" != "__DONTUSE__" ]; then
SPFFT_LIBS="-lspfft"
if [ "$with_spfft" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_spfft"
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"
@ -109,8 +109,8 @@ export SPFFT_LIBS="-lspfft"
export SPFFT_ROOT="${pkg_install_dir}"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$pkg_install_dir/lib64/pkgconfig:$pkg_install_dir/lib/pkgconfig"
EOF
fi
cat << EOF >> "${BUILDDIR}/setup_spfft"
fi
cat << EOF >> "${BUILDDIR}/setup_spfft"
export SPFFT_CFLAGS="${SPFFT_CFLAGS}"
export SPFFT_LDFLAGS="${SPFFT_LDFLAGS}"
export SPFFT_CUDA_LDFLAGS="${SPFFT_CUDA_LDFLAGS}"
@ -124,7 +124,7 @@ export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$pkg_install_dir/lib64/pkgconfig:$pkg_i
export SPFFT_VERSION=${spfft-ver}
export CP_LIBS="IF_MPI(${SPFFT_LIBS}|) \${CP_LIBS}"
EOF
cat "${BUILDDIR}/setup_spfft" >> $SETUPFILE
cat "${BUILDDIR}/setup_spfft" >> $SETUPFILE
fi
load "${BUILDDIR}/setup_spfft"

View file

@ -16,92 +16,92 @@ source "${INSTALLDIR}"/toolchain.env
cd "${BUILDDIR}"
case "$with_spla" in
__INSTALL__)
echo "==================== Installing spla ===================="
pkg_install_dir="${INSTALLDIR}/SpLA-${spla_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}" ; then
echo "SpLA-${spla_ver} is already installed, skipping it."
else
if [ -f SpLA-${spla_ver}.tar.gz ] ; then
echo "SpLA-${spla_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${spla_sha256} \
"https://github.com/eth-cscs/Spla/archive/v${spla_ver}.tar.gz" \
-o SpLA-${spla_ver}.tar.gz
__INSTALL__)
echo "==================== Installing spla ===================="
pkg_install_dir="${INSTALLDIR}/SpLA-${spla_ver}"
install_lock_file="$pkg_install_dir/install_successful"
if verify_checksums "${install_lock_file}"; then
echo "SpLA-${spla_ver} is already installed, skipping it."
else
if [ -f SpLA-${spla_ver}.tar.gz ]; then
echo "SpLA-${spla_ver}.tar.gz is found"
else
download_pkg ${DOWNLOADER_FLAGS} ${spla_sha256} \
"https://github.com/eth-cscs/Spla/archive/v${spla_ver}.tar.gz" \
-o SpLA-${spla_ver}.tar.gz
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d SpLA-${spla_ver} ] && rm -rf SpLA-${spla_ver}
tar -xzf SpLA-${spla_ver}.tar.gz
cd spla-${spla_ver}
mkdir build-cpu
cd build-cpu
cmake \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE \
-DSPLA_OMP=ON \
-DSPLA_MPI=ON \
-DSPLA_INSTALL=ON \
-DSPLA_STATIC=OM \
.. > cmake.log 2>&1
make -j $NPROCS > make.log 2>&1
make -j $NPROCS install > install.log 2>&1
cd ..
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d SpLA-${spla_ver} ] && rm -rf SpLA-${spla_ver}
tar -xzf SpLA-${spla_ver}.tar.gz
cd spla-${spla_ver}
mkdir build-cpu
cd build-cpu
cmake \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE \
-DSPLA_OMP=ON \
-DSPLA_MPI=ON \
-DSPLA_INSTALL=ON \
-DSPLA_STATIC=OM \
.. > cmake.log 2>&1
make -j $NPROCS > make.log 2>&1
make -j $NPROCS install > install.log 2>&1
cd ..
if [ "$ENABLE_CUDA" = "__TRUE__" ] ; then
[ -d build-cuda ] && rm -rf "build-cuda"
mkdir build-cuda
cd build-cuda
cmake \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE \
-DSPLA_OMP=ON \
-DSPLA_MPI=ON \
-DSPLA_STATIC=OM \
-DSPLA_INSTALL=ON \
-DSPLA_GPU_BACKEND=CUDA \
.. > cmake.log 2>&1
make -j $NPROCS > make.log 2>&1
install -d ${pkg_install_dir}/lib/cuda
[ -f src/libspla.a ] && install -m 644 src/*.a ${pkg_install_dir}/lib/cuda >> install.log 2>&1
[ -f src/libspla.so ] && install -m 644 src/*.so ${pkg_install_dir}/lib/cuda >> install.log 2>&1
fi
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage8/$(basename ${SCRIPT_NAME})"
fi
SPLA_ROOT="${pkg_install_dir}"
SPLA_CFLAGS="-I'${pkg_install_dir}/include'"
SPLA_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
SPLA_CUDA_LDFLAGS="-L'${pkg_install_dir}/lib/cuda' -Wl,-rpath='${pkg_install_dir}/lib/cuda'"
;;
__SYSTEM__)
echo "==================== Finding spla from system paths ===================="
check_command pkg-config --modversion spla
add_include_from_paths SPLA_CFLAGS "spla.h" $INCLUDE_PATHS
add_lib_from_paths SPLA_LDFLAGS "libspla.*" $LIB_PATHS
;;
__DONTUSE__)
;;
*)
echo "==================== Linking spla to user paths ===================="
pkg_install_dir="$with_spla"
if [ "$ENABLE_CUDA" = "__TRUE__" ]; then
[ -d build-cuda ] && rm -rf "build-cuda"
mkdir build-cuda
cd build-cuda
cmake \
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE \
-DSPLA_OMP=ON \
-DSPLA_MPI=ON \
-DSPLA_STATIC=OM \
-DSPLA_INSTALL=ON \
-DSPLA_GPU_BACKEND=CUDA \
.. > cmake.log 2>&1
make -j $NPROCS > make.log 2>&1
install -d ${pkg_install_dir}/lib/cuda
[ -f src/libspla.a ] && install -m 644 src/*.a ${pkg_install_dir}/lib/cuda >> install.log 2>&1
[ -f src/libspla.so ] && install -m 644 src/*.so ${pkg_install_dir}/lib/cuda >> install.log 2>&1
fi
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage8/$(basename ${SCRIPT_NAME})"
fi
SPLA_ROOT="${pkg_install_dir}"
SPLA_CFLAGS="-I'${pkg_install_dir}/include'"
SPLA_LDFLAGS="-L'${pkg_install_dir}/lib' -Wl,-rpath='${pkg_install_dir}/lib'"
SPLA_CUDA_LDFLAGS="-L'${pkg_install_dir}/lib/cuda' -Wl,-rpath='${pkg_install_dir}/lib/cuda'"
;;
__SYSTEM__)
echo "==================== Finding spla from system paths ===================="
check_command pkg-config --modversion spla
add_include_from_paths SPLA_CFLAGS "spla.h" $INCLUDE_PATHS
add_lib_from_paths SPLA_LDFLAGS "libspla.*" $LIB_PATHS
;;
__DONTUSE__) ;;
# use the lib64 directory if present (multi-abi distros may link lib/ to lib32/ instead)
SPLA_LIBDIR="${pkg_install_dir}/lib"
[ -d "${pkg_install_dir}/lib64" ] && SPLA_LIBDIR="${pkg_install_dir}/lib64"
*)
echo "==================== Linking spla to user paths ===================="
pkg_install_dir="$with_spla"
check_dir "${SPLA_LIBDIR}"
check_dir "${pkg_install_dir}/include"
SPLA_CFLAGS="-I'${pkg_install_dir}/include'"
SPLA_LDFLAGS="-L'${SPLA_LIBDIR}' -Wl,-rpath='${SPLA_LIBDIR}'"
;;
# use the lib64 directory if present (multi-abi distros may link lib/ to lib32/ instead)
SPLA_LIBDIR="${pkg_install_dir}/lib"
[ -d "${pkg_install_dir}/lib64" ] && SPLA_LIBDIR="${pkg_install_dir}/lib64"
check_dir "${SPLA_LIBDIR}"
check_dir "${pkg_install_dir}/include"
SPLA_CFLAGS="-I'${pkg_install_dir}/include'"
SPLA_LDFLAGS="-L'${SPLA_LIBDIR}' -Wl,-rpath='${SPLA_LIBDIR}'"
;;
esac
if [ "$with_spla" != "__DONTUSE__" ] ; then
SPLA_LIBS="-lspla"
if [ "$with_spla" != "__SYSTEM__" ] ; then
cat << EOF > "${BUILDDIR}/setup_spla"
if [ "$with_spla" != "__DONTUSE__" ]; then
SPLA_LIBS="-lspla"
if [ "$with_spla" != "__SYSTEM__" ]; then
cat << EOF > "${BUILDDIR}/setup_spla"
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"
@ -111,8 +111,8 @@ export SPLA_LIBS="-lspla"
export SPLA_ROOT="${pkg_install_dir}"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$pkg_install_dir/lib64/pkgconfig:$pkg_install_dir/lib/pkgconfig"
EOF
fi
cat << EOF >> "${BUILDDIR}/setup_spla"
fi
cat << EOF >> "${BUILDDIR}/setup_spla"
export SPLA_CFLAGS="${SPLA_CFLAGS}"
export SPLA_LDFLAGS="${SPLA_LDFLAGS}"
export SPLA_CUDA_LDFLAGS="${SPLA_CUDA_LDFLAGS}"
@ -126,7 +126,7 @@ export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$pkg_install_dir/lib64/pkgconfig:$pkg_i
export SPLA_VERSION=${spla-ver}
export CP_LIBS="IF_MPI(${SPLA_LIBS}|) \${CP_LIBS}"
EOF
cat "${BUILDDIR}/setup_spla" >> $SETUPFILE
cat "${BUILDDIR}/setup_spla" >> $SETUPFILE
fi
load "${BUILDDIR}/setup_spla"

File diff suppressed because it is too large Load diff