-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelloworld_gnu.slurm
More file actions
65 lines (49 loc) · 1.52 KB
/
helloworld_gnu.slurm
File metadata and controls
65 lines (49 loc) · 1.52 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
#!/bin/bash --login
#SBATCH --job-name=main_jxu_short_job
#SBATCH --partition=main_jxu
#SBATCH --nodes=1
#SBATCH --ntasks=6
#SBATCH --time=00:20:00
#SBATCH --gres=gpu:1
#SBATCH --mem=32
#SBATCH --export=NONE
# To compile with the GNU toolchain
module load gcc/9.4.0
module load matlab
# leave in, it lists the environment loaded by the modules
module list
# Note: SLURM_JOBID is a unique number for every job.
# These are generic variables
EXECUTABLE=main.m
SCRATCH=$MYSCRATCH/main.m/$SLURM_JOBID
RESULTS=$MYGROUP/main_results/$SLURM_JOBID
###############################################
# Creates a unique directory in the SCRATCH directory for this job to run in.
if [ ! -d $SCRATCH ]; then
mkdir -p $SCRATCH
fi
echo SCRATCH is $SCRATCH
###############################################
# Creates a unique directory in your GROUP directory for the results of this job
if [ ! -d $RESULTS ]; then
mkdir -p $RESULTS
fi
echo the results directory is $RESULTS
################################################
# declare the name of the output file or log file
OUTPUT=main.log
#############################################
# Copy input files to $SCRATCH
# then change directory to $SCRATCH
cp $EXECUTABLE $SCRATCH
cd $SCRATCH
srun -n 1 ./$EXECUTABLE >> ${OUTPUT}
#############################################
# $OUTPUT file to the unique results dir
# note this can be a copy or move
mv $OUTPUT ${RESULTS}
cd $HOME
###########################
# Clean up $SCRATCH
rm -r $SCRATCH
echo main_jxu job finished at `date`