-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_simulation_2
executable file
·60 lines (49 loc) · 1.73 KB
/
run_simulation_2
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
#!/bin/bash
#---------------------------------------------------------
# run_simulation
# Author: Amy Ousterhout
#---------------------------------------------------------
#---------------------------------------------------------
# This script compiles and runs the momose simulation
# and does necessary post-processing for c++ simulator.
#
# The default is to not compile anything - by specifying expat and momose as args, you
# con instruct it to compile the expat libs and momose.
#
# commands for java simulator
# javac -classpath ./src:./lib/gluegen-rt.jar:./lib/jogl.jar -d ./bin ./src/gui/Momose.java
# java -cp ./bin:./lib/gluegen-rt.jar:./lib/jogl.jar -Djava.library.path=./lib gui.Momose -d32
#
#---------------------------------------------------------
# MAKE SURE YOU GET THE NUMBER RIGHT IN THE MESSAGE_RECORDER FILE!!!!!
C2="c2"
COUNT=0
NUM="$1"
# add libraries to be preloaded if running on c2
if [ "$2" = $C2 ]; then
export LD_PRELOAD="./../extlibs/expat/lib/libexpat.so.1"
echo $LD_PRELOAD
fi
# NUM should be a number for this sim - make a new directory for it and copy the configs into it
mkdir sim_$NUM
for f in $( ls ./momosecpp/configs/*RWM_config_* ); do
cp $f sim_"$1"
done
# run momose and process the output into Simulations/sim_0X/data_??.csv
# where ?? is a number
echo "Running the simulation"
cd ./momosecpp/src
for f in $( ls ../../sim_"$1"/RWM_config_* ); do
echo "Running sim for file: " $f
./momose -f $f
echo "Processing data for file: " $f
cd ../../plotting
python process_hist.py "../momosecpp/output/messageRecorderOutput_$1.csv" > ../sim_"$1"/data_$COUNT.csv
cd ../momosecpp/src
let COUNT=COUNT+1
done
cd ../..
cd sim_"$1"
rm -f archive.tar
tar -cf archive.tar data_* *config_*
cd ..