Generic Job Array

Job Array with inline switch

jobarray_inline.sh
#!/bin/bash
## Runs an array of jobs = one submission for x jobs
## 
#################### Job Settings #################################################################
#SBATCH -J myJobArray         # Setting the display name for the submission
#SBATCH -N 1                  # Number of nodes to reserve,. variable number possible: -N 2-5  
#SBATCH --ntasks-per-node 16  # typically 16, range: 1..16 (max 16 cores per node)
#SBATCH -t 30:00              # set walltime in hours, format:   hhh:mm:ss, days-hh, days-hhh:mm:ss
#SBATCH -p short              # Desired Partition
#SBATCH --mem 100G            # Requested Memory. Neumann gives priority bonus under 120G 
#SBATCH --array=1-3           # Sequence of task IDs, for example: 1-300 or nonsequentially: 1,3,17
 
 
## Different programs and arguments set by TASK_ID
case ${SLURM_ARRAY_TASK_ID} in
  1) TASK='bash -c "./app1"';;
  2) TASK='bash -c "./app2"';;
  3) TASK="echo task \$SLURM_PROCID of \$SLURM_NPROCS runs on \$SLURMD_NODENAME";;
esac
 
WORKDIR=/scratch/tmp/myuser/mydir
 
 
cd $WORKDIR
 
 
## Executing the task selected in case loop
srun $TASK

Arguments from file

args.txt
-np 1 ./app
-np 2 ./app
-np 4 ./app
-np 8 ./app
jobarray_extSettings.sh
#!/bin/bash
## Runs an array of jobs = one submission for x jobs
## 
#################### Job Settings #################################################################
#SBATCH -J myJobArray         # Setting the display name for the submission
#SBATCH -N 1                  # Number of nodes to reserve,. variable number possible: -N 2-5  
#SBATCH --ntasks-per-node 16  # typically 16, range: 1..16 (max 16 cores per node)
#SBATCH -t 30:00              # set walltime in hours, format:   hhh:mm:ss, days-hh, days-hhh:mm:ss
#SBATCH -p short              # Desired Partition
#SBATCH --mem 100G            # Requested Memory. Neumann gives priority bonus under 120G 
#SBATCH --array=1-4           # Sequence of task IDs, for example: 1-300 or nonsequentially: 1,3,17
 
ROOTDIR=/scratch/tmp/myuser/mydir
 
cd $ROOTDIR
 
## Different programs and arguments set by TASK_ID from args.txt
ARGS=$(sed -n "${SLURM_ARRAY_TASK_ID}p" $ROOTDIR/args.txt)
 
## Executing the task selected in case loop
mpirun $ARGS
guide/neumann/jobscript_generic_jobarray.txt · Last modified: 2019/02/18 14:53 by seengel
Back to top
CC Attribution-Share Alike 3.0 Unported
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0