-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_stan.sh
38 lines (33 loc) · 936 Bytes
/
run_stan.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
#!/bin/bash
while getopts m:n:s:i: option ; do
case "${option}"
in
m) MODEL=${OPTARG};;
n) N=${OPTARG};;
s) SHARDS=${OPTARG};;
i) REPS=${OPTARG};;
esac
done
COUNTER=0
fn=results/times_m${MODEL}_n${N}_s${SHARDS}.txt
echo model n shards seconds > $fn
dataf=data/bbdata_n${N}_s${SHARDS}.Rdump
outf=out/output_m${MODEL}_n${N}_s${SHARDS}
while [ $COUNTER -lt $REPS ] ; do
outf=out/output_m${MODEL}_n${N}_s${SHARDS}_i${COUNTER}.csv
SECONDS=0
if [ $MODEL == 0 ]
then
./bb0 sample data file=$dataf init=1 output file=$outf
elif [ $MODEL == 1 ]
then
mpirun -np $SHARDS -q bb1 sample data file=$dataf init=1 output file=$outf
elif [ $MODEL == 2 ]
then
export STAN_NUM_THREADS=$SHARDS
./bb2 sample data file=$dataf init=1 output file=$outf
fi
echo $MODEL $N $SHARDS $SECONDS >> x$fn
echo x$MODEL $N $SHARDS $SECONDS >> results/all.txt
let COUNTER=COUNTER+1
done