The discussion forums in the XSEDE User Portal are for users to share experiences, questions, and comments with other users and XSEDE staff. Visitors are welcome to browse and search, but you must login to contribute to the forums. While XSEDE staff monitor the lists, XSEDE does not guarantee that questions will be answered. Please note that the forums are not a replacement for formal support or bug reporting procedures through the XSEDE Help Desk. You must be logged in to post to the user forums.

« Back to General Discussion

'wait' - a simple question

Combination View Flat View Tree View
Threads [ Previous | Next ]
'wait' - a simple question
Answer
3/31/16 3:51 PM
Hi,

I'm new to setting up batch files, and have a question about the 'wait' command.

The goal here is to run a lot of models with the 'cloudy' code, but last time I ran my batch file, it only calculated 72 models out of ~700. So in my new batch file (part of it inserted below), I added an increasing 'offset' (from 0 to 19), then a 'wait' to wait for the first 20 models to finish, after which the offset is reset to 0. Is that possible at all? Is there a more correct way of doing this?

Batch file has been submitted but is still in the queue so I thought I'd just ask.

Thanks in advance,
Karen

#!/bin/bash -l

#----------------------------------------------------
# SLURM job script to run SIGAME on
# TACC's Stampede system.
#
#----------------------------------------------------

#SBATCH -J SIGAME-test # Job name
#SBATCH -o sigame.%j.out # Name of stdout output file (%j expands to jobId)
#SBATCH -p normal # Queue name
#SBATCH -N 20 # Total number of nodes requested (16 cores/node)
#SBATCH -n 20 # Total number of mpi tasks requested
#SBATCH -t 02:00:00 # Run time (hh:mm:ss) - 1.5 hours
#SBATCH --mail-user=...
#SBATCH --mail-type=begin # email me when the job starts
#SBATCH --mail-type=end # email me when the job finishes

#SBATCH -A ... # <-- Allocation name to charge job against

# Launch this
ibrun -o 0 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_0 &
ibrun -o 1 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_1 &
ibrun -o 2 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_2 &
ibrun -o 3 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_3 &
ibrun -o 4 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_4 &
ibrun -o 5 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_5 &
ibrun -o 6 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_6 &
ibrun -o 7 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_7 &
ibrun -o 8 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_8 &
ibrun -o 9 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_9 &
ibrun -o 10 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_10 &
ibrun -o 11 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_11 &
ibrun -o 12 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_12 &
ibrun -o 13 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_13 &
ibrun -o 14 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_14 &
ibrun -o 15 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_15 &
ibrun -o 16 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_16 &
ibrun -o 17 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_17 &
ibrun -o 18 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_18 &
ibrun -o 19 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_19 &
wait
ibrun -o 0 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_20 &
ibrun -o 1 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_21 &
ibrun -o 2 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_22 &
ibrun -o 3 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_23 &
ibrun -o 4 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_24 &
ibrun -o 5 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_25 &
ibrun -o 6 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_26 &
ibrun -o 7 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_27 &
ibrun -o 8 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_28 &
ibrun -o 9 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_29 &
ibrun -o 10 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_30 &
ibrun -o 11 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_31 &
ibrun -o 12 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_32 &
ibrun -o 13 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_33 &
ibrun -o 14 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_34 &
ibrun -o 15 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_35 &
ibrun -o 16 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_36 &
ibrun -o 17 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_37 &
ibrun -o 18 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_38 &
ibrun -o 19 -n 1 /work/04075/kpolsen/SIGAME/cloudy/source/cloudy.exe -p GMC_39 &
wait