-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmT_runOneJob.sh
57 lines (45 loc) · 1.24 KB
/
mT_runOneJob.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
#!/bin/bash
#SBATCH --job-name=modelFit
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --ntasks-per-node=1
#SBATCH --time=12:00:00
#SBATCH --export=NONE
# Set the amount of time MATLAB is aiming to run for. Speciify as ??:??:??
timeLim="03:00:00"
# INPUT
# $1 directory. All relevant MATLAB scripts should be in the folder
# directory/scripts or a subfolder of this directory. Temp folders will be
# created here.
# $2 file name of the job to run
# $3 Are we starting a new fit or resuming and old one ("0" or "1")
umask 077
set -e
module load matlab/2018b
jobDirectory="$1"
filename="$2"
resuming="$3"
TMP="$TMPDIR"
echo 'System temp dirs:'
echo "$TMPDIR"
echo "$TMP"
export MATLAB_PREFDIR=$TMPDIR/.matlab/R2018b/
mkdir $TMPDIR/.matlab
cp -r $HOME/.matlab/R2018b $TMPDIR/.matlab
cat<<EOF | matlab -nodisplay -nosplash
tmpFolder = fullfile("$TMPDIR", 'parallelJobs');
disp('Folder in use for temporary storage of files...')
disp(tmpFolder)
disp('')
mkdir(tmpFolder)
try
thisClst = parcluster();
thisClst.JobStorageLocation = tmpFolder;
parpool(thisClst, [1, 32])
mT_runOnCluster('$jobDirectory', '$filename', '$resuming', '$timeLim');
catch err
disp('Quitting early due to error')
rethrow(err)
end
EOF