exp-add-sims.sh: Generate a SLURM batch script for an Experiment/Family
Given an Experiment or Family consisting of multiple EXOSIMS scripts, and a seed or list of seeds, makes a batch script ready for SLURM submission. Features: - Submits an array job over all Scripts in the Family/Experiment - With -j N, allows N-way parallelism over seeds in each Script - With -m TARGET, allows postprocessing with "make reduce", etc.
Simple Usage: exp-add-sims.sh -0 -j 16 -m reduce,html-only Scripts/example.fam Experiment/seed100.txt exp-add-sims.sh -0 -j 1 -m reduce,html-only Scripts/example.fam =777
Complete Usage:
exp-add-sims.sh [-0] [-j N] [-/ S] [[-m target,target,...] ...] [-q|-v] Experiment Seeds
where arguments are: Experiment: a directory name within Scripts/ of an Experiment or Family Seeds: a file of integer seeds, or =S to use a single integer seed S.
and options are:
-0: Warm caches before ensemble seed-by-seed runs
-j N: Ensemble is created with N-way parallelism
-/ S: Divide the "M" scripts in the Experiment into "S" batches,
producing "S" scripts. Default 1. Needed for large M.
-m TARGET: Run "make S==... TARGET postprocessing after ensemble
and less-used options:
-q: less chatty
-v: chatty about job invocation
-h: print this help
Note: comma-separated postprocessing steps are done in one invovation
- of "make", and repeated "-m" options cause repeated invocations of
"make". So -m reduce,obs-timeline-2 -m html-only will: make S=... reduce obs-timeline-2 make S=... html-only- within each script directory. The comma-separated form is quicker
- to type, but the trailing "-m html-only" ensures that a final HTML
- page is generated with the timelines in it.
Context: - Your working directory is the /scratch or /scratch-edge Sandbox - Your scripts are in a Family/Experiment in same Sandbox - You should be in the Python VENV you wish to use- The generated script can be submitted to either the "slurm" or "edge" cluster,
- provided that the Experiment/Family exists in the Scripts/ directory
- on the scratch for that cluster. (You must copy the files
- in
Scripts/...between clusters yourself.) Just usesbatch -M edgeor sbatch -M slurm. Or,sbatchwithout-Mwill submit to the default- cluster for that node.
Example
we are in /scratch, in a VENV
$ pwd; echo $VIRTUAL_ENV /scratch/exo-yield/Sandbox/hwo /scratch-jpl/exo-yield/Sandbox/Python-venvs/exosims-202509-mjt
create the script
$ exp-add-sims.sh -0 -j16 -m reduce,obs-timeline-2 -m html-only Scripts/Test.exp Experiments/seed100.txt (...output...) exp-add-sims.sh: Batch script placed in: Scripts/Test.exp/Batch/Run.sh
submit the generated file
$ sbatch Scripts/Test.exp/Batch/Run.sh Submitted batch job 4987542