Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#!/bin/bash
#SBATCH --ntasks 3
#SBATCH --output submit.out
#SBATCH --dependency singleton
#SBATCH --job-name example-03-parameter-sweep
# Kill job after 1 minute to show resuming feature.
#SBATCH --time 1:00
parallel_opts=$(~/parallel-slurm/parallel_opts.sh)
module load parallel
# Alias our model running program.
model="python model.py"
# Read the number of simulations to run.
n_sim=$( $model --sim )
n_remaining=$( $model --remaining )
# Check if all simulations are completed.
echo "Started SLURM job $SLURM_JOB_ID"
if [[ n_remaining -eq 0 ]]
then
echo "Nothing to run; all $n_sim simulations complete."
echo "Completed SLURM job $SLURM_JOB_ID in $(sacct -nXj $SLURM_JOB_ID -o elapsed)"
exit 0
fi
# Run an interruption prone program.
seq $n_sim > param_index
echo "Running $n_remaining of total $n_sim simulations."
# It's okay to use
parallel $parallel_opts \
--joblog joblog \
--resume \
--retries 3 \
--line-buffer \
$model \
:::: param_index
echo "Completed SLURM job $SLURM_JOB_ID in $(sacct -nXj $SLURM_JOB_ID -o elapsed)"