Skip to content

Instantly share code, notes, and snippets.

@willirath
Last active August 7, 2023 13:03
Show Gist options
  • Save willirath/abac67bf95d29afb0969ced047b539f7 to your computer and use it in GitHub Desktop.
Save willirath/abac67bf95d29afb0969ced047b539f7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#SBATCH --job-name=high_throughput
#SBATCH --ntasks=13 # number of tasks running at the same time
#SBATCH --cpus-per-task=1
#SBATCH --mem-per-cpu=12G
#SBATCH --time=1:00:00 # one hour
#SBATCH --partition=cluster
#SBATCH --output=high_throughput.out
#SBATCH --error=high_throughput.err
#SBATCH [email protected]
#SBATCH --mail-type=ALL
for mytask in {001..300}; do # this will submit 300 tasks of which 13 will run at the same time
export mytask
srun --ntasks=1 --exclusive bash -c 'DELAY=$((RANDOM % 12)); sleep $DELAY; echo $mytask took $DELAY seconds;' &
done
wait
jobinf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment