Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add example slurm scripts #1115

Merged
merged 4 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/example_files/multi_sorcha.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
#SBATCH --job-name=the_best_job
#SBATCH --account=im_a_power_user
#SBATCH --partition=the_best_partition
#SBATCH --mem=all_of_it
#SBATCH --time=24:00:00
#SBATCH --output=log-%a.log

python3 multi_sorcha.py --config my_config.ini --input_orbits my_orbits.csv --input_physical my_colors.csv --pointings my_pointings.db --path ./ --chunksize $(($1 * $2)) --norbits $1 --cores $2 --instance ${SLURM_ARRAY_TASK_ID} --cleanup --copy_inputs
19 changes: 19 additions & 0 deletions docs/example_files/sorcha.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
#SBATCH --job-name=three_jobs_in_one
#SBATCH --account=lazy_slurm_user
#SBATCH --partition=the_bestest_partition
#SBATCH --ntasks=3
#SBATCH --mem-per-cpu=1G
#SBATCH --time=24:00:00
#SBATCH --output=log-%a.log

dt=$(date '+%d/%m/%Y %H:%M:%S');
echo "$dt Beginning Sorcha."

srun --exclusive -N1 -n1 sorcha run -c ./sorcha_config_demo.ini --pd ./baseline_v2.0_1yr.db --ob ./sspp_testset_orbits.des -p ./sspp_testset_colours.txt -o ./ -t testrun_e2e_1 -st testrun_e2e_stats_1 &
srun --exclusive -N1 -n1 sorcha run -c ./sorcha_config_demo.ini --pd ./baseline_v2.0_1yr.db --ob ./sspp_testset_orbits.des -p ./sspp_testset_colours.txt -o ./ -t testrun_e2e_2 -st testrun_e2e_stats_2 &
srun --exclusive -N1 -n1 sorcha run -c ./sorcha_config_demo.ini --pd ./baseline_v2.0_1yr.db --ob ./sspp_testset_orbits.des -p ./sspp_testset_colours.txt -o ./ -t testrun_e2e_3 -st testrun_e2e_stats_3 &
wait

dt=$(date '+%d/%m/%Y %H:%M:%S');
echo "$dt Sorcha complete."
5 changes: 3 additions & 2 deletions docs/hpc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ We provide as a starting point our example scripts for running on HPC facilitie

Below is a very simple slurm script example designed to run the :ref:`demo files <quickstart>` three times on three cores in parallel. Here, one core has been assigned to each ``Sorcha`` run, with each core assigned 1Gb of memory.

.. literalinclude:: ./example_files/multi_sorcha.sh
.. literalinclude:: ./example_files/sorcha.sh
:language: text

Please note that time taken to run and memory required will vary enormously based on the size of your input files, your input population, and the chunk size assigned in the ``Sorcha`` configuration file: we therefore recommend test runs before you commit to very large runs. The chunk size is an especially important parameter: too small and ``Sorcha`` will take a very long time to run, too large and the memory footprint may become prohibitive. We have found that chunk sizes of 1000 to 10,000 work best.
Expand All @@ -43,8 +43,9 @@ multi_sorcha.py:
.. note::
We provide these here for you to copy, paste, and edit as needed. You might have to some slight modifications to both the slurm script and multi_sorcha.py depending if you're using ``Sorcha`` without calling the stats file.

multi_sorcha.sh requests many parallel Slurm jobs of multi_sorcha.py, feeding each a different --instance parameter. After changing ‘my_orbits.csv’, ‘my_colors.csv’, and ‘my_pointings.db’ to match the above, it could be run as sbatch --array=0-9 multi_sorcha.sh 25 4 to generate ten jobs, each with 4 cores running 25 orbits each.
multi_sorcha.sh requests many parallel Slurm jobs of multi_sorcha.py, feeding each a different --instance parameter. After changing ‘my_orbits.csv’, ‘my_colors.csv’, ‘my_pointings.db’, ‘my_config.ini’, and the various slurm parameters to match the above, you could generate 10 jobs, each with 4 cores running 25 orbits each, as follows::

sbatch --array=0-9 multi_sorcha.sh 25 4

You can run multi_sorcha.py on the command line as well::

Expand Down
Loading