lattice-benchmarks/Grid/build-benchmark.sh

36 lines
919 B
Bash
Raw Permalink Normal View History

2023-01-24 20:08:40 +00:00
#!/usr/bin/env bash
# shellcheck disable=SC1090,SC1091
set -euo pipefail
if (( $# != 2 )); then
echo "usage: $(basename "$0") <environment directory> <config>" 1>&2
exit 1
fi
env_dir=$1
cfg=$2
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/Grid-benchmarks/${cfg}"
mkdir -p "${build_dir}"
source "${env_dir}/env.sh"
entry=$(jq ".configs[]|select(.name==\"${cfg}\")" "${env_dir}"/grid-config.json)
env_script=$(echo "${entry}" | jq -r ".\"env-script\"")
source "${env_dir}/${env_script}"
2023-02-01 23:55:37 +00:00
cd "${script_dir}"
if [ ! -f configure ]; then
./bootstrap.sh
fi
cd "${build_dir}"
2023-01-26 18:57:47 +00:00
if [ ! -f Makefile ]; then
"${script_dir}/configure" --with-grid="${env_dir}/prefix/grid_${cfg}" \
--prefix="${env_dir}/prefix/gridbench_${cfg}"
fi
2023-01-24 20:08:40 +00:00
make -j 128
make install
cd "${call_dir}"