-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbootstrap-env.sh
More file actions
executable file
·78 lines (66 loc) · 2.23 KB
/
Copy pathbootstrap-env.sh
File metadata and controls
executable file
·78 lines (66 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env bash
set -euo pipefail
config_dir="${HOME}/.config/grid-benchmark"
if (( $# != 2 )); then
echo "usage: $(basename "$0") <environment directory> <system>" 1>&2
exit 1
fi
dir=$1
sys=$2
call_dir=$(pwd -P)
script_dir="$(dirname "$(readlink -f "${BASH_SOURCE:-$0}")")"
if [ -d "${dir}" ]; then
echo "error: directory '${dir}' exists"
exit 1
fi
if [ ! -d "${script_dir}/systems/${sys}" ]; then
echo "error: system directory '${sys}' does not exist"
exit 1
fi
if [ -f "${script_dir}/systems/${sys}/files/shell-wrapper.sh" ]; then
if [ ! "${_grid_wrapped_+x}" ]; then
echo "error: system '${sys}' requires to use a shell wrapper, please run" 1>&2
echo '' 1>&2
echo "systems/${sys}/files/shell-wrapper.sh $0 $*" 1>&2
exit 1
fi
fi
mkdir -p "${dir}"
cd "${dir}"; dir=$(pwd -P); cd "${call_dir}"
echo "-- install Pixi"
export PIXI_HOME="${dir}/prefix/pixi"
export PIXI_NO_PATH_UPDATE=1
curl -fsSL https://pixi.sh/install.sh | sh
export PATH="${dir}/prefix/pixi/bin:${PATH}"
pixi_log='pixi -v --no-progress'
echo "-- install default environment"
cp "${script_dir}/pixi.toml" "${dir}"
cd "${dir}"
$pixi_log install
export PATH="${dir}/.pixi/envs/default/bin:${PATH}"
cp "${script_dir}/env-base.sh" "${script_dir}/env-pixi.sh" "${script_dir}/env.sh" "${dir}"
echo "-- install system specific files (system: ${sys})"
cp "${script_dir}/systems/${sys}/files"/* "${dir}"
cp "${script_dir}/systems/${sys}/grid-config.json" "${dir}"
echo "-- install system specific environment(s) (system: ${sys})"
for e in $(jq -r '.configs[]."pixi-env"' "${dir}/grid-config.json"); do
echo "* install environment '${e}'"
$pixi_log install -e "${e}"
done
echo "-- install C-LIME"
mkdir -p "${dir}/build"
cd "${dir}/build"
lime_url='http://usqcd-software.github.io/downloads/c-lime/lime-1.3.2.tar.gz'
wget ${lime_url}
lime_archive=$(basename ${lime_url})
lime_dir=$(tar -tzf "${lime_archive}" | cut -d/ -f1 | uniq )
tar -xzf "${lime_archive}"
cd "${lime_dir}"
mkdir build && cd build
../configure --prefix="${dir}/prefix/lime" CFLAGS='-fPIE'
make -j && make install
echo "-- save environment directory in '${config_dir}/grid-env'"
mkdir -p "${config_dir}"
echo "${dir}" > "${config_dir}/grid-env"
echo "-- done!"
cd "${call_dir}"