-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_benchmark.sh
executable file
·54 lines (54 loc) · 1.67 KB
/
run_benchmark.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
49
50
51
52
53
54
#!/bin/bash
has_n_option=false
while getopts l:d:m:n: flag
do
case "${flag}" in
l) lang=${OPTARG};;
d) dev=${OPTARG};;
m) model=${OPTARG};;
n) nmax=${OPTARG};has_n_option=true;;
\?) echo "Unknown option -$OPTARG"; exit 1;;
esac
done
if $has_n_option; then
nmax=$nmax
else
nmax=$((2**24))
fi
echo $lang
if [ $lang == "julia" ]; then
echo "Benchmarking ${lang^} ${dev^^} accelerated ensemble ${model^^} solvers..."
if [ $dev == "cpu" ];then
cmd="./runner_scripts/${dev}/run_${model}_${lang}.sh ${nmax}"
eval "$cmd"
elif [ $model == "sde" ];then
cmd="./runner_scripts/${dev}/run_${model}_${lang}.sh ${nmax}"
eval "$cmd"
else
if [ -d "./data/${lang^}" ];
then
rm -f "./data/${lang^}"/*
mkdir -p "./data/${lang^}"
else
mkdir -p "./data/${lang^}"
fi
cmd="./runner_scripts/${dev}/run_${model}_${lang}.sh ${nmax}"
eval "$cmd"
fi
elif [[ $lang == "jax" || $lang == "pytorch" || $lang == "cpp" ]]; then
if [[ $model != "ode" || $dev != "gpu" ]]; then
echo "The benchmarking of ensemble ${model^^} solvers on ${dev^^} with ${lang} is not supported. Please use -m flag with \"ode\" and -d with \"gpu\"."
exit 1
else
echo "Benchmarking ${lang^^} ${dev^^} accelerated ensemble ${model^^} solvers..."
if [ -d "./data/${lang^^}" ]
then
rm -rf "./data/${lang^^}"/*
mkdir -p "./data/${lang^^}"
else
mkdir -p "./data/${lang^^}"
fi
cmd="./runner_scripts/${dev}/run_${model}_${lang}.sh ${nmax}"
eval "$cmd"
fi
fi