#!/bin/bash # Script: multiple_jobs.sh # Usage: For submitting multiple batch jobs to LSF # Author: Jianwei Dian, Jonathan Cranford # Last Update: 8/16/2024 # # To run, type: # ./multiple_jobs.sh [# jobs] # # Script must have execute permissions, i.e., # chmod u+x multiple_jobs.sh # Exit script with error message if the number of jobs is not specified: if [ $# -ne 1 ]; then echo "Usage: You need to feed one argument to this program which is" echo "the number of jobs you want to submit at once. For example," echo echo "./multiple_jobs.sh 8" exit 1 fi # Set up appropriate environment for running your app # or, source # ### USER MODIFY SECTION # module load # (or) # conda activate # (or) # source /usr/local/apps/application/environment.sh ### END USER MODIFY SECTION # The number of jobs to submit is given as # command line argument to script numJobs=$1 # Initialize the job counter index jobCounter=1 while [ $jobCounter -le $numJobs ] do echo "Submit job $jobCounter" ### USER MODIFY SECTION: # bsub -n 8 -R "span[ptile=8]" -W 15 -o out-${jobCounter}.%J -e err-${jobCounter}.%J "yourAppCommand appParameters app> bsub -n 1 -W 15 -o out-${jobCounter}.%J -e err-${jobCounter}.%J "source ./run.sh" ### END USER MODIFY SECTION ((jobCounter++)) done echo "Completed submitting all $numJobs jobs."