-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun_test.sh
executable file
·81 lines (48 loc) · 1.64 KB
/
run_test.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# 1 read out folder
LOCAL_COMPUTE=false
DEBUG=false
CLUSTER='x-men'
TESTRUN='net-test'
while getopts "l" opt; do
case $opt in
l) LOCAL_COMPUTE=true ;;
\?) echo "error: option -$OPTARG is not implemented"; exit ;;
esac
done
# combine getopts with positional parameters, see
# https://stackoverflow.com/questions/11742996
TESTDIR_FULL=${@:$OPTIND:1}
TESTDIR=$(basename $TESTDIR_FULL)
CODEDIR=$(pwd);
# use timestamp + TESTDIR as working dir name
WDIR=$(date +"%y%m%d_%H%M%S")"_"$TESTDIR;
# 2 copy to location with appropriate file name
mkdir -p ../tests/testing/$WDIR
if [[ -d ../analysis-dev/ ]]
then
echo "Note: analysis-dev/ directory found."
echo "Replacing analysis/ with analysis-dev/ in output folder."
rsync -a --exclude='*~' --exclude='analysis/' \
$CODEDIR/ ../tests/testing/$WDIR/src/
rsync -a --delete --exclude='*~' --exclude='__pycache__' \
$CODEDIR/../analysis-dev/ ../tests/testing/$WDIR/src/analysis
else
echo "Note: analysis-dev/ directory not found."
echo "Proceeding without replacment."
rsync -a --exclude='*~' \
$CODEDIR/ ../tests/testing/$WDIR/src/
fi
cd ../tests/testing/$WDIR
# 3 read out simulation set up (cores, memory etc...)
source "./src/"$TESTDIR_FULL"simulation.config"
# echo $NPARSIM
# echo $NCORES
# echo $MEMGB
# 4 replace explored_params
cp "./src/"$TESTDIR_FULL"explored_params.py" ./src/net/
# 5 start simulation through run_local with settings from 3)
rm -f nohup.out
nohup ./src/run_local.sh $WDIR $CODEDIR $NPARSIM \
$NCORES $MEMGB $LOCAL_COMPUTE \
$CLUSTER $TESTRUN $TESTDIR_FULL &