Permalink
Cannot retrieve contributors at this time
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?
parallel-slurm/examples/03-submit-param-sweep.slurm
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
40 lines (34 sloc)
1.04 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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)" |