-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_test
executable file
·95 lines (78 loc) · 2.54 KB
/
run_test
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
##########################################
#
# University of Southampton, 9 March 2016
#
# James Matthews
#
# run_test
#
# run_test is a shell script which compiles python then runs a load
# standard parameter files.
#
# Usage: ./run_test [version] [mode]"
# version: version of Python to run
# mode: 0, small test, 1, medium with fiducial agn, 2, large parallel test w/ matoms 3
# or: -h : print this message
#
# Environment variables needed are
# PYTHON : normal git repo
##########################################
display_help() {
echo "run_test is a shell script which compiles PYTHON then runs a load of standard parameter files."
echo ""
echo "Usage: ./run_test [version] [mode]"
echo ""
echo "version: version of Python to run"
echo "mode: 0, small test, 1, large parallel test"
echo "-h : print this message"
echo ""
exit
}
VERSION=""
MODE=1
if [ $# -lt 1 ]; then
display_help
elif [ $# -lt 2 ]; then
if [[ $1 == "-h" ]]; then
display_help
fi
else
echo "Reading version and mode from cmd line..."
VERSION=$1
MODE=$2
fi
# make a folder to store my outputs in
DATE=$(date +%F)
FOLDER="test_"$VERSION"_"$DATE
echo $FOLDER
mkdir $FOLDER
cd $FOLDER
# First make sure the error and output files are empty.
: > run_test_out.txt
: > run_test_err.txt
date > run_test_out.txt
date > run_test_err.txt
cp $PYTHON/examples/core/*.pf .
Setup_Py_Dir
# run the ion loop
# python $PYTEST/scripts/ion_loop_jm.py $VERSION $VERSION standard78 &
# if we are in mode 2 or 3 then we should really be running multicore
if [[ $MODE == 2 ]]; then
read -p "How many cores should I run fiducial_agn and loop on?" ncores
echo "Running 2 jobs on "$ncores" cores each"
nice mpirun -n $ncores $PYTHON/bin/py$VERSION fiducial_agn > fiducial_agn.out &
python ../run_ion_loop.py ../AGN_vIP.param $VERSION $ncores &
elif [[ $MODE == 3 ]]; then
read -p "How many cores should I run the longer models on?" ncores
echo "Running 4 jobs on "$ncores" cores each"
nice mpirun -n $ncores $PYTHON/bin/py$VERSION fiducial_agn > fiducial_agn.out &
nice mpirun -n $ncores $PYTHON/bin/py$VERSION cv_macro_benchmark > cv_macro_benchmark.out &
nice mpirun -n $ncores $PYTHON/bin/py$VERSION m16_agn > m16_agn.out &
python ../run_ion_loop.py ../AGN_vIP.param $VERSION $ncores
fi
# if we're in mode 1 then we are just running quick models
# these are all runnable on 1 core in a reasonable time and run in all modes
py$VERSION cv_standard > cv_standard.out &
py$VERSION 1d_sn > 1d_sn.out &
py$VERSION star > star.out &