forked from esi-neuroscience/slurmfun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
matlabcmd.sh
50 lines (43 loc) · 1.25 KB
/
matlabcmd.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
#!/bin/bash
matlab='/cs/opt/matlab-2020b/bin/matlab'
export HOME=/cs/slurm/$SLURM_JOB_ACCOUNT
if [ ! -d "$HOME" ]; then
mkdir $HOME
fi
while :; do
case $1 in
-h|-\?|--help)
show_help # Display a usage synopsis.
exit
;;
-m|--matlab) # Takes an option argument; ensure it has been specified.
if [ "$2" ]; then
matlab=$2
shift
else
die 'ERROR: "--matlab" requires a non-empty option argument.'
fi
;;
--) # End of all options.
shift
break
;;
-?*)
printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2
;;
*) # Default case: No more options, so break out of the loop.
break
esac
shift
done
echo "---------------------------------------------------"
echo "Job: $SLURM_JOB_ID"
echo "Partition: $SLURM_JOB_PARTITION"
echo "Account: $SLURM_JOB_ACCOUNT"
echo "Node: $SLURMD_NODENAME"
echo "Job start time: `date`"
echo "MATLAB: $matlab"
echo "Command: $1"
echo "---------------------------------------------------"
echo ""
srun $matlab -nodisplay -nosplash -r "try $1; exit; catch exit; end"