-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaunch_rwm.sh
82 lines (55 loc) · 1.55 KB
/
launch_rwm.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
#!/usr/bin/env bash
if [ $# -eq 0 ]; then
echo
echo "Usage: launch_rwm.sh <TSL_input_file> <list_file> <step_size>"
echo
elif [ ! -f $1 ]; then
echo
echo "Cannot open $1. Please provide a valid config file."
echo
else
# PATH DEFINITIONS
# Modify according to your username and configuration
script=$( realpath $0 )
SCRIPT_PATH=$( dirname $script )
WORK_PATH="<PATH_TO_STORE_STUFF>"
OUTPUT_PATH="<PATH_TO_STORE_LOG_FILES>"
ERROR_PATH="<PATH_TO_STORE_ERROR_FILES>"
if [ ! -d "$WORK_PATH" ]; then mkdir -p $WORK_PATH; fi
if [ ! -d "$OUTPUT_PATH" ]; then mkdir -p $OUTPUT_PATH; fi
if [ ! -d "$ERROR_PATH" ]; then mkdir -p $ERROR_PATH; fi
# PYTHON file
# Path and name of the python file to be executed
python_file="<PATH_TO_REPO>/remove-winter-maxima.py"
ACCOUNT=morsanat
input_file=$1
list_file=$2
n_lines=$(wc -l < "$list_file")
if [ -z ${3+x} ]; then
step=100
else
step=$3
fi
i=0
while [ $i -le $n_lines ]; do
sbatch \
--ntasks=5 \
--exclusive \
--output=$OUTPUT_PATH/%j.log \
--error=$ERROR_PATH/%j.log \
--workdir=$WORK_PATH \
--job-name="PPpy$i" \
--qos=short \
--account=$ACCOUNT \
--partition=computehm \
--mail-type=ALL \
${SCRIPT_PATH}/PP_python.sh \
$python_file \
$input_file \
$list_file \
$i \
$(( i + step )) \
False
((i+=step))
done
fi