-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_simulations_waterfilling.sh
executable file
·40 lines (36 loc) · 1.26 KB
/
run_simulations_waterfilling.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
#!/bin/bash
BASE_DIR=$1
USERMODEL=$2
PATH_ALG=$3
NSF_ROOT_DIR=$4
OUTPUT="normal"
NUM_SAMPLES=50000
NSF_TYPE="slim"
TRACEFILE=$BASE_DIR/in/users2-processed.traces.pickle
LOGLEVEL="INFO"
PARALLEL_PROCESS=10
PARALLEL_PROCESS_MAX=48
DIRS=`ls -l $NSF_ROOT_DIR | egrep '^d' | awk '{print $9}'`
j=1
for DIR in $DIRS
do
EXP_NAME=$USERMODEL.${DIR}.$PATH_ALG
NSF_DIR=$NSF_ROOT_DIR/${DIR}
OUT_DIR=$BASE_DIR/out/simulate/$EXP_NAME
mkdir -p $OUT_DIR
i=1
while [ $i -lt $PARALLEL_PROCESS ]
do
if [ $j -le $(($PARALLEL_PROCESS_MAX-1)) ]
then
# wait this process to finish
(time pypy pathsim.py simulate --nsf_dir $NSF_DIR --num_samples $NUM_SAMPLES --trace_file $TRACEFILE --user_model $USERMODEL --format $OUTPUT --loglevel $LOGLEVEL $PATH_ALG) 2> $OUT_DIR/simulate.$EXP_NAME.$NUM_SAMPLES-samples.$i.time 1> $OUT_DIR/simulate.$EXP_NAME.$NUM_SAMPLES-samples.$i.out
j=0
else
# parallelize process
(time pypy pathsim.py simulate --nsf_dir $NSF_DIR --num_samples $NUM_SAMPLES --trace_file $TRACEFILE --user_model $USERMODEL --format $OUTPUT --loglevel $LOGLEVEL $PATH_ALG) 2> $OUT_DIR/simulate.$EXP_NAME.$NUM_SAMPLES-samples.$i.time 1> $OUT_DIR/simulate.$EXP_NAME.$NUM_SAMPLES-samples.$i.out &
fi
i=$(($i+1))
j=$(($j+1))
done
done