-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun
More file actions
executable file
·95 lines (85 loc) · 2.21 KB
/
Copy pathrun
File metadata and controls
executable file
·95 lines (85 loc) · 2.21 KB
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
95
#!/usr/bin/env bash
ARCH=`uname -s`
_main_dir=$(dirname $BASH_SOURCE)
EASYPAPDIR=${EASYPAPDIR:-${_main_dir}}
. ${_main_dir}/script/easypap-common.bash
unset _main_dir
TRACE=no
THUMBS=no
DEBUG=no
for ((i = 1; i <= $#; i++ )); do
case ${!i} in
-t|--trace|-ti|--trace-iter)
TRACE=yes
;;
-tn|--thumbs)
THUMBS=yes
;;
-lk|--list-kernels)
shift
exec ${EASYPAPDIR}/script/easypap-list-kernels "$@"
;;
-lv|--list-variants)
shift
exec ${EASYPAPDIR}/script/easypap-list-variants "$@"
;;
-mpi|--mpirun)
if ((i == $#)); then
echo "Error: option --mpi must be followed by a string"
${SIMU} --help
exit 1
fi
j=$((i + 1))
MPIRUNARGS="${!j}"
;;
--gdb|--lldb)
DEBUG=${!i#--}
;;
*)
;;
esac
done
# build easypap if needed
if [[ ! -f ${SIMU} ]]; then
make -j
fi
# if thumbnails generation is requested, clean the old files
if [[ $THUMBS == "yes" ]]; then
${EASYPAPDIR}/script/clean-thumbs
fi
# if trace generation is requested, we back up the previous trace file
if [[ $TRACE = "yes" ]]; then
if [[ -f ${TRACEFILE} ]] ; then
mv ${TRACEFILE} ${OLDTRACEFILE}
fi
fi
# if no thread binding is specified, use OMP_PLACES=cores on Linux systems
if [[ -z $OMP_PLACES ]]; then
if [[ $ARCH == "Linux" ]]; then
export OMP_PLACES="cores"
else # MacOS
# OMP_PLACES is not supported by libgomp yet
if ! otool -L ${SIMU} | grep libgomp > /dev/null; then
export OMP_PLACES="cores"
fi
fi
fi
# Run under debugger
if [[ $DEBUG = "lldb" ]]; then
exec lldb ${SIMU} -- "$@"
elif [[ $DEBUG = "gdb" ]]; then
exec gdb --args ${SIMU} "$@"
fi
# check if program should be launched by mpirun
if [[ -n $MPIRUNARGS ]]; then
vars=(OMP_NUM_THREADS OMP_SCHEDULE OMP_PLACES)
MPIENV=""
for v in ${vars[@]}; do
if [[ -n ${!v} ]]; then
MPIENV="${MPIENV} -x $v"
fi
done
mpirun ${MPIENV} ${MPIRUNARGS} ${SIMU} "$@"
else
exec ${SIMU} "$@"
fi