-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.sh
executable file
·48 lines (47 loc) · 1.74 KB
/
commands.sh
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
#!/bin/sh
set -eu
print_help() {
echo "usage: commands.sh [-r] [-h] [-c config_path] [-o out_dir]"
echo " options:"
echo " -r run in real environment"
echo " -c config_path set config file(TOML) path"
echo " -o out_dir set output directory"
echo " -h show this help message and exit"
}
run_env=simurator
config_path=src/config.toml
out_dir=out
while getopts rhc:o: OPT; do
case $OPT in
r) run_env=real;;
c) config_path=$OPTARG;;
o) out_dir=$OPTARG;;
h) print_help; exit 0;;
*) echo "unkown option $OPT"; print_help; exit 1;;
esac
done
SCRIPT_DIR="$( cd "$( dirname "$0" )"; pwd )"
cd "${SCRIPT_DIR}"
if ! command -v sdk_debug_shell >/dev/null; then
echo "sdk_debug_shell not found"
exit 1
fi
sif_path="$(dirname "$(command -v sdk_debug_shell)")/sdk-cbcore-202406260214-3-f03c8e31.sif"
if ! singularity instance list | grep cerebras >/dev/null; then
singularity instance start $sif_path cerebras
fi
if ! singularity exec instance://cerebras python -c "import tomli" >/dev/null 2>&1; then
singularity exec instance://cerebras pip install tomli
fi
if [ $run_env = "real" ]; then
singularity exec instance://cerebras python src/build.py \
--name "$out_dir" --config "$config_path" --real
flock /mnt/Pure_CustomerVol3/run_cs2.lock \
singularity exec instance://cerebras python src/run.py \
--name "$out_dir" --config "$config_path" --cmaddr 192.168.0.199:9000
else
singularity exec instance://cerebras python src/build.py \
--name "$out_dir" --config "$config_path"
singularity exec instance://cerebras python src/run.py \
--name "$out_dir" --config "$config_path"
fi