#!/usr/bin/env bash # shellcheck disable=SC1090,SC1091 set -euo pipefail if (( $# != 1 )); then echo "usage: $(basename "$0") " 1>&2 exit 1 fi env_dir=$1 # TODO: this is Tursa specific. have not figured out the correct way to do this. EXTRA_LIBS="/home/dp207/dp207/shared/env/versions/220428/spack/opt/spack/linux-rhel8-zen2/gcc-9.4.0/cuda-11.4.0-etxow4jb23qdbs7j6txczy44cdatpj22/lib64/stubs/libcuda.so /home/dp207/dp207/shared/env/versions/220428/spack/opt/spack/linux-rhel8-zen2/gcc-9.4.0/cuda-11.4.0-etxow4jb23qdbs7j6txczy44cdatpj22/lib64/stubs/libnvidia-ml.so" # NOTE: these flags need to be in sync with Qudas compilation options (see build-quda.sh) BUILD_FLAGS="-O3 -std=c++17 -DMPI_COMMS -DMULTI_GPU -DQUDA_PRECISION=12 -DQUDA_RECONSTRUCT=4" call_dir=$(pwd -P) script_dir="$(dirname "$(readlink -f "${BASH_SOURCE:-$0}")")" cd "${env_dir}" env_dir=$(pwd -P) cd "${call_dir}" BUILD_DIR="${env_dir}/build/Quda-benchmarks" PREFIX_DIR="${env_dir}/prefix/qudabench" QUDA_DIR=${env_dir}/prefix/quda mkdir -p "${BUILD_DIR}" mkdir -p "${PREFIX_DIR}" LINK_FLAGS="-Wl,-rpath,$QUDA_DIR/lib: $QUDA_DIR/lib/libquda.so $EXTRA_LIBS -lpthread -lmpi" g++ $BUILD_FLAGS -I$QUDA_DIR/include -c -o $BUILD_DIR/Benchmark_Quda.o $script_dir/Benchmark_Quda.cpp g++ -g -O3 $BUILD_DIR/Benchmark_Quda.o -o $PREFIX_DIR/Benchmark_Quda $LINK_FLAGS -lmpi