Skip to content

Instantly share code, notes, and snippets.

@wahello
Forked from andersgs/job_array_demo.sh
Created September 29, 2020 15:54
Show Gist options
  • Save wahello/7f46f9f6de93604212ddfcfc0c1e5e76 to your computer and use it in GitHub Desktop.
Save wahello/7f46f9f6de93604212ddfcfc0c1e5e76 to your computer and use it in GitHub Desktop.
Slurm job arrays
#!/bin/bash
# Illustrating the use of job arrays in SLURM
# use the command: sbatch --array=1-100 job_array_demo.sh
# Partition for the job:
#SBATCH -p main
# Multithreaded (SMP) job: must run on one node
#SBATCH --nodes=1
# The name of the job:
#SBATCH --job-name="job_arrays"
# The project ID which this job should run under:
# This may or may not be needed
#SBATCH --account="999999"
# Maximum number of tasks/CPU cores used by the job:
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
# The amount of memory in megabytes per process in the job:
#SBATCH --mem=200
# Send yourself an email when the job:
# aborts abnormally (fails)
#SBATCH --mail-type=FAIL
# begins
#SBATCH --mail-type=BEGIN
# ends successfully
#SBATCH --mail-type=END
# Use this email address:
#SBATCH --mail-user=some.email@your_institutions.com
# The maximum running time of the job in days-hours:mins:sec
#SBATCH --time=0-0:00:05
# check that the script is launched with sbatch
if [ "x$SLURM_JOB_ID" == "x" ]; then
echo "You need to submit your job to the queuing system with sbatch"
exit 1
fi
# Get the line corresponding the to the task number
# from a file called words
WORD=$(sed -n "${SLURM_ARRAY_TASK_ID}p" words)
# Do something with it information
# Some available env variables include:
# $SLURM_ARRAY_TASK_ID -- index of the current task
# $SLURM_ARRAY_JOB_ID --- the job id in the slurm queue
# $SLURM_ARRAY_TASK_MAX --- the largest index possible for task
# $SLUM_ARRAY_TASK_MIN --- the smalles index possible for task
echo "This is task number ${SLURM_ARRAY_TASK_ID} of ${SLURM_ARRAY_TASK_MAX} from job ${SLURM_ARRAY_JOB_ID}. The dictionary word is ${WORD}."
1080
10-point
10th
11-point
12-point
16-point
18-point
1st
2
20-point
2,4,5-t
2,4-d
2D
2nd
30-30
3-D
3-d
3D
3M
3rd
48-point
4-D
4GL
4H
4th
5-point
5-T
5th
6-point
6th
7-point
7th
8-point
8th
9-point
9th
-a
A
A.
a
a'
a-
a.
A-1
A1
a1
A4
A5
AA
aa
A.A.A.
AAA
aaa
AAAA
AAAAAA
AAAL
AAAS
Aaberg
Aachen
AAE
AAEE
AAF
AAG
aah
aahed
aahing
aahs
AAII
aal
Aalborg
Aalesund
aalii
aaliis
aals
Aalst
Aalto
AAM
aam
AAMSI
Aandahl
A-and-R
Aani
AAO
AAP
AAPSS
Aaqbiye
Aar
Aara
Aarau
AARC
aardvark
aardvarks
aardwolf
aardwolves
Aaren
Aargau
aargh
Aarhus
Aarika
Aaron
aaron
Aaronic
aaronic
Aaronical
Aaronite
Aaronitic
Aaron's-beard
Aaronsburg
Aaronson
AARP
aarrgh
aarrghh
Aaru
AAS
aas
A'asia
aasvogel
aasvogels
AAU
AAUP
AAUW
AAVSO
AAX
A-axes
A-axis
A.B.
AB
Ab
ab
ab-
A.B.A.
ABA
Aba
aba
Ababa
Ababdeh
Ababua
abac
abaca
abacas
abacate
abacaxi
abacay
abaci
abacinate
abacination
abacisci
abaciscus
abacist
aback
abacli
Abaco
abacot
abacterial
abactinal
abactinally
abaction
abactor
abaculi
abaculus
abacus
abacuses
Abad
abada
Abadan
Abaddon
abaddon
abadejo
abadengo
abadia
Abadite
abaff
abaft
Abagael
Abagail
Abagtha
Abailard
abaisance
abaised
abaiser
abaisse
abaissed
abaka
Abakan
abakas
Abakumov
abalation
abalienate
abalienated
abalienating
abalienation
abalone
abalones
Abama
abamp
abampere
abamperes
abamps
Abana
aband
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment