-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrundemo.sh
109 lines (95 loc) · 2.85 KB
/
rundemo.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
#
#Run demonstration scripts
#
#--------------------------------------------------------------------
#PyCIS: An a-contrario detection algorithm for space object tracking from optical time-series telescope data.
#Copyright (C) 2022, Benjamin G. Feuge-Miller, <[email protected]>
#
#This program is free software; you can redistribute it and/or modify
#t under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License along
#with this program; if not, write to the Free Software Foundation, Inc.,
#51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#--------------------------------------------------------------------
CWD=$(pwd)
COPYLOC="$CWD/data"
OUTLOC="$CWD/results"
TDMLOC="$CWD/TDM"
#Create folders if necessary
if [ ! -d "$COPYLOC" ]; then
echo "ERROR: PLEASE DOWNLOAD DEMO DATA INTO THE DATA FOLDER"
echo "aborting..."
return 0
fi
if [ ! -d "$OUTLOC" ]; then
mkdir $OUTLOC
fi
if [ ! -d "$TDMLOC" ]; then
mkdir $TDMLOC
fi
timer=60 #runtime in minutes
sleeper=2 #sleep time in minutes (to close scripts)
for FOLDER in $COPYLOC/*/; do
FOLDER=${FOLDER%*/}
FOLDER="${FOLDER##*/}"
if ! type "sbatch" >& /dev/null; then
#IF sbatch does not exist (standard case)
echo "launching on bash"
#reset paths
if ! which "solve-field" >& /dev/null ; then
echo "resetting paths"
. setup.sh
fi
# Check installation and activate source
source env/bin/activate
#set omp and run demo with faulthandler
export OMP_NUM_THREADS=48
python3 -q -X faulthandler demo.py
python3 -q -X faulthandler runpycis.py -i $COPYLOC -s $FOLDER -o $OUTLOC/$FOLDER -t $TDMLOC
#close source for safe exit
deactivate
else
#IF sbatch does exist (TACC case)
echo "launching through slurm"
#reset paths
module load gcc/9.1
module load cmake/3.16.1 #.10.2
module load python3/3.8.2
if ! which "solve-field" >& /dev/null ; then
echo "resetting paths"
. setup.sh
fi
#Launch sbatch
cat <<EOF |sbatch
#!/bin/bash
#SBATCH -p skx-normal
#SBATCH -J pycis.job
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 00:$timer:00
#SBATCH -o $COPYLOC/$FOLDER/pycis.out
# #SBATCH --mail-user
# #SBATCH --mail-type ALL
# Switch to folder and load modules
module load gcc/9.1
module load cmake/3.10.2
module load python3/3.8.2
# Check installation and activate source
source env/bin/activate
#set omp and run demo with faulthandler
export OMP_NUM_THREADS=48
python3 -q -X faulthandler runpycis.py -i $COPYLOC -s $FOLDER -o $OUTLOC/$FOLDER -t $TDMLOC
#close source for safe exit
deactivate
EOF
fi
done