From 6b1b0d0ae1f22c3eefd9de8bbabb7f6616a7f871 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Thu, 19 Nov 2026 10:01:44 +0100 Subject: [PATCH 1/9] [Documentation] Introduce executorlib through HPC user workflows Add a Getting Started on HPC guide which introduces submission, resources and MPI, dependencies, caching and the execution strategy through concrete HPC user challenges, with local development via SingleNodeExecutor. Link it prominently from the README and the existing chapters. Closes #1110 Co-Authored-By: Claude Opus 5.5 --- README.md | 50 +++++- docs/_toc.yml | 1 + docs/hpc-workflow.md | 292 ++++++++++++++++++++++++++++++++++ notebooks/1-single-node.ipynb | 2 +- notebooks/2-hpc-cluster.ipynb | 2 +- 5 files changed, 342 insertions(+), 5 deletions(-) create mode 100644 docs/hpc-workflow.md diff --git a/README.md b/README.md index d14430c6..0cfb4f90 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,41 @@ know, rather than asking you to adopt a new data, actor, or workflow model. [comparison: when to use which](https://executorlib.readthedocs.io/en/latest/comparison.html) for honest guidance on when another tool is the better fit. +## Getting Started on HPC +Running Python functions on an HPC cluster typically means writing batch scripts, requesting resources for each +calculation, tracking job IDs to chain calculations, and resubmitting work after a session was interrupted. executorlib +replaces these steps with the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#executor-objects) +of the Python standard library. Submitting a Python function from the login node as a SLURM job is as simple as: +```python +from executorlib import SlurmClusterExecutor + + +def calc(i): + return i * 2 + + +with SlurmClusterExecutor(cache_directory="./cache") as exe: + future_lst = [exe.submit(calc, i) for i in range(1, 4)] + print([f.result() for f in future_lst]) +``` +The [Getting Started on HPC](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html) guide walks through a +complete HPC workflow and introduces each feature where it solves a concrete challenge: +* [Submission](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#submission) - run existing Python + functions through SLURM with the `SlurmClusterExecutor`. +* [Resources and MPI](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#resources-and-mpi) - assign MPI + ranks, CPU threads and GPUs to individual function calls. +* [Dependencies](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#dependencies) - connect calculations + without manually coordinating scheduler jobs and intermediate files. +* [Caching](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#caching) - reuse completed calculations + when revising or resuming a workflow. +* [Execution strategy](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#execution-strategy) - choose + between one scheduler job per function and many functions within one allocation with the `SlurmJobExecutor`. +* [Local development](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#local-development) - develop and + test the same workflow on a laptop with the `SingleNodeExecutor`. + +The cluster-specific settings like the partition, run time limits and the submission template are explained in the +guide. Readers without access to an HPC cluster can follow the same workflow locally, as shown below. + ## Examples The Python standard library provides the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#executor-objects) with the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) and the @@ -47,9 +82,10 @@ execution of Python functions on a single computer. executorlib extends this fun functions over multiple computers within a high performance computing (HPC) cluster. This can be either achieved by submitting each function as individual job to the HPC job scheduler with an [HPC Cluster Executor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html) - or by requesting a job from the HPC cluster and then distribute the Python functions within this job with an -[HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html). Finally, to accelerate the -development process executorlib also provides a [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) - -to use the executorlib functionality on a laptop, workstation or single compute node for testing. Starting with the +[HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html). To develop and test the same workflow +on a laptop, workstation or single compute node before using cluster resources, executorlib also provides a +[Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html). The following examples can be +executed without cluster access, starting with the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html): ```python from executorlib import SingleNodeExecutor @@ -173,6 +209,14 @@ cluster-specific configuration for the `SlurmClusterExecutor`. * [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/installation.html#hpc-job-executor) * [Visualisation](https://executorlib.readthedocs.io/en/latest/installation.html#visualisation) * [For Developers](https://executorlib.readthedocs.io/en/latest/installation.html#for-developers) +* [Getting Started on HPC](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html) + * [Submission](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#submission) + * [Resources and MPI](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#resources-and-mpi) + * [Dependencies](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#dependencies) + * [Caching](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#caching) + * [Execution Strategy](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#execution-strategy) + * [Local Development](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#local-development) + * [Next Steps](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#next-steps) * [Comparison](https://executorlib.readthedocs.io/en/latest/comparison.html#comparison) * [At a glace](https://executorlib.readthedocs.io/en/latest/comparison.html#at-a-glance) * [Concurrent futures](https://executorlib.readthedocs.io/en/latest/comparison.html#concurrent-futures-the-python-standard-library) diff --git a/docs/_toc.yml b/docs/_toc.yml index e10f734d..dddbd2ba 100644 --- a/docs/_toc.yml +++ b/docs/_toc.yml @@ -2,6 +2,7 @@ format: jb-book root: README chapters: - file: installation.md +- file: hpc-workflow.md - file: comparison.md - file: 1-single-node.ipynb - file: 2-hpc-cluster.ipynb diff --git a/docs/hpc-workflow.md b/docs/hpc-workflow.md new file mode 100644 index 00000000..25d9f8b8 --- /dev/null +++ b/docs/hpc-workflow.md @@ -0,0 +1,292 @@ +# Getting Started on HPC + +executorlib is designed for one job: running *existing* Python functions on a high performance computing (HPC) cluster +without rewriting them into scheduler scripts. This page walks through a typical HPC workflow and introduces each +feature of executorlib at the point where it solves a concrete problem: + +1. [Submission](#submission) - run a Python function as a SLURM job instead of writing a batch script. +2. [Resources and MPI](#resources-and-mpi) - give each function call its own MPI ranks, CPU threads and GPUs. +3. [Dependencies](#dependencies) - chain calculations without coordinating job IDs and intermediate files by hand. +4. [Caching](#caching) - reuse completed calculations when you revise, interrupt or resume a workflow. +5. [Execution strategy](#execution-strategy) - decide between one scheduler job per function and many functions + inside one allocation. +6. [Local development](#local-development) - develop and test the same workflow on a laptop before using cluster + resources. + +The examples are taken from the detailed chapters on the [HPC Cluster Executor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html), the +[HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) and the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html), which provide additional +background for each step. + +```{admonition} Cluster-specific prerequisites +:class: important +The HPC examples on this page cannot be executed on readthedocs or on a laptop. They assume: + +* access to the login node of an HPC cluster with the [SLURM](https://slurm.schedmd.com) job scheduler, +* executorlib installed with the [HPC Cluster Executor](https://executorlib.readthedocs.io/en/latest/installation.html#hpc-cluster-executor) dependencies + ([pysqa](https://pysqa.readthedocs.io) and [h5py](https://www.h5py.org)) - plus [mpi4py](https://mpi4py.readthedocs.io) + for the MPI examples - in a Python environment which is also available on the compute nodes, +* a shared file system between the login node and the compute nodes, which is used for the `cache_directory`. + +Values marked as **cluster-specific** in the examples below - like the partition name `"regular"`, the run time limit or +the PMI mode `"pmix"` - have to be adapted to your cluster. The +[executorlib-cluster-setup](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#setup-with-claude-code) skill for +[Claude Code](https://docs.claude.com/en/docs/claude-code/overview) can analyse your cluster and generate a tested +configuration. Readers without cluster access can follow the same workflow with the `SingleNodeExecutor` as explained in +the [local development](#local-development) section. +``` + +## Submission +**Challenge:** You have a Python function which runs too long for the login node. The classical approach is to write a +Python script, wrap it in a SLURM batch script, submit it with `sbatch`, wait, and then parse the output files. + +**Solution:** The `SlurmClusterExecutor` follows the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#executor-objects) +of the Python standard library. Each call of `submit()` writes the function and its arguments to the `cache_directory`, +submits one SLURM job via `sbatch` and returns a [Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) +object. Calling `result()` on the future waits for the job to finish and loads the return value: + +```python +from executorlib import SlurmClusterExecutor + + +def calc(i): + return i * 2 + + +with SlurmClusterExecutor(cache_directory="./cache") as exe: + future_lst = [exe.submit(calc, i) for i in range(1, 4)] + print([f.result() for f in future_lst]) +``` + +The SLURM settings which are specific to your cluster are defined in a [Jinja2](https://jinja.palletsprojects.com) +submission template and passed via the resource dictionary `resource_dict`: + +```python +submission_template = """\ +#!/bin/bash +#SBATCH --output=time.out +#SBATCH --job-name={{job_name}} +#SBATCH --chdir={{working_directory}} +#SBATCH --get-user-env=L +#SBATCH --partition={{partition}} +{%- if run_time_max %} +#SBATCH --time={{ [1, run_time_max // 60]|max }} +{%- endif %} +{%- if dependency %} +#SBATCH --dependency=afterok:{{ dependency | join(',') }} +{%- endif %} +#SBATCH --ntasks={{cores}} + +{{command}} +""" + +with SlurmClusterExecutor( + cache_directory="./cache", + resource_dict={ + "submission_template": submission_template, + "partition": "regular", # cluster-specific + "run_time_max": 3600, # in seconds, cluster-specific + }, +) as exe: + future = exe.submit(calc, 4) + print(future.result()) +``` + +Rather than repeating the template in every script it can be stored once in a pysqa configuration directory and +referenced with the `pysqa_config_directory` parameter, as explained in +[reusing the configuration](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#reusing-the-configuration-with-pysqa-config-directory). When a +submission fails, for example because the default template does not match the cluster, `sbatch` returns an error which +is raised as `CalledProcessError` - see [SLURM](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#slurm) for details. + +## Resources and MPI +**Challenge:** Most steps of a scientific workflow are serial, but a few are expensive simulations which should use many +CPU cores via MPI, multiple threads or GPUs. Writing the whole program in MPI is not an option, and requesting the +largest allocation for every step wastes resources. + +**Solution:** executorlib assigns resources per function call. The resource dictionary `resource_dict` defines the +number of MPI ranks `cores`, the CPU threads per rank `threads_per_core` and the GPUs per rank `gpus_per_core`. Only the +function which benefits from parallel execution uses [mpi4py](https://mpi4py.readthedocs.io), the rest of the +program remains serial: + +```python +from executorlib import SlurmClusterExecutor + + +def calc_mpi(i): + from mpi4py import MPI + + size = MPI.COMM_WORLD.Get_size() + rank = MPI.COMM_WORLD.Get_rank() + return i, size, rank + + +with SlurmClusterExecutor( + cache_directory="./cache", + pmi_mode="pmix", # cluster-specific, depends on the MPI library + resource_dict={"submission_template": submission_template, "partition": "regular"}, +) as exe: + fs_serial = exe.submit(calc_mpi, 1, resource_dict={"cores": 1}) + fs_mpi = exe.submit(calc_mpi, 2, resource_dict={"cores": 4}) + fs_gpu = exe.submit(calc_mpi, 3, resource_dict={"cores": 1, "gpus_per_core": 1}) + print(fs_serial.result(), fs_mpi.result(), fs_gpu.result()) +``` + +The `resource_dict` passed to `submit()` extends the default `resource_dict` defined for the executor. The full list of +supported keys is available in the [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary) section. To confirm +that SLURM assigned the requested resources, the job ID of each function is stored in the cache and can be inspected +with `sacct` - see [verifying the resource assignment](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#verifying-the-resource-assignment). + +## Dependencies +**Challenge:** The output of one calculation is the input of the next one. With plain SLURM this requires collecting +job IDs, adding `--dependency=afterok:` to each batch script and writing and parsing intermediate files. + +**Solution:** Pass the future object of one calculation as an argument to the next `submit()` call. executorlib +translates the dependency into a SLURM job dependency and transfers the result between the jobs via the +`cache_directory`. The Python process does not have to wait for the first calculation to finish before submitting the +second one: + +```python +from executorlib import SlurmClusterExecutor + + +def add_funct(a, b): + return a + b + + +with SlurmClusterExecutor(cache_directory="./cache") as exe: + future = 0 + for i in range(4, 8): + future = exe.submit(add_funct, i, future) + print(future.result()) +``` + +Functions returning tuples or dictionaries can be split into individual futures with `split_future()` and +`get_item_from_future()`, and many futures can be grouped with `batched()`. These patterns are introduced in the +[advanced scheduling](https://executorlib.readthedocs.io/en/latest/1-single-node.html#advanced-scheduling) section and apply unchanged to the HPC executors. To +debug complex dependencies the graph can be visualised with `plot_dependency_graph=True`, see +[dependencies](https://executorlib.readthedocs.io/en/latest/1-single-node.html#dependencies). + +## Caching +**Challenge:** HPC workflows are developed iteratively. You add an analysis step to a workflow whose simulations took +hours, your session on the login node is disconnected, or one step fails and has to be fixed. In each case you do not +want to repeat the calculations which already finished. + +**Solution:** All results of the `SlurmClusterExecutor` are stored in the `cache_directory`. Each task is identified by +a hash of the function and its arguments. When the same function is submitted again with the same arguments and the +same `cache_directory`, the stored result is returned instead of submitting a new job. This also allows you to submit a +workflow, close the Python process and reconnect later: + +```python +from executorlib import SlurmClusterExecutor + +exe = SlurmClusterExecutor(cache_directory="./cache") +future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)] +exe.shutdown(wait=False, cancel_futures=False) # disconnect, the jobs keep running +``` + +Later - even from a new Python process - the same submission reloads the results from the cache: + +```python +with SlurmClusterExecutor(cache_directory="./cache") as exe: + future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)] + print([f.result() for f in future_lst]) +``` + +The results of all cached calculations can be collected in a `pandas.DataFrame` with `get_cache_data()`, see +[cache](https://executorlib.readthedocs.io/en/latest/1-single-node.html#cache). Keep in mind the lifetime and limitations of the cache: + +* **What invalidates a cached result:** changing the function or its arguments creates a new hash and a new + calculation. Changing only the `resource_dict` does not, so a result computed with 4 cores is reused when the same + call is submitted with 8 cores. An explicit identifier can be set with the `cache_key` entry of the + [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary). +* **Duplicates within one session:** the cache restores results from previous sessions. It is not designed to detect + the same function call submitted twice within one `with`-statement. +* **Lifetime:** executorlib never deletes the `cache_directory`. Remove it once the results are no longer needed, as + explained in [cleaning cache](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#cleaning-cache), since disk space on shared file systems is limited. +* **Not long-term storage:** the cache uses [cloudpickle](https://github.com/cloudpipe/cloudpickle) and + [h5py](https://www.h5py.org). The format may change between versions of executorlib and Python, so results which + should be kept have to be stored in a format of your choice. + +## Execution strategy +**Challenge:** Submitting every function as its own SLURM job is robust, but each job waits in the queue and the +scheduler is not designed for thousands of short jobs. On the other hand many clusters favour large allocations, or you +already have an interactive allocation. + +**Solution:** Use the `SlurmJobExecutor` inside an existing SLURM allocation. It distributes the functions over the +resources of the allocation using `srun` job steps, so no new jobs enter the queue. The `submit()` interface, the +`resource_dict` and the dependency handling remain the same: + +```python +from executorlib import SlurmJobExecutor + +# This code runs inside an existing SLURM allocation, e.g. a script submitted with sbatch or salloc +with SlurmJobExecutor(max_workers=4) as exe: + future_lst = [exe.submit(calc_mpi, i, resource_dict={"cores": 2}) for i in range(4)] + print([f.result() for f in future_lst]) +``` + +Both strategies can also be combined: a function submitted with the `SlurmClusterExecutor` can itself create a +`SlurmJobExecutor` to distribute many small tasks within its allocation - see [combine both](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#combine-both). +For many short tasks within one allocation, starting the hierarchical [flux](http://flux-framework.org) scheduler inside +the SLURM allocation reduces the load on the SLURM database - see [SLURM with flux](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html#slurm-with-flux). + +| | `SlurmClusterExecutor` | `SlurmJobExecutor` | +|---|---|---| +| Where the Python process runs | login node | inside a SLURM allocation | +| One function call is | one `sbatch` job | one `srun` job step | +| Waiting time | each function waits in the queue | the allocation waits once | +| Python process can be closed while functions run | yes, results are reloaded from the cache | no | +| Communication | shared file system (`cache_directory` required) | sockets (`cache_directory` optional) | +| Overhead per function | high (queue and file system) | low | +| Best for | few long-running functions with different resource requirements | many short functions, high throughput | + +As a rule of thumb: start with the `SlurmClusterExecutor` when individual calculations run for minutes to hours or the +workflow should survive the end of your login session. Switch to the `SlurmJobExecutor` (or `FluxJobExecutor`) when you +execute many short functions or your cluster limits the number of jobs per user. The +[which executor should I use](https://executorlib.readthedocs.io/en/latest/#which-executor-should-i-use) table +summarizes all executors, including the corresponding [flux](http://flux-framework.org) executors. + +## Local development +**Challenge:** Debugging a workflow by waiting in the queue of the cluster is slow and consumes compute time, and not +everybody has access to an HPC cluster. + +**Solution:** Develop and test the workflow with the `SingleNodeExecutor` on your laptop or workstation. It supports +the same `submit()` interface, the same `resource_dict` - including MPI parallel functions with `cores` - the same +dependency handling and the same `cache_directory`. Moving to the cluster only requires replacing the executor class +and adding the cluster-specific settings: + +```python +from executorlib import SingleNodeExecutor + + +def calc_mpi(i): + from mpi4py import MPI + + size = MPI.COMM_WORLD.Get_size() + rank = MPI.COMM_WORLD.Get_rank() + return i, size, rank + + +def add_funct(a, b): + return a + b + + +with SingleNodeExecutor(cache_directory="./cache") as exe: + fs_mpi = exe.submit(calc_mpi, 3, resource_dict={"cores": 2}) + fs_sum = exe.submit(add_funct, 1, 2) + fs_final = exe.submit(add_funct, fs_sum, 3) # dependency via the future object + print(fs_mpi.result(), fs_final.result()) +``` + +The `SingleNodeExecutor` communicates via sockets like the `SlurmJobExecutor`. To test the file based communication of +the `SlurmClusterExecutor` locally, executorlib provides the `TestClusterExecutor` - see +[TestClusterExecutor](https://executorlib.readthedocs.io/en/latest/1-single-node.html#testclusterexecutor). The full functionality of the local executor is +introduced in the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) chapter, which can be executed without cluster access, for +example on [mybinder](https://mybinder.org/v2/gh/pyiron/executorlib/HEAD). + +## Next steps +* [HPC Cluster Executor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html) - SLURM background, submission templates, pysqa configuration, flux and + disconnecting and reconnecting. +* [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) - executing functions inside an allocation with SLURM and flux. +* [Application](https://executorlib.readthedocs.io/en/latest/application.html) - complete examples for [GPAW](https://executorlib.readthedocs.io/en/latest/4-1-gpaw.html) and + [Quantum Espresso](https://executorlib.readthedocs.io/en/latest/4-2-quantum-espresso.html). +* [Trouble Shooting](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html) - file system usage, firewalls, MPI and the full resource dictionary. diff --git a/notebooks/1-single-node.ipynb b/notebooks/1-single-node.ipynb index 55afeb33..935b997a 100644 --- a/notebooks/1-single-node.ipynb +++ b/notebooks/1-single-node.ipynb @@ -1 +1 @@ -{"metadata":{"kernelspec":{"display_name":"Python 3 (ipykernel)","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.13.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"6915218e-7cf3-4bf4-9618-7e6942b4762f","cell_type":"markdown","source":"# Single Node Executor\nThe `SingleNodeExecutor` in executorlib, is primarily used to enable rapid prototyping on a workstation computer to test your parallel Python program with executorlib before transferring it to an high performance computer (HPC). With the added capability of executorlib it is typically 10% slower than the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) from the Python standard library on a single node, when all acceleration features are enabled. This overhead is primarily related to the creation of new tasks. So the performance of executorlib improves when the individual Python function calls require extensive computations.\n\nAn advantage that executorlib has over the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) and the [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) from the Python standard libary, is the use of [cloudpickle](https://github.com/cloudpipe/cloudpickle) as serialization backend to transfer Python functions between processes. This enables the use of dynamically defined Python functions for example in the case of a Jupyter notebook. ","metadata":{}},{"id":"ccc686dd-8fc5-4755-8a19-f40010ebb1b8","cell_type":"markdown","source":"## Basic Functionality\nThe general functionality of executorlib follows the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) of the Python standard library. You can import the `SingleNodeExecutor` class directly from executorlib and then just replace the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) or [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) with the `SingleNodeExecutor` class to start using executorlib.","metadata":{}},{"id":"b1907f12-7378-423b-9b83-1b65fc0a20f5","cell_type":"code","source":"from executorlib import SingleNodeExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":1},{"id":"1654679f-38b3-4699-9bfe-b48cbde0b2db","cell_type":"markdown","source":"It is recommended to use the `SingleNodeExecutor` class in combination with a `with`-statement. This guarantees the processes created by the `SingleNodeExecutor` class to evaluate the Python functions are afterward closed and do not remain ghost processes. A function is then submitted using the `submit(fn, /, *args, **kwargs)` function which executes a given function `fn` as `fn(*args, **kwargs)`. The `submit()` function returns a [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object, as defined by the Python Standard Library. As a first example we submit the function `sum()` to calculate the sum of the list `[1, 1]`:","metadata":{}},{"id":"16f7d138-ed77-45ea-a554-d329f7237500","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\nCPU times: user 35.7 ms, sys: 38.1 ms, total: 73.8 ms\nWall time: 274 ms\n"}],"execution_count":2},{"id":"a1109584-9db2-4f9d-b3ed-494d96241396","cell_type":"markdown","source":"As expected the result of the summation `sum([1, 1])` is `2`. The same result is retrieved from the [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object received from the submission of the `sum()` as it is printed here `print(future.result())`. For most Python functions and especially the `sum()` function it is computationally not efficient to initialize the `SingleNodeExecutor` class only for the execution of a single function call, rather it is more computationally efficient to initialize the `SingleNodeExecutor` class once and then submit a number of functions. This can be achieved with a loop. For example the sum of the pairs `[2, 2]`, `[3, 3]` and `[4, 4]` can be achieved with a for-loop inside the context of the `SingleNodeExecutor()` class as provided by the `with`-statement.","metadata":{}},{"cell_type":"markdown","id":"9d4d4481-b637-4b15-aa14-0de62199411f","metadata":{},"source":["### Understanding Future Objects\n","Each call of the `submit()` function returns immediately - not with the result of the function but with a [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object. A `Future` is a placeholder for a result which is not yet available. The submitted function is executed in the background while the main Python program continues, this is what allows executorlib to evaluate many functions at the same time. The most important methods of a `Future` object are:\n","\n","| Method | Description |\n","|---|---|\n","| `future.result()` | Wait until the function is finished and return its result - or raise the exception if the function failed. |\n","| `future.done()` | Return `True` if the function already finished, without waiting for it. |\n","| `future.cancel()` | Try to cancel the function in case it has not started yet. |\n","\n","The key to parallel execution is to first submit all functions and only afterwards collect the results by calling `result()`. When `result()` is called directly after each `submit()`, the program waits for each function to finish before the next function is submitted, so the functions are executed one after another rather than in parallel. The example below illustrates this: directly after the submission the function is not yet finished, while after requesting the result with `result()` it is."]},{"cell_type":"code","execution_count":null,"id":"b653ab65-b6fb-40a2-999c-fa2a16f5d9aa","metadata":{"trusted":true},"outputs":[],"source":["with SingleNodeExecutor() as exe:\n"," future = exe.submit(sum, [1, 1])\n"," print(\"finished directly after submit:\", future.done())\n"," print(\"result:\", future.result())\n"," print(\"finished after result:\", future.done())"]},{"id":"cfccdf9a-b23b-4814-8c14-36703a8a5f9e","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(2, 5)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[4, 6, 8]\nCPU times: user 36.6 ms, sys: 10 ms, total: 46.6 ms\nWall time: 1.16 s\n"}],"execution_count":3},{"id":"7db58f70-8137-4f1c-a87b-0d282f2bc3c5","cell_type":"markdown","source":"If only the parameters change but the function, which is applied to these parameters, remains the same, like in the case above the `sum()` function is applied to three pairs of parameters, then the `map(fn, *iterables, timeout=None, chunksize=1)` function can be used to map the function to the different sets of parameters - as it is defined in the [Python standard library](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.map). ","metadata":{}},{"id":"abd0beb7-471d-490e-bb9c-96755bd7aacf","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n results = exe.map(sum, [[5, 5], [6, 6], [7, 7]])\n print(list(results))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[10, 12, 14]\nCPU times: user 35.4 ms, sys: 9.3 ms, total: 44.7 ms\nWall time: 1.2 s\n"}],"execution_count":4},{"id":"d07a3314-fbaf-4ff5-98dd-dea62194abcd","cell_type":"markdown","source":"The `map()` function also works naturally with [pandas](https://pandas.pydata.org) DataFrames. Rather than using `DataFrame.apply()` for row-wise operations, `map()` can be used to apply a function to each pair of values from two columns in parallel:","metadata":{}},{"id":"4e7d5ef4-6437-4fa2-b500-19b8cc53f377","cell_type":"code","source":"def sum_df(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":5},{"id":"1428ac7c-dd3c-48db-b41f-4ea975df2d78","cell_type":"code","source":"import pandas\n\ndf = pandas.DataFrame({\"a\": [1, 2, 3], \"b\": [4, 5, 6]})\n\nwith SingleNodeExecutor() as exe:\n df[\"c\"] = list(exe.map(sum_df, df[\"a\"], df[\"b\"]))\n print(df)","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":" a b c\n0 1 4 5\n1 2 5 7\n2 3 6 9\n"}],"execution_count":6},{"id":"ac86bf47-4eb6-4d7c-acae-760b880803a8","cell_type":"markdown","source":"These examples cover the general functionality of the `SingleNodeExecutor` class. Following the [Executor](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) interface as it is defined in the Python standard library.","metadata":{}},{"id":"5de0f0f2-bf5c-46b3-8171-a3a206ce6775","cell_type":"markdown","source":"## Parallel Functions\nWriting parallel software is not trivial. So rather than writing the whole Python program in a parallel way, executorlib allows developers to implement parallel execution on a function by function level. In this way individual functions can be replaced by parallel functions as needed without the need to modify the rest of the program. With the Local Mode executorlib supports two levels of parallel execution, parallel execution based on the Message Passing Interface (MPI) using the [mpi4py](https://mpi4py.readthedocs.io) package, or thread based parallel execution. Both levels of parallelism can be defined inside the function and do not require any modifications to the rest of the Python program. ","metadata":{}},{"id":"dc8e692f-bf6c-4838-bb82-6a6b8454a2e7","cell_type":"markdown","source":"### MPI Parallel Functions\nMPI is the default way to develop parallel programs for HPCs. Still it can be challenging to refactor a previously serial program to efficiently use MPI to achieve optimal computational efficiency for parallel execution, even with libraries like [mpi4py](https://mpi4py.readthedocs.io). To simplify the up-scaling of Python programs executorlib provides the option to use MPI parallel Python code inside a given Python function and then submit this parallel Python function to an `SingleNodeExecutor` for evaluation.\n\nThe following `calc_mpi()` function imports the [mpi4py](https://mpi4py.readthedocs.io) package and then uses the internal functionality of MPI to get the total number of parallel CPU cores in the current MPI group `MPI.COMM_WORLD.Get_size()` and the index of the current processor in the MPI group `MPI.COMM_WORLD.Get_rank()`.\n\nThe [mpi4py](https://mpi4py.readthedocs.io) package is an optional dependency of executorlib. The installation of the [mpi4py](https://mpi4py.readthedocs.io) package is covered in the installation section.","metadata":{}},{"id":"a251d083-489e-41c1-9e49-c86093858006","cell_type":"code","source":"def calc_mpi(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank","metadata":{"trusted":true},"outputs":[],"execution_count":7},{"id":"adbf8a10-04e1-4fd9-8768-4375bcba9ec3","cell_type":"markdown","source":"The computational resources for the execution of the `calc_mpi()` Python function are defined using the resource dictionary parameter `resource_dict={}`. The reseource dictionary can either be provided as additional parameter for the `submit()` function. It is important that the parameter name `resource_dict` is reserved exclusively for the `submit()` function and cannot be used in the function which is submitted, like the `calc_mpi()` function in this example:","metadata":{}},{"id":"266864f1-d29e-4934-9b5d-51f4ffb11f5c","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n fs = exe.submit(calc_mpi, 3, resource_dict={\"cores\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":8},{"id":"3a449e3f-d7a4-4056-a1d0-35dfca4dad22","cell_type":"markdown","source":"Another option is to set the resource dictionary parameter `resource_dict` during the initialization of the `Executor`. In this case it is internally set for every call of the `submit()` function, without the need to specify it again.","metadata":{}},{"id":"cb4ad978-bdf2-47bb-a7df-846641a54ec2","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"cores\": 2}) as exe:\n fs = exe.submit(calc_mpi, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":9},{"id":"c1d1d7b1-64fa-4e47-bbde-2a16036568d6","cell_type":"markdown","source":"In addition, to the compute cores `cores`, the resource dictionary parameter `resource_dict` can also define the threads per core as `threads_per_core`, the GPUs per core as `gpus_per_core`, the working directory with `cwd`, the option to use the OpenMPI oversubscribe feature with `openmpi_oversubscribe` and finally for the [Simple Linux Utility for Resource \nManagement (SLURM)](https://slurm.schedmd.com) queuing system the option to provide additional command line arguments with the `slurm_cmd_args` parameter - [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary).","metadata":{}},{"id":"4f5c5221-d99c-4614-82b1-9d6d3260c1bf","cell_type":"markdown","source":"### Thread Parallel Functions\nAn alternative option of parallelism is [thread based parallelism](https://docs.python.org/3/library/threading.html). executorlib supports thread based parallelism with the `threads_per_core` parameter in the resource dictionary `resource_dict`. Given the [global interpreter lock](https://docs.python.org/3/glossary.html#term-global-interpreter-lock) in the cPython implementation a common application of thread based parallelism in Python is using additional threads in linked libraries. The number of threads is commonly controlled with environment variables like `OMP_NUM_THREADS`, `OPENBLAS_NUM_THREADS`, `MKL_NUM_THREADS`, `VECLIB_MAXIMUM_THREADS` and `NUMEXPR_NUM_THREADS`. Specific libraries might require other environment variables. The environment variables can be set using the environment interface of the Python standard library `os.environ`.","metadata":{}},{"id":"7a7d21f6-9f1a-4f30-8024-9993e156dc75","cell_type":"code","source":"def calc_with_threads(i):\n import os\n\n os.environ[\"OMP_NUM_THREADS\"] = \"2\"\n os.environ[\"OPENBLAS_NUM_THREADS\"] = \"2\"\n os.environ[\"MKL_NUM_THREADS\"] = \"2\"\n os.environ[\"VECLIB_MAXIMUM_THREADS\"] = \"2\"\n os.environ[\"NUMEXPR_NUM_THREADS\"] = \"2\"\n import numpy as np\n\n return i","metadata":{"trusted":true},"outputs":[],"execution_count":10},{"id":"82ed8f46-836c-402e-9363-be6e16c2a0b0","cell_type":"markdown","source":"Again the resource dictionary parameter `resource_dict` can be set either in the `submit()` function:","metadata":{}},{"id":"b8ed330d-ee77-44a0-a02f-670fa945b043","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n fs = exe.submit(calc_with_threads, 3, resource_dict={\"threads_per_core\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"3\n"}],"execution_count":11},{"id":"63222cd5-664b-4aba-a80c-5814166b1239","cell_type":"markdown","source":"Or alternatively, the resource dictionary parameter `resource_dict` can also be set during the initialization of the `Executor` class:","metadata":{}},{"id":"31562f89-c01c-4e7a-bbdd-fa26ca99e68b","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"threads_per_core\": 2}) as exe:\n fs = exe.submit(calc_with_threads, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"3\n"}],"execution_count":12},{"id":"8b78a7b4-066e-4cbc-858e-606c8bbbbf0c","cell_type":"markdown","source":"For most cases MPI based parallelism leads to higher computational efficiency in comparison to thread based parallelism, still the choice of parallelism depends on the specific Python function which should be executed in parallel. Careful benchmarks are required to achieve the optimal performance for a given computational architecture. \n\nBeyond MPI based parallelism and thread based parallelism the [HPC Cluster Executors](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html) and the [HPC Job Executors](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) also provide the option to assign GPUs to the execution of individual Python functions.","metadata":{}},{"id":"ca9bc450-2762-4d49-b7f8-48cc83e068fd","cell_type":"markdown","source":"## Performance Optimization\nThe default settings of executorlib are chosen to favour stability over performance. Consequently, the performance of executorlib can be improved by setting additional parameters. It is commonly recommended to start with an initial implementation based on executorlib and then improve the performance by enabling specialized features.","metadata":{}},{"id":"e9b52ecf-3984-4695-98e7-315aa3712104","cell_type":"markdown","source":"### Block Allocation\nBy default each submitted Python function is executed in a dedicated process. This gurantees that the execution of the submitted Python function starts with a fresh process. Still the initialization of the Python process takes time. Especially when the call of the Python function requires only limited computational resources it makes sense to reuse the existing Python process for the execution of multiple Python functions. In executorlib this functionality is enabled by setting the `block_allocation` parameter to `Ture`. To limit the number of parallel Python processes when using block allocation it is recommended to set the `max_workers` parameter to restrict the number of available computing resources. ","metadata":{}},{"id":"0da4c7d0-2268-4ea8-b62d-5d94c79ebc72","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(max_workers=2, block_allocation=True) as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\nCPU times: user 31.5 ms, sys: 11.5 ms, total: 43 ms\nWall time: 709 ms\n"}],"execution_count":13},{"id":"d38163b3-1c04-431c-964b-2bad4f823a4d","cell_type":"markdown","source":"The same functionality also applies to MPI parallel Python functions. The important part is that while it is possible to assign more than one Python process to the execution of a Python function in block allocation mode, it is not possible to assign resources during the submission of the function with the `submit()` function. Starting again with the `calc_mpi()` function: ","metadata":{}},{"id":"cb8c4943-4c78-4203-95f2-1db758e588d9","cell_type":"code","source":"def calc_mpi(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank","metadata":{"trusted":true},"outputs":[],"execution_count":14},{"id":"9e1212c4-e3fb-4e21-be43-0a4f0a08b856","cell_type":"markdown","source":"Still the resource dictionary parameter can still be set during the initialisation of the `SingleNodeExecutor` class. Internally, this groups the created Python processes in fixed allocations and afterwards submit Python functions to these allocations.","metadata":{}},{"id":"5ebf7195-58f9-40f2-8203-2d4b9f0e9602","cell_type":"code","source":"with SingleNodeExecutor(max_workers=2, resource_dict={\"cores\": 2}, block_allocation=True) as exe:\n fs = exe.submit(calc_mpi, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":15},{"id":"b75fb95f-f2f5-4be9-9f2a-9c2e9961c644","cell_type":"markdown","source":"The weakness of memory from a previous Python function remaining in the Python process can at the same time be an advantage for working with large datasets. In executorlib this is achieved by introducing the `init_function` parameter. The `init_function` returns a dictionary of parameters which can afterwards be reused as keyword arguments `**kwargs` in the functions submitted to the `Executor`. When block allocation `block_allocation` is disabled this functionality is not available, as each function is executed in a separate process, so no data can be preloaded.","metadata":{}},{"id":"8aa754cc-eb1a-4fa1-bd72-272246df1d2f","cell_type":"code","source":"def init_function():\n return {\"j\": 4, \"k\": 3, \"l\": 2}","metadata":{"trusted":true},"outputs":[],"execution_count":16},{"id":"1854895a-7239-4b30-b60d-cf1a89234464","cell_type":"code","source":"def calc_with_preload(i, j, k):\n return i + j + k","metadata":{"trusted":true},"outputs":[],"execution_count":17},{"id":"d07cf107-3627-4cb0-906c-647497d6e0d2","cell_type":"markdown","source":"The function `calc_with_preload()` requires three inputs `i`, `j` and `k`. But when the function is submitted to the executor only two inputs are provided `fs = exe.submit(calc, 2, j=5)`. In this case the first input parameter is mapped to `i=2`, the second input parameter is specified explicitly `j=5` but the third input parameter `k` is not provided. So the `SingleNodeExecutor` automatically checks the keys set in the `init_function()` function. In this case the returned dictionary `{\"j\": 4, \"k\": 3, \"l\": 2}` defines `j=4`, `k=3` and `l=2`. For this specific call of the `calc_with_preload()` function, `i` and `j` are already provided so `j` is not required, but `k=3` is used from the `init_function()` and as the `calc_with_preload()` function does not define the `l` parameter this one is also ignored.","metadata":{}},{"id":"cc648799-a0c6-4878-a469-97457bce024f","cell_type":"code","source":"with SingleNodeExecutor(max_workers=2, init_function=init_function, block_allocation=True) as exe:\n fs = exe.submit(calc_with_preload, 2, j=5)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"10\n"}],"execution_count":18},{"id":"1073b8ca-1492-46e9-8d1f-f52ad48d28a2","cell_type":"markdown","source":"The result is `2+5+3=10` as `i=2` and `j=5` are provided during the submission and `k=3` is defined in the `init_function()` function.","metadata":{}},{"id":"24397d78-dff1-4834-830c-a8f390fe6b9c","cell_type":"markdown","source":"### Cache\nThe development of scientific workflows is commonly an interactive process, extending the functionality step by step. This lead to the development of interactive environments like [Jupyter](https://jupyter.org) which is fully supported by executorlib. Still many of the computationally intensive Python functions can take in the order of minutes to hours or even longer to execute, so reusing an existing Python process is not feasible. To address this challenge executorlib provides a file based cache to store the results of previously computed [concurrent future Futures](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects. The results are serialized using [cloudpickle](https://github.com/cloudpipe/cloudpickle) and stored in a user-defined cache directory `cache_directory` to be reloaded later on. Internally, the hierarchical data format (HDF5) is used via the [h5py](https://www.h5py.org), which is an optional dependency for executorlib. \n\nThe [h5py](https://www.h5py.org) package is an optional dependency of executorlib. The installation of the [h5py](https://www.h5py.org) package is covered in the installation section. ","metadata":{}},{"id":"ecdcef49-5c89-4538-b377-d53979673bf7","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(cache_directory=\"./file\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[2, 4, 6]\nCPU times: user 84.3 ms, sys: 33.6 ms, total: 118 ms\nWall time: 1.35 s\n"}],"execution_count":19},{"id":"32d0fb2e-5ac1-4249-b6c8-953c92fdfded","cell_type":"markdown","source":"When the same code is executed again, executorlib finds the existing results in the cache directory specified by the `cache_directory` parameter and reloads the result, accelerating the computation especially during the prototyping phase when similar computations are repeated frequently for testing. \n\nStill it is important to mention, that this cache is not designed to identify the submission of the same parameters within the context of one `with`-statement. It is the task of the user to minimize duplicate computations, the cache is only designed to restore previous calculation results when the Python process managing executorlib was stopped after the successful execution. ","metadata":{}},{"id":"c39babe8-4370-4d31-9520-9a7ce63378c8","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(cache_directory=\"./file\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[2, 4, 6]\nCPU times: user 44.2 ms, sys: 15.5 ms, total: 59.7 ms\nWall time: 1.3 s\n"}],"execution_count":20},{"id":"5144a035-633e-4e60-a362-f3b15b28848b","cell_type":"markdown","source":"An additional advantage of the cache is the option to gather the results of previously submitted functions. Using the `get_cache_data()` function the results of each Python function is converted to a dictionary. This list of dictionaries can be converted to a `pandas.DataFrame` for further processing:","metadata":{}},{"id":"f574b9e1-de55-4e38-aef7-a4bed540e040","cell_type":"code","source":"import pandas\nfrom executorlib import get_cache_data\n\ndf = pandas.DataFrame(get_cache_data(cache_directory=\"./file\"))\ndf","metadata":{"trusted":true},"outputs":[{"execution_count":21,"output_type":"execute_result","data":{"text/plain":" function input_args input_kwargs output resource_dict \\\n0 ([2, 2],) {} 4 {} \n1 ([3, 3],) {} 6 {} \n2 ([1, 1],) {} 2 {} \n\n runtime filename \n0 0.910742 /home/jovyan/file/sum89afbdf9da5eb1794f6976a3f... \n1 0.911247 /home/jovyan/file/sum0f7710227cda6456e5d071877... \n2 0.908284 /home/jovyan/file/sumf5ad27b855231a293ddd735a8... ","text/html":"
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
functioninput_argsinput_kwargsoutputresource_dictruntimefilename
0<built-in function sum>([2, 2],){}4{}0.910742/home/jovyan/file/sum89afbdf9da5eb1794f6976a3f...
1<built-in function sum>([3, 3],){}6{}0.911247/home/jovyan/file/sum0f7710227cda6456e5d071877...
2<built-in function sum>([1, 1],){}2{}0.908284/home/jovyan/file/sumf5ad27b855231a293ddd735a8...
\n
"},"metadata":{}}],"execution_count":21},{"id":"68092479-e846-494a-9ac9-d9638b102bd8","cell_type":"markdown","source":"After the development phase is concluded it is the task of the user to remove the cache directory defined with the `cache_directory` parameter. The cache directory is never removed by executorlib to prevent the repeation of expensive computations. Still as disk space on shared file systems in HPC environments is commonly limited it is recommended to remove the cache directory once the development process concluded. ","metadata":{}},{"id":"34a9316d-577f-4a63-af14-736fb4e6b219","cell_type":"code","source":"import os\nimport shutil\n\ncache_dir = \"./file\"\nif os.path.exists(cache_dir):\n print(os.listdir(cache_dir))\n try:\n shutil.rmtree(cache_dir)\n except OSError:\n pass","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"['sum89afbdf9da5eb1794f6976a3f01697c2_o.h5', 'sum0f7710227cda6456e5d07187702313f3_o.h5', 'sumf5ad27b855231a293ddd735a8554c9ea_o.h5']\n"}],"execution_count":22},{"id":"1cea95b5-4110-444c-82af-fa6718bfa17f","cell_type":"markdown","source":"Typically the use of the cache is recommended for development processes only and for production workflows the user should implement their own long-term storage solution. The binary format used by executorlib is based on [cloudpickle](https://github.com/cloudpipe/cloudpickle) and might change in future without further notice, rendering existing data in the cache unusable. Consequently, using the cache beyond the development process is not recommended. In addition the writing of the results to files might result in additional overhead for accessing the shared file system. ","metadata":{}},{"id":"71a8a0be-a933-4e83-9da5-50da35e9975b","cell_type":"markdown","source":"### Dependencies\nMany scientific Python programs consist of series of Python function calls with varying level of parallel computations or map-reduce patterns where the same function is first mapped to a number of parameters and afterwards the results are reduced in a single function. To extend the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) of the Python standard library to support this programming pattern, the `SingleNodeExecutor` class from executorlib supports submitting Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) objects to the `SingleNodeExecutor` which are resolved before submission. So the `SingleNodeExecutor` internally waits until all Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) objects are successfully executed before it triggers the execution of the submitted Python function.","metadata":{}},{"id":"d8b75a26-479d-405e-8895-a8d56b3f0f4b","cell_type":"code","source":"def calc_add(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":23},{"id":"36118ae0-c13c-4f7a-bcd3-3d7f4bb5a078","cell_type":"markdown","source":"For example the function which adds two numbers `calc_add()` is used in a loop which adds a counter to the previous numbers. In the first iteration the `future` parameter is set to `0` but already in the second iteration it is the Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object of the first iteration and so on. \n\nThe important part is that the user does not have to wait until the first function is executed but instead the waiting happens internally in the `SingleNodeExecutor`.","metadata":{}},{"id":"35fd5747-c57d-4926-8d83-d5c55a130ad6","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future = 0\n for i in range(1, 4):\n future = exe.submit(calc_add, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"6\n"}],"execution_count":24},{"id":"38e1bbb3-1028-4f50-93c1-d2427f399a7d","cell_type":"markdown","source":"As the reusing of existing [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object can lead to rather complex dependencies, executorlib provides the option to plot the dependency graph by setting the `plot_dependency_graph=True` during the initialization of the `SingleNodeExecutor` class.\n\nNo computation is executed when the `plot_dependency_graph=True` is set. This parameter is for debugging only. \n\nInternally, the [pygraphviz](https://pygraphviz.github.io/documentation/stable) package is used for the visualisation of these dependency graphs. It is an optional dependency of executorlib. The installation of the [pygraphviz](https://pygraphviz.github.io/documentation/stable) package is covered in the installation section. ","metadata":{}},{"id":"f67470b5-af1d-4add-9de8-7f259ca67324","cell_type":"code","source":"with SingleNodeExecutor(plot_dependency_graph=True) as exe:\n future = 0\n for i in range(1, 4):\n future = exe.submit(calc_add, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"None\n"},{"output_type":"display_data","data":{"text/plain":"","image/svg+xml":"\n\n\n\n\n0\n\ncalc_add\n\n\n\n1\n\ncalc_add\n\n\n\n0->1\n\n\nb\n\n\n\n2\n\ncalc_add\n\n\n\n1->2\n\n\nb\n\n\n\n3\n\n1\n\n\n\n3->0\n\n\na\n\n\n\n4\n\n0\n\n\n\n4->0\n\n\nb\n\n\n\n5\n\n2\n\n\n\n5->1\n\n\na\n\n\n\n6\n\n3\n\n\n\n6->2\n\n\na\n\n\n"},"metadata":{}}],"execution_count":25},{"id":"4c952a9d-2b58-401d-b7ec-fda740db774a","cell_type":"markdown","source":"## Advanced Scheduling\nGoing beyond just directed acyclic graphs (DAG) with one-to-many and many-to-one relationships, executorlib provides a number of advanced scheduling patterns. These are briefly introduced in the following.","metadata":{}},{"id":"4db2c87c-9a7d-4074-82d0-24357fa4f0e6","cell_type":"markdown","source":"### Runtime-dependent Batching \nTo maximize the throughput of dependent calculation tasks its important to idenify all tasks which can be executed at a given moment. Unfortunately, some of these dependencies can only be determined at run time, which is challenging for most schedulers. To demonstrate the runtime-dependent batching in executorlib we discuss the following example. Starting with a group of ten tasks and then grouping them into groups of three for processing. Still the order of the tasks, which tasks belong into which group, is only determined at run time. \n\nFor simplicity, we just use a simple function which directly returns the input.","metadata":{}},{"id":"857a5e0f-50d6-45ec-aac7-a7151f36c19f","cell_type":"code","source":"def reply(i):\n return i","metadata":{"trusted":true},"outputs":[],"execution_count":26},{"id":"544dacab-5601-4a9b-814f-88560eafb079","cell_type":"markdown","source":"After the group of ten tasks is submitted their future objects are stored in a list named `future_individual_lst`. This list is then provided to the `batched()` function of the `SingleNodeExecutor()` to generate batches of tasks which are then provided to the `sum` function for further processing. The results of this second step are stored in the `future_group_lst`. Finally, the results of these future objects are evaluated in the third step. ","metadata":{}},{"id":"17d1354a-0943-4b62-9b0d-7d39c8df23f2","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future_individual_lst = [\n exe.submit(reply, i) for i in range(10)\n ]\n future_group_lst = [\n exe.submit(sum, f) for f in exe.batched(future_individual_lst, n=3)\n ]\n print(sum([f.result() for f in future_group_lst]))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"45\n"}],"execution_count":27},{"id":"80e8b154-d659-4f3e-add2-701a454d770d","cell_type":"markdown","source":"### Split Future Objects\nIn analogy to the `batched()` function which combines multiple future objects in a batch for further processing, it is also necessary to split the future objects even before the evaluation is completed. Executorlib provides two utility functions, namely `split_future()` for tuples and lists and `get_item_from_future()` for dictionaries. \n\nStarting with a function which returns a tuple, named `get_a_tuple()`:","metadata":{}},{"id":"6ef541e3-a2be-4e05-9e77-65eaceff4248","cell_type":"code","source":"def get_a_tuple(i):\n return \"a\", \"b\", i","metadata":{"trusted":true},"outputs":[],"execution_count":28},{"id":"dd3e4312-1594-4b3b-baf3-5b3121ca8910","cell_type":"markdown","source":"This function is submitted to the `SingleNodeExecutor()` and while in this case it directly returns the tuple, the evaluation would commonly take much longer. By having the ability to split the output of the future object using the `split_future()` function, a number of future objects is generated one for each element of the tuple. This is enabled by providing the number of elements in the tuple as an additional parameter `n=3`. ","metadata":{}},{"id":"927c5931-d7fd-4bc1-ae0e-3dd2f4bc99ce","cell_type":"code","source":"from executorlib import split_future","metadata":{"trusted":true},"outputs":[],"execution_count":29},{"id":"64a9b46e-0de6-4abb-99d9-8aaa0c6cbccb","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future = exe.submit(get_a_tuple, 15)\n f1, f2, f3 = split_future(future=future, n=3)\n print(f1.result(), f2.result(), f3.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"a b 15\n"}],"execution_count":30},{"id":"a10d8f90-e790-4708-b193-90a7f014d699","cell_type":"markdown","source":"In analogy, to the `split_future()` function for lists and tuples, the `get_item_from_future()` function returns one item of a dicitionary which is returned by a function submitted to an `Executor()`. In this example the `get_a_dict()` function returns a dictionary, again in this example the dictionary is returned directly while commonly this would take much longer. ","metadata":{}},{"id":"51ec4dbf-d009-41c9-bc04-cf1b16fe782f","cell_type":"code","source":"def get_a_dict(i):\n return {\"a\": 1, \"b\": 2, \"c\": i}","metadata":{"trusted":true},"outputs":[],"execution_count":31},{"id":"5c90ab75-2a6b-4fbe-a7ee-7f91b2b4af43","cell_type":"markdown","source":"The `get_a_dict()` function is submitted to the `SingleNodeExecutor()`, it returns a future object named `future_dict`. Still as we know that the `result()` of this future object `future_dict` returns a dictionary, we can already access the items of this dictionary with the `get_item_from_future()` function. The `get_item_from_future()` function takes a future object as input in addition to the `key` of the dictionary which should be accessed, as a result the `get_item_from_future()` function returns a future object for the value related to the key. In this example these future objects are named `f1`, `f2` and `f3`. These fucture objects are evaluated afterwards.","metadata":{}},{"id":"a41251d2-a840-4c12-9625-c2e0585c489b","cell_type":"code","source":"from executorlib import get_item_from_future","metadata":{"trusted":true},"outputs":[],"execution_count":32},{"id":"a6e75c5e-ad0c-4723-99c5-8125b63fbeaf","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future_dict = exe.submit(get_a_dict, 15)\n f1 = get_item_from_future(future=future_dict, key=\"a\")\n f2 = get_item_from_future(future=future_dict, key=\"b\")\n f3 = get_item_from_future(future=future_dict, key=\"c\")\n print(f1.result(), f2.result(), f3.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"1 2 15\n"}],"execution_count":33},{"id":"a945c98d-dc73-4284-9d8c-52475a760f6b","cell_type":"markdown","source":"### Recursion\nIn addition to the `map()` function for parallel loops and the option to integrate `while` loops directly in the submission, it is sometimes helpful to use recursive algorthims to accelerate scientific simulation and analysis. To demonstrate the use of executorlib in combination with recursive algorithms, the quicksort algorithm is demonstrated. \n\nThe quicksort algorithm is implemented in two parts, a `quick_sort()` which splits the input `sequence` into two sets, one lower and one larger than the pivot element of the `sequence`. After the initial execution the `quick_sort()` function is again applied to both resulting sets until only a single element remains in the `sequence`. In this case the single element is returned. The pivot is defined as the first element of the `sequence`.\n\nTo simplify the submission of the `quick_sort()` function to the `SingleNodeExecutor()` dictionaries are used as return types, these dictionaries either contain only a single item with the key `\"result\"` when only a single element remains in the list, or three items, one `\"left\"` for a list lower than the pivot, one `\"right\"` for the items larger than the pivot and the `\"result\"` for the pivot itself. ","metadata":{}},{"id":"08b0c0a1-34ad-4b2a-847c-fe9c96956b27","cell_type":"code","source":"def quick_sort(sequence):\n length = len(sequence)\n if length <= 1:\n return {\"result\": sequence}\n else:\n pivot = sequence.pop() \n \n greater_items = []\n lesser_items = []\n\n for item in sequence:\n if item > pivot:\n greater_items.append(item)\n else:\n lesser_items.append(item)\n\n return {\"left\": lesser_items, \"right\": greater_items, \"result\": [pivot]}","metadata":{"trusted":true},"outputs":[],"execution_count":34},{"id":"54a8a765-0b9f-424a-86e5-8024c4d59018","cell_type":"markdown","source":"To enable the recursive submission to the `SingleNodeExecutor()` a `recusive_submit()` function is defined using the [asynchronous IO module](https://docs.python.org/3/library/asyncio.html) of the Python standard libary, indicated by the `async` keyword ahead of the function definition. It takes a `function`, the `sequence` and the `executor` as inputs. As a first step the function is submitted to the `executor` and the execution is halted until the first result is available by wrapping the future object using the `wrap_future()` function of the `asyncio` package and appling the `await` function. Then the corresponding result dictionary `result_dict` is evaluated: If the `result_dict` contains more than one key, then the `recusive_submit()` is evaluated for both the left side with lower values than the pivot element and the right side with elements higher than the pivot element. Again in both cases the `await` keyword is used to enable the parallel execution of both branches at the same time. Afterwards the result of both sides is combined with the pivot element. For the case that the dictionary only contains a single element, it is returned directly. ","metadata":{}},{"id":"4e142829-c9de-4969-ab3c-97f3e1ada90c","cell_type":"code","source":"import asyncio\n\nasync def recusive_submit(function, sequence, executor):\n result_dict = await asyncio.wrap_future(exe.submit(function, sequence))\n if len(result_dict) > 1:\n left = await recusive_submit(function=function, sequence=result_dict[\"left\"], executor=executor)\n right = await recusive_submit(function=function, sequence=result_dict[\"right\"], executor=executor)\n return left + result_dict[\"result\"] + right\n else:\n return result_dict[\"result\"]","metadata":{"trusted":true},"outputs":[],"execution_count":35},{"id":"531a8f7d-5b21-46d0-b632-32a1568571c8","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n loop = asyncio.get_event_loop()\n task = loop.create_task(recusive_submit(function=quick_sort, sequence=[0,9,3,8,2,7,5], executor=exe))\n print(await task)","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[0, 2, 3, 5, 7, 8, 9]\n"}],"execution_count":36},{"id":"725c8ac2-27e4-495b-b061-1fd6053f4c0b","cell_type":"markdown","source":"## Testing and Debugging\nThe up-scaling of Python functions from a single workstation to an High Performance Computer (HPC) can be challenging, so executorlib provides a number of debugging utilities to help you optimize your functions for execution with executorlib. ","metadata":{}},{"id":"2c96b460-ebd2-4c8a-a5e1-922a860808ab","cell_type":"markdown","source":"### Measure Data Transferred \nTransferring a large amount of data between two processes requires additional resources so it is helpful to measure the data transferred between the frontend and backend process. This is achieved by setting the `log_obj_size` parameter to `True`:","metadata":{}},{"id":"71905acf-2fef-4738-82ae-89e35e2e3d2d","cell_type":"code","source":"from executorlib import SingleNodeExecutor\n\nwith SingleNodeExecutor(log_obj_size=True) as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stderr","output_type":"stream","text":"Send dictionary of size: 101\nReceived dictionary of size: 59\nSend dictionary of size: 69\nReceived dictionary of size: 58\n"},{"name":"stdout","output_type":"stream","text":"2\n"}],"execution_count":37},{"id":"0e9f7192-2b7d-4caf-b2b8-ae9cb060e90f","cell_type":"markdown","source":"### Write Log Files\nLibraries like executorlib are commonly used to sample a large parameter space, in this case it is possible that out of a large number of parameters one combination throws an error. This error can be logged in a file which also contains the function and input parameters using the `\"error_log_file\"` parameter in the `resource_dict`. This allows to change the log file on a per-function bases.","metadata":{}},{"id":"2810acd5-a46e-4d85-b447-945248ffca15","cell_type":"code","source":"from executorlib import SingleNodeExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":38},{"id":"ef6b87a7-361e-4a3f-bad3-72ad87968e8c","cell_type":"code","source":"def my_funct(i, j): \n if i == 2 and j == 2:\n raise ValueError()\n else: \n return i * j + i + j","metadata":{"trusted":true},"outputs":[],"execution_count":39},{"id":"209ff76b-913a-46f7-9fff-250e207898b2","cell_type":"markdown","source":"A try and except statement is added to prevent the jupyter notebook from crashing:","metadata":{}},{"id":"30381a00-30cc-45a2-82ff-17371339f5c7","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"error_log_file\": \"error.out\"}) as exe:\n future_lst = []\n for i in range(4):\n for j in range(4):\n future_lst.append(exe.submit(my_funct, i=i, j=j))\n try:\n print([f.result() for f in future_lst])\n except ValueError:\n pass","metadata":{"trusted":true},"outputs":[],"execution_count":40},{"id":"36bfc556-aa86-4b50-972b-4b8f68ceec3d","cell_type":"markdown","source":"The content of the log file is a basic text file, so it can be read with any kind of file utility. The important part is that the log file contains not only the error message but in addition also the function name and the input parameters in the case `kwargs: {'i': 2, 'j': 2}` which helps for future debugging of the sampling function.","metadata":{}},{"id":"a61c06fc-3029-48ed-895f-9f6c065b7c47","cell_type":"code","source":"with open(\"error.out\") as f:\n content = f.readlines()","metadata":{"trusted":true},"outputs":[],"execution_count":41},{"id":"6a6cd10f-6fe3-4a17-a8e6-2536feb9a11a","cell_type":"code","source":"content","metadata":{"trusted":true},"outputs":[{"execution_count":42,"output_type":"execute_result","data":{"text/plain":"['function: \\n',\n 'args: ()\\n',\n \"kwargs: {'i': 2, 'j': 2}\\n\",\n 'Traceback (most recent call last):\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/backend/interactive_serial.py\", line 56, in main\\n',\n ' output = call_funct(input_dict=input_dict, funct=None, memory=memory)\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/standalone/interactive/backend.py\", line 33, in call_funct\\n',\n ' return funct(input_dict[\"fn\"], *input_dict[\"args\"], **input_dict[\"kwargs\"])\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/standalone/interactive/backend.py\", line 22, in funct\\n',\n ' return args[0].__call__(*args[1:], **kwargs)\\n',\n ' ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^\\n',\n ' File \"/tmp/ipykernel_463/3167739528.py\", line 3, in my_funct\\n',\n 'ValueError\\n']"},"metadata":{}}],"execution_count":42},{"id":"5aff120a-317f-47d4-9639-8eccfb136117","cell_type":"code","source":"import os\n\nif os.path.exists(\"error.out\"):\n os.remove(\"error.out\")","metadata":{"trusted":true},"outputs":[],"execution_count":43},{"id":"44cd41d7-4417-429e-8481-f2a49e5f769c","cell_type":"markdown","source":"### TestClusterExecutor\nWhile the `SingleNodeExecutor` internally behaves very similar to the `FluxJobExecutor` and `SlurmJobExecutor` the `FluxClusterExecutor` and `SlurmClusterExecutor` behave very different as they use the file system to exchange information rather than socket-based communication. This can lead to complications when it comes to debugging. To address this challenge executorlib provides the `TestClusterExecutor` which can be executed on a local workstation just like the `SingleNodeExecutor` but in the background it uses the same file based communication like the `SlurmClusterExecutor` and the `FluxClusterExecutor`:","metadata":{}},{"id":"2ae29fb0-54e5-468f-8727-a179b6ed363e","cell_type":"code","source":"from executorlib.api import TestClusterExecutor\n\nwith TestClusterExecutor(cache_directory=\"test\") as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\n"}],"execution_count":44}]} \ No newline at end of file +{"metadata":{"kernelspec":{"display_name":"Python 3 (ipykernel)","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.13.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"6915218e-7cf3-4bf4-9618-7e6942b4762f","cell_type":"markdown","source":"# Single Node Executor\nThe `SingleNodeExecutor` in executorlib, is primarily used to enable rapid prototyping on a workstation computer to test your parallel Python program with executorlib before transferring it to an high performance computer (HPC). With the added capability of executorlib it is typically 10% slower than the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) from the Python standard library on a single node, when all acceleration features are enabled. This overhead is primarily related to the creation of new tasks. So the performance of executorlib improves when the individual Python function calls require extensive computations.\n\nAn advantage that executorlib has over the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) and the [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) from the Python standard libary, is the use of [cloudpickle](https://github.com/cloudpipe/cloudpickle) as serialization backend to transfer Python functions between processes. This enables the use of dynamically defined Python functions for example in the case of a Jupyter notebook. \n\nThe `SingleNodeExecutor` supports the same `submit()` interface, resource dictionary `resource_dict`, dependency handling and cache directory `cache_directory` as the HPC executors. A workflow developed with the `SingleNodeExecutor` can therefore be transferred to an HPC cluster by replacing the executor class and adding the cluster-specific settings. The [Getting Started on HPC](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html) guide demonstrates this transition for a typical HPC workflow, while the examples in this chapter can be executed without access to an HPC cluster.","metadata":{}},{"id":"ccc686dd-8fc5-4755-8a19-f40010ebb1b8","cell_type":"markdown","source":"## Basic Functionality\nThe general functionality of executorlib follows the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) of the Python standard library. You can import the `SingleNodeExecutor` class directly from executorlib and then just replace the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) or [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) with the `SingleNodeExecutor` class to start using executorlib.","metadata":{}},{"id":"b1907f12-7378-423b-9b83-1b65fc0a20f5","cell_type":"code","source":"from executorlib import SingleNodeExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":1},{"id":"1654679f-38b3-4699-9bfe-b48cbde0b2db","cell_type":"markdown","source":"It is recommended to use the `SingleNodeExecutor` class in combination with a `with`-statement. This guarantees the processes created by the `SingleNodeExecutor` class to evaluate the Python functions are afterward closed and do not remain ghost processes. A function is then submitted using the `submit(fn, /, *args, **kwargs)` function which executes a given function `fn` as `fn(*args, **kwargs)`. The `submit()` function returns a [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object, as defined by the Python Standard Library. As a first example we submit the function `sum()` to calculate the sum of the list `[1, 1]`:","metadata":{}},{"id":"16f7d138-ed77-45ea-a554-d329f7237500","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\nCPU times: user 35.7 ms, sys: 38.1 ms, total: 73.8 ms\nWall time: 274 ms\n"}],"execution_count":2},{"id":"a1109584-9db2-4f9d-b3ed-494d96241396","cell_type":"markdown","source":"As expected the result of the summation `sum([1, 1])` is `2`. The same result is retrieved from the [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object received from the submission of the `sum()` as it is printed here `print(future.result())`. For most Python functions and especially the `sum()` function it is computationally not efficient to initialize the `SingleNodeExecutor` class only for the execution of a single function call, rather it is more computationally efficient to initialize the `SingleNodeExecutor` class once and then submit a number of functions. This can be achieved with a loop. For example the sum of the pairs `[2, 2]`, `[3, 3]` and `[4, 4]` can be achieved with a for-loop inside the context of the `SingleNodeExecutor()` class as provided by the `with`-statement.","metadata":{}},{"cell_type":"markdown","id":"9d4d4481-b637-4b15-aa14-0de62199411f","metadata":{},"source":["### Understanding Future Objects\n","Each call of the `submit()` function returns immediately - not with the result of the function but with a [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object. A `Future` is a placeholder for a result which is not yet available. The submitted function is executed in the background while the main Python program continues, this is what allows executorlib to evaluate many functions at the same time. The most important methods of a `Future` object are:\n","\n","| Method | Description |\n","|---|---|\n","| `future.result()` | Wait until the function is finished and return its result - or raise the exception if the function failed. |\n","| `future.done()` | Return `True` if the function already finished, without waiting for it. |\n","| `future.cancel()` | Try to cancel the function in case it has not started yet. |\n","\n","The key to parallel execution is to first submit all functions and only afterwards collect the results by calling `result()`. When `result()` is called directly after each `submit()`, the program waits for each function to finish before the next function is submitted, so the functions are executed one after another rather than in parallel. The example below illustrates this: directly after the submission the function is not yet finished, while after requesting the result with `result()` it is."]},{"cell_type":"code","execution_count":null,"id":"b653ab65-b6fb-40a2-999c-fa2a16f5d9aa","metadata":{"trusted":true},"outputs":[],"source":["with SingleNodeExecutor() as exe:\n"," future = exe.submit(sum, [1, 1])\n"," print(\"finished directly after submit:\", future.done())\n"," print(\"result:\", future.result())\n"," print(\"finished after result:\", future.done())"]},{"id":"cfccdf9a-b23b-4814-8c14-36703a8a5f9e","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(2, 5)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[4, 6, 8]\nCPU times: user 36.6 ms, sys: 10 ms, total: 46.6 ms\nWall time: 1.16 s\n"}],"execution_count":3},{"id":"7db58f70-8137-4f1c-a87b-0d282f2bc3c5","cell_type":"markdown","source":"If only the parameters change but the function, which is applied to these parameters, remains the same, like in the case above the `sum()` function is applied to three pairs of parameters, then the `map(fn, *iterables, timeout=None, chunksize=1)` function can be used to map the function to the different sets of parameters - as it is defined in the [Python standard library](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.map). ","metadata":{}},{"id":"abd0beb7-471d-490e-bb9c-96755bd7aacf","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n results = exe.map(sum, [[5, 5], [6, 6], [7, 7]])\n print(list(results))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[10, 12, 14]\nCPU times: user 35.4 ms, sys: 9.3 ms, total: 44.7 ms\nWall time: 1.2 s\n"}],"execution_count":4},{"id":"d07a3314-fbaf-4ff5-98dd-dea62194abcd","cell_type":"markdown","source":"The `map()` function also works naturally with [pandas](https://pandas.pydata.org) DataFrames. Rather than using `DataFrame.apply()` for row-wise operations, `map()` can be used to apply a function to each pair of values from two columns in parallel:","metadata":{}},{"id":"4e7d5ef4-6437-4fa2-b500-19b8cc53f377","cell_type":"code","source":"def sum_df(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":5},{"id":"1428ac7c-dd3c-48db-b41f-4ea975df2d78","cell_type":"code","source":"import pandas\n\ndf = pandas.DataFrame({\"a\": [1, 2, 3], \"b\": [4, 5, 6]})\n\nwith SingleNodeExecutor() as exe:\n df[\"c\"] = list(exe.map(sum_df, df[\"a\"], df[\"b\"]))\n print(df)","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":" a b c\n0 1 4 5\n1 2 5 7\n2 3 6 9\n"}],"execution_count":6},{"id":"ac86bf47-4eb6-4d7c-acae-760b880803a8","cell_type":"markdown","source":"These examples cover the general functionality of the `SingleNodeExecutor` class. Following the [Executor](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) interface as it is defined in the Python standard library.","metadata":{}},{"id":"5de0f0f2-bf5c-46b3-8171-a3a206ce6775","cell_type":"markdown","source":"## Parallel Functions\nWriting parallel software is not trivial. So rather than writing the whole Python program in a parallel way, executorlib allows developers to implement parallel execution on a function by function level. In this way individual functions can be replaced by parallel functions as needed without the need to modify the rest of the program. With the Local Mode executorlib supports two levels of parallel execution, parallel execution based on the Message Passing Interface (MPI) using the [mpi4py](https://mpi4py.readthedocs.io) package, or thread based parallel execution. Both levels of parallelism can be defined inside the function and do not require any modifications to the rest of the Python program. ","metadata":{}},{"id":"dc8e692f-bf6c-4838-bb82-6a6b8454a2e7","cell_type":"markdown","source":"### MPI Parallel Functions\nMPI is the default way to develop parallel programs for HPCs. Still it can be challenging to refactor a previously serial program to efficiently use MPI to achieve optimal computational efficiency for parallel execution, even with libraries like [mpi4py](https://mpi4py.readthedocs.io). To simplify the up-scaling of Python programs executorlib provides the option to use MPI parallel Python code inside a given Python function and then submit this parallel Python function to an `SingleNodeExecutor` for evaluation.\n\nThe following `calc_mpi()` function imports the [mpi4py](https://mpi4py.readthedocs.io) package and then uses the internal functionality of MPI to get the total number of parallel CPU cores in the current MPI group `MPI.COMM_WORLD.Get_size()` and the index of the current processor in the MPI group `MPI.COMM_WORLD.Get_rank()`.\n\nThe [mpi4py](https://mpi4py.readthedocs.io) package is an optional dependency of executorlib. The installation of the [mpi4py](https://mpi4py.readthedocs.io) package is covered in the installation section.","metadata":{}},{"id":"a251d083-489e-41c1-9e49-c86093858006","cell_type":"code","source":"def calc_mpi(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank","metadata":{"trusted":true},"outputs":[],"execution_count":7},{"id":"adbf8a10-04e1-4fd9-8768-4375bcba9ec3","cell_type":"markdown","source":"The computational resources for the execution of the `calc_mpi()` Python function are defined using the resource dictionary parameter `resource_dict={}`. The reseource dictionary can either be provided as additional parameter for the `submit()` function. It is important that the parameter name `resource_dict` is reserved exclusively for the `submit()` function and cannot be used in the function which is submitted, like the `calc_mpi()` function in this example:","metadata":{}},{"id":"266864f1-d29e-4934-9b5d-51f4ffb11f5c","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n fs = exe.submit(calc_mpi, 3, resource_dict={\"cores\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":8},{"id":"3a449e3f-d7a4-4056-a1d0-35dfca4dad22","cell_type":"markdown","source":"Another option is to set the resource dictionary parameter `resource_dict` during the initialization of the `Executor`. In this case it is internally set for every call of the `submit()` function, without the need to specify it again.","metadata":{}},{"id":"cb4ad978-bdf2-47bb-a7df-846641a54ec2","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"cores\": 2}) as exe:\n fs = exe.submit(calc_mpi, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":9},{"id":"c1d1d7b1-64fa-4e47-bbde-2a16036568d6","cell_type":"markdown","source":"In addition, to the compute cores `cores`, the resource dictionary parameter `resource_dict` can also define the threads per core as `threads_per_core`, the GPUs per core as `gpus_per_core`, the working directory with `cwd`, the option to use the OpenMPI oversubscribe feature with `openmpi_oversubscribe` and finally for the [Simple Linux Utility for Resource \nManagement (SLURM)](https://slurm.schedmd.com) queuing system the option to provide additional command line arguments with the `slurm_cmd_args` parameter - [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary).","metadata":{}},{"id":"4f5c5221-d99c-4614-82b1-9d6d3260c1bf","cell_type":"markdown","source":"### Thread Parallel Functions\nAn alternative option of parallelism is [thread based parallelism](https://docs.python.org/3/library/threading.html). executorlib supports thread based parallelism with the `threads_per_core` parameter in the resource dictionary `resource_dict`. Given the [global interpreter lock](https://docs.python.org/3/glossary.html#term-global-interpreter-lock) in the cPython implementation a common application of thread based parallelism in Python is using additional threads in linked libraries. The number of threads is commonly controlled with environment variables like `OMP_NUM_THREADS`, `OPENBLAS_NUM_THREADS`, `MKL_NUM_THREADS`, `VECLIB_MAXIMUM_THREADS` and `NUMEXPR_NUM_THREADS`. Specific libraries might require other environment variables. The environment variables can be set using the environment interface of the Python standard library `os.environ`.","metadata":{}},{"id":"7a7d21f6-9f1a-4f30-8024-9993e156dc75","cell_type":"code","source":"def calc_with_threads(i):\n import os\n\n os.environ[\"OMP_NUM_THREADS\"] = \"2\"\n os.environ[\"OPENBLAS_NUM_THREADS\"] = \"2\"\n os.environ[\"MKL_NUM_THREADS\"] = \"2\"\n os.environ[\"VECLIB_MAXIMUM_THREADS\"] = \"2\"\n os.environ[\"NUMEXPR_NUM_THREADS\"] = \"2\"\n import numpy as np\n\n return i","metadata":{"trusted":true},"outputs":[],"execution_count":10},{"id":"82ed8f46-836c-402e-9363-be6e16c2a0b0","cell_type":"markdown","source":"Again the resource dictionary parameter `resource_dict` can be set either in the `submit()` function:","metadata":{}},{"id":"b8ed330d-ee77-44a0-a02f-670fa945b043","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n fs = exe.submit(calc_with_threads, 3, resource_dict={\"threads_per_core\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"3\n"}],"execution_count":11},{"id":"63222cd5-664b-4aba-a80c-5814166b1239","cell_type":"markdown","source":"Or alternatively, the resource dictionary parameter `resource_dict` can also be set during the initialization of the `Executor` class:","metadata":{}},{"id":"31562f89-c01c-4e7a-bbdd-fa26ca99e68b","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"threads_per_core\": 2}) as exe:\n fs = exe.submit(calc_with_threads, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"3\n"}],"execution_count":12},{"id":"8b78a7b4-066e-4cbc-858e-606c8bbbbf0c","cell_type":"markdown","source":"For most cases MPI based parallelism leads to higher computational efficiency in comparison to thread based parallelism, still the choice of parallelism depends on the specific Python function which should be executed in parallel. Careful benchmarks are required to achieve the optimal performance for a given computational architecture. \n\nBeyond MPI based parallelism and thread based parallelism the [HPC Cluster Executors](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html) and the [HPC Job Executors](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) also provide the option to assign GPUs to the execution of individual Python functions.","metadata":{}},{"id":"ca9bc450-2762-4d49-b7f8-48cc83e068fd","cell_type":"markdown","source":"## Performance Optimization\nThe default settings of executorlib are chosen to favour stability over performance. Consequently, the performance of executorlib can be improved by setting additional parameters. It is commonly recommended to start with an initial implementation based on executorlib and then improve the performance by enabling specialized features.","metadata":{}},{"id":"e9b52ecf-3984-4695-98e7-315aa3712104","cell_type":"markdown","source":"### Block Allocation\nBy default each submitted Python function is executed in a dedicated process. This gurantees that the execution of the submitted Python function starts with a fresh process. Still the initialization of the Python process takes time. Especially when the call of the Python function requires only limited computational resources it makes sense to reuse the existing Python process for the execution of multiple Python functions. In executorlib this functionality is enabled by setting the `block_allocation` parameter to `Ture`. To limit the number of parallel Python processes when using block allocation it is recommended to set the `max_workers` parameter to restrict the number of available computing resources. ","metadata":{}},{"id":"0da4c7d0-2268-4ea8-b62d-5d94c79ebc72","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(max_workers=2, block_allocation=True) as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\nCPU times: user 31.5 ms, sys: 11.5 ms, total: 43 ms\nWall time: 709 ms\n"}],"execution_count":13},{"id":"d38163b3-1c04-431c-964b-2bad4f823a4d","cell_type":"markdown","source":"The same functionality also applies to MPI parallel Python functions. The important part is that while it is possible to assign more than one Python process to the execution of a Python function in block allocation mode, it is not possible to assign resources during the submission of the function with the `submit()` function. Starting again with the `calc_mpi()` function: ","metadata":{}},{"id":"cb8c4943-4c78-4203-95f2-1db758e588d9","cell_type":"code","source":"def calc_mpi(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank","metadata":{"trusted":true},"outputs":[],"execution_count":14},{"id":"9e1212c4-e3fb-4e21-be43-0a4f0a08b856","cell_type":"markdown","source":"Still the resource dictionary parameter can still be set during the initialisation of the `SingleNodeExecutor` class. Internally, this groups the created Python processes in fixed allocations and afterwards submit Python functions to these allocations.","metadata":{}},{"id":"5ebf7195-58f9-40f2-8203-2d4b9f0e9602","cell_type":"code","source":"with SingleNodeExecutor(max_workers=2, resource_dict={\"cores\": 2}, block_allocation=True) as exe:\n fs = exe.submit(calc_mpi, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":15},{"id":"b75fb95f-f2f5-4be9-9f2a-9c2e9961c644","cell_type":"markdown","source":"The weakness of memory from a previous Python function remaining in the Python process can at the same time be an advantage for working with large datasets. In executorlib this is achieved by introducing the `init_function` parameter. The `init_function` returns a dictionary of parameters which can afterwards be reused as keyword arguments `**kwargs` in the functions submitted to the `Executor`. When block allocation `block_allocation` is disabled this functionality is not available, as each function is executed in a separate process, so no data can be preloaded.","metadata":{}},{"id":"8aa754cc-eb1a-4fa1-bd72-272246df1d2f","cell_type":"code","source":"def init_function():\n return {\"j\": 4, \"k\": 3, \"l\": 2}","metadata":{"trusted":true},"outputs":[],"execution_count":16},{"id":"1854895a-7239-4b30-b60d-cf1a89234464","cell_type":"code","source":"def calc_with_preload(i, j, k):\n return i + j + k","metadata":{"trusted":true},"outputs":[],"execution_count":17},{"id":"d07cf107-3627-4cb0-906c-647497d6e0d2","cell_type":"markdown","source":"The function `calc_with_preload()` requires three inputs `i`, `j` and `k`. But when the function is submitted to the executor only two inputs are provided `fs = exe.submit(calc, 2, j=5)`. In this case the first input parameter is mapped to `i=2`, the second input parameter is specified explicitly `j=5` but the third input parameter `k` is not provided. So the `SingleNodeExecutor` automatically checks the keys set in the `init_function()` function. In this case the returned dictionary `{\"j\": 4, \"k\": 3, \"l\": 2}` defines `j=4`, `k=3` and `l=2`. For this specific call of the `calc_with_preload()` function, `i` and `j` are already provided so `j` is not required, but `k=3` is used from the `init_function()` and as the `calc_with_preload()` function does not define the `l` parameter this one is also ignored.","metadata":{}},{"id":"cc648799-a0c6-4878-a469-97457bce024f","cell_type":"code","source":"with SingleNodeExecutor(max_workers=2, init_function=init_function, block_allocation=True) as exe:\n fs = exe.submit(calc_with_preload, 2, j=5)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"10\n"}],"execution_count":18},{"id":"1073b8ca-1492-46e9-8d1f-f52ad48d28a2","cell_type":"markdown","source":"The result is `2+5+3=10` as `i=2` and `j=5` are provided during the submission and `k=3` is defined in the `init_function()` function.","metadata":{}},{"id":"24397d78-dff1-4834-830c-a8f390fe6b9c","cell_type":"markdown","source":"### Cache\nThe development of scientific workflows is commonly an interactive process, extending the functionality step by step. This lead to the development of interactive environments like [Jupyter](https://jupyter.org) which is fully supported by executorlib. Still many of the computationally intensive Python functions can take in the order of minutes to hours or even longer to execute, so reusing an existing Python process is not feasible. To address this challenge executorlib provides a file based cache to store the results of previously computed [concurrent future Futures](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects. The results are serialized using [cloudpickle](https://github.com/cloudpipe/cloudpickle) and stored in a user-defined cache directory `cache_directory` to be reloaded later on. Internally, the hierarchical data format (HDF5) is used via the [h5py](https://www.h5py.org), which is an optional dependency for executorlib. \n\nThe [h5py](https://www.h5py.org) package is an optional dependency of executorlib. The installation of the [h5py](https://www.h5py.org) package is covered in the installation section. ","metadata":{}},{"id":"ecdcef49-5c89-4538-b377-d53979673bf7","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(cache_directory=\"./file\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[2, 4, 6]\nCPU times: user 84.3 ms, sys: 33.6 ms, total: 118 ms\nWall time: 1.35 s\n"}],"execution_count":19},{"id":"32d0fb2e-5ac1-4249-b6c8-953c92fdfded","cell_type":"markdown","source":"When the same code is executed again, executorlib finds the existing results in the cache directory specified by the `cache_directory` parameter and reloads the result, accelerating the computation especially during the prototyping phase when similar computations are repeated frequently for testing. \n\nStill it is important to mention, that this cache is not designed to identify the submission of the same parameters within the context of one `with`-statement. It is the task of the user to minimize duplicate computations, the cache is only designed to restore previous calculation results when the Python process managing executorlib was stopped after the successful execution. ","metadata":{}},{"id":"c39babe8-4370-4d31-9520-9a7ce63378c8","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(cache_directory=\"./file\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[2, 4, 6]\nCPU times: user 44.2 ms, sys: 15.5 ms, total: 59.7 ms\nWall time: 1.3 s\n"}],"execution_count":20},{"id":"5144a035-633e-4e60-a362-f3b15b28848b","cell_type":"markdown","source":"An additional advantage of the cache is the option to gather the results of previously submitted functions. Using the `get_cache_data()` function the results of each Python function is converted to a dictionary. This list of dictionaries can be converted to a `pandas.DataFrame` for further processing:","metadata":{}},{"id":"f574b9e1-de55-4e38-aef7-a4bed540e040","cell_type":"code","source":"import pandas\nfrom executorlib import get_cache_data\n\ndf = pandas.DataFrame(get_cache_data(cache_directory=\"./file\"))\ndf","metadata":{"trusted":true},"outputs":[{"execution_count":21,"output_type":"execute_result","data":{"text/plain":" function input_args input_kwargs output resource_dict \\\n0 ([2, 2],) {} 4 {} \n1 ([3, 3],) {} 6 {} \n2 ([1, 1],) {} 2 {} \n\n runtime filename \n0 0.910742 /home/jovyan/file/sum89afbdf9da5eb1794f6976a3f... \n1 0.911247 /home/jovyan/file/sum0f7710227cda6456e5d071877... \n2 0.908284 /home/jovyan/file/sumf5ad27b855231a293ddd735a8... ","text/html":"
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
functioninput_argsinput_kwargsoutputresource_dictruntimefilename
0<built-in function sum>([2, 2],){}4{}0.910742/home/jovyan/file/sum89afbdf9da5eb1794f6976a3f...
1<built-in function sum>([3, 3],){}6{}0.911247/home/jovyan/file/sum0f7710227cda6456e5d071877...
2<built-in function sum>([1, 1],){}2{}0.908284/home/jovyan/file/sumf5ad27b855231a293ddd735a8...
\n
"},"metadata":{}}],"execution_count":21},{"id":"68092479-e846-494a-9ac9-d9638b102bd8","cell_type":"markdown","source":"After the development phase is concluded it is the task of the user to remove the cache directory defined with the `cache_directory` parameter. The cache directory is never removed by executorlib to prevent the repeation of expensive computations. Still as disk space on shared file systems in HPC environments is commonly limited it is recommended to remove the cache directory once the development process concluded. ","metadata":{}},{"id":"34a9316d-577f-4a63-af14-736fb4e6b219","cell_type":"code","source":"import os\nimport shutil\n\ncache_dir = \"./file\"\nif os.path.exists(cache_dir):\n print(os.listdir(cache_dir))\n try:\n shutil.rmtree(cache_dir)\n except OSError:\n pass","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"['sum89afbdf9da5eb1794f6976a3f01697c2_o.h5', 'sum0f7710227cda6456e5d07187702313f3_o.h5', 'sumf5ad27b855231a293ddd735a8554c9ea_o.h5']\n"}],"execution_count":22},{"id":"1cea95b5-4110-444c-82af-fa6718bfa17f","cell_type":"markdown","source":"Typically the use of the cache is recommended for development processes only and for production workflows the user should implement their own long-term storage solution. The binary format used by executorlib is based on [cloudpickle](https://github.com/cloudpipe/cloudpickle) and might change in future without further notice, rendering existing data in the cache unusable. Consequently, using the cache beyond the development process is not recommended. In addition the writing of the results to files might result in additional overhead for accessing the shared file system. ","metadata":{}},{"id":"71a8a0be-a933-4e83-9da5-50da35e9975b","cell_type":"markdown","source":"### Dependencies\nMany scientific Python programs consist of series of Python function calls with varying level of parallel computations or map-reduce patterns where the same function is first mapped to a number of parameters and afterwards the results are reduced in a single function. To extend the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) of the Python standard library to support this programming pattern, the `SingleNodeExecutor` class from executorlib supports submitting Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) objects to the `SingleNodeExecutor` which are resolved before submission. So the `SingleNodeExecutor` internally waits until all Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) objects are successfully executed before it triggers the execution of the submitted Python function.","metadata":{}},{"id":"d8b75a26-479d-405e-8895-a8d56b3f0f4b","cell_type":"code","source":"def calc_add(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":23},{"id":"36118ae0-c13c-4f7a-bcd3-3d7f4bb5a078","cell_type":"markdown","source":"For example the function which adds two numbers `calc_add()` is used in a loop which adds a counter to the previous numbers. In the first iteration the `future` parameter is set to `0` but already in the second iteration it is the Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object of the first iteration and so on. \n\nThe important part is that the user does not have to wait until the first function is executed but instead the waiting happens internally in the `SingleNodeExecutor`.","metadata":{}},{"id":"35fd5747-c57d-4926-8d83-d5c55a130ad6","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future = 0\n for i in range(1, 4):\n future = exe.submit(calc_add, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"6\n"}],"execution_count":24},{"id":"38e1bbb3-1028-4f50-93c1-d2427f399a7d","cell_type":"markdown","source":"As the reusing of existing [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object can lead to rather complex dependencies, executorlib provides the option to plot the dependency graph by setting the `plot_dependency_graph=True` during the initialization of the `SingleNodeExecutor` class.\n\nNo computation is executed when the `plot_dependency_graph=True` is set. This parameter is for debugging only. \n\nInternally, the [pygraphviz](https://pygraphviz.github.io/documentation/stable) package is used for the visualisation of these dependency graphs. It is an optional dependency of executorlib. The installation of the [pygraphviz](https://pygraphviz.github.io/documentation/stable) package is covered in the installation section. ","metadata":{}},{"id":"f67470b5-af1d-4add-9de8-7f259ca67324","cell_type":"code","source":"with SingleNodeExecutor(plot_dependency_graph=True) as exe:\n future = 0\n for i in range(1, 4):\n future = exe.submit(calc_add, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"None\n"},{"output_type":"display_data","data":{"text/plain":"","image/svg+xml":"\n\n\n\n\n0\n\ncalc_add\n\n\n\n1\n\ncalc_add\n\n\n\n0->1\n\n\nb\n\n\n\n2\n\ncalc_add\n\n\n\n1->2\n\n\nb\n\n\n\n3\n\n1\n\n\n\n3->0\n\n\na\n\n\n\n4\n\n0\n\n\n\n4->0\n\n\nb\n\n\n\n5\n\n2\n\n\n\n5->1\n\n\na\n\n\n\n6\n\n3\n\n\n\n6->2\n\n\na\n\n\n"},"metadata":{}}],"execution_count":25},{"id":"4c952a9d-2b58-401d-b7ec-fda740db774a","cell_type":"markdown","source":"## Advanced Scheduling\nGoing beyond just directed acyclic graphs (DAG) with one-to-many and many-to-one relationships, executorlib provides a number of advanced scheduling patterns. These are briefly introduced in the following.","metadata":{}},{"id":"4db2c87c-9a7d-4074-82d0-24357fa4f0e6","cell_type":"markdown","source":"### Runtime-dependent Batching \nTo maximize the throughput of dependent calculation tasks its important to idenify all tasks which can be executed at a given moment. Unfortunately, some of these dependencies can only be determined at run time, which is challenging for most schedulers. To demonstrate the runtime-dependent batching in executorlib we discuss the following example. Starting with a group of ten tasks and then grouping them into groups of three for processing. Still the order of the tasks, which tasks belong into which group, is only determined at run time. \n\nFor simplicity, we just use a simple function which directly returns the input.","metadata":{}},{"id":"857a5e0f-50d6-45ec-aac7-a7151f36c19f","cell_type":"code","source":"def reply(i):\n return i","metadata":{"trusted":true},"outputs":[],"execution_count":26},{"id":"544dacab-5601-4a9b-814f-88560eafb079","cell_type":"markdown","source":"After the group of ten tasks is submitted their future objects are stored in a list named `future_individual_lst`. This list is then provided to the `batched()` function of the `SingleNodeExecutor()` to generate batches of tasks which are then provided to the `sum` function for further processing. The results of this second step are stored in the `future_group_lst`. Finally, the results of these future objects are evaluated in the third step. ","metadata":{}},{"id":"17d1354a-0943-4b62-9b0d-7d39c8df23f2","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future_individual_lst = [\n exe.submit(reply, i) for i in range(10)\n ]\n future_group_lst = [\n exe.submit(sum, f) for f in exe.batched(future_individual_lst, n=3)\n ]\n print(sum([f.result() for f in future_group_lst]))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"45\n"}],"execution_count":27},{"id":"80e8b154-d659-4f3e-add2-701a454d770d","cell_type":"markdown","source":"### Split Future Objects\nIn analogy to the `batched()` function which combines multiple future objects in a batch for further processing, it is also necessary to split the future objects even before the evaluation is completed. Executorlib provides two utility functions, namely `split_future()` for tuples and lists and `get_item_from_future()` for dictionaries. \n\nStarting with a function which returns a tuple, named `get_a_tuple()`:","metadata":{}},{"id":"6ef541e3-a2be-4e05-9e77-65eaceff4248","cell_type":"code","source":"def get_a_tuple(i):\n return \"a\", \"b\", i","metadata":{"trusted":true},"outputs":[],"execution_count":28},{"id":"dd3e4312-1594-4b3b-baf3-5b3121ca8910","cell_type":"markdown","source":"This function is submitted to the `SingleNodeExecutor()` and while in this case it directly returns the tuple, the evaluation would commonly take much longer. By having the ability to split the output of the future object using the `split_future()` function, a number of future objects is generated one for each element of the tuple. This is enabled by providing the number of elements in the tuple as an additional parameter `n=3`. ","metadata":{}},{"id":"927c5931-d7fd-4bc1-ae0e-3dd2f4bc99ce","cell_type":"code","source":"from executorlib import split_future","metadata":{"trusted":true},"outputs":[],"execution_count":29},{"id":"64a9b46e-0de6-4abb-99d9-8aaa0c6cbccb","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future = exe.submit(get_a_tuple, 15)\n f1, f2, f3 = split_future(future=future, n=3)\n print(f1.result(), f2.result(), f3.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"a b 15\n"}],"execution_count":30},{"id":"a10d8f90-e790-4708-b193-90a7f014d699","cell_type":"markdown","source":"In analogy, to the `split_future()` function for lists and tuples, the `get_item_from_future()` function returns one item of a dicitionary which is returned by a function submitted to an `Executor()`. In this example the `get_a_dict()` function returns a dictionary, again in this example the dictionary is returned directly while commonly this would take much longer. ","metadata":{}},{"id":"51ec4dbf-d009-41c9-bc04-cf1b16fe782f","cell_type":"code","source":"def get_a_dict(i):\n return {\"a\": 1, \"b\": 2, \"c\": i}","metadata":{"trusted":true},"outputs":[],"execution_count":31},{"id":"5c90ab75-2a6b-4fbe-a7ee-7f91b2b4af43","cell_type":"markdown","source":"The `get_a_dict()` function is submitted to the `SingleNodeExecutor()`, it returns a future object named `future_dict`. Still as we know that the `result()` of this future object `future_dict` returns a dictionary, we can already access the items of this dictionary with the `get_item_from_future()` function. The `get_item_from_future()` function takes a future object as input in addition to the `key` of the dictionary which should be accessed, as a result the `get_item_from_future()` function returns a future object for the value related to the key. In this example these future objects are named `f1`, `f2` and `f3`. These fucture objects are evaluated afterwards.","metadata":{}},{"id":"a41251d2-a840-4c12-9625-c2e0585c489b","cell_type":"code","source":"from executorlib import get_item_from_future","metadata":{"trusted":true},"outputs":[],"execution_count":32},{"id":"a6e75c5e-ad0c-4723-99c5-8125b63fbeaf","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future_dict = exe.submit(get_a_dict, 15)\n f1 = get_item_from_future(future=future_dict, key=\"a\")\n f2 = get_item_from_future(future=future_dict, key=\"b\")\n f3 = get_item_from_future(future=future_dict, key=\"c\")\n print(f1.result(), f2.result(), f3.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"1 2 15\n"}],"execution_count":33},{"id":"a945c98d-dc73-4284-9d8c-52475a760f6b","cell_type":"markdown","source":"### Recursion\nIn addition to the `map()` function for parallel loops and the option to integrate `while` loops directly in the submission, it is sometimes helpful to use recursive algorthims to accelerate scientific simulation and analysis. To demonstrate the use of executorlib in combination with recursive algorithms, the quicksort algorithm is demonstrated. \n\nThe quicksort algorithm is implemented in two parts, a `quick_sort()` which splits the input `sequence` into two sets, one lower and one larger than the pivot element of the `sequence`. After the initial execution the `quick_sort()` function is again applied to both resulting sets until only a single element remains in the `sequence`. In this case the single element is returned. The pivot is defined as the first element of the `sequence`.\n\nTo simplify the submission of the `quick_sort()` function to the `SingleNodeExecutor()` dictionaries are used as return types, these dictionaries either contain only a single item with the key `\"result\"` when only a single element remains in the list, or three items, one `\"left\"` for a list lower than the pivot, one `\"right\"` for the items larger than the pivot and the `\"result\"` for the pivot itself. ","metadata":{}},{"id":"08b0c0a1-34ad-4b2a-847c-fe9c96956b27","cell_type":"code","source":"def quick_sort(sequence):\n length = len(sequence)\n if length <= 1:\n return {\"result\": sequence}\n else:\n pivot = sequence.pop() \n \n greater_items = []\n lesser_items = []\n\n for item in sequence:\n if item > pivot:\n greater_items.append(item)\n else:\n lesser_items.append(item)\n\n return {\"left\": lesser_items, \"right\": greater_items, \"result\": [pivot]}","metadata":{"trusted":true},"outputs":[],"execution_count":34},{"id":"54a8a765-0b9f-424a-86e5-8024c4d59018","cell_type":"markdown","source":"To enable the recursive submission to the `SingleNodeExecutor()` a `recusive_submit()` function is defined using the [asynchronous IO module](https://docs.python.org/3/library/asyncio.html) of the Python standard libary, indicated by the `async` keyword ahead of the function definition. It takes a `function`, the `sequence` and the `executor` as inputs. As a first step the function is submitted to the `executor` and the execution is halted until the first result is available by wrapping the future object using the `wrap_future()` function of the `asyncio` package and appling the `await` function. Then the corresponding result dictionary `result_dict` is evaluated: If the `result_dict` contains more than one key, then the `recusive_submit()` is evaluated for both the left side with lower values than the pivot element and the right side with elements higher than the pivot element. Again in both cases the `await` keyword is used to enable the parallel execution of both branches at the same time. Afterwards the result of both sides is combined with the pivot element. For the case that the dictionary only contains a single element, it is returned directly. ","metadata":{}},{"id":"4e142829-c9de-4969-ab3c-97f3e1ada90c","cell_type":"code","source":"import asyncio\n\nasync def recusive_submit(function, sequence, executor):\n result_dict = await asyncio.wrap_future(exe.submit(function, sequence))\n if len(result_dict) > 1:\n left = await recusive_submit(function=function, sequence=result_dict[\"left\"], executor=executor)\n right = await recusive_submit(function=function, sequence=result_dict[\"right\"], executor=executor)\n return left + result_dict[\"result\"] + right\n else:\n return result_dict[\"result\"]","metadata":{"trusted":true},"outputs":[],"execution_count":35},{"id":"531a8f7d-5b21-46d0-b632-32a1568571c8","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n loop = asyncio.get_event_loop()\n task = loop.create_task(recusive_submit(function=quick_sort, sequence=[0,9,3,8,2,7,5], executor=exe))\n print(await task)","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[0, 2, 3, 5, 7, 8, 9]\n"}],"execution_count":36},{"id":"725c8ac2-27e4-495b-b061-1fd6053f4c0b","cell_type":"markdown","source":"## Testing and Debugging\nThe up-scaling of Python functions from a single workstation to an High Performance Computer (HPC) can be challenging, so executorlib provides a number of debugging utilities to help you optimize your functions for execution with executorlib. ","metadata":{}},{"id":"2c96b460-ebd2-4c8a-a5e1-922a860808ab","cell_type":"markdown","source":"### Measure Data Transferred \nTransferring a large amount of data between two processes requires additional resources so it is helpful to measure the data transferred between the frontend and backend process. This is achieved by setting the `log_obj_size` parameter to `True`:","metadata":{}},{"id":"71905acf-2fef-4738-82ae-89e35e2e3d2d","cell_type":"code","source":"from executorlib import SingleNodeExecutor\n\nwith SingleNodeExecutor(log_obj_size=True) as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stderr","output_type":"stream","text":"Send dictionary of size: 101\nReceived dictionary of size: 59\nSend dictionary of size: 69\nReceived dictionary of size: 58\n"},{"name":"stdout","output_type":"stream","text":"2\n"}],"execution_count":37},{"id":"0e9f7192-2b7d-4caf-b2b8-ae9cb060e90f","cell_type":"markdown","source":"### Write Log Files\nLibraries like executorlib are commonly used to sample a large parameter space, in this case it is possible that out of a large number of parameters one combination throws an error. This error can be logged in a file which also contains the function and input parameters using the `\"error_log_file\"` parameter in the `resource_dict`. This allows to change the log file on a per-function bases.","metadata":{}},{"id":"2810acd5-a46e-4d85-b447-945248ffca15","cell_type":"code","source":"from executorlib import SingleNodeExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":38},{"id":"ef6b87a7-361e-4a3f-bad3-72ad87968e8c","cell_type":"code","source":"def my_funct(i, j): \n if i == 2 and j == 2:\n raise ValueError()\n else: \n return i * j + i + j","metadata":{"trusted":true},"outputs":[],"execution_count":39},{"id":"209ff76b-913a-46f7-9fff-250e207898b2","cell_type":"markdown","source":"A try and except statement is added to prevent the jupyter notebook from crashing:","metadata":{}},{"id":"30381a00-30cc-45a2-82ff-17371339f5c7","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"error_log_file\": \"error.out\"}) as exe:\n future_lst = []\n for i in range(4):\n for j in range(4):\n future_lst.append(exe.submit(my_funct, i=i, j=j))\n try:\n print([f.result() for f in future_lst])\n except ValueError:\n pass","metadata":{"trusted":true},"outputs":[],"execution_count":40},{"id":"36bfc556-aa86-4b50-972b-4b8f68ceec3d","cell_type":"markdown","source":"The content of the log file is a basic text file, so it can be read with any kind of file utility. The important part is that the log file contains not only the error message but in addition also the function name and the input parameters in the case `kwargs: {'i': 2, 'j': 2}` which helps for future debugging of the sampling function.","metadata":{}},{"id":"a61c06fc-3029-48ed-895f-9f6c065b7c47","cell_type":"code","source":"with open(\"error.out\") as f:\n content = f.readlines()","metadata":{"trusted":true},"outputs":[],"execution_count":41},{"id":"6a6cd10f-6fe3-4a17-a8e6-2536feb9a11a","cell_type":"code","source":"content","metadata":{"trusted":true},"outputs":[{"execution_count":42,"output_type":"execute_result","data":{"text/plain":"['function: \\n',\n 'args: ()\\n',\n \"kwargs: {'i': 2, 'j': 2}\\n\",\n 'Traceback (most recent call last):\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/backend/interactive_serial.py\", line 56, in main\\n',\n ' output = call_funct(input_dict=input_dict, funct=None, memory=memory)\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/standalone/interactive/backend.py\", line 33, in call_funct\\n',\n ' return funct(input_dict[\"fn\"], *input_dict[\"args\"], **input_dict[\"kwargs\"])\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/standalone/interactive/backend.py\", line 22, in funct\\n',\n ' return args[0].__call__(*args[1:], **kwargs)\\n',\n ' ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^\\n',\n ' File \"/tmp/ipykernel_463/3167739528.py\", line 3, in my_funct\\n',\n 'ValueError\\n']"},"metadata":{}}],"execution_count":42},{"id":"5aff120a-317f-47d4-9639-8eccfb136117","cell_type":"code","source":"import os\n\nif os.path.exists(\"error.out\"):\n os.remove(\"error.out\")","metadata":{"trusted":true},"outputs":[],"execution_count":43},{"id":"44cd41d7-4417-429e-8481-f2a49e5f769c","cell_type":"markdown","source":"### TestClusterExecutor\nWhile the `SingleNodeExecutor` internally behaves very similar to the `FluxJobExecutor` and `SlurmJobExecutor` the `FluxClusterExecutor` and `SlurmClusterExecutor` behave very different as they use the file system to exchange information rather than socket-based communication. This can lead to complications when it comes to debugging. To address this challenge executorlib provides the `TestClusterExecutor` which can be executed on a local workstation just like the `SingleNodeExecutor` but in the background it uses the same file based communication like the `SlurmClusterExecutor` and the `FluxClusterExecutor`:","metadata":{}},{"id":"2ae29fb0-54e5-468f-8727-a179b6ed363e","cell_type":"code","source":"from executorlib.api import TestClusterExecutor\n\nwith TestClusterExecutor(cache_directory=\"test\") as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\n"}],"execution_count":44}]} \ No newline at end of file diff --git a/notebooks/2-hpc-cluster.ipynb b/notebooks/2-hpc-cluster.ipynb index e80c5815..543507d6 100644 --- a/notebooks/2-hpc-cluster.ipynb +++ b/notebooks/2-hpc-cluster.ipynb @@ -1 +1 @@ -{"metadata":{"kernelspec":{"display_name":"Flux","language":"python","name":"flux"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.13.14"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"ddf66f38-dc4a-4306-8b1c-b923fdb76922","cell_type":"markdown","source":"# HPC Cluster Executor\nIn contrast to the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) and the [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) the HPC Submission Executors do not communicate via the [zero message queue](https://zeromq.org) but instead store the python functions on the file system and uses the job scheduler to handle the dependencies of the Python functions. Consequently, the block allocation `block_allocation` and the init function `init_function` are not available in the HPC Cluster Executors. At the same time it is possible to close the Python process which created the `Executor`, wait until the execution of the submitted Python functions is completed and afterwards reload the results from the cache.\n\nInternally the HPC submission mode is using the [Python simple queuing system adatper (pysqa)](https://pysqa.readthedocs.io) to connect to HPC job schedulers and the [h5py](https://www.h5py.org) package for serializing the Python functions to store them on the file system. Both packages are optional dependency of executorlib. The installation of the [pysqa](https://pysqa.readthedocs.io) package and the [h5py](https://www.h5py.org) package are covered in the installation section. ","metadata":{}},{"id":"d56862a6-8279-421d-a090-7ca2a3c4d416","cell_type":"markdown","source":["## SLURM\n","The [Simple Linux Utility for Resource Management (SLURM)](https://slurm.schedmd.com) job scheduler is currently the most commonly used job scheduler for HPC clusters. On shared HPC systems users cannot access compute nodes directly — SLURM acts as the resource controller, accepting job requests, managing the queue, and assigning work to nodes when resources become free.\n","\n","In the HPC submission mode executorlib internally uses the [sbatch](https://slurm.schedmd.com/sbatch.html) command, this is in contrast to the [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) which internally uses the [srun](https://slurm.schedmd.com/srun.html) command.\n","\n","The connection to the job scheduler is based on the [Python simple queuing system adatper (pysqa)](https://pysqa.readthedocs.io). It provides a default configuration for most commonly used job schedulers including SLURM, in addition it is also possible to provide the submission template as part of the resource dictionary `resource_dict` for a single script, or persist it once in a configuration directory referenced via the `pysqa_config_directory` parameter, as covered in the \"Reusing the Configuration\" section below. All three options are covered in more detail on the [pysqa documentation](https://pysqa.readthedocs.io)."],"metadata":{}},{"id":"slurm-background-001","cell_type":"markdown","source":"### Background\n\nThree commands cover the day-to-day SLURM workflow:\n\n**`sbatch`** submits a batch script from the login node. The script carries resource directives on lines starting with `#SBATCH`:\n\n```bash\n#!/bin/bash\n#SBATCH --job-name=my_job\n#SBATCH --output=my_job.out\n#SBATCH --ntasks=4 # total MPI ranks\n#SBATCH --cpus-per-task=1 # CPU threads per rank\n#SBATCH --time=00:30:00 # wall-clock limit (HH:MM:SS)\n#SBATCH --partition=regular\n\nsrun --mpi=pmix python my_script.py\n```\n\n```bash\nsbatch job.sh # submit — returns a job ID immediately\n```\n\nKey `#SBATCH` directives:\n\n| Directive | Meaning |\n|---|---|\n| `--ntasks=N` | Total MPI ranks (processes) |\n| `--cpus-per-task=N` | CPU threads available to each rank |\n| `--mem=NG` | Memory per node (e.g. `8G`) |\n| `--time=HH:MM:SS` | Maximum wall-clock time |\n| `--partition=name` | Queue / partition to target |\n| `--dependency=afterok:JOBID` | Run only after another job succeeds |\n\n**`srun`** launches parallel tasks *inside* an existing allocation. Multiple `srun` calls can run concurrently using shell backgrounding:\n\n```bash\nsrun --mpi=pmix -n 4 python task_a.py &\nsrun --mpi=pmix -n 4 python task_b.py &\nwait # block until both finish\n```\n\n**`squeue`** and **`sacct`** let you inspect the queue and verify resource assignments:\n\n```bash\nsqueue --me # your running/pending jobs\nsacct -j 12345 --format=JobID,State,AllocCPUS,Elapsed # accounting for job 12345\n```\n\nCommon `squeue` state codes: `PD` (pending), `R` (running), `CG` (completing).","metadata":{}},{"id":"slurm-mpi-001","cell_type":"markdown","source":"### MPI-parallel Python\n\nThe [Message Passing Interface (MPI)](https://www.mpi-forum.org) is the dominant parallelisation standard on HPC systems. [`mpi4py`](https://mpi4py.readthedocs.io) provides Python bindings. A minimal example:\n\n```python\n# script.py\nfrom mpi4py import MPI\ncomm = MPI.COMM_WORLD\nprint(f\"rank {comm.Get_rank()} of {comm.Get_size()}\")\n```\n\n```bash\nsrun --mpi=pmix -n 4 python script.py\n```\n\nWhen multiple independent groups of ranks need to run inside one allocation there are two approaches:\n\n| Approach | How | Cross-group communication |\n|---|---|---|\n| Multiple `srun` calls | Each `srun` gets its own communicator | Not possible |\n| `MPI_Comm_split` | One `srun`, split in Python | Possible via `MPI.COMM_WORLD` |\n\n```python\n# communicator splitting — 8 ranks split into two groups of 4\ncomm = MPI.COMM_WORLD\ncolor = comm.Get_rank() // 4 # group 0 or group 1\nsub_comm = comm.Split(color)\n```","metadata":{}},{"id":"db7760e8-35a6-4a1c-8b0f-410b536c3835","cell_type":"markdown","source":"### SlurmClusterExecutor\n\n```python\nfrom executorlib import SlurmClusterExecutor\n```","metadata":{}},{"id":"b20913f3-59e4-418c-a399-866124f8e497","cell_type":"markdown","source":"In comparison to the [SingleNodeExecutor](https://executorlib.readthedocs.io/en/latest/1-single-node.html), the only parameter which is changed in the `SlurmClusterExecutor` is the requirement to specify the cache directory using the `cache_directory=\"./cache\"`. The rest of the syntax remains exactly the same, to simplify the up-scaling of simulation workflows.","metadata":{}},{"id":"0b8f3b77-6199-4736-9f28-3058c5230777","cell_type":"markdown","source":"```python\nwith SlurmClusterExecutor(cache_directory=\"./cache\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])\n```","metadata":{}},{"id":"37bef7ac-ce3e-4d8a-b848-b1474c370bca","cell_type":"markdown","source":"Specific parameters for `SlurmClusterExecutor` like the maximum run time `\"run_time_max\"`, the maximum memory `\"memory_max\"` or the submission template for the job submission script `\"submission_template\"` can be specified as part of the resource dictionary. Again it is possible to specify the resource dictonary `resource_dicionary` either for each function in the `submit()` function or during the initialization of the `SlurmClusterExecutor`.","metadata":{}},{"id":"658781de-f222-4235-8c26-b0f77a0831b3","cell_type":"markdown","source":"```python\nsubmission_template = \"\"\"\\\n#!/bin/bash\n#SBATCH --output=time.out\n#SBATCH --job-name={{job_name}}\n#SBATCH --chdir={{working_directory}}\n#SBATCH --get-user-env=L\n#SBATCH --partition={{partition}}\n{%- if run_time_max %}\n#SBATCH --time={{ [1, run_time_max // 60]|max }}\n{%- endif %}\n{%- if dependency %}\n#SBATCH --dependency=afterok:{{ dependency | join(',') }}\n{%- endif %}\n{%- if memory_max %}\n#SBATCH --mem={{memory_max}}G\n{%- endif %}\n#SBATCH --ntasks={{cores}}\n\n{{command}}\n\"\"\"\n\nwith SlurmClusterExecutor(cache_directory=\"./cache\") as exe:\n future = exe.submit(\n sum, [4, 4], \n resource_dict={\n \"submission_template\": submission_template, \n \"run_time_max\": 180, # in seconds \n \"partition\": \"s.cmfe\",\n })\n print(future.result())\n```","metadata":{}},{"id":"f7ad9c97-7743-4f87-9344-4299b2b31a56","cell_type":"markdown","source":"The template uses [Jinja2](https://jinja.palletsprojects.com) syntax. executorlib fills `{{cores}}` into `--ntasks`, so `cores=1` requests one serial process and `cores=4` requests four MPI ranks. With `pmi_mode=\"pmix\"` the executor additionally wraps the function call in `srun --mpi=pmix -n `:\n\n```python\ndef mpi_calc(i):\n from mpi4py import MPI\n comm = MPI.COMM_WORLD\n return {\"rank\": comm.Get_rank(), \"size\": comm.Get_size(), \"input\": i}\n\nwith SlurmClusterExecutor(pmi_mode=\"pmix\", cache_directory=\"./cache\") as exe:\n future = exe.submit(\n mpi_calc, 42,\n resource_dict={\"submission_template\": submission_template, \"cores\": 4, \"partition\": \"regular\", \"run_time_max\": 120})\n print(future.result())\n```\n\nWith these options executorlib in combination with the SLURM job scheduler provides a lot flexibility to configure the submission of Python functions depending on the specific configuration of the job scheduler. \n\nIn case the submission goes wrong, for example when no submission template is defined and executorlib falls back to the default submission template a `CalledProcessError` is raised:\n\n```python\ndef echo(i):\n return i\n\nwith SlurmClusterExecutor() as exe:\n f1 = exe.submit(echo)\n print(f1.result())\n```\n\nThe error message would be something like:\n```\nCalledProcessError: Command '['sbatch', '--parsable', '/home/jovyan/executorlib_cache/echoe5873521b7330f831bed941744079e83/run_queue.sh']' returned non-zero exit status 1.\n```\n\nThis is not really helpful, as it primarily says the `sbatch` command was not successful, but the error message which `sbatch` raised on the command line is not directly accessible from Python. To access the error message you can access the exception of the future object:\n\n```python\nexcep = f1.exception()\nprint(excep.output)\n```\n\nThis gives:\n```\nsbatch: error: invalid partition specified: (null)\nsbatch: error: Batch job submission failed: Invalid partition name specified\n```\n\nSo the submission failed because no partition was provided, which can be corrected by adding the `--partition` flag in the submission template, as demonstrated above. ","metadata":{}},{"id":"e1299068-990e-4fd3-b926-f6415b4e9d75","cell_type":"markdown","source":"### Verifying the Resource Assignment\nAfter the submission it is often useful to confirm that the job scheduler actually assigned the requested resources. For the `SlurmClusterExecutor` the SLURM job identifier is stored in the cache and can be retrieved with the `get_cache_data()` function. This job identifier `queue_id` can then be passed to the SLURM [sacct](https://slurm.schedmd.com/sacct.html) command to inspect the accounting record of the job:\n\n```python\nfrom executorlib import get_cache_data\nimport subprocess\n\nfor entry in get_cache_data(cache_directory=\"./cache\"):\n if \"calc\" in str(entry[\"function\"]):\n job_id = entry[\"queue_id\"]\n print(subprocess.check_output(\n [\"sacct\", \"-j\", str(job_id), \"--format=JobID,State,AllocCPUS,Elapsed\"],\n universal_newlines=True,\n ))\n```\n\nThe `AllocCPUS` column reports the number of CPU cores SLURM allocated for the function. In addition to the `queue_id` each cache entry also contains the full `resource_dict`, the runtime and the path of the result file, which together provide a complete audit trail of the submission - this is the same information returned by the `get_cache_data()` function demonstrated for the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html#cache).","metadata":{}},{"cell_type":"markdown","id":"pysqa-config-directory-001","metadata":{"trusted":true},"source":["### Reusing the Configuration with `pysqa_config_directory`\n","The `submission_template` shown above is convenient for a single script, but has to be repeated in every Python session which submits jobs. For a configuration which is set up once and reused by any number of scripts and users, executorlib can instead read the submission template from a configuration directory via the `pysqa_config_directory` parameter, which is passed through to the [pysqa](https://pysqa.readthedocs.io) package. This is the same mechanism [pyiron](https://pyiron.org) uses to manage its HPC configuration, so an existing pysqa configuration directory can be reused directly with executorlib.\n","\n","A pysqa configuration directory contains a `queue.yaml` file which lists the available queues, together with a Jinja2 submission template for each of them:\n","```\n","~/.queues/\n","├── queue.yaml\n","└── slurm.sh\n","```\n","\n","`queue.yaml` defines the queue type, the primary queue and the individual queues - `cores_min` and `cores_max` restrict the number of cores which can be requested, `run_time_max` caps the maximum run time in seconds and `script` points to the Jinja2 template file used to generate the submission script:\n","```yaml\n","queue_type: SLURM\n","queue_primary: slurm\n","queues:\n"," slurm: {cores_min: 1, cores_max: 100, run_time_max: 259200, script: slurm.sh}\n","```\n","\n","`slurm.sh` is the same kind of Jinja2 template already introduced above as the `submission_template`, just stored in a file rather than a Python string:\n","```\n","#!/bin/bash\n","#SBATCH --output=time.out\n","#SBATCH --job-name={{job_name}}\n","#SBATCH --chdir={{working_directory}}\n","#SBATCH --get-user-env=L\n","#SBATCH --partition=my_partition\n","{%- if run_time_max %}\n","#SBATCH --time={{ [1, run_time_max // 60]|max }}\n","{%- endif %}\n","{%- if dependency_list %}\n","#SBATCH --dependency=afterok:{{ dependency_list | join(',') }}\n","{%- endif %}\n","{%- if memory_max %}\n","#SBATCH --mem={{memory_max}}G\n","{%- endif %}\n","#SBATCH --ntasks={{cores}}\n","\n","{{command}}\n","```\n","\n","Once the directory is set up it can be reused by any `SlurmClusterExecutor`, simply by pointing `pysqa_config_directory` at it - no `submission_template` needs to be specified anymore:\n","```python\n","with SlurmClusterExecutor(cache_directory=\"./cache\", pysqa_config_directory=\"~/.queues\") as exe:\n"," future = exe.submit(sum, [4, 4], resource_dict={\"run_time_max\": 180, \"cores\": 4})\n"," print(future.result())\n","```\n","\n","If `pysqa_config_directory` is not provided, as in the earlier examples, executorlib falls back to a generic, built-in submission template for the selected job scheduler - this is the default submission template referenced in the `CalledProcessError` example above. Providing an explicit `pysqa_config_directory` (or `submission_template`) becomes necessary as soon as the target HPC system requires mandatory options like `--partition`.\n","\n","For clusters which are only reachable via SSH, or setups spanning multiple job schedulers, the configuration directory can instead contain a `clusters.yaml` file referencing several such `queue.yaml` configurations. This and further configuration options, like SSH-based remote submission, are covered in the [pysqa documentation](https://pysqa.readthedocs.io)."]},{"cell_type":"markdown","id":"claude-code-setup-001","metadata":{},"source":["### Setup with Claude Code\n","Writing a `submission_template` for a new HPC cluster requires knowing its partitions, memory defaults, GPU resources, submit filters and job limits. To automate this step, executorlib provides the [executorlib-cluster-setup](https://github.com/pyiron/executorlib/blob/main/.claude/skills/executorlib-cluster-setup/SKILL.md) skill for [Claude Code](https://docs.claude.com/en/docs/claude-code/overview). Started on the login node of a SLURM cluster, it analyses the cluster with `sinfo`, `scontrol` and `sacctmgr`, checks the generated submission templates with `sbatch --test-only`, runs short smoke tests for serial functions, GPUs, MPI binaries and dependencies, and finally writes a cluster-specific skill `executorlib-`. This cluster-specific skill contains the tested `submission_template`, helper functions to construct the `resource_dict` and the pitfalls found during testing, so later Claude Code sessions can submit Python functions with the `SlurmClusterExecutor` on this cluster.\n","\n","To install the skill for your user, download it to the Claude Code skills directory on the login node:\n","\n","```bash\n","mkdir -p ~/.claude/skills/executorlib-cluster-setup\n","curl -o ~/.claude/skills/executorlib-cluster-setup/SKILL.md https://raw.githubusercontent.com/pyiron/executorlib/main/.claude/skills/executorlib-cluster-setup/SKILL.md\n","```\n","\n","Afterwards start `claude` on the login node, in the Python environment with executorlib and pysqa installed, and call the skill with `/executorlib-cluster-setup` or ask Claude Code to set up executorlib for this cluster. Claude Code asks for the information the cluster cannot provide itself, like the codes you want to run, the account to charge and the URL of the site documentation. As the smoke tests submit short jobs, preferably to a debug or test partition, they consume a small amount of your computing time."]},{"id":"2a814efb-2fbc-41ba-98df-cf121d19ea66","cell_type":"markdown","source":"## Flux\n[Flux](http://flux-framework.org) is a modern HPC resource manager developed at Lawrence Livermore National Laboratory (LLNL). On many systems it runs as a **secondary scheduler inside a SLURM allocation**, enabling fine-grained hierarchical task distribution. Unlike SLURM, Flux can also be installed locally via conda — making it especially suitable for demonstrations, testing, and continuous integration:\n\n```bash\nconda install -c conda-forge flux-core\nflux start # launch a local Flux instance\n```\n\nThis simple installation is explained in the [installation section](https://executorlib.readthedocs.io/en/latest/installation.html#alternative-installations). The features demonstrated below using Flux apply equally to SLURM.","metadata":{}},{"id":"flux-background-001","cell_type":"markdown","source":"### Background\n\nThe key Flux commands map closely onto their SLURM equivalents:\n\n| Flux command | SLURM equivalent | Description |\n|---|---|---|\n| `flux resource list` | `sinfo` | Show available nodes, cores, and GPUs |\n| `flux jobs -a` | `squeue` | List all jobs (running and completed) |\n| `flux submit` | `sbatch` | Submit a non-blocking job; returns a job ID immediately |\n| `flux run` | `srun` | Launch a blocking job; waits for completion |\n| `flux job attach ` | — | Stream output of a previously submitted job |\n\n```bash\n# submit a non-blocking 4-rank MPI job\nflux submit -o pmi=pmix --ntasks=4 python script.py\n\n# run a blocking 4-rank MPI job (waits for output)\nflux run -o pmi=pmix -n 4 python script.py\n```\n\nThe `-o pmi=pmix` flag matches what SLURM's `--mpi=pmix` provides — the same `mpi4py` scripts run unchanged under both schedulers.","metadata":{}},{"id":"29d7aa18-357e-416e-805c-1322b59abec1","cell_type":"markdown","source":"### Dependencies\nAs already demonstrated for the [SingleNodeExecutor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) the `Executor` classes from executorlib are capable of resolving the dependencies of serial functions, when [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects are used as inputs for subsequent function calls. For the case of the HPC submission these dependencies are communicated to the job scheduler, which allows to stop the Python process which created the `Executor` class, wait until the execution of the submitted Python functions is completed and afterwards restart the Python process for the `Executor` class and reload the calculation results from the cache defined by the `cache_directory` parameter.","metadata":{}},{"id":"0f7fc37a-1248-492d-91ab-9db1d737eaee","cell_type":"code","source":"def add_funct(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":1},{"id":"ae308683-6083-4e78-afc2-bff6c6dc297b","cell_type":"code","source":"from executorlib import FluxClusterExecutor\n\nwith FluxClusterExecutor(cache_directory=\"./file\") as exe:\n future = 0\n for i in range(4, 8):\n future = exe.submit(add_funct, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"22\n"}],"execution_count":2},{"id":"ca75cb6c-c50f-4bee-9b09-d8d29d6c263b","cell_type":"markdown","source":"### Resource Assignment\nIn analogy to the [SingleNodeExecutor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) the resource assignment for the `FluxClusterExecutor` is handled by either including the resource dictionary parameter `resource_dict` in the initialization of the `FluxClusterExecutor` class or in every call of the `submit()` function.\n\nBelow this is demonstrated once for the assignment of multiple CPU cores for the execution of a Python function which internally uses the message passing interface (MPI) via the [mpi4py](https://mpi4py.readthedocs.io) package.","metadata":{}},{"id":"eded3a0f-e54f-44f6-962f-eedde4bd2158","cell_type":"code","source":"def calc(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank\n","metadata":{"trusted":true},"outputs":[],"execution_count":3},{"id":"669b05df-3cb2-4f69-9d94-8b2442745ebb","cell_type":"code","source":"with FluxClusterExecutor(cache_directory=\"./file\") as exe:\n fs = exe.submit(calc, 3, resource_dict={\"cores\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"(3, 1, 0)\n"}],"execution_count":4},{"id":"d91499d7-5c6c-4c10-b7b7-bfc4b87ddaa8","cell_type":"markdown","source":"Beyond CPU cores and threads which were previously also introduced for the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) the HPC Cluster Executors also provide the option to select the available accelerator cards or GPUs, by specifying the `\"gpus_per_core\"` parameter in the resource dictionary `resource_dict`. For demonstration we create a Python function which reads the GPU device IDs and submit it to the `FluxClusterExecutor` class:\n```python\ndef get_available_gpus():\n import socket\n from tensorflow.python.client import device_lib\n local_device_protos = device_lib.list_local_devices()\n return [\n (x.name, x.physical_device_desc, socket.gethostname()) \n for x in local_device_protos if x.device_type == 'GPU'\n ]\n```\n\n```python\nwith FluxClusterExecutor(\n cache_directory=\"./cache\",\n resource_dict={\"gpus_per_core\": 1}\n) as exe:\n fs_1 = exe.submit(get_available_gpus)\n fs_2 = exe.submit(get_available_gpus)\n print(fs_1.result(), fs_2.result())\n```","metadata":{}},{"id":"b779e393-0c01-4a2a-9343-3480ea59f74b","cell_type":"markdown","source":"### Block Allocation\nIn analogy to the `SingleNodeExecutor` also the `FluxClusterExecutor` and `SlurmClusterExecutor` support the block allocation mode. This starts a number of workers by submitting jobs to the HPC cluster. After these jobs are started, functions are submitted using socket based communication and the same Executor is used to execute multiple functions. This scheme is commonly known as a worker approach, which enables off-loading compute heavy tasks. Below the same example is repeated, which was previously introduced for the `SingleNodeExecutor`:","metadata":{}},{"id":"da81f07f-99f9-469b-9454-efbc083e2043","cell_type":"code","source":"def init_function():\n return {\"j\": 4, \"k\": 3, \"l\": 2}","metadata":{"trusted":true},"outputs":[],"execution_count":5},{"id":"7a3bca08-f39a-48ea-a07c-c41855006843","cell_type":"code","source":"def calc_with_preload(i, j, k):\n return i + j + k","metadata":{"trusted":true},"outputs":[],"execution_count":6},{"id":"1265650e-457d-4a46-9a62-9ad2c95fb80a","cell_type":"markdown","source":"The function `calc_with_preload()` requires three inputs `i`, `j` and `k`. But when the function is submitted to the executor only two inputs are provided `fs = exe.submit(calc, 2, j=5)`. In this case the first input parameter is mapped to `i=2`, the second input parameter is specified explicitly `j=5` but the third input parameter `k` is not provided. So the `FluxClusterExecutor` automatically checks the keys set in the `init_function()` function. In this case the returned dictionary `{\"j\": 4, \"k\": 3, \"l\": 2}` defines `j=4`, `k=3` and `l=2`. For this specific call of the `calc_with_preload()` function, `i` and `j` are already provided so `j` is not required, but `k=3` is used from the `init_function()` and as the `calc_with_preload()` function does not define the `l` parameter this one is also ignored.","metadata":{}},{"id":"ce4dd44c-8db5-4445-bcc5-fad731702444","cell_type":"code","source":"with FluxClusterExecutor(\n cache_directory=\"./file\", \n max_workers=2, \n init_function=init_function, \n block_allocation=True\n) as exe:\n fs = exe.submit(calc_with_preload, 2, j=5)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"10\n"}],"execution_count":7},{"id":"93a54d18-9d65-469b-ad6e-bcc1ec590671","cell_type":"markdown","source":"The result is `2+5+3=10` as `i=2` and `j=5` are provided during the submission and `k=3` is defined in the `init_function()` function.","metadata":{}},{"id":"c9c46c64-d097-49d3-ba79-ecb871c8f4da","cell_type":"markdown","source":"## Disconnecting and Reconnecting\nA key advantage of the HPC Cluster Executors over the [HPC Job Executors](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) is that the Python process which created the executor does not need to stay alive while the submitted functions are running. As the functions are submitted as individual scheduler jobs and the results are stored on the file system, the Python process can be closed after the submission - for example to log out of the login node overnight - and the results can be reloaded later. This is controlled with the `shutdown()` method of the executor, which provides the same `wait` and `cancel_futures` parameters as the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.shutdown) of the Python standard library.\n\nTo submit a set of functions and disconnect without waiting, the executor is created without a `with` statement and `shutdown()` is called with `wait=False` and `cancel_futures=False`:\n\n```python\nfrom executorlib import SlurmClusterExecutor\n\nexe = SlurmClusterExecutor(cache_directory=\"./cache\")\nfuture_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\nexe.shutdown(wait=False, cancel_futures=False)\n```\n\nThe submitted jobs remain in the queue of the job scheduler and continue to run. At a later point - even from a new Python process - the same functions are submitted again using the same `cache_directory`. executorlib recognises the cached results and returns them immediately instead of submitting the functions a second time:\n\n```python\nfrom executorlib import SlurmClusterExecutor\n\nwith SlurmClusterExecutor(cache_directory=\"./cache\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])\n```\n\nThe behaviour of the `shutdown()` method is summarized in the following table:\n\n| `shutdown()` call | Effect |\n|---|---|\n| `shutdown(wait=True)` | Wait until all submitted functions are finished before continuing - this is the default and also what the `with` statement does. |\n| `shutdown(wait=False, cancel_futures=False)` | Return immediately and leave the submitted jobs running in the scheduler queue - used to disconnect from a running workflow. |\n| `shutdown(wait=False, cancel_futures=True)` | Cancel the submitted jobs which have not started or finished yet. |\n\nThis disconnect-and-reconnect capability is available for both the `SlurmClusterExecutor` and the `FluxClusterExecutor`, as both communicate via the file system rather than via sockets.","metadata":{}},{"id":"slurm-job-executor-001","cell_type":"markdown","source":"## Combine both\n\nWhile `SlurmClusterExecutor` submits each Python function as a separate `sbatch` job from the login node, the [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) (`SlurmJobExecutor`) runs **inside** an already-running SLURM allocation and dispatches tasks as `srun` steps — no new jobs enter the queue.\n\n```python\nfrom executorlib import SlurmJobExecutor\n\n# This code runs inside an existing SLURM job\nwith SlurmJobExecutor(max_workers=4) as exe:\n futures = [exe.submit(sum, [i, i], resource_dict={\"cores\": 1}) for i in range(4)]\n print([f.result() for f in futures])\n```\n\nThe two executor types can be nested: a function submitted via `SlurmClusterExecutor` (running as an `sbatch` job) can itself create a `SlurmJobExecutor` to parallelise sub-tasks as `srun` steps within the same allocation:\n\n```python\nfrom executorlib import SlurmClusterExecutor, SlurmJobExecutor\n\ndef parallel_workflow(n):\n with SlurmJobExecutor(max_workers=n) as inner:\n futures = [inner.submit(sum, [i, i], resource_dict={\"cores\": 1}) for i in range(n)]\n return [f.result() for f in futures]\n\nwith SlurmClusterExecutor(cache_directory=\"./cache\") as outer:\n future = outer.submit(\n parallel_workflow, 4,\n resource_dict={\"cores\": 1, \"partition\": \"regular\", \"run_time_max\": 300})\n print(future.result())\n```\n\nThe `sacct` output for such a job will show the outer `sbatch` job together with numbered `srun` steps (e.g. `12345.0`, `12345.1`, …), all completing within the same allocation.\n\n| Executor | Scheduler command | Typical use |\n|---|---|---|\n| `SlurmClusterExecutor` | `sbatch` (one job per function) | Submit from login node |\n| `SlurmJobExecutor` | `srun` steps within current job | Inside an existing allocation |\n| `FluxClusterExecutor` | `flux submit` | Flux-managed allocation or local testing |","metadata":{}},{"id":"3f47fd34-04d1-42a7-bb06-6821dc99a648","cell_type":"markdown","source":"## Cleaning Cache\nFinally, as the HPC Cluster Executors leverage the file system to communicate serialized Python functions, it is important to clean up the cache directory specified by the `cache_directory` parameter once the results of the submitted Python functions are no longer needed. The serialized Python functions are stored in binary format using the [cloudpickle](https://github.com/cloudpipe/cloudpickle) library for serialization. This format is design for caching but not for long-term storage. The user is responsible for the long-term storage of their data.","metadata":{}},{"id":"f537b4f6-cc98-43da-8aca-94a823bcbcbd","cell_type":"code","source":"import os\nimport shutil\n\ncache_dir = \"./file\"\nif os.path.exists(cache_dir):\n print(os.listdir(cache_dir))\n try:\n shutil.rmtree(cache_dir)\n except OSError:\n pass","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"['add_funct144ecf19b5020fccad214df3f4bdabd0_o.h5', 'add_funct67b8245bf71c3c6dcb2018663939c72d', 'add_funct4a5d1f06cca57f0ffbaa3116d39ecc6a', 'add_functcb272924f36cbaa9ac79f8d42b6771c8_o.h5', 'calcd732cdcbd2c8e68145d99f0be814e667', '393f99f890d39348c6248689096e6efb', 'add_funct67b8245bf71c3c6dcb2018663939c72d_o.h5', 'add_funct4a5d1f06cca57f0ffbaa3116d39ecc6a_o.h5', 'calcd732cdcbd2c8e68145d99f0be814e667_o.h5', '3888b889a896c43b68f0bd924ee5285c', 'add_funct144ecf19b5020fccad214df3f4bdabd0', 'add_functcb272924f36cbaa9ac79f8d42b6771c8', 'calc_with_preloade920bec0b69f103b2579175e37aa3528_o.h5']\n"}],"execution_count":8},{"id":"3efc9f5d-fbf9-4a85-8963-5711a453130d","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]} \ No newline at end of file +{"metadata":{"kernelspec":{"display_name":"Flux","language":"python","name":"flux"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.13.14"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"ddf66f38-dc4a-4306-8b1c-b923fdb76922","cell_type":"markdown","source":"# HPC Cluster Executor\nIn contrast to the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) and the [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) the HPC Submission Executors do not communicate via the [zero message queue](https://zeromq.org) but instead store the python functions on the file system and uses the job scheduler to handle the dependencies of the Python functions. Consequently, the block allocation `block_allocation` and the init function `init_function` are not available in the HPC Cluster Executors. At the same time it is possible to close the Python process which created the `Executor`, wait until the execution of the submitted Python functions is completed and afterwards reload the results from the cache.\n\nInternally the HPC submission mode is using the [Python simple queuing system adatper (pysqa)](https://pysqa.readthedocs.io) to connect to HPC job schedulers and the [h5py](https://www.h5py.org) package for serializing the Python functions to store them on the file system. Both packages are optional dependency of executorlib. The installation of the [pysqa](https://pysqa.readthedocs.io) package and the [h5py](https://www.h5py.org) package are covered in the installation section. \n\nFor a step-by-step introduction to submission, resource assignment, dependencies, caching and the choice between the HPC Cluster Executor and the [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html), start with the [Getting Started on HPC](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html) guide. This chapter provides the detailed background and the cluster-specific configuration.","metadata":{}},{"id":"d56862a6-8279-421d-a090-7ca2a3c4d416","cell_type":"markdown","source":["## SLURM\n","The [Simple Linux Utility for Resource Management (SLURM)](https://slurm.schedmd.com) job scheduler is currently the most commonly used job scheduler for HPC clusters. On shared HPC systems users cannot access compute nodes directly — SLURM acts as the resource controller, accepting job requests, managing the queue, and assigning work to nodes when resources become free.\n","\n","In the HPC submission mode executorlib internally uses the [sbatch](https://slurm.schedmd.com/sbatch.html) command, this is in contrast to the [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) which internally uses the [srun](https://slurm.schedmd.com/srun.html) command.\n","\n","The connection to the job scheduler is based on the [Python simple queuing system adatper (pysqa)](https://pysqa.readthedocs.io). It provides a default configuration for most commonly used job schedulers including SLURM, in addition it is also possible to provide the submission template as part of the resource dictionary `resource_dict` for a single script, or persist it once in a configuration directory referenced via the `pysqa_config_directory` parameter, as covered in the \"Reusing the Configuration\" section below. All three options are covered in more detail on the [pysqa documentation](https://pysqa.readthedocs.io)."],"metadata":{}},{"id":"slurm-background-001","cell_type":"markdown","source":"### Background\n\nThree commands cover the day-to-day SLURM workflow:\n\n**`sbatch`** submits a batch script from the login node. The script carries resource directives on lines starting with `#SBATCH`:\n\n```bash\n#!/bin/bash\n#SBATCH --job-name=my_job\n#SBATCH --output=my_job.out\n#SBATCH --ntasks=4 # total MPI ranks\n#SBATCH --cpus-per-task=1 # CPU threads per rank\n#SBATCH --time=00:30:00 # wall-clock limit (HH:MM:SS)\n#SBATCH --partition=regular\n\nsrun --mpi=pmix python my_script.py\n```\n\n```bash\nsbatch job.sh # submit — returns a job ID immediately\n```\n\nKey `#SBATCH` directives:\n\n| Directive | Meaning |\n|---|---|\n| `--ntasks=N` | Total MPI ranks (processes) |\n| `--cpus-per-task=N` | CPU threads available to each rank |\n| `--mem=NG` | Memory per node (e.g. `8G`) |\n| `--time=HH:MM:SS` | Maximum wall-clock time |\n| `--partition=name` | Queue / partition to target |\n| `--dependency=afterok:JOBID` | Run only after another job succeeds |\n\n**`srun`** launches parallel tasks *inside* an existing allocation. Multiple `srun` calls can run concurrently using shell backgrounding:\n\n```bash\nsrun --mpi=pmix -n 4 python task_a.py &\nsrun --mpi=pmix -n 4 python task_b.py &\nwait # block until both finish\n```\n\n**`squeue`** and **`sacct`** let you inspect the queue and verify resource assignments:\n\n```bash\nsqueue --me # your running/pending jobs\nsacct -j 12345 --format=JobID,State,AllocCPUS,Elapsed # accounting for job 12345\n```\n\nCommon `squeue` state codes: `PD` (pending), `R` (running), `CG` (completing).","metadata":{}},{"id":"slurm-mpi-001","cell_type":"markdown","source":"### MPI-parallel Python\n\nThe [Message Passing Interface (MPI)](https://www.mpi-forum.org) is the dominant parallelisation standard on HPC systems. [`mpi4py`](https://mpi4py.readthedocs.io) provides Python bindings. A minimal example:\n\n```python\n# script.py\nfrom mpi4py import MPI\ncomm = MPI.COMM_WORLD\nprint(f\"rank {comm.Get_rank()} of {comm.Get_size()}\")\n```\n\n```bash\nsrun --mpi=pmix -n 4 python script.py\n```\n\nWhen multiple independent groups of ranks need to run inside one allocation there are two approaches:\n\n| Approach | How | Cross-group communication |\n|---|---|---|\n| Multiple `srun` calls | Each `srun` gets its own communicator | Not possible |\n| `MPI_Comm_split` | One `srun`, split in Python | Possible via `MPI.COMM_WORLD` |\n\n```python\n# communicator splitting — 8 ranks split into two groups of 4\ncomm = MPI.COMM_WORLD\ncolor = comm.Get_rank() // 4 # group 0 or group 1\nsub_comm = comm.Split(color)\n```","metadata":{}},{"id":"db7760e8-35a6-4a1c-8b0f-410b536c3835","cell_type":"markdown","source":"### SlurmClusterExecutor\n\n```python\nfrom executorlib import SlurmClusterExecutor\n```","metadata":{}},{"id":"b20913f3-59e4-418c-a399-866124f8e497","cell_type":"markdown","source":"In comparison to the [SingleNodeExecutor](https://executorlib.readthedocs.io/en/latest/1-single-node.html), the only parameter which is changed in the `SlurmClusterExecutor` is the requirement to specify the cache directory using the `cache_directory=\"./cache\"`. The rest of the syntax remains exactly the same, to simplify the up-scaling of simulation workflows.","metadata":{}},{"id":"0b8f3b77-6199-4736-9f28-3058c5230777","cell_type":"markdown","source":"```python\nwith SlurmClusterExecutor(cache_directory=\"./cache\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])\n```","metadata":{}},{"id":"37bef7ac-ce3e-4d8a-b848-b1474c370bca","cell_type":"markdown","source":"Specific parameters for `SlurmClusterExecutor` like the maximum run time `\"run_time_max\"`, the maximum memory `\"memory_max\"` or the submission template for the job submission script `\"submission_template\"` can be specified as part of the resource dictionary. Again it is possible to specify the resource dictonary `resource_dicionary` either for each function in the `submit()` function or during the initialization of the `SlurmClusterExecutor`.","metadata":{}},{"id":"658781de-f222-4235-8c26-b0f77a0831b3","cell_type":"markdown","source":"```python\nsubmission_template = \"\"\"\\\n#!/bin/bash\n#SBATCH --output=time.out\n#SBATCH --job-name={{job_name}}\n#SBATCH --chdir={{working_directory}}\n#SBATCH --get-user-env=L\n#SBATCH --partition={{partition}}\n{%- if run_time_max %}\n#SBATCH --time={{ [1, run_time_max // 60]|max }}\n{%- endif %}\n{%- if dependency %}\n#SBATCH --dependency=afterok:{{ dependency | join(',') }}\n{%- endif %}\n{%- if memory_max %}\n#SBATCH --mem={{memory_max}}G\n{%- endif %}\n#SBATCH --ntasks={{cores}}\n\n{{command}}\n\"\"\"\n\nwith SlurmClusterExecutor(cache_directory=\"./cache\") as exe:\n future = exe.submit(\n sum, [4, 4], \n resource_dict={\n \"submission_template\": submission_template, \n \"run_time_max\": 180, # in seconds \n \"partition\": \"s.cmfe\",\n })\n print(future.result())\n```","metadata":{}},{"id":"f7ad9c97-7743-4f87-9344-4299b2b31a56","cell_type":"markdown","source":"The template uses [Jinja2](https://jinja.palletsprojects.com) syntax. executorlib fills `{{cores}}` into `--ntasks`, so `cores=1` requests one serial process and `cores=4` requests four MPI ranks. With `pmi_mode=\"pmix\"` the executor additionally wraps the function call in `srun --mpi=pmix -n `:\n\n```python\ndef mpi_calc(i):\n from mpi4py import MPI\n comm = MPI.COMM_WORLD\n return {\"rank\": comm.Get_rank(), \"size\": comm.Get_size(), \"input\": i}\n\nwith SlurmClusterExecutor(pmi_mode=\"pmix\", cache_directory=\"./cache\") as exe:\n future = exe.submit(\n mpi_calc, 42,\n resource_dict={\"submission_template\": submission_template, \"cores\": 4, \"partition\": \"regular\", \"run_time_max\": 120})\n print(future.result())\n```\n\nWith these options executorlib in combination with the SLURM job scheduler provides a lot flexibility to configure the submission of Python functions depending on the specific configuration of the job scheduler. \n\nIn case the submission goes wrong, for example when no submission template is defined and executorlib falls back to the default submission template a `CalledProcessError` is raised:\n\n```python\ndef echo(i):\n return i\n\nwith SlurmClusterExecutor() as exe:\n f1 = exe.submit(echo)\n print(f1.result())\n```\n\nThe error message would be something like:\n```\nCalledProcessError: Command '['sbatch', '--parsable', '/home/jovyan/executorlib_cache/echoe5873521b7330f831bed941744079e83/run_queue.sh']' returned non-zero exit status 1.\n```\n\nThis is not really helpful, as it primarily says the `sbatch` command was not successful, but the error message which `sbatch` raised on the command line is not directly accessible from Python. To access the error message you can access the exception of the future object:\n\n```python\nexcep = f1.exception()\nprint(excep.output)\n```\n\nThis gives:\n```\nsbatch: error: invalid partition specified: (null)\nsbatch: error: Batch job submission failed: Invalid partition name specified\n```\n\nSo the submission failed because no partition was provided, which can be corrected by adding the `--partition` flag in the submission template, as demonstrated above. ","metadata":{}},{"id":"e1299068-990e-4fd3-b926-f6415b4e9d75","cell_type":"markdown","source":"### Verifying the Resource Assignment\nAfter the submission it is often useful to confirm that the job scheduler actually assigned the requested resources. For the `SlurmClusterExecutor` the SLURM job identifier is stored in the cache and can be retrieved with the `get_cache_data()` function. This job identifier `queue_id` can then be passed to the SLURM [sacct](https://slurm.schedmd.com/sacct.html) command to inspect the accounting record of the job:\n\n```python\nfrom executorlib import get_cache_data\nimport subprocess\n\nfor entry in get_cache_data(cache_directory=\"./cache\"):\n if \"calc\" in str(entry[\"function\"]):\n job_id = entry[\"queue_id\"]\n print(subprocess.check_output(\n [\"sacct\", \"-j\", str(job_id), \"--format=JobID,State,AllocCPUS,Elapsed\"],\n universal_newlines=True,\n ))\n```\n\nThe `AllocCPUS` column reports the number of CPU cores SLURM allocated for the function. In addition to the `queue_id` each cache entry also contains the full `resource_dict`, the runtime and the path of the result file, which together provide a complete audit trail of the submission - this is the same information returned by the `get_cache_data()` function demonstrated for the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html#cache).","metadata":{}},{"cell_type":"markdown","id":"pysqa-config-directory-001","metadata":{"trusted":true},"source":["### Reusing the Configuration with `pysqa_config_directory`\n","The `submission_template` shown above is convenient for a single script, but has to be repeated in every Python session which submits jobs. For a configuration which is set up once and reused by any number of scripts and users, executorlib can instead read the submission template from a configuration directory via the `pysqa_config_directory` parameter, which is passed through to the [pysqa](https://pysqa.readthedocs.io) package. This is the same mechanism [pyiron](https://pyiron.org) uses to manage its HPC configuration, so an existing pysqa configuration directory can be reused directly with executorlib.\n","\n","A pysqa configuration directory contains a `queue.yaml` file which lists the available queues, together with a Jinja2 submission template for each of them:\n","```\n","~/.queues/\n","├── queue.yaml\n","└── slurm.sh\n","```\n","\n","`queue.yaml` defines the queue type, the primary queue and the individual queues - `cores_min` and `cores_max` restrict the number of cores which can be requested, `run_time_max` caps the maximum run time in seconds and `script` points to the Jinja2 template file used to generate the submission script:\n","```yaml\n","queue_type: SLURM\n","queue_primary: slurm\n","queues:\n"," slurm: {cores_min: 1, cores_max: 100, run_time_max: 259200, script: slurm.sh}\n","```\n","\n","`slurm.sh` is the same kind of Jinja2 template already introduced above as the `submission_template`, just stored in a file rather than a Python string:\n","```\n","#!/bin/bash\n","#SBATCH --output=time.out\n","#SBATCH --job-name={{job_name}}\n","#SBATCH --chdir={{working_directory}}\n","#SBATCH --get-user-env=L\n","#SBATCH --partition=my_partition\n","{%- if run_time_max %}\n","#SBATCH --time={{ [1, run_time_max // 60]|max }}\n","{%- endif %}\n","{%- if dependency_list %}\n","#SBATCH --dependency=afterok:{{ dependency_list | join(',') }}\n","{%- endif %}\n","{%- if memory_max %}\n","#SBATCH --mem={{memory_max}}G\n","{%- endif %}\n","#SBATCH --ntasks={{cores}}\n","\n","{{command}}\n","```\n","\n","Once the directory is set up it can be reused by any `SlurmClusterExecutor`, simply by pointing `pysqa_config_directory` at it - no `submission_template` needs to be specified anymore:\n","```python\n","with SlurmClusterExecutor(cache_directory=\"./cache\", pysqa_config_directory=\"~/.queues\") as exe:\n"," future = exe.submit(sum, [4, 4], resource_dict={\"run_time_max\": 180, \"cores\": 4})\n"," print(future.result())\n","```\n","\n","If `pysqa_config_directory` is not provided, as in the earlier examples, executorlib falls back to a generic, built-in submission template for the selected job scheduler - this is the default submission template referenced in the `CalledProcessError` example above. Providing an explicit `pysqa_config_directory` (or `submission_template`) becomes necessary as soon as the target HPC system requires mandatory options like `--partition`.\n","\n","For clusters which are only reachable via SSH, or setups spanning multiple job schedulers, the configuration directory can instead contain a `clusters.yaml` file referencing several such `queue.yaml` configurations. This and further configuration options, like SSH-based remote submission, are covered in the [pysqa documentation](https://pysqa.readthedocs.io)."]},{"cell_type":"markdown","id":"claude-code-setup-001","metadata":{},"source":["### Setup with Claude Code\n","Writing a `submission_template` for a new HPC cluster requires knowing its partitions, memory defaults, GPU resources, submit filters and job limits. To automate this step, executorlib provides the [executorlib-cluster-setup](https://github.com/pyiron/executorlib/blob/main/.claude/skills/executorlib-cluster-setup/SKILL.md) skill for [Claude Code](https://docs.claude.com/en/docs/claude-code/overview). Started on the login node of a SLURM cluster, it analyses the cluster with `sinfo`, `scontrol` and `sacctmgr`, checks the generated submission templates with `sbatch --test-only`, runs short smoke tests for serial functions, GPUs, MPI binaries and dependencies, and finally writes a cluster-specific skill `executorlib-`. This cluster-specific skill contains the tested `submission_template`, helper functions to construct the `resource_dict` and the pitfalls found during testing, so later Claude Code sessions can submit Python functions with the `SlurmClusterExecutor` on this cluster.\n","\n","To install the skill for your user, download it to the Claude Code skills directory on the login node:\n","\n","```bash\n","mkdir -p ~/.claude/skills/executorlib-cluster-setup\n","curl -o ~/.claude/skills/executorlib-cluster-setup/SKILL.md https://raw.githubusercontent.com/pyiron/executorlib/main/.claude/skills/executorlib-cluster-setup/SKILL.md\n","```\n","\n","Afterwards start `claude` on the login node, in the Python environment with executorlib and pysqa installed, and call the skill with `/executorlib-cluster-setup` or ask Claude Code to set up executorlib for this cluster. Claude Code asks for the information the cluster cannot provide itself, like the codes you want to run, the account to charge and the URL of the site documentation. As the smoke tests submit short jobs, preferably to a debug or test partition, they consume a small amount of your computing time."]},{"id":"2a814efb-2fbc-41ba-98df-cf121d19ea66","cell_type":"markdown","source":"## Flux\n[Flux](http://flux-framework.org) is a modern HPC resource manager developed at Lawrence Livermore National Laboratory (LLNL). On many systems it runs as a **secondary scheduler inside a SLURM allocation**, enabling fine-grained hierarchical task distribution. Unlike SLURM, Flux can also be installed locally via conda — making it especially suitable for demonstrations, testing, and continuous integration:\n\n```bash\nconda install -c conda-forge flux-core\nflux start # launch a local Flux instance\n```\n\nThis simple installation is explained in the [installation section](https://executorlib.readthedocs.io/en/latest/installation.html#alternative-installations). The features demonstrated below using Flux apply equally to SLURM.","metadata":{}},{"id":"flux-background-001","cell_type":"markdown","source":"### Background\n\nThe key Flux commands map closely onto their SLURM equivalents:\n\n| Flux command | SLURM equivalent | Description |\n|---|---|---|\n| `flux resource list` | `sinfo` | Show available nodes, cores, and GPUs |\n| `flux jobs -a` | `squeue` | List all jobs (running and completed) |\n| `flux submit` | `sbatch` | Submit a non-blocking job; returns a job ID immediately |\n| `flux run` | `srun` | Launch a blocking job; waits for completion |\n| `flux job attach ` | — | Stream output of a previously submitted job |\n\n```bash\n# submit a non-blocking 4-rank MPI job\nflux submit -o pmi=pmix --ntasks=4 python script.py\n\n# run a blocking 4-rank MPI job (waits for output)\nflux run -o pmi=pmix -n 4 python script.py\n```\n\nThe `-o pmi=pmix` flag matches what SLURM's `--mpi=pmix` provides — the same `mpi4py` scripts run unchanged under both schedulers.","metadata":{}},{"id":"29d7aa18-357e-416e-805c-1322b59abec1","cell_type":"markdown","source":"### Dependencies\nAs already demonstrated for the [SingleNodeExecutor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) the `Executor` classes from executorlib are capable of resolving the dependencies of serial functions, when [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects are used as inputs for subsequent function calls. For the case of the HPC submission these dependencies are communicated to the job scheduler, which allows to stop the Python process which created the `Executor` class, wait until the execution of the submitted Python functions is completed and afterwards restart the Python process for the `Executor` class and reload the calculation results from the cache defined by the `cache_directory` parameter.","metadata":{}},{"id":"0f7fc37a-1248-492d-91ab-9db1d737eaee","cell_type":"code","source":"def add_funct(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":1},{"id":"ae308683-6083-4e78-afc2-bff6c6dc297b","cell_type":"code","source":"from executorlib import FluxClusterExecutor\n\nwith FluxClusterExecutor(cache_directory=\"./file\") as exe:\n future = 0\n for i in range(4, 8):\n future = exe.submit(add_funct, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"22\n"}],"execution_count":2},{"id":"ca75cb6c-c50f-4bee-9b09-d8d29d6c263b","cell_type":"markdown","source":"### Resource Assignment\nIn analogy to the [SingleNodeExecutor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) the resource assignment for the `FluxClusterExecutor` is handled by either including the resource dictionary parameter `resource_dict` in the initialization of the `FluxClusterExecutor` class or in every call of the `submit()` function.\n\nBelow this is demonstrated once for the assignment of multiple CPU cores for the execution of a Python function which internally uses the message passing interface (MPI) via the [mpi4py](https://mpi4py.readthedocs.io) package.","metadata":{}},{"id":"eded3a0f-e54f-44f6-962f-eedde4bd2158","cell_type":"code","source":"def calc(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank\n","metadata":{"trusted":true},"outputs":[],"execution_count":3},{"id":"669b05df-3cb2-4f69-9d94-8b2442745ebb","cell_type":"code","source":"with FluxClusterExecutor(cache_directory=\"./file\") as exe:\n fs = exe.submit(calc, 3, resource_dict={\"cores\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"(3, 1, 0)\n"}],"execution_count":4},{"id":"d91499d7-5c6c-4c10-b7b7-bfc4b87ddaa8","cell_type":"markdown","source":"Beyond CPU cores and threads which were previously also introduced for the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) the HPC Cluster Executors also provide the option to select the available accelerator cards or GPUs, by specifying the `\"gpus_per_core\"` parameter in the resource dictionary `resource_dict`. For demonstration we create a Python function which reads the GPU device IDs and submit it to the `FluxClusterExecutor` class:\n```python\ndef get_available_gpus():\n import socket\n from tensorflow.python.client import device_lib\n local_device_protos = device_lib.list_local_devices()\n return [\n (x.name, x.physical_device_desc, socket.gethostname()) \n for x in local_device_protos if x.device_type == 'GPU'\n ]\n```\n\n```python\nwith FluxClusterExecutor(\n cache_directory=\"./cache\",\n resource_dict={\"gpus_per_core\": 1}\n) as exe:\n fs_1 = exe.submit(get_available_gpus)\n fs_2 = exe.submit(get_available_gpus)\n print(fs_1.result(), fs_2.result())\n```","metadata":{}},{"id":"b779e393-0c01-4a2a-9343-3480ea59f74b","cell_type":"markdown","source":"### Block Allocation\nIn analogy to the `SingleNodeExecutor` also the `FluxClusterExecutor` and `SlurmClusterExecutor` support the block allocation mode. This starts a number of workers by submitting jobs to the HPC cluster. After these jobs are started, functions are submitted using socket based communication and the same Executor is used to execute multiple functions. This scheme is commonly known as a worker approach, which enables off-loading compute heavy tasks. Below the same example is repeated, which was previously introduced for the `SingleNodeExecutor`:","metadata":{}},{"id":"da81f07f-99f9-469b-9454-efbc083e2043","cell_type":"code","source":"def init_function():\n return {\"j\": 4, \"k\": 3, \"l\": 2}","metadata":{"trusted":true},"outputs":[],"execution_count":5},{"id":"7a3bca08-f39a-48ea-a07c-c41855006843","cell_type":"code","source":"def calc_with_preload(i, j, k):\n return i + j + k","metadata":{"trusted":true},"outputs":[],"execution_count":6},{"id":"1265650e-457d-4a46-9a62-9ad2c95fb80a","cell_type":"markdown","source":"The function `calc_with_preload()` requires three inputs `i`, `j` and `k`. But when the function is submitted to the executor only two inputs are provided `fs = exe.submit(calc, 2, j=5)`. In this case the first input parameter is mapped to `i=2`, the second input parameter is specified explicitly `j=5` but the third input parameter `k` is not provided. So the `FluxClusterExecutor` automatically checks the keys set in the `init_function()` function. In this case the returned dictionary `{\"j\": 4, \"k\": 3, \"l\": 2}` defines `j=4`, `k=3` and `l=2`. For this specific call of the `calc_with_preload()` function, `i` and `j` are already provided so `j` is not required, but `k=3` is used from the `init_function()` and as the `calc_with_preload()` function does not define the `l` parameter this one is also ignored.","metadata":{}},{"id":"ce4dd44c-8db5-4445-bcc5-fad731702444","cell_type":"code","source":"with FluxClusterExecutor(\n cache_directory=\"./file\", \n max_workers=2, \n init_function=init_function, \n block_allocation=True\n) as exe:\n fs = exe.submit(calc_with_preload, 2, j=5)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"10\n"}],"execution_count":7},{"id":"93a54d18-9d65-469b-ad6e-bcc1ec590671","cell_type":"markdown","source":"The result is `2+5+3=10` as `i=2` and `j=5` are provided during the submission and `k=3` is defined in the `init_function()` function.","metadata":{}},{"id":"c9c46c64-d097-49d3-ba79-ecb871c8f4da","cell_type":"markdown","source":"## Disconnecting and Reconnecting\nA key advantage of the HPC Cluster Executors over the [HPC Job Executors](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) is that the Python process which created the executor does not need to stay alive while the submitted functions are running. As the functions are submitted as individual scheduler jobs and the results are stored on the file system, the Python process can be closed after the submission - for example to log out of the login node overnight - and the results can be reloaded later. This is controlled with the `shutdown()` method of the executor, which provides the same `wait` and `cancel_futures` parameters as the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.shutdown) of the Python standard library.\n\nTo submit a set of functions and disconnect without waiting, the executor is created without a `with` statement and `shutdown()` is called with `wait=False` and `cancel_futures=False`:\n\n```python\nfrom executorlib import SlurmClusterExecutor\n\nexe = SlurmClusterExecutor(cache_directory=\"./cache\")\nfuture_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\nexe.shutdown(wait=False, cancel_futures=False)\n```\n\nThe submitted jobs remain in the queue of the job scheduler and continue to run. At a later point - even from a new Python process - the same functions are submitted again using the same `cache_directory`. executorlib recognises the cached results and returns them immediately instead of submitting the functions a second time:\n\n```python\nfrom executorlib import SlurmClusterExecutor\n\nwith SlurmClusterExecutor(cache_directory=\"./cache\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])\n```\n\nThe behaviour of the `shutdown()` method is summarized in the following table:\n\n| `shutdown()` call | Effect |\n|---|---|\n| `shutdown(wait=True)` | Wait until all submitted functions are finished before continuing - this is the default and also what the `with` statement does. |\n| `shutdown(wait=False, cancel_futures=False)` | Return immediately and leave the submitted jobs running in the scheduler queue - used to disconnect from a running workflow. |\n| `shutdown(wait=False, cancel_futures=True)` | Cancel the submitted jobs which have not started or finished yet. |\n\nThis disconnect-and-reconnect capability is available for both the `SlurmClusterExecutor` and the `FluxClusterExecutor`, as both communicate via the file system rather than via sockets.","metadata":{}},{"id":"slurm-job-executor-001","cell_type":"markdown","source":"## Combine both\n\nWhile `SlurmClusterExecutor` submits each Python function as a separate `sbatch` job from the login node, the [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) (`SlurmJobExecutor`) runs **inside** an already-running SLURM allocation and dispatches tasks as `srun` steps — no new jobs enter the queue.\n\n```python\nfrom executorlib import SlurmJobExecutor\n\n# This code runs inside an existing SLURM job\nwith SlurmJobExecutor(max_workers=4) as exe:\n futures = [exe.submit(sum, [i, i], resource_dict={\"cores\": 1}) for i in range(4)]\n print([f.result() for f in futures])\n```\n\nThe two executor types can be nested: a function submitted via `SlurmClusterExecutor` (running as an `sbatch` job) can itself create a `SlurmJobExecutor` to parallelise sub-tasks as `srun` steps within the same allocation:\n\n```python\nfrom executorlib import SlurmClusterExecutor, SlurmJobExecutor\n\ndef parallel_workflow(n):\n with SlurmJobExecutor(max_workers=n) as inner:\n futures = [inner.submit(sum, [i, i], resource_dict={\"cores\": 1}) for i in range(n)]\n return [f.result() for f in futures]\n\nwith SlurmClusterExecutor(cache_directory=\"./cache\") as outer:\n future = outer.submit(\n parallel_workflow, 4,\n resource_dict={\"cores\": 1, \"partition\": \"regular\", \"run_time_max\": 300})\n print(future.result())\n```\n\nThe `sacct` output for such a job will show the outer `sbatch` job together with numbered `srun` steps (e.g. `12345.0`, `12345.1`, …), all completing within the same allocation.\n\n| Executor | Scheduler command | Typical use |\n|---|---|---|\n| `SlurmClusterExecutor` | `sbatch` (one job per function) | Submit from login node |\n| `SlurmJobExecutor` | `srun` steps within current job | Inside an existing allocation |\n| `FluxClusterExecutor` | `flux submit` | Flux-managed allocation or local testing |","metadata":{}},{"id":"3f47fd34-04d1-42a7-bb06-6821dc99a648","cell_type":"markdown","source":"## Cleaning Cache\nFinally, as the HPC Cluster Executors leverage the file system to communicate serialized Python functions, it is important to clean up the cache directory specified by the `cache_directory` parameter once the results of the submitted Python functions are no longer needed. The serialized Python functions are stored in binary format using the [cloudpickle](https://github.com/cloudpipe/cloudpickle) library for serialization. This format is design for caching but not for long-term storage. The user is responsible for the long-term storage of their data.","metadata":{}},{"id":"f537b4f6-cc98-43da-8aca-94a823bcbcbd","cell_type":"code","source":"import os\nimport shutil\n\ncache_dir = \"./file\"\nif os.path.exists(cache_dir):\n print(os.listdir(cache_dir))\n try:\n shutil.rmtree(cache_dir)\n except OSError:\n pass","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"['add_funct144ecf19b5020fccad214df3f4bdabd0_o.h5', 'add_funct67b8245bf71c3c6dcb2018663939c72d', 'add_funct4a5d1f06cca57f0ffbaa3116d39ecc6a', 'add_functcb272924f36cbaa9ac79f8d42b6771c8_o.h5', 'calcd732cdcbd2c8e68145d99f0be814e667', '393f99f890d39348c6248689096e6efb', 'add_funct67b8245bf71c3c6dcb2018663939c72d_o.h5', 'add_funct4a5d1f06cca57f0ffbaa3116d39ecc6a_o.h5', 'calcd732cdcbd2c8e68145d99f0be814e667_o.h5', '3888b889a896c43b68f0bd924ee5285c', 'add_funct144ecf19b5020fccad214df3f4bdabd0', 'add_functcb272924f36cbaa9ac79f8d42b6771c8', 'calc_with_preloade920bec0b69f103b2579175e37aa3528_o.h5']\n"}],"execution_count":8},{"id":"3efc9f5d-fbf9-4a85-8963-5711a453130d","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]} \ No newline at end of file From 904be00ce14646b64d0fa90900898746a685e31b Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Thu, 19 Nov 2026 10:39:24 +0100 Subject: [PATCH 2/9] Execute the SLURM examples of the documentation notebooks in CI The SLURM examples in notebooks/2-hpc-cluster.ipynb and notebooks/3-hpc-job.ipynb were markdown code blocks which were never executed. They are now code cells which are executed in the new notebooks_slurm job on the single node SLURM test cluster of koesterlab/setup-slurm-action, while the flux examples continue to be executed in the notebooks job. - .ci_support/run_notebooks.py selects the code cells per job based on the cell tags "slurm" / "flux" (untagged cells run in both) and executes notebooks with the notebook metadata "executorlib_ci": {"allocation": true} inside "salloc -n 2". - notebooks_slurm also executes notebooks/story-*.ipynb if they exist. - Fix the submission template: pysqa provides dependency_list, not dependency, and the partition is only set when "partition" is defined in the resource_dict. - Add executable examples for SLURM dependencies and the SlurmJobExecutor with MPI. Co-Authored-By: Claude Opus 5.5 --- .ci_support/run_notebooks.py | 112 +++++++++++++++++++++++++++++++++ .github/workflows/pipeline.yml | 57 +++++++++++++++-- notebooks/2-hpc-cluster.ipynb | 2 +- notebooks/3-hpc-job.ipynb | 71 +++++++++++++++++++-- 4 files changed, 231 insertions(+), 11 deletions(-) create mode 100644 .ci_support/run_notebooks.py diff --git a/.ci_support/run_notebooks.py b/.ci_support/run_notebooks.py new file mode 100644 index 00000000..513b8e18 --- /dev/null +++ b/.ci_support/run_notebooks.py @@ -0,0 +1,112 @@ +""" +Execute the documentation notebooks with papermill for a given job scheduler. + +The documentation notebooks demonstrate executorlib for both SLURM and flux, but each CI job only provides one of the +two job schedulers. To keep the rendered documentation free of any CI plumbing, the selection is based on metadata +which is not visible in the rendered notebooks: + +Cell tags (cell metadata "tags"): + "slurm" - the code cell is only executed in the SLURM CI job (notebooks_slurm). + "flux" - the code cell is only executed in the flux CI job (notebooks). + no tag - the code cell is executed in both jobs, e.g. function definitions or cleaning the cache. + +Notebook metadata (top-level notebook metadata, only evaluated for --scheduler slurm): + "executorlib_ci": {"allocation": true} + The notebook uses the SlurmJobExecutor (srun) and is executed inside a SLURM allocation, which is created with + "salloc -n ". Notebooks without this flag are executed on the login node, i.e. directly on the runner, + which is the setup for the SlurmClusterExecutor (sbatch). + "executorlib_ci": {"allocation": true, "cores": 2} + Number of cores requested for the allocation, defaults to 2. The single node test cluster only provides 2 CPU + cores, so the allocation occupies the whole cluster: a notebook executed inside an allocation must not submit + jobs with sbatch (SlurmClusterExecutor), as these jobs would wait for the allocation to finish. Notebooks which + combine both, like a SlurmJobExecutor nested in a function submitted via the SlurmClusterExecutor, are executed + on the login node. + +For each input notebook the cells which do not match the selected scheduler are removed, the filtered notebook is +written to a temporary directory and executed with papermill in the directory of the original notebook. The executed +notebook is stored next to the original notebook as -out.ipynb. + +Usage: + python .ci_support/run_notebooks.py --scheduler slurm notebooks/2-hpc-cluster.ipynb notebooks/story-*.ipynb + flux start python .ci_support/run_notebooks.py --scheduler flux notebooks/2-hpc-cluster.ipynb +""" + +import argparse +import os +import subprocess +import sys +import tempfile + +import nbformat + +SCHEDULERS = ("flux", "slurm") + + +def filter_notebook(nb: nbformat.NotebookNode, scheduler: str) -> nbformat.NotebookNode: + """Remove the code cells which are tagged for a different job scheduler.""" + other_tags = {s for s in SCHEDULERS if s != scheduler} + nb.cells = [ + cell + for cell in nb.cells + if cell.cell_type != "code" + or not other_tags.intersection(cell.get("metadata", {}).get("tags", [])) + ] + return nb + + +def get_command( + nb: nbformat.NotebookNode, + scheduler: str, + input_path: str, + output_path: str, + cwd: str, +) -> list[str]: + """Construct the papermill command, wrapped in a SLURM allocation if the notebook requests it.""" + command = ["papermill", input_path, output_path, "-k", "python3", "--cwd", cwd] + ci_config = nb.metadata.get("executorlib_ci", {}) + if scheduler == "slurm" and ci_config.get("allocation", False): + command = ["salloc", "-n", str(ci_config.get("cores", 2))] + command + return command + + +def run_notebook(path: str, scheduler: str, tmp_dir: str) -> bool: + nb = filter_notebook(nb=nbformat.read(path, as_version=4), scheduler=scheduler) + name = os.path.splitext(os.path.basename(path))[0] + input_path = os.path.join(tmp_dir, name + "-" + scheduler + ".ipynb") + output_path = os.path.join( + os.path.dirname(os.path.abspath(path)), name + "-out.ipynb" + ) + nbformat.write(nb, input_path) + command = get_command( + nb=nb, + scheduler=scheduler, + input_path=input_path, + output_path=output_path, + cwd=os.path.dirname(os.path.abspath(path)), + ) + print("Execute:", " ".join(command), flush=True) + return subprocess.run(command, check=False).returncode == 0 + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__.split("\n\n")[0]) + parser.add_argument("--scheduler", choices=SCHEDULERS, required=True) + parser.add_argument("notebooks", nargs="*") + args = parser.parse_args() + if len(args.notebooks) == 0: + print("No notebooks to execute.") + return 0 + failed = [] + with tempfile.TemporaryDirectory() as tmp_dir: + # skip the output of previous executions which is matched by glob patterns like notebooks/story-*.ipynb + for path in [p for p in args.notebooks if not p.endswith("-out.ipynb")]: + if not run_notebook(path=path, scheduler=args.scheduler, tmp_dir=tmp_dir): + failed.append(path) + if len(failed) > 0: + print("Failed notebooks:", ", ".join(failed)) + return 1 + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 637672f9..e7165697 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -176,10 +176,59 @@ jobs: timeout-minutes: 5 run: | papermill notebooks/1-single-node.ipynb notebooks/1-single-node-out.ipynb -k python3 - flux start papermill notebooks/2-hpc-cluster.ipynb notebooks/2-hpc-cluster-out.ipynb -k python3 - flux start papermill notebooks/3-hpc-job.ipynb notebooks/3-hpc-job-out.ipynb -k python3 + flux start python .ci_support/run_notebooks.py --scheduler flux notebooks/2-hpc-cluster.ipynb + flux start python .ci_support/run_notebooks.py --scheduler flux notebooks/3-hpc-job.ipynb papermill notebooks/5-developer.ipynb notebooks/5-developer-out.ipynb -k python3 + # Execute the SLURM examples of the documentation notebooks on a single node SLURM test cluster (2 CPU cores). + # The notebooks are executed with .ci_support/run_notebooks.py, which selects the cells based on cell tags: + # - code cells tagged "slurm" are only executed in this job, code cells tagged "flux" only in the notebooks job, + # code cells without these tags are executed in both jobs. + # By default a notebook is executed on the login node (the runner itself), which is the setup for the + # SlurmClusterExecutor (sbatch). Notebooks using the SlurmJobExecutor (srun) declare in their notebook metadata + # "executorlib_ci": {"allocation": true} + # and are executed inside a SLURM allocation "salloc -n 2 papermill ...". As the allocation occupies all cores of the + # test cluster, these notebooks must not submit jobs with sbatch (SlurmClusterExecutor). The user story notebooks + # notebooks/story-*.ipynb follow the same convention and are executed if they exist. + notebooks_slurm: + needs: [black] + runs-on: ubuntu-24.04 + services: + mysql: + image: mysql:8.0 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - "8888:3306" + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - uses: actions/checkout@v7 + - uses: koesterlab/setup-slurm-action@v1 + timeout-minutes: 10 + - name: ubnuntu install + run: sudo apt install -y mpich + - name: Merge Notebook environment + run: | + cp .ci_support/environment-mpich.yml environment.yml + tail --lines=+4 .ci_support/environment-notebooks.yml >> environment.yml + - uses: conda-incubator/setup-miniconda@v4 + with: + python-version: '3.14' + miniforge-version: latest + channels: conda-forge + conda-remove-defaults: "true" + environment-file: environment.yml + - name: Install + shell: bash -l {0} + run: pip install . --no-deps --no-build-isolation + - name: Notebooks + shell: bash -l {0} + timeout-minutes: 20 + run: | + sinfo -o "%n %e %m %a %c %C" + shopt -s nullglob + python .ci_support/run_notebooks.py --scheduler slurm notebooks/2-hpc-cluster.ipynb notebooks/3-hpc-job.ipynb notebooks/story-*.ipynb + notebooks_integration: needs: [black] runs-on: ubuntu-latest @@ -445,7 +494,7 @@ jobs: OMPI_MCA_btl_vader_single_copy_mechanism: 'none' autobot: - needs: [unittest_old, unittest_win, unittest_openmpi, unittest_mpich, unittest_flux_openmpi, unittest_flux_mpich, notebooks, benchmark, minimal, pip_check, mypy] + needs: [unittest_old, unittest_win, unittest_openmpi, unittest_mpich, unittest_flux_openmpi, unittest_flux_mpich, notebooks, notebooks_slurm, benchmark, minimal, pip_check, mypy] permissions: contents: write pull-requests: write @@ -459,7 +508,7 @@ jobs: GH_TOKEN: ${{secrets.GITHUB_TOKEN}} uml: - needs: [uv_check, unittest_slurm_mpich, unittest_old, unittest_win, unittest_openmpi, unittest_mpich, unittest_flux_openmpi, unittest_flux_mpich, notebooks, benchmark, minimal, pip_check, mypy] + needs: [uv_check, unittest_slurm_mpich, unittest_old, unittest_win, unittest_openmpi, unittest_mpich, unittest_flux_openmpi, unittest_flux_mpich, notebooks, notebooks_slurm, benchmark, minimal, pip_check, mypy] runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 diff --git a/notebooks/2-hpc-cluster.ipynb b/notebooks/2-hpc-cluster.ipynb index e80c5815..49ae6355 100644 --- a/notebooks/2-hpc-cluster.ipynb +++ b/notebooks/2-hpc-cluster.ipynb @@ -1 +1 @@ -{"metadata":{"kernelspec":{"display_name":"Flux","language":"python","name":"flux"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.13.14"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"ddf66f38-dc4a-4306-8b1c-b923fdb76922","cell_type":"markdown","source":"# HPC Cluster Executor\nIn contrast to the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) and the [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) the HPC Submission Executors do not communicate via the [zero message queue](https://zeromq.org) but instead store the python functions on the file system and uses the job scheduler to handle the dependencies of the Python functions. Consequently, the block allocation `block_allocation` and the init function `init_function` are not available in the HPC Cluster Executors. At the same time it is possible to close the Python process which created the `Executor`, wait until the execution of the submitted Python functions is completed and afterwards reload the results from the cache.\n\nInternally the HPC submission mode is using the [Python simple queuing system adatper (pysqa)](https://pysqa.readthedocs.io) to connect to HPC job schedulers and the [h5py](https://www.h5py.org) package for serializing the Python functions to store them on the file system. Both packages are optional dependency of executorlib. The installation of the [pysqa](https://pysqa.readthedocs.io) package and the [h5py](https://www.h5py.org) package are covered in the installation section. ","metadata":{}},{"id":"d56862a6-8279-421d-a090-7ca2a3c4d416","cell_type":"markdown","source":["## SLURM\n","The [Simple Linux Utility for Resource Management (SLURM)](https://slurm.schedmd.com) job scheduler is currently the most commonly used job scheduler for HPC clusters. On shared HPC systems users cannot access compute nodes directly — SLURM acts as the resource controller, accepting job requests, managing the queue, and assigning work to nodes when resources become free.\n","\n","In the HPC submission mode executorlib internally uses the [sbatch](https://slurm.schedmd.com/sbatch.html) command, this is in contrast to the [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) which internally uses the [srun](https://slurm.schedmd.com/srun.html) command.\n","\n","The connection to the job scheduler is based on the [Python simple queuing system adatper (pysqa)](https://pysqa.readthedocs.io). It provides a default configuration for most commonly used job schedulers including SLURM, in addition it is also possible to provide the submission template as part of the resource dictionary `resource_dict` for a single script, or persist it once in a configuration directory referenced via the `pysqa_config_directory` parameter, as covered in the \"Reusing the Configuration\" section below. All three options are covered in more detail on the [pysqa documentation](https://pysqa.readthedocs.io)."],"metadata":{}},{"id":"slurm-background-001","cell_type":"markdown","source":"### Background\n\nThree commands cover the day-to-day SLURM workflow:\n\n**`sbatch`** submits a batch script from the login node. The script carries resource directives on lines starting with `#SBATCH`:\n\n```bash\n#!/bin/bash\n#SBATCH --job-name=my_job\n#SBATCH --output=my_job.out\n#SBATCH --ntasks=4 # total MPI ranks\n#SBATCH --cpus-per-task=1 # CPU threads per rank\n#SBATCH --time=00:30:00 # wall-clock limit (HH:MM:SS)\n#SBATCH --partition=regular\n\nsrun --mpi=pmix python my_script.py\n```\n\n```bash\nsbatch job.sh # submit — returns a job ID immediately\n```\n\nKey `#SBATCH` directives:\n\n| Directive | Meaning |\n|---|---|\n| `--ntasks=N` | Total MPI ranks (processes) |\n| `--cpus-per-task=N` | CPU threads available to each rank |\n| `--mem=NG` | Memory per node (e.g. `8G`) |\n| `--time=HH:MM:SS` | Maximum wall-clock time |\n| `--partition=name` | Queue / partition to target |\n| `--dependency=afterok:JOBID` | Run only after another job succeeds |\n\n**`srun`** launches parallel tasks *inside* an existing allocation. Multiple `srun` calls can run concurrently using shell backgrounding:\n\n```bash\nsrun --mpi=pmix -n 4 python task_a.py &\nsrun --mpi=pmix -n 4 python task_b.py &\nwait # block until both finish\n```\n\n**`squeue`** and **`sacct`** let you inspect the queue and verify resource assignments:\n\n```bash\nsqueue --me # your running/pending jobs\nsacct -j 12345 --format=JobID,State,AllocCPUS,Elapsed # accounting for job 12345\n```\n\nCommon `squeue` state codes: `PD` (pending), `R` (running), `CG` (completing).","metadata":{}},{"id":"slurm-mpi-001","cell_type":"markdown","source":"### MPI-parallel Python\n\nThe [Message Passing Interface (MPI)](https://www.mpi-forum.org) is the dominant parallelisation standard on HPC systems. [`mpi4py`](https://mpi4py.readthedocs.io) provides Python bindings. A minimal example:\n\n```python\n# script.py\nfrom mpi4py import MPI\ncomm = MPI.COMM_WORLD\nprint(f\"rank {comm.Get_rank()} of {comm.Get_size()}\")\n```\n\n```bash\nsrun --mpi=pmix -n 4 python script.py\n```\n\nWhen multiple independent groups of ranks need to run inside one allocation there are two approaches:\n\n| Approach | How | Cross-group communication |\n|---|---|---|\n| Multiple `srun` calls | Each `srun` gets its own communicator | Not possible |\n| `MPI_Comm_split` | One `srun`, split in Python | Possible via `MPI.COMM_WORLD` |\n\n```python\n# communicator splitting — 8 ranks split into two groups of 4\ncomm = MPI.COMM_WORLD\ncolor = comm.Get_rank() // 4 # group 0 or group 1\nsub_comm = comm.Split(color)\n```","metadata":{}},{"id":"db7760e8-35a6-4a1c-8b0f-410b536c3835","cell_type":"markdown","source":"### SlurmClusterExecutor\n\n```python\nfrom executorlib import SlurmClusterExecutor\n```","metadata":{}},{"id":"b20913f3-59e4-418c-a399-866124f8e497","cell_type":"markdown","source":"In comparison to the [SingleNodeExecutor](https://executorlib.readthedocs.io/en/latest/1-single-node.html), the only parameter which is changed in the `SlurmClusterExecutor` is the requirement to specify the cache directory using the `cache_directory=\"./cache\"`. The rest of the syntax remains exactly the same, to simplify the up-scaling of simulation workflows.","metadata":{}},{"id":"0b8f3b77-6199-4736-9f28-3058c5230777","cell_type":"markdown","source":"```python\nwith SlurmClusterExecutor(cache_directory=\"./cache\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])\n```","metadata":{}},{"id":"37bef7ac-ce3e-4d8a-b848-b1474c370bca","cell_type":"markdown","source":"Specific parameters for `SlurmClusterExecutor` like the maximum run time `\"run_time_max\"`, the maximum memory `\"memory_max\"` or the submission template for the job submission script `\"submission_template\"` can be specified as part of the resource dictionary. Again it is possible to specify the resource dictonary `resource_dicionary` either for each function in the `submit()` function or during the initialization of the `SlurmClusterExecutor`.","metadata":{}},{"id":"658781de-f222-4235-8c26-b0f77a0831b3","cell_type":"markdown","source":"```python\nsubmission_template = \"\"\"\\\n#!/bin/bash\n#SBATCH --output=time.out\n#SBATCH --job-name={{job_name}}\n#SBATCH --chdir={{working_directory}}\n#SBATCH --get-user-env=L\n#SBATCH --partition={{partition}}\n{%- if run_time_max %}\n#SBATCH --time={{ [1, run_time_max // 60]|max }}\n{%- endif %}\n{%- if dependency %}\n#SBATCH --dependency=afterok:{{ dependency | join(',') }}\n{%- endif %}\n{%- if memory_max %}\n#SBATCH --mem={{memory_max}}G\n{%- endif %}\n#SBATCH --ntasks={{cores}}\n\n{{command}}\n\"\"\"\n\nwith SlurmClusterExecutor(cache_directory=\"./cache\") as exe:\n future = exe.submit(\n sum, [4, 4], \n resource_dict={\n \"submission_template\": submission_template, \n \"run_time_max\": 180, # in seconds \n \"partition\": \"s.cmfe\",\n })\n print(future.result())\n```","metadata":{}},{"id":"f7ad9c97-7743-4f87-9344-4299b2b31a56","cell_type":"markdown","source":"The template uses [Jinja2](https://jinja.palletsprojects.com) syntax. executorlib fills `{{cores}}` into `--ntasks`, so `cores=1` requests one serial process and `cores=4` requests four MPI ranks. With `pmi_mode=\"pmix\"` the executor additionally wraps the function call in `srun --mpi=pmix -n `:\n\n```python\ndef mpi_calc(i):\n from mpi4py import MPI\n comm = MPI.COMM_WORLD\n return {\"rank\": comm.Get_rank(), \"size\": comm.Get_size(), \"input\": i}\n\nwith SlurmClusterExecutor(pmi_mode=\"pmix\", cache_directory=\"./cache\") as exe:\n future = exe.submit(\n mpi_calc, 42,\n resource_dict={\"submission_template\": submission_template, \"cores\": 4, \"partition\": \"regular\", \"run_time_max\": 120})\n print(future.result())\n```\n\nWith these options executorlib in combination with the SLURM job scheduler provides a lot flexibility to configure the submission of Python functions depending on the specific configuration of the job scheduler. \n\nIn case the submission goes wrong, for example when no submission template is defined and executorlib falls back to the default submission template a `CalledProcessError` is raised:\n\n```python\ndef echo(i):\n return i\n\nwith SlurmClusterExecutor() as exe:\n f1 = exe.submit(echo)\n print(f1.result())\n```\n\nThe error message would be something like:\n```\nCalledProcessError: Command '['sbatch', '--parsable', '/home/jovyan/executorlib_cache/echoe5873521b7330f831bed941744079e83/run_queue.sh']' returned non-zero exit status 1.\n```\n\nThis is not really helpful, as it primarily says the `sbatch` command was not successful, but the error message which `sbatch` raised on the command line is not directly accessible from Python. To access the error message you can access the exception of the future object:\n\n```python\nexcep = f1.exception()\nprint(excep.output)\n```\n\nThis gives:\n```\nsbatch: error: invalid partition specified: (null)\nsbatch: error: Batch job submission failed: Invalid partition name specified\n```\n\nSo the submission failed because no partition was provided, which can be corrected by adding the `--partition` flag in the submission template, as demonstrated above. ","metadata":{}},{"id":"e1299068-990e-4fd3-b926-f6415b4e9d75","cell_type":"markdown","source":"### Verifying the Resource Assignment\nAfter the submission it is often useful to confirm that the job scheduler actually assigned the requested resources. For the `SlurmClusterExecutor` the SLURM job identifier is stored in the cache and can be retrieved with the `get_cache_data()` function. This job identifier `queue_id` can then be passed to the SLURM [sacct](https://slurm.schedmd.com/sacct.html) command to inspect the accounting record of the job:\n\n```python\nfrom executorlib import get_cache_data\nimport subprocess\n\nfor entry in get_cache_data(cache_directory=\"./cache\"):\n if \"calc\" in str(entry[\"function\"]):\n job_id = entry[\"queue_id\"]\n print(subprocess.check_output(\n [\"sacct\", \"-j\", str(job_id), \"--format=JobID,State,AllocCPUS,Elapsed\"],\n universal_newlines=True,\n ))\n```\n\nThe `AllocCPUS` column reports the number of CPU cores SLURM allocated for the function. In addition to the `queue_id` each cache entry also contains the full `resource_dict`, the runtime and the path of the result file, which together provide a complete audit trail of the submission - this is the same information returned by the `get_cache_data()` function demonstrated for the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html#cache).","metadata":{}},{"cell_type":"markdown","id":"pysqa-config-directory-001","metadata":{"trusted":true},"source":["### Reusing the Configuration with `pysqa_config_directory`\n","The `submission_template` shown above is convenient for a single script, but has to be repeated in every Python session which submits jobs. For a configuration which is set up once and reused by any number of scripts and users, executorlib can instead read the submission template from a configuration directory via the `pysqa_config_directory` parameter, which is passed through to the [pysqa](https://pysqa.readthedocs.io) package. This is the same mechanism [pyiron](https://pyiron.org) uses to manage its HPC configuration, so an existing pysqa configuration directory can be reused directly with executorlib.\n","\n","A pysqa configuration directory contains a `queue.yaml` file which lists the available queues, together with a Jinja2 submission template for each of them:\n","```\n","~/.queues/\n","├── queue.yaml\n","└── slurm.sh\n","```\n","\n","`queue.yaml` defines the queue type, the primary queue and the individual queues - `cores_min` and `cores_max` restrict the number of cores which can be requested, `run_time_max` caps the maximum run time in seconds and `script` points to the Jinja2 template file used to generate the submission script:\n","```yaml\n","queue_type: SLURM\n","queue_primary: slurm\n","queues:\n"," slurm: {cores_min: 1, cores_max: 100, run_time_max: 259200, script: slurm.sh}\n","```\n","\n","`slurm.sh` is the same kind of Jinja2 template already introduced above as the `submission_template`, just stored in a file rather than a Python string:\n","```\n","#!/bin/bash\n","#SBATCH --output=time.out\n","#SBATCH --job-name={{job_name}}\n","#SBATCH --chdir={{working_directory}}\n","#SBATCH --get-user-env=L\n","#SBATCH --partition=my_partition\n","{%- if run_time_max %}\n","#SBATCH --time={{ [1, run_time_max // 60]|max }}\n","{%- endif %}\n","{%- if dependency_list %}\n","#SBATCH --dependency=afterok:{{ dependency_list | join(',') }}\n","{%- endif %}\n","{%- if memory_max %}\n","#SBATCH --mem={{memory_max}}G\n","{%- endif %}\n","#SBATCH --ntasks={{cores}}\n","\n","{{command}}\n","```\n","\n","Once the directory is set up it can be reused by any `SlurmClusterExecutor`, simply by pointing `pysqa_config_directory` at it - no `submission_template` needs to be specified anymore:\n","```python\n","with SlurmClusterExecutor(cache_directory=\"./cache\", pysqa_config_directory=\"~/.queues\") as exe:\n"," future = exe.submit(sum, [4, 4], resource_dict={\"run_time_max\": 180, \"cores\": 4})\n"," print(future.result())\n","```\n","\n","If `pysqa_config_directory` is not provided, as in the earlier examples, executorlib falls back to a generic, built-in submission template for the selected job scheduler - this is the default submission template referenced in the `CalledProcessError` example above. Providing an explicit `pysqa_config_directory` (or `submission_template`) becomes necessary as soon as the target HPC system requires mandatory options like `--partition`.\n","\n","For clusters which are only reachable via SSH, or setups spanning multiple job schedulers, the configuration directory can instead contain a `clusters.yaml` file referencing several such `queue.yaml` configurations. This and further configuration options, like SSH-based remote submission, are covered in the [pysqa documentation](https://pysqa.readthedocs.io)."]},{"cell_type":"markdown","id":"claude-code-setup-001","metadata":{},"source":["### Setup with Claude Code\n","Writing a `submission_template` for a new HPC cluster requires knowing its partitions, memory defaults, GPU resources, submit filters and job limits. To automate this step, executorlib provides the [executorlib-cluster-setup](https://github.com/pyiron/executorlib/blob/main/.claude/skills/executorlib-cluster-setup/SKILL.md) skill for [Claude Code](https://docs.claude.com/en/docs/claude-code/overview). Started on the login node of a SLURM cluster, it analyses the cluster with `sinfo`, `scontrol` and `sacctmgr`, checks the generated submission templates with `sbatch --test-only`, runs short smoke tests for serial functions, GPUs, MPI binaries and dependencies, and finally writes a cluster-specific skill `executorlib-`. This cluster-specific skill contains the tested `submission_template`, helper functions to construct the `resource_dict` and the pitfalls found during testing, so later Claude Code sessions can submit Python functions with the `SlurmClusterExecutor` on this cluster.\n","\n","To install the skill for your user, download it to the Claude Code skills directory on the login node:\n","\n","```bash\n","mkdir -p ~/.claude/skills/executorlib-cluster-setup\n","curl -o ~/.claude/skills/executorlib-cluster-setup/SKILL.md https://raw.githubusercontent.com/pyiron/executorlib/main/.claude/skills/executorlib-cluster-setup/SKILL.md\n","```\n","\n","Afterwards start `claude` on the login node, in the Python environment with executorlib and pysqa installed, and call the skill with `/executorlib-cluster-setup` or ask Claude Code to set up executorlib for this cluster. Claude Code asks for the information the cluster cannot provide itself, like the codes you want to run, the account to charge and the URL of the site documentation. As the smoke tests submit short jobs, preferably to a debug or test partition, they consume a small amount of your computing time."]},{"id":"2a814efb-2fbc-41ba-98df-cf121d19ea66","cell_type":"markdown","source":"## Flux\n[Flux](http://flux-framework.org) is a modern HPC resource manager developed at Lawrence Livermore National Laboratory (LLNL). On many systems it runs as a **secondary scheduler inside a SLURM allocation**, enabling fine-grained hierarchical task distribution. Unlike SLURM, Flux can also be installed locally via conda — making it especially suitable for demonstrations, testing, and continuous integration:\n\n```bash\nconda install -c conda-forge flux-core\nflux start # launch a local Flux instance\n```\n\nThis simple installation is explained in the [installation section](https://executorlib.readthedocs.io/en/latest/installation.html#alternative-installations). The features demonstrated below using Flux apply equally to SLURM.","metadata":{}},{"id":"flux-background-001","cell_type":"markdown","source":"### Background\n\nThe key Flux commands map closely onto their SLURM equivalents:\n\n| Flux command | SLURM equivalent | Description |\n|---|---|---|\n| `flux resource list` | `sinfo` | Show available nodes, cores, and GPUs |\n| `flux jobs -a` | `squeue` | List all jobs (running and completed) |\n| `flux submit` | `sbatch` | Submit a non-blocking job; returns a job ID immediately |\n| `flux run` | `srun` | Launch a blocking job; waits for completion |\n| `flux job attach ` | — | Stream output of a previously submitted job |\n\n```bash\n# submit a non-blocking 4-rank MPI job\nflux submit -o pmi=pmix --ntasks=4 python script.py\n\n# run a blocking 4-rank MPI job (waits for output)\nflux run -o pmi=pmix -n 4 python script.py\n```\n\nThe `-o pmi=pmix` flag matches what SLURM's `--mpi=pmix` provides — the same `mpi4py` scripts run unchanged under both schedulers.","metadata":{}},{"id":"29d7aa18-357e-416e-805c-1322b59abec1","cell_type":"markdown","source":"### Dependencies\nAs already demonstrated for the [SingleNodeExecutor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) the `Executor` classes from executorlib are capable of resolving the dependencies of serial functions, when [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects are used as inputs for subsequent function calls. For the case of the HPC submission these dependencies are communicated to the job scheduler, which allows to stop the Python process which created the `Executor` class, wait until the execution of the submitted Python functions is completed and afterwards restart the Python process for the `Executor` class and reload the calculation results from the cache defined by the `cache_directory` parameter.","metadata":{}},{"id":"0f7fc37a-1248-492d-91ab-9db1d737eaee","cell_type":"code","source":"def add_funct(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":1},{"id":"ae308683-6083-4e78-afc2-bff6c6dc297b","cell_type":"code","source":"from executorlib import FluxClusterExecutor\n\nwith FluxClusterExecutor(cache_directory=\"./file\") as exe:\n future = 0\n for i in range(4, 8):\n future = exe.submit(add_funct, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"22\n"}],"execution_count":2},{"id":"ca75cb6c-c50f-4bee-9b09-d8d29d6c263b","cell_type":"markdown","source":"### Resource Assignment\nIn analogy to the [SingleNodeExecutor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) the resource assignment for the `FluxClusterExecutor` is handled by either including the resource dictionary parameter `resource_dict` in the initialization of the `FluxClusterExecutor` class or in every call of the `submit()` function.\n\nBelow this is demonstrated once for the assignment of multiple CPU cores for the execution of a Python function which internally uses the message passing interface (MPI) via the [mpi4py](https://mpi4py.readthedocs.io) package.","metadata":{}},{"id":"eded3a0f-e54f-44f6-962f-eedde4bd2158","cell_type":"code","source":"def calc(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank\n","metadata":{"trusted":true},"outputs":[],"execution_count":3},{"id":"669b05df-3cb2-4f69-9d94-8b2442745ebb","cell_type":"code","source":"with FluxClusterExecutor(cache_directory=\"./file\") as exe:\n fs = exe.submit(calc, 3, resource_dict={\"cores\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"(3, 1, 0)\n"}],"execution_count":4},{"id":"d91499d7-5c6c-4c10-b7b7-bfc4b87ddaa8","cell_type":"markdown","source":"Beyond CPU cores and threads which were previously also introduced for the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) the HPC Cluster Executors also provide the option to select the available accelerator cards or GPUs, by specifying the `\"gpus_per_core\"` parameter in the resource dictionary `resource_dict`. For demonstration we create a Python function which reads the GPU device IDs and submit it to the `FluxClusterExecutor` class:\n```python\ndef get_available_gpus():\n import socket\n from tensorflow.python.client import device_lib\n local_device_protos = device_lib.list_local_devices()\n return [\n (x.name, x.physical_device_desc, socket.gethostname()) \n for x in local_device_protos if x.device_type == 'GPU'\n ]\n```\n\n```python\nwith FluxClusterExecutor(\n cache_directory=\"./cache\",\n resource_dict={\"gpus_per_core\": 1}\n) as exe:\n fs_1 = exe.submit(get_available_gpus)\n fs_2 = exe.submit(get_available_gpus)\n print(fs_1.result(), fs_2.result())\n```","metadata":{}},{"id":"b779e393-0c01-4a2a-9343-3480ea59f74b","cell_type":"markdown","source":"### Block Allocation\nIn analogy to the `SingleNodeExecutor` also the `FluxClusterExecutor` and `SlurmClusterExecutor` support the block allocation mode. This starts a number of workers by submitting jobs to the HPC cluster. After these jobs are started, functions are submitted using socket based communication and the same Executor is used to execute multiple functions. This scheme is commonly known as a worker approach, which enables off-loading compute heavy tasks. Below the same example is repeated, which was previously introduced for the `SingleNodeExecutor`:","metadata":{}},{"id":"da81f07f-99f9-469b-9454-efbc083e2043","cell_type":"code","source":"def init_function():\n return {\"j\": 4, \"k\": 3, \"l\": 2}","metadata":{"trusted":true},"outputs":[],"execution_count":5},{"id":"7a3bca08-f39a-48ea-a07c-c41855006843","cell_type":"code","source":"def calc_with_preload(i, j, k):\n return i + j + k","metadata":{"trusted":true},"outputs":[],"execution_count":6},{"id":"1265650e-457d-4a46-9a62-9ad2c95fb80a","cell_type":"markdown","source":"The function `calc_with_preload()` requires three inputs `i`, `j` and `k`. But when the function is submitted to the executor only two inputs are provided `fs = exe.submit(calc, 2, j=5)`. In this case the first input parameter is mapped to `i=2`, the second input parameter is specified explicitly `j=5` but the third input parameter `k` is not provided. So the `FluxClusterExecutor` automatically checks the keys set in the `init_function()` function. In this case the returned dictionary `{\"j\": 4, \"k\": 3, \"l\": 2}` defines `j=4`, `k=3` and `l=2`. For this specific call of the `calc_with_preload()` function, `i` and `j` are already provided so `j` is not required, but `k=3` is used from the `init_function()` and as the `calc_with_preload()` function does not define the `l` parameter this one is also ignored.","metadata":{}},{"id":"ce4dd44c-8db5-4445-bcc5-fad731702444","cell_type":"code","source":"with FluxClusterExecutor(\n cache_directory=\"./file\", \n max_workers=2, \n init_function=init_function, \n block_allocation=True\n) as exe:\n fs = exe.submit(calc_with_preload, 2, j=5)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"10\n"}],"execution_count":7},{"id":"93a54d18-9d65-469b-ad6e-bcc1ec590671","cell_type":"markdown","source":"The result is `2+5+3=10` as `i=2` and `j=5` are provided during the submission and `k=3` is defined in the `init_function()` function.","metadata":{}},{"id":"c9c46c64-d097-49d3-ba79-ecb871c8f4da","cell_type":"markdown","source":"## Disconnecting and Reconnecting\nA key advantage of the HPC Cluster Executors over the [HPC Job Executors](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) is that the Python process which created the executor does not need to stay alive while the submitted functions are running. As the functions are submitted as individual scheduler jobs and the results are stored on the file system, the Python process can be closed after the submission - for example to log out of the login node overnight - and the results can be reloaded later. This is controlled with the `shutdown()` method of the executor, which provides the same `wait` and `cancel_futures` parameters as the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.shutdown) of the Python standard library.\n\nTo submit a set of functions and disconnect without waiting, the executor is created without a `with` statement and `shutdown()` is called with `wait=False` and `cancel_futures=False`:\n\n```python\nfrom executorlib import SlurmClusterExecutor\n\nexe = SlurmClusterExecutor(cache_directory=\"./cache\")\nfuture_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\nexe.shutdown(wait=False, cancel_futures=False)\n```\n\nThe submitted jobs remain in the queue of the job scheduler and continue to run. At a later point - even from a new Python process - the same functions are submitted again using the same `cache_directory`. executorlib recognises the cached results and returns them immediately instead of submitting the functions a second time:\n\n```python\nfrom executorlib import SlurmClusterExecutor\n\nwith SlurmClusterExecutor(cache_directory=\"./cache\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])\n```\n\nThe behaviour of the `shutdown()` method is summarized in the following table:\n\n| `shutdown()` call | Effect |\n|---|---|\n| `shutdown(wait=True)` | Wait until all submitted functions are finished before continuing - this is the default and also what the `with` statement does. |\n| `shutdown(wait=False, cancel_futures=False)` | Return immediately and leave the submitted jobs running in the scheduler queue - used to disconnect from a running workflow. |\n| `shutdown(wait=False, cancel_futures=True)` | Cancel the submitted jobs which have not started or finished yet. |\n\nThis disconnect-and-reconnect capability is available for both the `SlurmClusterExecutor` and the `FluxClusterExecutor`, as both communicate via the file system rather than via sockets.","metadata":{}},{"id":"slurm-job-executor-001","cell_type":"markdown","source":"## Combine both\n\nWhile `SlurmClusterExecutor` submits each Python function as a separate `sbatch` job from the login node, the [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) (`SlurmJobExecutor`) runs **inside** an already-running SLURM allocation and dispatches tasks as `srun` steps — no new jobs enter the queue.\n\n```python\nfrom executorlib import SlurmJobExecutor\n\n# This code runs inside an existing SLURM job\nwith SlurmJobExecutor(max_workers=4) as exe:\n futures = [exe.submit(sum, [i, i], resource_dict={\"cores\": 1}) for i in range(4)]\n print([f.result() for f in futures])\n```\n\nThe two executor types can be nested: a function submitted via `SlurmClusterExecutor` (running as an `sbatch` job) can itself create a `SlurmJobExecutor` to parallelise sub-tasks as `srun` steps within the same allocation:\n\n```python\nfrom executorlib import SlurmClusterExecutor, SlurmJobExecutor\n\ndef parallel_workflow(n):\n with SlurmJobExecutor(max_workers=n) as inner:\n futures = [inner.submit(sum, [i, i], resource_dict={\"cores\": 1}) for i in range(n)]\n return [f.result() for f in futures]\n\nwith SlurmClusterExecutor(cache_directory=\"./cache\") as outer:\n future = outer.submit(\n parallel_workflow, 4,\n resource_dict={\"cores\": 1, \"partition\": \"regular\", \"run_time_max\": 300})\n print(future.result())\n```\n\nThe `sacct` output for such a job will show the outer `sbatch` job together with numbered `srun` steps (e.g. `12345.0`, `12345.1`, …), all completing within the same allocation.\n\n| Executor | Scheduler command | Typical use |\n|---|---|---|\n| `SlurmClusterExecutor` | `sbatch` (one job per function) | Submit from login node |\n| `SlurmJobExecutor` | `srun` steps within current job | Inside an existing allocation |\n| `FluxClusterExecutor` | `flux submit` | Flux-managed allocation or local testing |","metadata":{}},{"id":"3f47fd34-04d1-42a7-bb06-6821dc99a648","cell_type":"markdown","source":"## Cleaning Cache\nFinally, as the HPC Cluster Executors leverage the file system to communicate serialized Python functions, it is important to clean up the cache directory specified by the `cache_directory` parameter once the results of the submitted Python functions are no longer needed. The serialized Python functions are stored in binary format using the [cloudpickle](https://github.com/cloudpipe/cloudpickle) library for serialization. This format is design for caching but not for long-term storage. The user is responsible for the long-term storage of their data.","metadata":{}},{"id":"f537b4f6-cc98-43da-8aca-94a823bcbcbd","cell_type":"code","source":"import os\nimport shutil\n\ncache_dir = \"./file\"\nif os.path.exists(cache_dir):\n print(os.listdir(cache_dir))\n try:\n shutil.rmtree(cache_dir)\n except OSError:\n pass","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"['add_funct144ecf19b5020fccad214df3f4bdabd0_o.h5', 'add_funct67b8245bf71c3c6dcb2018663939c72d', 'add_funct4a5d1f06cca57f0ffbaa3116d39ecc6a', 'add_functcb272924f36cbaa9ac79f8d42b6771c8_o.h5', 'calcd732cdcbd2c8e68145d99f0be814e667', '393f99f890d39348c6248689096e6efb', 'add_funct67b8245bf71c3c6dcb2018663939c72d_o.h5', 'add_funct4a5d1f06cca57f0ffbaa3116d39ecc6a_o.h5', 'calcd732cdcbd2c8e68145d99f0be814e667_o.h5', '3888b889a896c43b68f0bd924ee5285c', 'add_funct144ecf19b5020fccad214df3f4bdabd0', 'add_functcb272924f36cbaa9ac79f8d42b6771c8', 'calc_with_preloade920bec0b69f103b2579175e37aa3528_o.h5']\n"}],"execution_count":8},{"id":"3efc9f5d-fbf9-4a85-8963-5711a453130d","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]} \ No newline at end of file +{"metadata":{"kernelspec":{"display_name":"Flux","language":"python","name":"flux"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.13.14"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"ddf66f38-dc4a-4306-8b1c-b923fdb76922","cell_type":"markdown","source":"# HPC Cluster Executor\nIn contrast to the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) and the [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) the HPC Submission Executors do not communicate via the [zero message queue](https://zeromq.org) but instead store the python functions on the file system and uses the job scheduler to handle the dependencies of the Python functions. Consequently, the block allocation `block_allocation` and the init function `init_function` are not available in the HPC Cluster Executors. At the same time it is possible to close the Python process which created the `Executor`, wait until the execution of the submitted Python functions is completed and afterwards reload the results from the cache.\n\nInternally the HPC submission mode is using the [Python simple queuing system adatper (pysqa)](https://pysqa.readthedocs.io) to connect to HPC job schedulers and the [h5py](https://www.h5py.org) package for serializing the Python functions to store them on the file system. Both packages are optional dependency of executorlib. The installation of the [pysqa](https://pysqa.readthedocs.io) package and the [h5py](https://www.h5py.org) package are covered in the installation section. ","metadata":{}},{"id":"d56862a6-8279-421d-a090-7ca2a3c4d416","cell_type":"markdown","source":["## SLURM\n","The [Simple Linux Utility for Resource Management (SLURM)](https://slurm.schedmd.com) job scheduler is currently the most commonly used job scheduler for HPC clusters. On shared HPC systems users cannot access compute nodes directly — SLURM acts as the resource controller, accepting job requests, managing the queue, and assigning work to nodes when resources become free.\n","\n","In the HPC submission mode executorlib internally uses the [sbatch](https://slurm.schedmd.com/sbatch.html) command, this is in contrast to the [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) which internally uses the [srun](https://slurm.schedmd.com/srun.html) command.\n","\n","The connection to the job scheduler is based on the [Python simple queuing system adatper (pysqa)](https://pysqa.readthedocs.io). It provides a default configuration for most commonly used job schedulers including SLURM, in addition it is also possible to provide the submission template as part of the resource dictionary `resource_dict` for a single script, or persist it once in a configuration directory referenced via the `pysqa_config_directory` parameter, as covered in the \"Reusing the Configuration\" section below. All three options are covered in more detail on the [pysqa documentation](https://pysqa.readthedocs.io)."],"metadata":{}},{"id":"slurm-background-001","cell_type":"markdown","source":"### Background\n\nThree commands cover the day-to-day SLURM workflow:\n\n**`sbatch`** submits a batch script from the login node. The script carries resource directives on lines starting with `#SBATCH`:\n\n```bash\n#!/bin/bash\n#SBATCH --job-name=my_job\n#SBATCH --output=my_job.out\n#SBATCH --ntasks=4 # total MPI ranks\n#SBATCH --cpus-per-task=1 # CPU threads per rank\n#SBATCH --time=00:30:00 # wall-clock limit (HH:MM:SS)\n#SBATCH --partition=regular\n\nsrun --mpi=pmix python my_script.py\n```\n\n```bash\nsbatch job.sh # submit — returns a job ID immediately\n```\n\nKey `#SBATCH` directives:\n\n| Directive | Meaning |\n|---|---|\n| `--ntasks=N` | Total MPI ranks (processes) |\n| `--cpus-per-task=N` | CPU threads available to each rank |\n| `--mem=NG` | Memory per node (e.g. `8G`) |\n| `--time=HH:MM:SS` | Maximum wall-clock time |\n| `--partition=name` | Queue / partition to target |\n| `--dependency=afterok:JOBID` | Run only after another job succeeds |\n\n**`srun`** launches parallel tasks *inside* an existing allocation. Multiple `srun` calls can run concurrently using shell backgrounding:\n\n```bash\nsrun --mpi=pmix -n 4 python task_a.py &\nsrun --mpi=pmix -n 4 python task_b.py &\nwait # block until both finish\n```\n\n**`squeue`** and **`sacct`** let you inspect the queue and verify resource assignments:\n\n```bash\nsqueue --me # your running/pending jobs\nsacct -j 12345 --format=JobID,State,AllocCPUS,Elapsed # accounting for job 12345\n```\n\nCommon `squeue` state codes: `PD` (pending), `R` (running), `CG` (completing).","metadata":{}},{"id":"slurm-mpi-001","cell_type":"markdown","source":"### MPI-parallel Python\n\nThe [Message Passing Interface (MPI)](https://www.mpi-forum.org) is the dominant parallelisation standard on HPC systems. [`mpi4py`](https://mpi4py.readthedocs.io) provides Python bindings. A minimal example:\n\n```python\n# script.py\nfrom mpi4py import MPI\ncomm = MPI.COMM_WORLD\nprint(f\"rank {comm.Get_rank()} of {comm.Get_size()}\")\n```\n\n```bash\nsrun --mpi=pmix -n 4 python script.py\n```\n\nWhen multiple independent groups of ranks need to run inside one allocation there are two approaches:\n\n| Approach | How | Cross-group communication |\n|---|---|---|\n| Multiple `srun` calls | Each `srun` gets its own communicator | Not possible |\n| `MPI_Comm_split` | One `srun`, split in Python | Possible via `MPI.COMM_WORLD` |\n\n```python\n# communicator splitting — 8 ranks split into two groups of 4\ncomm = MPI.COMM_WORLD\ncolor = comm.Get_rank() // 4 # group 0 or group 1\nsub_comm = comm.Split(color)\n```","metadata":{}},{"id":"ef94e3cb-f353-440b-b235-040833993d2c","cell_type":"markdown","source":"### SlurmClusterExecutor","metadata":{}},{"id":"6b7fde30-92fb-43e7-9875-120c1ae555eb","cell_type":"code","source":"from executorlib import SlurmClusterExecutor","metadata":{"trusted":true,"tags":["slurm"]},"outputs":[],"execution_count":null},{"id":"b20913f3-59e4-418c-a399-866124f8e497","cell_type":"markdown","source":"In comparison to the [SingleNodeExecutor](https://executorlib.readthedocs.io/en/latest/1-single-node.html), the only parameter which is changed in the `SlurmClusterExecutor` is the requirement to specify the cache directory using the `cache_directory=\"./cache\"`. The rest of the syntax remains exactly the same, to simplify the up-scaling of simulation workflows.\n\nIn addition, most HPC clusters require site-specific options in the job submission script, like the partition or the maximum run time. These options are defined in a submission template, which is explained in more detail below:","metadata":{}},{"id":"afef53ac-a787-43f2-8062-62ad14610527","cell_type":"code","source":"submission_template = \"\"\"\\\n#!/bin/bash\n#SBATCH --output=time.out\n#SBATCH --job-name={{job_name}}\n#SBATCH --chdir={{working_directory}}\n#SBATCH --get-user-env=L\n{%- if partition %}\n#SBATCH --partition={{partition}}\n{%- endif %}\n{%- if run_time_max %}\n#SBATCH --time={{ [1, run_time_max // 60]|max }}\n{%- endif %}\n{%- if dependency_list %}\n#SBATCH --dependency=afterok:{{ dependency_list | join(',') }}\n{%- endif %}\n{%- if memory_max %}\n#SBATCH --mem={{memory_max}}G\n{%- endif %}\n#SBATCH --ntasks={{cores}}\n\n{{command}}\n\"\"\"","metadata":{"trusted":true,"tags":["slurm"]},"outputs":[],"execution_count":null},{"id":"c24193fb-0cf7-436d-9004-835362b222da","cell_type":"markdown","source":"The submission template is passed to the `SlurmClusterExecutor` as part of the resource dictionary `resource_dict`:","metadata":{}},{"id":"35c9decb-bc65-4ba8-a9cb-9078363f66ef","cell_type":"code","source":"with SlurmClusterExecutor(\n cache_directory=\"./cache\",\n resource_dict={\"submission_template\": submission_template},\n) as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true,"tags":["slurm"]},"outputs":[],"execution_count":null},{"id":"37bef7ac-ce3e-4d8a-b848-b1474c370bca","cell_type":"markdown","source":"Specific parameters for `SlurmClusterExecutor` like the maximum run time `\"run_time_max\"`, the maximum memory `\"memory_max\"` or the submission template for the job submission script `\"submission_template\"` can be specified as part of the resource dictionary. Again it is possible to specify the resource dictonary `resource_dicionary` either for each function in the `submit()` function or during the initialization of the `SlurmClusterExecutor`.","metadata":{}},{"id":"d342170b-3149-4dbc-a4ad-f9e7eab6a051","cell_type":"markdown","source":"The submission template defined above only adds the `#SBATCH` lines for parameters which are set, for example the `--partition` line is only added when the `\"partition\"` is specified in the resource dictionary:","metadata":{}},{"id":"3f68277b-2eb5-4349-a72c-718aeed97466","cell_type":"code","source":"with SlurmClusterExecutor(cache_directory=\"./cache\") as exe:\n future = exe.submit(\n sum, [4, 4],\n resource_dict={\n \"submission_template\": submission_template,\n \"run_time_max\": 180, # in seconds\n # \"partition\": \"regular\", # select the partition of your HPC cluster\n })\n print(future.result())","metadata":{"trusted":true,"tags":["slurm"]},"outputs":[],"execution_count":null},{"id":"65e32bbb-c5b0-4be0-8d1d-32fd583c79aa","cell_type":"markdown","source":"The template uses [Jinja2](https://jinja.palletsprojects.com) syntax. executorlib fills `{{cores}}` into `--ntasks`, so `cores=1` requests one serial process and `cores=4` requests four MPI ranks. With the `pmi_mode` parameter the executor additionally wraps the function call in `srun --mpi= -n `, for example `pmi_mode=\"pmix\"` for OpenMPI >= 5 or `pmi_mode=\"pmi2\"` for MPICH:","metadata":{}},{"id":"b165bb7e-f76f-4634-b502-5c3e04febcb2","cell_type":"code","source":"def mpi_calc(i):\n from mpi4py import MPI\n comm = MPI.COMM_WORLD\n return {\"rank\": comm.Get_rank(), \"size\": comm.Get_size(), \"input\": i}\n\nwith SlurmClusterExecutor(pmi_mode=\"pmi2\", cache_directory=\"./cache\") as exe:\n future = exe.submit(\n mpi_calc, 42,\n resource_dict={\"submission_template\": submission_template, \"cores\": 2, \"run_time_max\": 120})\n print(future.result())","metadata":{"trusted":true,"tags":["slurm"]},"outputs":[],"execution_count":null},{"id":"1e66986c-650c-4c65-8fa4-fafccb772c7c","cell_type":"markdown","source":"When the result of one function is used as input for the next function, executorlib communicates this dependency to SLURM. The job of the second function is submitted with the `--dependency=afterok:` option, which is generated from the `dependency_list` in the submission template:","metadata":{}},{"id":"2619ad8e-fad7-457c-83d0-9d1ea4823186","cell_type":"code","source":"def add(a, b):\n return a + b\n\nwith SlurmClusterExecutor(\n cache_directory=\"./cache\",\n resource_dict={\"submission_template\": submission_template},\n) as exe:\n future = 0\n for i in range(1, 4):\n future = exe.submit(add, i, future)\n print(future.result())","metadata":{"trusted":true,"tags":["slurm"]},"outputs":[],"execution_count":null},{"id":"961b0769-6aa2-4957-a650-e042f9e5cfb0","cell_type":"markdown","source":"With these options executorlib in combination with the SLURM job scheduler provides a lot flexibility to configure the submission of Python functions depending on the specific configuration of the job scheduler. \n\nIn case the submission goes wrong, for example when no submission template is defined and executorlib falls back to the default submission template a `CalledProcessError` is raised:\n\n```python\ndef echo(i):\n return i\n\nwith SlurmClusterExecutor() as exe:\n f1 = exe.submit(echo)\n print(f1.result())\n```\n\nThe error message would be something like:\n```\nCalledProcessError: Command '['sbatch', '--parsable', '/home/jovyan/executorlib_cache/echoe5873521b7330f831bed941744079e83/run_queue.sh']' returned non-zero exit status 1.\n```\n\nThis is not really helpful, as it primarily says the `sbatch` command was not successful, but the error message which `sbatch` raised on the command line is not directly accessible from Python. To access the error message you can access the exception of the future object:\n\n```python\nexcep = f1.exception()\nprint(excep.output)\n```\n\nThis gives:\n```\nsbatch: error: invalid partition specified: (null)\nsbatch: error: Batch job submission failed: Invalid partition name specified\n```\n\nSo the submission failed because no partition was provided, which can be corrected by adding the `--partition` flag in the submission template, as demonstrated above - with the submission template defined above by adding the `\"partition\"` to the resource dictionary `resource_dict`.","metadata":{}},{"id":"a334b1b1-d316-42c0-995f-d44ea01cbaaa","cell_type":"markdown","source":"### Verifying the Resource Assignment\nAfter the submission it is often useful to confirm that the job scheduler actually assigned the requested resources. For the `SlurmClusterExecutor` the SLURM job identifier is stored in the cache and can be retrieved with the `get_cache_data()` function. This job identifier `queue_id` can then be passed to the SLURM [sacct](https://slurm.schedmd.com/sacct.html) command to inspect the accounting record of the job:","metadata":{}},{"id":"c1ea42c4-29f8-490f-aa8e-1890018677f4","cell_type":"code","source":"from executorlib import get_cache_data\nimport subprocess\n\nfor entry in get_cache_data(cache_directory=\"./cache\"):\n if \"mpi_calc\" in str(entry[\"function\"]):\n job_id = entry[\"queue_id\"]\n print(subprocess.check_output(\n [\"sacct\", \"-j\", str(job_id), \"--format=JobID,State,AllocCPUS,Elapsed\"],\n universal_newlines=True,\n ))","metadata":{"trusted":true,"tags":["slurm"]},"outputs":[],"execution_count":null},{"id":"3b150860-2c27-455f-9072-a526ab51da5a","cell_type":"markdown","source":"The `AllocCPUS` column reports the number of CPU cores SLURM allocated for the function. In addition to the `queue_id` each cache entry also contains the full `resource_dict`, the runtime and the path of the result file, which together provide a complete audit trail of the submission - this is the same information returned by the `get_cache_data()` function demonstrated for the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html#cache).","metadata":{}},{"cell_type":"markdown","id":"pysqa-config-directory-001","metadata":{"trusted":true},"source":["### Reusing the Configuration with `pysqa_config_directory`\n","The `submission_template` shown above is convenient for a single script, but has to be repeated in every Python session which submits jobs. For a configuration which is set up once and reused by any number of scripts and users, executorlib can instead read the submission template from a configuration directory via the `pysqa_config_directory` parameter, which is passed through to the [pysqa](https://pysqa.readthedocs.io) package. This is the same mechanism [pyiron](https://pyiron.org) uses to manage its HPC configuration, so an existing pysqa configuration directory can be reused directly with executorlib.\n","\n","A pysqa configuration directory contains a `queue.yaml` file which lists the available queues, together with a Jinja2 submission template for each of them:\n","```\n","~/.queues/\n","├── queue.yaml\n","└── slurm.sh\n","```\n","\n","`queue.yaml` defines the queue type, the primary queue and the individual queues - `cores_min` and `cores_max` restrict the number of cores which can be requested, `run_time_max` caps the maximum run time in seconds and `script` points to the Jinja2 template file used to generate the submission script:\n","```yaml\n","queue_type: SLURM\n","queue_primary: slurm\n","queues:\n"," slurm: {cores_min: 1, cores_max: 100, run_time_max: 259200, script: slurm.sh}\n","```\n","\n","`slurm.sh` is the same kind of Jinja2 template already introduced above as the `submission_template`, just stored in a file rather than a Python string:\n","```\n","#!/bin/bash\n","#SBATCH --output=time.out\n","#SBATCH --job-name={{job_name}}\n","#SBATCH --chdir={{working_directory}}\n","#SBATCH --get-user-env=L\n","#SBATCH --partition=my_partition\n","{%- if run_time_max %}\n","#SBATCH --time={{ [1, run_time_max // 60]|max }}\n","{%- endif %}\n","{%- if dependency_list %}\n","#SBATCH --dependency=afterok:{{ dependency_list | join(',') }}\n","{%- endif %}\n","{%- if memory_max %}\n","#SBATCH --mem={{memory_max}}G\n","{%- endif %}\n","#SBATCH --ntasks={{cores}}\n","\n","{{command}}\n","```\n","\n","Once the directory is set up it can be reused by any `SlurmClusterExecutor`, simply by pointing `pysqa_config_directory` at it - no `submission_template` needs to be specified anymore:\n","```python\n","with SlurmClusterExecutor(cache_directory=\"./cache\", pysqa_config_directory=\"~/.queues\") as exe:\n"," future = exe.submit(sum, [4, 4], resource_dict={\"run_time_max\": 180, \"cores\": 4})\n"," print(future.result())\n","```\n","\n","If `pysqa_config_directory` is not provided, as in the earlier examples, executorlib falls back to a generic, built-in submission template for the selected job scheduler - this is the default submission template referenced in the `CalledProcessError` example above. Providing an explicit `pysqa_config_directory` (or `submission_template`) becomes necessary as soon as the target HPC system requires mandatory options like `--partition`.\n","\n","For clusters which are only reachable via SSH, or setups spanning multiple job schedulers, the configuration directory can instead contain a `clusters.yaml` file referencing several such `queue.yaml` configurations. This and further configuration options, like SSH-based remote submission, are covered in the [pysqa documentation](https://pysqa.readthedocs.io)."]},{"cell_type":"markdown","id":"claude-code-setup-001","metadata":{},"source":["### Setup with Claude Code\n","Writing a `submission_template` for a new HPC cluster requires knowing its partitions, memory defaults, GPU resources, submit filters and job limits. To automate this step, executorlib provides the [executorlib-cluster-setup](https://github.com/pyiron/executorlib/blob/main/.claude/skills/executorlib-cluster-setup/SKILL.md) skill for [Claude Code](https://docs.claude.com/en/docs/claude-code/overview). Started on the login node of a SLURM cluster, it analyses the cluster with `sinfo`, `scontrol` and `sacctmgr`, checks the generated submission templates with `sbatch --test-only`, runs short smoke tests for serial functions, GPUs, MPI binaries and dependencies, and finally writes a cluster-specific skill `executorlib-`. This cluster-specific skill contains the tested `submission_template`, helper functions to construct the `resource_dict` and the pitfalls found during testing, so later Claude Code sessions can submit Python functions with the `SlurmClusterExecutor` on this cluster.\n","\n","To install the skill for your user, download it to the Claude Code skills directory on the login node:\n","\n","```bash\n","mkdir -p ~/.claude/skills/executorlib-cluster-setup\n","curl -o ~/.claude/skills/executorlib-cluster-setup/SKILL.md https://raw.githubusercontent.com/pyiron/executorlib/main/.claude/skills/executorlib-cluster-setup/SKILL.md\n","```\n","\n","Afterwards start `claude` on the login node, in the Python environment with executorlib and pysqa installed, and call the skill with `/executorlib-cluster-setup` or ask Claude Code to set up executorlib for this cluster. Claude Code asks for the information the cluster cannot provide itself, like the codes you want to run, the account to charge and the URL of the site documentation. As the smoke tests submit short jobs, preferably to a debug or test partition, they consume a small amount of your computing time."]},{"id":"2a814efb-2fbc-41ba-98df-cf121d19ea66","cell_type":"markdown","source":"## Flux\n[Flux](http://flux-framework.org) is a modern HPC resource manager developed at Lawrence Livermore National Laboratory (LLNL). On many systems it runs as a **secondary scheduler inside a SLURM allocation**, enabling fine-grained hierarchical task distribution. Unlike SLURM, Flux can also be installed locally via conda — making it especially suitable for demonstrations, testing, and continuous integration:\n\n```bash\nconda install -c conda-forge flux-core\nflux start # launch a local Flux instance\n```\n\nThis simple installation is explained in the [installation section](https://executorlib.readthedocs.io/en/latest/installation.html#alternative-installations). The features demonstrated below using Flux apply equally to SLURM.","metadata":{}},{"id":"flux-background-001","cell_type":"markdown","source":"### Background\n\nThe key Flux commands map closely onto their SLURM equivalents:\n\n| Flux command | SLURM equivalent | Description |\n|---|---|---|\n| `flux resource list` | `sinfo` | Show available nodes, cores, and GPUs |\n| `flux jobs -a` | `squeue` | List all jobs (running and completed) |\n| `flux submit` | `sbatch` | Submit a non-blocking job; returns a job ID immediately |\n| `flux run` | `srun` | Launch a blocking job; waits for completion |\n| `flux job attach ` | — | Stream output of a previously submitted job |\n\n```bash\n# submit a non-blocking 4-rank MPI job\nflux submit -o pmi=pmix --ntasks=4 python script.py\n\n# run a blocking 4-rank MPI job (waits for output)\nflux run -o pmi=pmix -n 4 python script.py\n```\n\nThe `-o pmi=pmix` flag matches what SLURM's `--mpi=pmix` provides — the same `mpi4py` scripts run unchanged under both schedulers.","metadata":{}},{"id":"29d7aa18-357e-416e-805c-1322b59abec1","cell_type":"markdown","source":"### Dependencies\nAs already demonstrated for the [SingleNodeExecutor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) the `Executor` classes from executorlib are capable of resolving the dependencies of serial functions, when [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects are used as inputs for subsequent function calls. For the case of the HPC submission these dependencies are communicated to the job scheduler, which allows to stop the Python process which created the `Executor` class, wait until the execution of the submitted Python functions is completed and afterwards restart the Python process for the `Executor` class and reload the calculation results from the cache defined by the `cache_directory` parameter.","metadata":{}},{"id":"0f7fc37a-1248-492d-91ab-9db1d737eaee","cell_type":"code","source":"def add_funct(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":1},{"id":"ae308683-6083-4e78-afc2-bff6c6dc297b","cell_type":"code","source":"from executorlib import FluxClusterExecutor\n\nwith FluxClusterExecutor(cache_directory=\"./file\") as exe:\n future = 0\n for i in range(4, 8):\n future = exe.submit(add_funct, i, future)\n print(future.result())","metadata":{"trusted":true,"tags":["flux"]},"outputs":[{"name":"stdout","output_type":"stream","text":"22\n"}],"execution_count":2},{"id":"ca75cb6c-c50f-4bee-9b09-d8d29d6c263b","cell_type":"markdown","source":"### Resource Assignment\nIn analogy to the [SingleNodeExecutor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) the resource assignment for the `FluxClusterExecutor` is handled by either including the resource dictionary parameter `resource_dict` in the initialization of the `FluxClusterExecutor` class or in every call of the `submit()` function.\n\nBelow this is demonstrated once for the assignment of multiple CPU cores for the execution of a Python function which internally uses the message passing interface (MPI) via the [mpi4py](https://mpi4py.readthedocs.io) package.","metadata":{}},{"id":"eded3a0f-e54f-44f6-962f-eedde4bd2158","cell_type":"code","source":"def calc(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank\n","metadata":{"trusted":true},"outputs":[],"execution_count":3},{"id":"669b05df-3cb2-4f69-9d94-8b2442745ebb","cell_type":"code","source":"with FluxClusterExecutor(cache_directory=\"./file\") as exe:\n fs = exe.submit(calc, 3, resource_dict={\"cores\": 2})\n print(fs.result())","metadata":{"trusted":true,"tags":["flux"]},"outputs":[{"name":"stdout","output_type":"stream","text":"(3, 1, 0)\n"}],"execution_count":4},{"id":"d91499d7-5c6c-4c10-b7b7-bfc4b87ddaa8","cell_type":"markdown","source":"Beyond CPU cores and threads which were previously also introduced for the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) the HPC Cluster Executors also provide the option to select the available accelerator cards or GPUs, by specifying the `\"gpus_per_core\"` parameter in the resource dictionary `resource_dict`. For demonstration we create a Python function which reads the GPU device IDs and submit it to the `FluxClusterExecutor` class:\n```python\ndef get_available_gpus():\n import socket\n from tensorflow.python.client import device_lib\n local_device_protos = device_lib.list_local_devices()\n return [\n (x.name, x.physical_device_desc, socket.gethostname()) \n for x in local_device_protos if x.device_type == 'GPU'\n ]\n```\n\n```python\nwith FluxClusterExecutor(\n cache_directory=\"./cache\",\n resource_dict={\"gpus_per_core\": 1}\n) as exe:\n fs_1 = exe.submit(get_available_gpus)\n fs_2 = exe.submit(get_available_gpus)\n print(fs_1.result(), fs_2.result())\n```","metadata":{}},{"id":"b779e393-0c01-4a2a-9343-3480ea59f74b","cell_type":"markdown","source":"### Block Allocation\nIn analogy to the `SingleNodeExecutor` also the `FluxClusterExecutor` and `SlurmClusterExecutor` support the block allocation mode. This starts a number of workers by submitting jobs to the HPC cluster. After these jobs are started, functions are submitted using socket based communication and the same Executor is used to execute multiple functions. This scheme is commonly known as a worker approach, which enables off-loading compute heavy tasks. Below the same example is repeated, which was previously introduced for the `SingleNodeExecutor`:","metadata":{}},{"id":"da81f07f-99f9-469b-9454-efbc083e2043","cell_type":"code","source":"def init_function():\n return {\"j\": 4, \"k\": 3, \"l\": 2}","metadata":{"trusted":true},"outputs":[],"execution_count":5},{"id":"7a3bca08-f39a-48ea-a07c-c41855006843","cell_type":"code","source":"def calc_with_preload(i, j, k):\n return i + j + k","metadata":{"trusted":true},"outputs":[],"execution_count":6},{"id":"1265650e-457d-4a46-9a62-9ad2c95fb80a","cell_type":"markdown","source":"The function `calc_with_preload()` requires three inputs `i`, `j` and `k`. But when the function is submitted to the executor only two inputs are provided `fs = exe.submit(calc, 2, j=5)`. In this case the first input parameter is mapped to `i=2`, the second input parameter is specified explicitly `j=5` but the third input parameter `k` is not provided. So the `FluxClusterExecutor` automatically checks the keys set in the `init_function()` function. In this case the returned dictionary `{\"j\": 4, \"k\": 3, \"l\": 2}` defines `j=4`, `k=3` and `l=2`. For this specific call of the `calc_with_preload()` function, `i` and `j` are already provided so `j` is not required, but `k=3` is used from the `init_function()` and as the `calc_with_preload()` function does not define the `l` parameter this one is also ignored.","metadata":{}},{"id":"ce4dd44c-8db5-4445-bcc5-fad731702444","cell_type":"code","source":"with FluxClusterExecutor(\n cache_directory=\"./file\", \n max_workers=2, \n init_function=init_function, \n block_allocation=True\n) as exe:\n fs = exe.submit(calc_with_preload, 2, j=5)\n print(fs.result())","metadata":{"trusted":true,"tags":["flux"]},"outputs":[{"name":"stdout","output_type":"stream","text":"10\n"}],"execution_count":7},{"id":"93a54d18-9d65-469b-ad6e-bcc1ec590671","cell_type":"markdown","source":"The result is `2+5+3=10` as `i=2` and `j=5` are provided during the submission and `k=3` is defined in the `init_function()` function.","metadata":{}},{"id":"5d1d1374-46a4-4c2d-8a88-eceeebb568e8","cell_type":"markdown","source":"## Disconnecting and Reconnecting\nA key advantage of the HPC Cluster Executors over the [HPC Job Executors](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) is that the Python process which created the executor does not need to stay alive while the submitted functions are running. As the functions are submitted as individual scheduler jobs and the results are stored on the file system, the Python process can be closed after the submission - for example to log out of the login node overnight - and the results can be reloaded later. This is controlled with the `shutdown()` method of the executor, which provides the same `wait` and `cancel_futures` parameters as the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.shutdown) of the Python standard library.\n\nTo submit a set of functions and disconnect without waiting, the executor is created without a `with` statement and `shutdown()` is called with `wait=False` and `cancel_futures=False`:","metadata":{}},{"id":"77db00e6-d201-4315-abec-21388ce75e0c","cell_type":"code","source":"from executorlib import SlurmClusterExecutor\n\nexe = SlurmClusterExecutor(\n cache_directory=\"./cache_disconnect\",\n resource_dict={\"submission_template\": submission_template},\n)\nfuture_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\nexe.shutdown(wait=False, cancel_futures=False)","metadata":{"trusted":true,"tags":["slurm"]},"outputs":[],"execution_count":null},{"id":"a976ae9f-0d30-42fb-9d41-3571b02036ca","cell_type":"markdown","source":"The submitted jobs remain in the queue of the job scheduler and continue to run. At a later point - even from a new Python process - the same functions are submitted again using the same `cache_directory`. executorlib recognises the cached results and returns them immediately instead of submitting the functions a second time:","metadata":{}},{"id":"2cc8722d-a60e-4a7c-8336-bbac5b48141b","cell_type":"code","source":"from executorlib import SlurmClusterExecutor\n\nwith SlurmClusterExecutor(\n cache_directory=\"./cache_disconnect\",\n resource_dict={\"submission_template\": submission_template},\n) as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true,"tags":["slurm"]},"outputs":[],"execution_count":null},{"id":"2dd17c71-3cbb-46e8-ae50-89f005437a21","cell_type":"markdown","source":"The behaviour of the `shutdown()` method is summarized in the following table:\n\n| `shutdown()` call | Effect |\n|---|---|\n| `shutdown(wait=True)` | Wait until all submitted functions are finished before continuing - this is the default and also what the `with` statement does. |\n| `shutdown(wait=False, cancel_futures=False)` | Return immediately and leave the submitted jobs running in the scheduler queue - used to disconnect from a running workflow. |\n| `shutdown(wait=False, cancel_futures=True)` | Cancel the submitted jobs which have not started or finished yet. |\n\nThis disconnect-and-reconnect capability is available for both the `SlurmClusterExecutor` and the `FluxClusterExecutor`, as both communicate via the file system rather than via sockets.","metadata":{}},{"id":"6842f73f-d6c4-4203-a43d-687ec97e7be7","cell_type":"markdown","source":"## Combine both\n\nWhile `SlurmClusterExecutor` submits each Python function as a separate `sbatch` job from the login node, the [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) (`SlurmJobExecutor`) runs **inside** an already-running SLURM allocation and dispatches tasks as `srun` steps — no new jobs enter the queue.\n\n```python\nfrom executorlib import SlurmJobExecutor\n\n# This code runs inside an existing SLURM job\nwith SlurmJobExecutor(max_workers=4) as exe:\n futures = [exe.submit(sum, [i, i], resource_dict={\"cores\": 1}) for i in range(4)]\n print([f.result() for f in futures])\n```\n\nThis example is executed inside a SLURM allocation in the [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) section. The two executor types can be nested: a function submitted via `SlurmClusterExecutor` (running as an `sbatch` job) can itself create a `SlurmJobExecutor` to parallelise sub-tasks as `srun` steps within the same allocation:","metadata":{}},{"id":"d66f03dc-8e72-4a22-8b63-f7cf15258fbf","cell_type":"code","source":"from executorlib import SlurmClusterExecutor, SlurmJobExecutor\n\ndef parallel_workflow(n):\n with SlurmJobExecutor(max_workers=n) as inner:\n futures = [inner.submit(sum, [i, i], resource_dict={\"cores\": 1}) for i in range(n)]\n return [f.result() for f in futures]\n\nwith SlurmClusterExecutor(cache_directory=\"./cache\") as outer:\n future = outer.submit(\n parallel_workflow, 2,\n resource_dict={\"cores\": 1, \"run_time_max\": 300, \"submission_template\": submission_template})\n print(future.result())","metadata":{"trusted":true,"tags":["slurm"]},"outputs":[],"execution_count":null},{"id":"9ce9bf0f-33c6-4b40-ab36-a1d0975e4d78","cell_type":"markdown","source":"The `sacct` output for such a job will show the outer `sbatch` job together with numbered `srun` steps (e.g. `12345.0`, `12345.1`, …), all completing within the same allocation.\n\n| Executor | Scheduler command | Typical use |\n|---|---|---|\n| `SlurmClusterExecutor` | `sbatch` (one job per function) | Submit from login node |\n| `SlurmJobExecutor` | `srun` steps within current job | Inside an existing allocation |\n| `FluxClusterExecutor` | `flux submit` | Flux-managed allocation or local testing |","metadata":{}},{"id":"3f47fd34-04d1-42a7-bb06-6821dc99a648","cell_type":"markdown","source":"## Cleaning Cache\nFinally, as the HPC Cluster Executors leverage the file system to communicate serialized Python functions, it is important to clean up the cache directory specified by the `cache_directory` parameter once the results of the submitted Python functions are no longer needed. The serialized Python functions are stored in binary format using the [cloudpickle](https://github.com/cloudpipe/cloudpickle) library for serialization. This format is design for caching but not for long-term storage. The user is responsible for the long-term storage of their data.","metadata":{}},{"id":"f537b4f6-cc98-43da-8aca-94a823bcbcbd","cell_type":"code","source":"import os\nimport shutil\n\nfor cache_dir in [\"./file\", \"./cache\", \"./cache_disconnect\"]:\n if os.path.exists(cache_dir):\n print(os.listdir(cache_dir))\n try:\n shutil.rmtree(cache_dir)\n except OSError:\n pass","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"['add_funct144ecf19b5020fccad214df3f4bdabd0_o.h5', 'add_funct67b8245bf71c3c6dcb2018663939c72d', 'add_funct4a5d1f06cca57f0ffbaa3116d39ecc6a', 'add_functcb272924f36cbaa9ac79f8d42b6771c8_o.h5', 'calcd732cdcbd2c8e68145d99f0be814e667', '393f99f890d39348c6248689096e6efb', 'add_funct67b8245bf71c3c6dcb2018663939c72d_o.h5', 'add_funct4a5d1f06cca57f0ffbaa3116d39ecc6a_o.h5', 'calcd732cdcbd2c8e68145d99f0be814e667_o.h5', '3888b889a896c43b68f0bd924ee5285c', 'add_funct144ecf19b5020fccad214df3f4bdabd0', 'add_functcb272924f36cbaa9ac79f8d42b6771c8', 'calc_with_preloade920bec0b69f103b2579175e37aa3528_o.h5']\n"}],"execution_count":8},{"id":"3efc9f5d-fbf9-4a85-8963-5711a453130d","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]} \ No newline at end of file diff --git a/notebooks/3-hpc-job.ipynb b/notebooks/3-hpc-job.ipynb index 7985423d..ca8d43d3 100644 --- a/notebooks/3-hpc-job.ipynb +++ b/notebooks/3-hpc-job.ipynb @@ -38,15 +38,20 @@ ] }, { - "cell_type": "markdown", - "id": "9b74944e-2ccd-4cb0-860a-d876310ea870", - "metadata": {}, + "cell_type": "code", + "execution_count": null, + "id": "dd6a748e-75b1-4c7d-9ae0-09d0b4926d51", + "metadata": { + "tags": [ + "slurm" + ], + "trusted": true + }, + "outputs": [], "source": [ - "```python\n", "with SlurmJobExecutor() as exe:\n", " future = exe.submit(sum, [1, 1])\n", - " print(future.result())\n", - "```" + " print(future.result())" ] }, { @@ -78,7 +83,9 @@ "#SBATCH --job-name={{job_name}}\n", "#SBATCH --chdir={{working_directory}}\n", "#SBATCH --get-user-env=L\n", + "{%- if partition %}\n", "#SBATCH --partition={{partition}}\n", + "{%- endif %}\n", "{%- if run_time_max %}\n", "#SBATCH --time={{ [1, run_time_max // 60]|max }}\n", "{%- endif %}\n", @@ -132,6 +139,9 @@ "execution_count": null, "id": "5802c7d7-9560-4909-9d30-a915a91ac0a1", "metadata": { + "tags": [ + "flux" + ], "trusted": true }, "outputs": [ @@ -151,6 +161,31 @@ " print(fs.result())" ] }, + { + "cell_type": "markdown", + "id": "6f3066cd-16d1-46a4-b697-102a4c04f135", + "metadata": {}, + "source": [ + "The same MPI parallel function can be executed with the `SlurmJobExecutor`. In this case the `pmi_mode` is passed to the `srun` command as `--mpi=`, for example `pmi_mode=\"pmi2\"` for MPICH:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "eaaccb1c-3014-4da7-80d5-a8eb8249a4cc", + "metadata": { + "tags": [ + "slurm" + ], + "trusted": true + }, + "outputs": [], + "source": [ + "with SlurmJobExecutor(pmi_mode=\"pmi2\") as exe:\n", + " fs = exe.submit(calc_mpi, 3, resource_dict={\"cores\": 2})\n", + " print(fs.result())" + ] + }, { "cell_type": "markdown", "id": "da862425-08b6-4ced-999f-89a74e85f410", @@ -191,6 +226,9 @@ "execution_count": null, "id": "0da13efa-1941-416f-b9e6-bba15b5cdfa2", "metadata": { + "tags": [ + "flux" + ], "trusted": true }, "outputs": [ @@ -250,6 +288,9 @@ "execution_count": null, "id": "1a2d440f-3cfc-4ff2-b74d-e21823c65f69", "metadata": { + "tags": [ + "flux" + ], "trusted": true }, "outputs": [ @@ -283,6 +324,9 @@ "execution_count": null, "id": "dcba63e0-72f5-49d1-ab04-2092fccc1c47", "metadata": { + "tags": [ + "flux" + ], "trusted": true }, "outputs": [ @@ -360,6 +404,9 @@ "execution_count": null, "id": "89b7d0fd-5978-4913-a79a-f26cc8047445", "metadata": { + "tags": [ + "flux" + ], "trusted": true }, "outputs": [ @@ -391,6 +438,9 @@ "execution_count": 13, "id": "3df0357e-d936-4989-a271-d0b03c6d0b48", "metadata": { + "tags": [ + "flux" + ], "trusted": true }, "outputs": [ @@ -426,6 +476,9 @@ "execution_count": 14, "id": "7481eb0a-a41b-4d46-bb48-b4db299fcd86", "metadata": { + "tags": [ + "flux" + ], "trusted": true }, "outputs": [ @@ -457,6 +510,9 @@ "execution_count": 15, "id": "1ee6e147-f53a-4526-8ed0-fd036f2ee6bf", "metadata": { + "tags": [ + "flux" + ], "trusted": true }, "outputs": [ @@ -505,6 +561,9 @@ } ], "metadata": { + "executorlib_ci": { + "allocation": true + }, "kernelspec": { "display_name": "Flux", "language": "python", From 25174c42314f1e460bb35fe14343814ee98d071c Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Thu, 19 Nov 2026 10:52:04 +0100 Subject: [PATCH 3/9] [Documentation] Rewrite getting started as user stories Add nine example notebooks which each start from the challenge of an HPC user and solve it end-to-end, combining the executorlib features the story needs: submit and reconnect, multi-resource pipelines, parameter studies in one allocation, local prototyping, recovery from failed jobs, block allocation with init functions, nested executors, adaptive workflows and documenting workflows. The cluster-specific settings are collected in one papermill parameters cell per notebook, so the notebooks can be executed on a SLURM test cluster in CI. The stories replace the Getting Started on HPC guide (hpc-workflow.md), the existing chapters are grouped under a Reference caption. Co-Authored-By: Claude Opus 5.5 --- README.md | 59 ++-- docs/_toc.yml | 42 ++- docs/hpc-workflow.md | 292 --------------- notebooks/story-1-submit-and-reconnect.ipynb | 301 ++++++++++++++++ .../story-2-multi-resource-pipeline.ipynb | 314 +++++++++++++++++ notebooks/story-3-parameter-study.ipynb | 278 +++++++++++++++ notebooks/story-4-prototype-then-scale.ipynb | 230 ++++++++++++ notebooks/story-5-recover-failed-jobs.ipynb | 333 ++++++++++++++++++ notebooks/story-6-expensive-setup-once.ipynb | 245 +++++++++++++ notebooks/story-7-fan-out-inside-jobs.ipynb | 239 +++++++++++++ notebooks/story-8-adaptive-workflows.ipynb | 230 ++++++++++++ notebooks/story-9-document-and-share.ipynb | 287 +++++++++++++++ 12 files changed, 2520 insertions(+), 330 deletions(-) delete mode 100644 docs/hpc-workflow.md create mode 100644 notebooks/story-1-submit-and-reconnect.ipynb create mode 100644 notebooks/story-2-multi-resource-pipeline.ipynb create mode 100644 notebooks/story-3-parameter-study.ipynb create mode 100644 notebooks/story-4-prototype-then-scale.ipynb create mode 100644 notebooks/story-5-recover-failed-jobs.ipynb create mode 100644 notebooks/story-6-expensive-setup-once.ipynb create mode 100644 notebooks/story-7-fan-out-inside-jobs.ipynb create mode 100644 notebooks/story-8-adaptive-workflows.ipynb create mode 100644 notebooks/story-9-document-and-share.ipynb diff --git a/README.md b/README.md index 0cfb4f90..b1f12023 100644 --- a/README.md +++ b/README.md @@ -56,23 +56,30 @@ with SlurmClusterExecutor(cache_directory="./cache") as exe: future_lst = [exe.submit(calc, i) for i in range(1, 4)] print([f.result() for f in future_lst]) ``` -The [Getting Started on HPC](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html) guide walks through a -complete HPC workflow and introduces each feature where it solves a concrete challenge: -* [Submission](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#submission) - run existing Python - functions through SLURM with the `SlurmClusterExecutor`. -* [Resources and MPI](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#resources-and-mpi) - assign MPI - ranks, CPU threads and GPUs to individual function calls. -* [Dependencies](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#dependencies) - connect calculations - without manually coordinating scheduler jobs and intermediate files. -* [Caching](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#caching) - reuse completed calculations - when revising or resuming a workflow. -* [Execution strategy](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#execution-strategy) - choose - between one scheduler job per function and many functions within one allocation with the `SlurmJobExecutor`. -* [Local development](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#local-development) - develop and - test the same workflow on a laptop with the `SingleNodeExecutor`. - -The cluster-specific settings like the partition, run time limits and the submission template are explained in the -guide. Readers without access to an HPC cluster can follow the same workflow locally, as shown below. +The user stories each start from a typical challenge of HPC users and solve it end-to-end, combining the features of +executorlib which are needed along the way: +1. [Submit a long-running function and come back later](https://executorlib.readthedocs.io/en/latest/story-1-submit-and-reconnect.html) - submit + from the login node, disconnect, check the status, reconnect and cancel jobs. +2. [A pipeline whose steps need different resources](https://executorlib.readthedocs.io/en/latest/story-2-multi-resource-pipeline.html) - per-call + resources, MPI-parallel functions and SLURM job dependencies from future objects. +3. [A parameter study with many short calculations](https://executorlib.readthedocs.io/en/latest/story-3-parameter-study.html) - distribute + calculations within one allocation, find failing parameter sets and collect the results in a DataFrame. +4. [Prototype on a laptop, then scale up](https://executorlib.readthedocs.io/en/latest/story-4-prototype-then-scale.html) - develop locally with + the same interface, test the file-based cluster mode and switch executors with one line. +5. [Recover from failed jobs](https://executorlib.readthedocs.io/en/latest/story-5-recover-failed-jobs.html) - diagnose exceptions and killed + jobs, then rerun only the failed calculations. +6. [Pay for an expensive setup only once](https://executorlib.readthedocs.io/en/latest/story-6-expensive-setup-once.html) - long-lived workers + with an initialization function and automatic restarts. +7. [Large jobs which each fan out into many small tasks](https://executorlib.readthedocs.io/en/latest/story-7-fan-out-inside-jobs.html) - + combine one SLURM job per campaign with many tasks inside each job. +8. [Adaptive workflows](https://executorlib.readthedocs.io/en/latest/story-8-adaptive-workflows.html) - convergence loops, recursion with + `asyncio` and batching in the order results arrive. +9. [Document and share a workflow](https://executorlib.readthedocs.io/en/latest/story-9-document-and-share.html) - export the workflow graph and + use the cache as an audit trail. + +The cluster-specific settings like the partition, run time limits and the submission template are collected in one +cell at the top of each story. Readers without access to an HPC cluster can start with +[Story 4](https://executorlib.readthedocs.io/en/latest/story-4-prototype-then-scale.html) or follow the examples below locally. ## Examples The Python standard library provides the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#executor-objects) @@ -209,14 +216,16 @@ cluster-specific configuration for the `SlurmClusterExecutor`. * [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/installation.html#hpc-job-executor) * [Visualisation](https://executorlib.readthedocs.io/en/latest/installation.html#visualisation) * [For Developers](https://executorlib.readthedocs.io/en/latest/installation.html#for-developers) -* [Getting Started on HPC](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html) - * [Submission](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#submission) - * [Resources and MPI](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#resources-and-mpi) - * [Dependencies](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#dependencies) - * [Caching](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#caching) - * [Execution Strategy](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#execution-strategy) - * [Local Development](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#local-development) - * [Next Steps](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html#next-steps) +* User Stories + * [Submit a Long-running Function and Come Back Later](https://executorlib.readthedocs.io/en/latest/story-1-submit-and-reconnect.html) + * [A Pipeline whose Steps Need Different Resources](https://executorlib.readthedocs.io/en/latest/story-2-multi-resource-pipeline.html) + * [A Parameter Study with Many Short Calculations](https://executorlib.readthedocs.io/en/latest/story-3-parameter-study.html) + * [Prototype on a Laptop, then Scale Up](https://executorlib.readthedocs.io/en/latest/story-4-prototype-then-scale.html) + * [Recover from Failed Jobs](https://executorlib.readthedocs.io/en/latest/story-5-recover-failed-jobs.html) + * [Pay for an Expensive Setup Only Once](https://executorlib.readthedocs.io/en/latest/story-6-expensive-setup-once.html) + * [Large Jobs which Each Fan Out into Many Small Tasks](https://executorlib.readthedocs.io/en/latest/story-7-fan-out-inside-jobs.html) + * [Adaptive Workflows](https://executorlib.readthedocs.io/en/latest/story-8-adaptive-workflows.html) + * [Document and Share a Workflow](https://executorlib.readthedocs.io/en/latest/story-9-document-and-share.html) * [Comparison](https://executorlib.readthedocs.io/en/latest/comparison.html#comparison) * [At a glace](https://executorlib.readthedocs.io/en/latest/comparison.html#at-a-glance) * [Concurrent futures](https://executorlib.readthedocs.io/en/latest/comparison.html#concurrent-futures-the-python-standard-library) diff --git a/docs/_toc.yml b/docs/_toc.yml index dddbd2ba..2b8594d0 100644 --- a/docs/_toc.yml +++ b/docs/_toc.yml @@ -1,17 +1,33 @@ format: jb-book root: README -chapters: -- file: installation.md -- file: hpc-workflow.md -- file: comparison.md -- file: 1-single-node.ipynb -- file: 2-hpc-cluster.ipynb -- file: 3-hpc-job.ipynb -- file: application.md - sections: +parts: +- caption: Getting Started + chapters: + - file: installation.md +- caption: User Stories + chapters: + - file: story-1-submit-and-reconnect.ipynb + - file: story-2-multi-resource-pipeline.ipynb + - file: story-3-parameter-study.ipynb + - file: story-4-prototype-then-scale.ipynb + - file: story-5-recover-failed-jobs.ipynb + - file: story-6-expensive-setup-once.ipynb + - file: story-7-fan-out-inside-jobs.ipynb + - file: story-8-adaptive-workflows.ipynb + - file: story-9-document-and-share.ipynb +- caption: Background + chapters: + - file: comparison.md +- caption: Reference + chapters: + - file: 1-single-node.ipynb + - file: 2-hpc-cluster.ipynb + - file: 3-hpc-job.ipynb + - file: application.md + sections: - file: 4-1-gpaw.ipynb - file: 4-2-quantum-espresso.ipynb -- file: coupling.md -- file: trouble_shooting.md -- file: 5-developer.ipynb -- file: api.rst + - file: coupling.md + - file: trouble_shooting.md + - file: 5-developer.ipynb + - file: api.rst diff --git a/docs/hpc-workflow.md b/docs/hpc-workflow.md deleted file mode 100644 index 25d9f8b8..00000000 --- a/docs/hpc-workflow.md +++ /dev/null @@ -1,292 +0,0 @@ -# Getting Started on HPC - -executorlib is designed for one job: running *existing* Python functions on a high performance computing (HPC) cluster -without rewriting them into scheduler scripts. This page walks through a typical HPC workflow and introduces each -feature of executorlib at the point where it solves a concrete problem: - -1. [Submission](#submission) - run a Python function as a SLURM job instead of writing a batch script. -2. [Resources and MPI](#resources-and-mpi) - give each function call its own MPI ranks, CPU threads and GPUs. -3. [Dependencies](#dependencies) - chain calculations without coordinating job IDs and intermediate files by hand. -4. [Caching](#caching) - reuse completed calculations when you revise, interrupt or resume a workflow. -5. [Execution strategy](#execution-strategy) - decide between one scheduler job per function and many functions - inside one allocation. -6. [Local development](#local-development) - develop and test the same workflow on a laptop before using cluster - resources. - -The examples are taken from the detailed chapters on the [HPC Cluster Executor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html), the -[HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) and the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html), which provide additional -background for each step. - -```{admonition} Cluster-specific prerequisites -:class: important -The HPC examples on this page cannot be executed on readthedocs or on a laptop. They assume: - -* access to the login node of an HPC cluster with the [SLURM](https://slurm.schedmd.com) job scheduler, -* executorlib installed with the [HPC Cluster Executor](https://executorlib.readthedocs.io/en/latest/installation.html#hpc-cluster-executor) dependencies - ([pysqa](https://pysqa.readthedocs.io) and [h5py](https://www.h5py.org)) - plus [mpi4py](https://mpi4py.readthedocs.io) - for the MPI examples - in a Python environment which is also available on the compute nodes, -* a shared file system between the login node and the compute nodes, which is used for the `cache_directory`. - -Values marked as **cluster-specific** in the examples below - like the partition name `"regular"`, the run time limit or -the PMI mode `"pmix"` - have to be adapted to your cluster. The -[executorlib-cluster-setup](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#setup-with-claude-code) skill for -[Claude Code](https://docs.claude.com/en/docs/claude-code/overview) can analyse your cluster and generate a tested -configuration. Readers without cluster access can follow the same workflow with the `SingleNodeExecutor` as explained in -the [local development](#local-development) section. -``` - -## Submission -**Challenge:** You have a Python function which runs too long for the login node. The classical approach is to write a -Python script, wrap it in a SLURM batch script, submit it with `sbatch`, wait, and then parse the output files. - -**Solution:** The `SlurmClusterExecutor` follows the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#executor-objects) -of the Python standard library. Each call of `submit()` writes the function and its arguments to the `cache_directory`, -submits one SLURM job via `sbatch` and returns a [Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) -object. Calling `result()` on the future waits for the job to finish and loads the return value: - -```python -from executorlib import SlurmClusterExecutor - - -def calc(i): - return i * 2 - - -with SlurmClusterExecutor(cache_directory="./cache") as exe: - future_lst = [exe.submit(calc, i) for i in range(1, 4)] - print([f.result() for f in future_lst]) -``` - -The SLURM settings which are specific to your cluster are defined in a [Jinja2](https://jinja.palletsprojects.com) -submission template and passed via the resource dictionary `resource_dict`: - -```python -submission_template = """\ -#!/bin/bash -#SBATCH --output=time.out -#SBATCH --job-name={{job_name}} -#SBATCH --chdir={{working_directory}} -#SBATCH --get-user-env=L -#SBATCH --partition={{partition}} -{%- if run_time_max %} -#SBATCH --time={{ [1, run_time_max // 60]|max }} -{%- endif %} -{%- if dependency %} -#SBATCH --dependency=afterok:{{ dependency | join(',') }} -{%- endif %} -#SBATCH --ntasks={{cores}} - -{{command}} -""" - -with SlurmClusterExecutor( - cache_directory="./cache", - resource_dict={ - "submission_template": submission_template, - "partition": "regular", # cluster-specific - "run_time_max": 3600, # in seconds, cluster-specific - }, -) as exe: - future = exe.submit(calc, 4) - print(future.result()) -``` - -Rather than repeating the template in every script it can be stored once in a pysqa configuration directory and -referenced with the `pysqa_config_directory` parameter, as explained in -[reusing the configuration](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#reusing-the-configuration-with-pysqa-config-directory). When a -submission fails, for example because the default template does not match the cluster, `sbatch` returns an error which -is raised as `CalledProcessError` - see [SLURM](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#slurm) for details. - -## Resources and MPI -**Challenge:** Most steps of a scientific workflow are serial, but a few are expensive simulations which should use many -CPU cores via MPI, multiple threads or GPUs. Writing the whole program in MPI is not an option, and requesting the -largest allocation for every step wastes resources. - -**Solution:** executorlib assigns resources per function call. The resource dictionary `resource_dict` defines the -number of MPI ranks `cores`, the CPU threads per rank `threads_per_core` and the GPUs per rank `gpus_per_core`. Only the -function which benefits from parallel execution uses [mpi4py](https://mpi4py.readthedocs.io), the rest of the -program remains serial: - -```python -from executorlib import SlurmClusterExecutor - - -def calc_mpi(i): - from mpi4py import MPI - - size = MPI.COMM_WORLD.Get_size() - rank = MPI.COMM_WORLD.Get_rank() - return i, size, rank - - -with SlurmClusterExecutor( - cache_directory="./cache", - pmi_mode="pmix", # cluster-specific, depends on the MPI library - resource_dict={"submission_template": submission_template, "partition": "regular"}, -) as exe: - fs_serial = exe.submit(calc_mpi, 1, resource_dict={"cores": 1}) - fs_mpi = exe.submit(calc_mpi, 2, resource_dict={"cores": 4}) - fs_gpu = exe.submit(calc_mpi, 3, resource_dict={"cores": 1, "gpus_per_core": 1}) - print(fs_serial.result(), fs_mpi.result(), fs_gpu.result()) -``` - -The `resource_dict` passed to `submit()` extends the default `resource_dict` defined for the executor. The full list of -supported keys is available in the [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary) section. To confirm -that SLURM assigned the requested resources, the job ID of each function is stored in the cache and can be inspected -with `sacct` - see [verifying the resource assignment](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#verifying-the-resource-assignment). - -## Dependencies -**Challenge:** The output of one calculation is the input of the next one. With plain SLURM this requires collecting -job IDs, adding `--dependency=afterok:` to each batch script and writing and parsing intermediate files. - -**Solution:** Pass the future object of one calculation as an argument to the next `submit()` call. executorlib -translates the dependency into a SLURM job dependency and transfers the result between the jobs via the -`cache_directory`. The Python process does not have to wait for the first calculation to finish before submitting the -second one: - -```python -from executorlib import SlurmClusterExecutor - - -def add_funct(a, b): - return a + b - - -with SlurmClusterExecutor(cache_directory="./cache") as exe: - future = 0 - for i in range(4, 8): - future = exe.submit(add_funct, i, future) - print(future.result()) -``` - -Functions returning tuples or dictionaries can be split into individual futures with `split_future()` and -`get_item_from_future()`, and many futures can be grouped with `batched()`. These patterns are introduced in the -[advanced scheduling](https://executorlib.readthedocs.io/en/latest/1-single-node.html#advanced-scheduling) section and apply unchanged to the HPC executors. To -debug complex dependencies the graph can be visualised with `plot_dependency_graph=True`, see -[dependencies](https://executorlib.readthedocs.io/en/latest/1-single-node.html#dependencies). - -## Caching -**Challenge:** HPC workflows are developed iteratively. You add an analysis step to a workflow whose simulations took -hours, your session on the login node is disconnected, or one step fails and has to be fixed. In each case you do not -want to repeat the calculations which already finished. - -**Solution:** All results of the `SlurmClusterExecutor` are stored in the `cache_directory`. Each task is identified by -a hash of the function and its arguments. When the same function is submitted again with the same arguments and the -same `cache_directory`, the stored result is returned instead of submitting a new job. This also allows you to submit a -workflow, close the Python process and reconnect later: - -```python -from executorlib import SlurmClusterExecutor - -exe = SlurmClusterExecutor(cache_directory="./cache") -future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)] -exe.shutdown(wait=False, cancel_futures=False) # disconnect, the jobs keep running -``` - -Later - even from a new Python process - the same submission reloads the results from the cache: - -```python -with SlurmClusterExecutor(cache_directory="./cache") as exe: - future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)] - print([f.result() for f in future_lst]) -``` - -The results of all cached calculations can be collected in a `pandas.DataFrame` with `get_cache_data()`, see -[cache](https://executorlib.readthedocs.io/en/latest/1-single-node.html#cache). Keep in mind the lifetime and limitations of the cache: - -* **What invalidates a cached result:** changing the function or its arguments creates a new hash and a new - calculation. Changing only the `resource_dict` does not, so a result computed with 4 cores is reused when the same - call is submitted with 8 cores. An explicit identifier can be set with the `cache_key` entry of the - [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary). -* **Duplicates within one session:** the cache restores results from previous sessions. It is not designed to detect - the same function call submitted twice within one `with`-statement. -* **Lifetime:** executorlib never deletes the `cache_directory`. Remove it once the results are no longer needed, as - explained in [cleaning cache](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#cleaning-cache), since disk space on shared file systems is limited. -* **Not long-term storage:** the cache uses [cloudpickle](https://github.com/cloudpipe/cloudpickle) and - [h5py](https://www.h5py.org). The format may change between versions of executorlib and Python, so results which - should be kept have to be stored in a format of your choice. - -## Execution strategy -**Challenge:** Submitting every function as its own SLURM job is robust, but each job waits in the queue and the -scheduler is not designed for thousands of short jobs. On the other hand many clusters favour large allocations, or you -already have an interactive allocation. - -**Solution:** Use the `SlurmJobExecutor` inside an existing SLURM allocation. It distributes the functions over the -resources of the allocation using `srun` job steps, so no new jobs enter the queue. The `submit()` interface, the -`resource_dict` and the dependency handling remain the same: - -```python -from executorlib import SlurmJobExecutor - -# This code runs inside an existing SLURM allocation, e.g. a script submitted with sbatch or salloc -with SlurmJobExecutor(max_workers=4) as exe: - future_lst = [exe.submit(calc_mpi, i, resource_dict={"cores": 2}) for i in range(4)] - print([f.result() for f in future_lst]) -``` - -Both strategies can also be combined: a function submitted with the `SlurmClusterExecutor` can itself create a -`SlurmJobExecutor` to distribute many small tasks within its allocation - see [combine both](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#combine-both). -For many short tasks within one allocation, starting the hierarchical [flux](http://flux-framework.org) scheduler inside -the SLURM allocation reduces the load on the SLURM database - see [SLURM with flux](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html#slurm-with-flux). - -| | `SlurmClusterExecutor` | `SlurmJobExecutor` | -|---|---|---| -| Where the Python process runs | login node | inside a SLURM allocation | -| One function call is | one `sbatch` job | one `srun` job step | -| Waiting time | each function waits in the queue | the allocation waits once | -| Python process can be closed while functions run | yes, results are reloaded from the cache | no | -| Communication | shared file system (`cache_directory` required) | sockets (`cache_directory` optional) | -| Overhead per function | high (queue and file system) | low | -| Best for | few long-running functions with different resource requirements | many short functions, high throughput | - -As a rule of thumb: start with the `SlurmClusterExecutor` when individual calculations run for minutes to hours or the -workflow should survive the end of your login session. Switch to the `SlurmJobExecutor` (or `FluxJobExecutor`) when you -execute many short functions or your cluster limits the number of jobs per user. The -[which executor should I use](https://executorlib.readthedocs.io/en/latest/#which-executor-should-i-use) table -summarizes all executors, including the corresponding [flux](http://flux-framework.org) executors. - -## Local development -**Challenge:** Debugging a workflow by waiting in the queue of the cluster is slow and consumes compute time, and not -everybody has access to an HPC cluster. - -**Solution:** Develop and test the workflow with the `SingleNodeExecutor` on your laptop or workstation. It supports -the same `submit()` interface, the same `resource_dict` - including MPI parallel functions with `cores` - the same -dependency handling and the same `cache_directory`. Moving to the cluster only requires replacing the executor class -and adding the cluster-specific settings: - -```python -from executorlib import SingleNodeExecutor - - -def calc_mpi(i): - from mpi4py import MPI - - size = MPI.COMM_WORLD.Get_size() - rank = MPI.COMM_WORLD.Get_rank() - return i, size, rank - - -def add_funct(a, b): - return a + b - - -with SingleNodeExecutor(cache_directory="./cache") as exe: - fs_mpi = exe.submit(calc_mpi, 3, resource_dict={"cores": 2}) - fs_sum = exe.submit(add_funct, 1, 2) - fs_final = exe.submit(add_funct, fs_sum, 3) # dependency via the future object - print(fs_mpi.result(), fs_final.result()) -``` - -The `SingleNodeExecutor` communicates via sockets like the `SlurmJobExecutor`. To test the file based communication of -the `SlurmClusterExecutor` locally, executorlib provides the `TestClusterExecutor` - see -[TestClusterExecutor](https://executorlib.readthedocs.io/en/latest/1-single-node.html#testclusterexecutor). The full functionality of the local executor is -introduced in the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) chapter, which can be executed without cluster access, for -example on [mybinder](https://mybinder.org/v2/gh/pyiron/executorlib/HEAD). - -## Next steps -* [HPC Cluster Executor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html) - SLURM background, submission templates, pysqa configuration, flux and - disconnecting and reconnecting. -* [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) - executing functions inside an allocation with SLURM and flux. -* [Application](https://executorlib.readthedocs.io/en/latest/application.html) - complete examples for [GPAW](https://executorlib.readthedocs.io/en/latest/4-1-gpaw.html) and - [Quantum Espresso](https://executorlib.readthedocs.io/en/latest/4-2-quantum-espresso.html). -* [Trouble Shooting](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html) - file system usage, firewalls, MPI and the full resource dictionary. diff --git a/notebooks/story-1-submit-and-reconnect.ipynb b/notebooks/story-1-submit-and-reconnect.ipynb new file mode 100644 index 00000000..a4ce0c9f --- /dev/null +++ b/notebooks/story-1-submit-and-reconnect.ipynb @@ -0,0 +1,301 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Story 1: Submit a Long-running Function and Come Back Later\n", + "**Who:** A scientist with a Python function which runs a simulation for hours, for example a molecular dynamics run\n", + "at a given temperature.\n", + "\n", + "**What they want:** Run the function for a few temperatures on the cluster, log out, and pick up the results the next\n", + "morning, directly as Python objects.\n", + "\n", + "**Why plain SLURM is painful:** The function has to be wrapped in a Python script which reads its inputs from files,\n", + "the script in a batch script, the batch script is submitted with `sbatch`, the job IDs are noted down and checked with\n", + "`squeue`, and finally the output files are parsed back into Python. A single function call turns into three files and\n", + "a manual bookkeeping exercise.\n", + "\n", + "**How executorlib helps:** The `SlurmClusterExecutor` submits every function call as its own SLURM job and stores\n", + "inputs and outputs in a cache directory on the shared file system. Because the state lives on disk rather than in the\n", + "Python process, you can disconnect, check the status from any Python process, reconnect later and cancel jobs you no\n", + "longer need.\n", + "\n", + "This notebook runs on the **login node** of a SLURM cluster - no allocation is required." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Cluster-specific settings\n", + "**Adapt the following cell to your cluster.** It collects everything which depends on the cluster rather than on your science. The values below are the ones used to test this notebook on a single-node SLURM test cluster. The submission template is a [Jinja2](https://jinja.palletsprojects.com) template which executorlib renders for every function call: add the lines your cluster requires, for example `#SBATCH --partition=`, `#SBATCH --account=` or `module load ...` commands before `{{command}}`. The [executorlib-cluster-setup](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#setup-with-claude-code) skill for Claude Code can analyse your cluster and generate a tested template." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "parameters" + ] + }, + "outputs": [], + "source": [ + "# Cluster-specific settings - adapt these values to your cluster.\n", + "submission_template = \"\"\"\\\n", + "#!/bin/bash\n", + "#SBATCH --output=time.out\n", + "#SBATCH --job-name={{job_name}}\n", + "#SBATCH --chdir={{working_directory}}\n", + "#SBATCH --get-user-env=L\n", + "#SBATCH --ntasks={{cores}}\n", + "{%- if run_time_max %}\n", + "#SBATCH --time={{ [1, run_time_max // 60]|max }}\n", + "{%- endif %}\n", + "{%- if dependency_list %}\n", + "#SBATCH --dependency=afterok:{{ dependency_list | join(',') }}\n", + "{%- endif %}\n", + "\n", + "{{command}}\n", + "\"\"\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 1: Write the function\n", + "The function is plain Python. It does not know anything about SLURM." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import time\n", + "\n", + "\n", + "def simulate(temperature, n_steps=500):\n", + " # Stand-in for an hours-long simulation: the run time grows with the number of steps.\n", + " time.sleep(n_steps / 100)\n", + " return {\"temperature\": temperature, \"energy\": -3.5 + 0.001 * temperature}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 2: Submit and disconnect\n", + "Every call of `submit()` serializes the function and its arguments to the `cache_directory`, renders the submission\n", + "template and calls `sbatch`. The `resource_dict` defined for the executor applies to all calls - here the maximum run\n", + "time `run_time_max` in seconds, which the template converts to `#SBATCH --time`.\n", + "\n", + "Instead of a `with` statement, which waits for all jobs to finish, the executor is shut down with\n", + "`shutdown(wait=False, cancel_futures=False)`. This returns immediately and leaves the jobs running in SLURM." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from executorlib import SlurmClusterExecutor\n", + "\n", + "cache_directory = \"./story1_cache\"\n", + "temperature_lst = [300, 600, 900]\n", + "\n", + "exe = SlurmClusterExecutor(\n", + " cache_directory=cache_directory,\n", + " resource_dict={\"submission_template\": submission_template, \"run_time_max\": 600},\n", + ")\n", + "future_lst = [exe.submit(simulate, temperature) for temperature in temperature_lst]\n", + "exe.shutdown(wait=False, cancel_futures=False)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The future objects of this Python process are now detached. They are marked as cancelled, because this process no\n", + "longer follows the jobs - the jobs themselves keep running. At this point you could close the notebook and log out." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "[future.cancelled() for future in future_lst]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 3: Check the status from any Python process\n", + "`get_cache_data_queue()` combines the content of the cache directory with the output of `squeue`. It only needs the\n", + "`cache_directory`, so it works from a new Python process as well. The `status` is `pending` or `running` while the job\n", + "is in the queue, `finished` once the result was written and `aborted` when the job left the queue without a result -\n", + "see [Story 5](story-5-recover-failed-jobs.ipynb) for how to handle that case." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas\n", + "from executorlib import get_cache_data_queue\n", + "\n", + "df = pandas.DataFrame(get_cache_data_queue(cache_directory=cache_directory, queue_type=\"slurm\"))\n", + "df[[\"input_args\", \"queue_id\", \"status\"]]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 4: Reconnect and collect the results\n", + "Later - after lunch, the next morning, or from a fresh Python process - submit the same function calls with the same\n", + "`cache_directory`. executorlib identifies each call by a hash of the function and its arguments:\n", + "\n", + "* calls which already finished are loaded from the cache,\n", + "* calls whose job is still in the queue are re-attached to that job instead of being submitted a second time,\n", + "* only calls which are unknown to the cache are submitted as new jobs.\n", + "\n", + "In a new Python process define the function with exactly the same code, otherwise the hash changes and new jobs are\n", + "submitted." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "with SlurmClusterExecutor(\n", + " cache_directory=cache_directory,\n", + " resource_dict={\"submission_template\": submission_template, \"run_time_max\": 600},\n", + ") as exe:\n", + " future_lst = [exe.submit(simulate, temperature) for temperature in temperature_lst]\n", + " result_lst = [future.result() for future in future_lst]\n", + "\n", + "result_lst" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "df = pandas.DataFrame(get_cache_data_queue(cache_directory=cache_directory, queue_type=\"slurm\"))\n", + "df[[\"input_args\", \"queue_id\", \"status\", \"runtime\"]]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 5: Cancel jobs you no longer need\n", + "Mistakes happen: here a run with one hundred times too many steps is submitted and the session is disconnected again." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "exe = SlurmClusterExecutor(\n", + " cache_directory=cache_directory,\n", + " resource_dict={\"submission_template\": submission_template, \"run_time_max\": 600},\n", + ")\n", + "future_wrong = exe.submit(simulate, 1200, n_steps=50000) # typo: should have been n_steps=500\n", + "exe.shutdown(wait=False, cancel_futures=False)\n", + "\n", + "df = pandas.DataFrame(get_cache_data_queue(cache_directory=cache_directory, queue_type=\"slurm\"))\n", + "df[[\"input_args\", \"input_kwargs\", \"queue_id\", \"status\"]]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "`terminate_tasks_in_cache()` calls `scancel` for every unfinished job recorded in the cache directory and removes its\n", + "input file, so a later resubmission starts from scratch. Finished results remain in the cache. To cancel a single\n", + "call use `terminate_task_in_cache()` with the `cache_key` of the call, which is the file name of its cache file without\n", + "the `_i.h5` suffix." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from executorlib import terminate_tasks_in_cache\n", + "\n", + "terminate_tasks_in_cache(cache_directory=cache_directory, backend=\"slurm\")\n", + "\n", + "df = pandas.DataFrame(get_cache_data_queue(cache_directory=cache_directory, queue_type=\"slurm\"))\n", + "df[[\"input_args\", \"input_kwargs\", \"queue_id\", \"status\"]]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Clean up\n", + "executorlib never deletes the cache directory, since it might contain results which took days to compute. Remove it\n", + "once the results are stored elsewhere - the cache format is designed for caching, not for long-term storage." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import shutil\n", + "\n", + "shutil.rmtree(cache_directory, ignore_errors=True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## What you learned\n", + "* The `SlurmClusterExecutor` submits each function call as a SLURM job, configured by a `submission_template` and the\n", + " `resource_dict`.\n", + "* `shutdown(wait=False, cancel_futures=False)` disconnects the Python process while the jobs keep running.\n", + "* Resubmitting the same calls with the same `cache_directory` reconnects to running jobs and reloads finished results.\n", + "* `get_cache_data_queue()` reports the status of all calls, `terminate_tasks_in_cache()` cancels unfinished ones.\n", + "\n", + "**Reference:** [HPC Cluster Executor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html) (submission templates, pysqa configuration directory,\n", + "[disconnecting and reconnecting](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#disconnecting-and-reconnecting),\n", + "[cleaning the cache](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#cleaning-cache)) and the\n", + "[resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary)." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/notebooks/story-2-multi-resource-pipeline.ipynb b/notebooks/story-2-multi-resource-pipeline.ipynb new file mode 100644 index 00000000..981bb0f8 --- /dev/null +++ b/notebooks/story-2-multi-resource-pipeline.ipynb @@ -0,0 +1,314 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Story 2: A Pipeline whose Steps Need Different Resources\n", + "**Who:** A computational chemist with a three-step workflow: a serial structure preparation, an MPI-parallel\n", + "simulation and a serial analysis - repeated for several lattice constants, followed by a final step which selects the\n", + "best candidate.\n", + "\n", + "**What they want:** Give every step exactly the resources it needs, and have each step start as soon as its inputs\n", + "are ready.\n", + "\n", + "**Why plain SLURM is painful:** Every step needs its own batch script with its own `#SBATCH` header. The job ID of\n", + "each submission has to be captured and passed to the next one as `--dependency=afterok:`, and the\n", + "intermediate results have to be written to files and parsed again. Running the whole workflow in one large MPI\n", + "allocation avoids the bookkeeping, but wastes core hours while the serial steps run.\n", + "\n", + "**How executorlib helps:** Resources are defined per function call with the `resource_dict`. Passing the future of one\n", + "call as argument to the next one turns into a SLURM job dependency, and the result is handed over through the cache.\n", + "\n", + "This notebook runs on the **login node** of a SLURM cluster." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Cluster-specific settings\n", + "**Adapt the following cell to your cluster.** It collects everything which depends on the cluster rather than on your science. The values below are the ones used to test this notebook on a single-node SLURM test cluster. The submission template is a [Jinja2](https://jinja.palletsprojects.com) template which executorlib renders for every function call: add the lines your cluster requires, for example `#SBATCH --partition=`, `#SBATCH --account=` or `module load ...` commands before `{{command}}`. The [executorlib-cluster-setup](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#setup-with-claude-code) skill for Claude Code can analyse your cluster and generate a tested template.\n", + "\n", + "The `pmi_mode` selects the process management interface which `srun` uses to start MPI-parallel functions. It depends on the MPI library your Python environment is linked to." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "parameters" + ] + }, + "outputs": [], + "source": [ + "# Cluster-specific settings - adapt these values to your cluster.\n", + "submission_template = \"\"\"\\\n", + "#!/bin/bash\n", + "#SBATCH --output=time.out\n", + "#SBATCH --job-name={{job_name}}\n", + "#SBATCH --chdir={{working_directory}}\n", + "#SBATCH --get-user-env=L\n", + "#SBATCH --ntasks={{cores}}\n", + "{%- if run_time_max %}\n", + "#SBATCH --time={{ [1, run_time_max // 60]|max }}\n", + "{%- endif %}\n", + "{%- if dependency_list %}\n", + "#SBATCH --dependency=afterok:{{ dependency_list | join(',') }}\n", + "{%- endif %}\n", + "\n", + "{{command}}\n", + "\"\"\"\n", + "pmi_mode = \"pmi2\" # MPI process management interface: \"pmi2\" for MPICH, \"pmix\" for OpenMPI >= 5" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 1: Write the steps as Python functions\n", + "Only the simulation uses MPI via [mpi4py](https://mpi4py.readthedocs.io), the other steps are serial. An MPI-parallel\n", + "function is executed on every MPI rank, so executorlib returns a list with one result per rank." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def prepare_structure(lattice_constant):\n", + " # Stand-in for building an atomistic structure (serial, seconds).\n", + " positions = [lattice_constant * i for i in range(8)]\n", + " return {\"positions\": positions, \"n_steps\": 100}\n", + "\n", + "\n", + "def run_simulation(positions, n_steps):\n", + " # Stand-in for an MPI-parallel simulation code (hours): every rank handles a slice of the atoms.\n", + " from mpi4py import MPI\n", + "\n", + " comm = MPI.COMM_WORLD\n", + " local_energy = sum(-1.0 / (1.0 + x) for x in positions[comm.Get_rank()::comm.Get_size()])\n", + " energy = comm.allreduce(local_energy) * n_steps / 100\n", + " return {\"energy\": energy, \"mpi_ranks\": comm.Get_size()}\n", + "\n", + "\n", + "def analyse(simulation_result, lattice_constant):\n", + " # Stand-in for the post-processing of the simulation output (serial).\n", + " return {\"lattice_constant\": lattice_constant, **simulation_result}\n", + "\n", + "\n", + "def select_minimum(*analysis_results):\n", + " # Final many-to-one step: the lattice constant with the lowest energy.\n", + " return min(analysis_results, key=lambda result: result[\"energy\"])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 2: Define the resources per step\n", + "The serial steps get one core, the simulation gets `cores_mpi` MPI ranks. `run_time_max` (in seconds) becomes the\n", + "`#SBATCH --time` limit of the corresponding job, so short steps can benefit from backfilling." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "cores_mpi = 2\n", + "resources_serial = {\"cores\": 1, \"run_time_max\": 60}\n", + "resources_mpi = {\"cores\": cores_mpi, \"run_time_max\": 120}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "On a production cluster the simulation might rather request:\n", + "\n", + "```python\n", + "resources_mpi = {\n", + " \"cores\": 256, # MPI ranks, rendered as {{cores}} in the template\n", + " \"threads_per_core\": 2, # executorlib requests cores * threads_per_core CPUs in total\n", + " \"num_nodes\": 2, # available as {{num_nodes}} - add \"#SBATCH --nodes={{num_nodes}}\" to the template\n", + " \"run_time_max\": 4 * 3600,\n", + "}\n", + "```\n", + "\n", + "Every key of the `resource_dict` is available in the submission template, so cluster-specific options like the\n", + "partition, the memory or GPUs can be added there. Note that the `SlurmClusterExecutor` does not translate\n", + "`gpus_per_core` into the job script by itself - add a line like `#SBATCH --gpus-per-task={{gpus}}` to the template\n", + "and request `{\"gpus\": 1}`. Inside an allocation the [SlurmJobExecutor](story-3-parameter-study.ipynb) translates\n", + "`gpus_per_core` directly to `srun --gpus-per-task`." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 3: Connect the steps with futures\n", + "The workflow is written as a function which takes the executor as argument, so it can be plotted before it is\n", + "executed. Three utilities connect the steps without waiting for any result:\n", + "\n", + "* `get_item_from_future()` selects one entry of a dictionary returned by a future,\n", + "* `split_future()` splits a future of a list or tuple - here the per-rank results of the MPI function,\n", + "* futures passed as arguments become `--dependency=afterok:` of the dependent job." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from executorlib import get_item_from_future, split_future\n", + "\n", + "\n", + "def submit_workflow(exe, lattice_constant_lst):\n", + " analysis_lst = []\n", + " for lattice_constant in lattice_constant_lst:\n", + " structure = exe.submit(prepare_structure, lattice_constant, resource_dict=resources_serial)\n", + " simulation = exe.submit(\n", + " run_simulation,\n", + " positions=get_item_from_future(structure, key=\"positions\"),\n", + " n_steps=get_item_from_future(structure, key=\"n_steps\"),\n", + " resource_dict=resources_mpi,\n", + " )\n", + " rank_results = split_future(simulation, n=cores_mpi) # one result per MPI rank\n", + " analysis_lst.append(\n", + " exe.submit(analyse, rank_results[0], lattice_constant, resource_dict=resources_serial)\n", + " )\n", + " return exe.submit(select_minimum, *analysis_lst, resource_dict=resources_serial)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "With `plot_dependency_graph=True` nothing is submitted - the executor only records the calls and draws the graph,\n", + "which is a cheap way to check a workflow before spending compute time. This requires the optional\n", + "[pygraphviz](https://pygraphviz.github.io) package." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from executorlib import SlurmClusterExecutor\n", + "\n", + "cache_directory = \"./story2_cache\"\n", + "lattice_constant_lst = [3.9, 4.1]\n", + "\n", + "with SlurmClusterExecutor(\n", + " cache_directory=cache_directory,\n", + " pmi_mode=pmi_mode,\n", + " resource_dict={\"submission_template\": submission_template},\n", + " plot_dependency_graph=True,\n", + ") as exe:\n", + " submit_workflow(exe, lattice_constant_lst)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 4: Run the pipeline\n", + "All seven jobs are submitted immediately. SLURM holds each job until the jobs it depends on finished successfully, so\n", + "the Python process does not have to coordinate anything - combined with [Story 1](story-1-submit-and-reconnect.ipynb)\n", + "you could even disconnect right after the submission." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "with SlurmClusterExecutor(\n", + " cache_directory=cache_directory,\n", + " pmi_mode=pmi_mode,\n", + " resource_dict={\"submission_template\": submission_template},\n", + ") as exe:\n", + " best = submit_workflow(exe, lattice_constant_lst)\n", + " print(best.result())" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 5: Verify which resources each step received\n", + "The cache records the `resource_dict` and the SLURM job ID `queue_id` of every call, which can be passed to\n", + "`sacct -j ` to inspect the accounting record of the job." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas\n", + "from executorlib import get_cache_data\n", + "\n", + "df = pandas.DataFrame(get_cache_data(cache_directory=cache_directory))\n", + "df[\"function\"] = df[\"function\"].apply(lambda fn: fn.__name__)\n", + "df[\"cores\"] = df[\"resource_dict\"].apply(lambda resource_dict: resource_dict[\"cores\"])\n", + "df[[\"function\", \"cores\", \"queue_id\", \"runtime\"]].sort_values(\"queue_id\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Clean up" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import shutil\n", + "\n", + "shutil.rmtree(cache_directory, ignore_errors=True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## What you learned\n", + "* The `resource_dict` passed to `submit()` assigns MPI ranks, threads, run time and any template variable per call.\n", + "* `pmi_mode` defines how MPI-parallel functions are started with `srun`.\n", + "* Futures used as arguments become SLURM job dependencies; `get_item_from_future()` and `split_future()` connect\n", + " individual entries of a result without waiting for it.\n", + "* `plot_dependency_graph=True` draws the workflow without submitting anything.\n", + "\n", + "**Reference:** [HPC Cluster Executor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html),\n", + "[dependencies](https://executorlib.readthedocs.io/en/latest/1-single-node.html#dependencies), [split future objects](https://executorlib.readthedocs.io/en/latest/1-single-node.html#split-future-objects),\n", + "[MPI parallel functions](https://executorlib.readthedocs.io/en/latest/1-single-node.html#mpi-parallel-functions) and the\n", + "[resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary)." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/notebooks/story-3-parameter-study.ipynb b/notebooks/story-3-parameter-study.ipynb new file mode 100644 index 00000000..60927bb5 --- /dev/null +++ b/notebooks/story-3-parameter-study.ipynb @@ -0,0 +1,278 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Story 3: A Parameter Study with Many Short Calculations\n", + "**Who:** A researcher screening a grid of strains and temperatures. Each calculation takes seconds to minutes, but\n", + "there are hundreds of them.\n", + "\n", + "**What they want:** Run the whole grid in one SLURM allocation, find out which parameter sets fail, and collect the\n", + "results in a table.\n", + "\n", + "**Why plain SLURM is painful:** One `sbatch` job per calculation floods the queue, every job waits separately, and many\n", + "clusters limit the number of jobs per user. Job arrays require mapping an index to parameters and collecting the\n", + "results from files. A hand-written loop of `srun ... &` calls in one batch script needs manual bookkeeping of free\n", + "cores, and the one failing parameter set is buried in hundreds of log files.\n", + "\n", + "**How executorlib helps:** The `SlurmJobExecutor` runs inside an existing allocation and distributes the function calls\n", + "over its cores as `srun` job steps - no new jobs enter the queue. Errors are collected in a single log file and\n", + "results are cached, so they can be loaded into a [pandas](https://pandas.pydata.org) DataFrame.\n", + "\n", + "This notebook has to run **inside a SLURM allocation** with at least two cores, for example started with\n", + "`salloc -n 2` or from a batch script submitted with `sbatch -n 2`." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Cluster-specific settings\n", + "**Adapt the following cell to your cluster and allocation.** The values below are the ones used to test this notebook in a two-core allocation of a single-node SLURM test cluster with MPICH. For OpenMPI >= 5 use `[\"--mpi=pmix\"]`; set `max_cores` to the number of cores of your allocation." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "parameters" + ] + }, + "outputs": [], + "source": [ + "# Cluster-specific settings - adapt these values to your cluster and allocation.\n", + "slurm_cmd_args = [\"--mpi=pmi2\"] # additional arguments for srun, e.g. the MPI plugin\n", + "max_cores = 2 # number of CPU cores of the allocation executorlib may use" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 1: Write the function\n", + "The toy model fails for large strains at high temperature, just like a real simulation which does not converge for\n", + "some parameter sets." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import time\n", + "\n", + "\n", + "def compute_energy(strain, temperature):\n", + " # Stand-in for a short simulation (seconds to minutes), e.g. the energy of a strained crystal.\n", + " time.sleep(0.5)\n", + " if strain > 0.04 and temperature > 600:\n", + " raise ValueError(\"simulation did not converge\")\n", + " return 100.0 * strain**2 * (1.0 - temperature / 3000.0)\n", + "\n", + "\n", + "strain_lst = [0.0, 0.01, 0.02, 0.03, 0.05]\n", + "temperature_lst = [300, 600, 900]\n", + "parameter_lst = [(strain, temperature) for strain in strain_lst for temperature in temperature_lst]\n", + "len(parameter_lst)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 2: Run the grid and find the failing parameter sets\n", + "`max_cores` limits how many cores executorlib uses at the same time; with one core per call it executes `max_cores`\n", + "calculations in parallel and starts the next one as soon as a core becomes free. The `error_log_file` in the\n", + "`resource_dict` collects the traceback of every failing call together with its function and arguments in one file -\n", + "use an absolute path, as the calculations do not necessarily run in the current directory." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "from executorlib import SlurmJobExecutor\n", + "\n", + "cache_directory = os.path.abspath(\"story3_cache\")\n", + "error_log_file = os.path.abspath(\"story3_errors.log\")\n", + "\n", + "with SlurmJobExecutor(\n", + " max_cores=max_cores,\n", + " cache_directory=cache_directory,\n", + " resource_dict={\"cores\": 1, \"slurm_cmd_args\": slurm_cmd_args, \"error_log_file\": error_log_file},\n", + ") as exe:\n", + " future_lst = [exe.submit(compute_energy, strain, temperature) for strain, temperature in parameter_lst]\n", + " failed_lst = [p for p, future in zip(parameter_lst, future_lst) if future.exception() is not None]\n", + "\n", + "failed_lst" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "with open(error_log_file) as f:\n", + " print(f.read())" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 3: Collect the results in a table\n", + "With a `cache_directory` every successful result is stored together with its input arguments and run time.\n", + "`get_cache_data()` returns them as a list of dictionaries which converts directly into a DataFrame. Failed calls are not\n", + "cached by the `SlurmJobExecutor`, so they are simply executed again on the next run." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas\n", + "from executorlib import get_cache_data\n", + "\n", + "df = pandas.DataFrame(get_cache_data(cache_directory=cache_directory))\n", + "df[\"strain\"] = df[\"input_args\"].apply(lambda args: args[0])\n", + "df[\"temperature\"] = df[\"input_args\"].apply(lambda args: args[1])\n", + "df[[\"strain\", \"temperature\", \"output\", \"runtime\"]].sort_values([\"temperature\", \"strain\"])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 4: Extend the study with `map()`\n", + "Your supervisor asks for two more strains. The `map()` function of the standard library\n", + "[Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.map) is the\n", + "most compact way to apply one function to many parameters. Using the same `cache_directory`, the results computed\n", + "above are loaded from the cache and only the new parameter sets are calculated. `map()` raises the first exception it\n", + "encounters, so the known failing parameter sets are excluded." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "new_parameter_lst = [(0.015, 300), (0.025, 300)]\n", + "valid_lst = [p for p in parameter_lst + new_parameter_lst if p not in failed_lst]\n", + "\n", + "with SlurmJobExecutor(\n", + " max_cores=max_cores,\n", + " cache_directory=cache_directory,\n", + " resource_dict={\"cores\": 1, \"slurm_cmd_args\": slurm_cmd_args},\n", + ") as exe:\n", + " energy_lst = list(exe.map(compute_energy, [s for s, _ in valid_lst], [t for _, t in valid_lst]))\n", + "\n", + "len(energy_lst), len(get_cache_data(cache_directory=cache_directory))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 5: Post-process results in batches as they arrive\n", + "Some follow-up steps are cheaper in groups, for example writing results to a database or fitting a model to a few\n", + "data points at a time. `batched()` groups futures into batches of `n` in the order in which they *finish*, so the first\n", + "batch is processed while other calculations are still running." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def summarize(energies):\n", + " # Stand-in for a follow-up step working on a group of results, e.g. storing them in a database.\n", + " return {\"n\": len(energies), \"max_energy\": max(energies)}\n", + "\n", + "\n", + "with SlurmJobExecutor(\n", + " max_cores=max_cores,\n", + " cache_directory=cache_directory,\n", + " resource_dict={\"cores\": 1, \"slurm_cmd_args\": slurm_cmd_args},\n", + ") as exe:\n", + " future_lst = [exe.submit(compute_energy, strain, temperature) for strain, temperature in valid_lst]\n", + " summary_lst = [exe.submit(summarize, batch) for batch in exe.batched(future_lst, n=4)]\n", + " print([summary.result() for summary in summary_lst])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Thousands of tasks: SLURM with flux\n", + "Every call of the `SlurmJobExecutor` creates a SLURM job step, and every job step is registered in the central SLURM\n", + "database. For thousands of short calculations start the hierarchical [flux](https://flux-framework.org) scheduler\n", + "inside the allocation with `srun flux start python my_study.py` and replace the `SlurmJobExecutor` by the\n", + "`FluxJobExecutor` - the rest of the code stays the same. See\n", + "[SLURM with flux](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html#slurm-with-flux)." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Clean up" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import shutil\n", + "\n", + "shutil.rmtree(cache_directory, ignore_errors=True)\n", + "if os.path.exists(error_log_file):\n", + " os.remove(error_log_file)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## What you learned\n", + "* The `SlurmJobExecutor` distributes many function calls over one allocation; `max_cores` limits the cores in use.\n", + "* `error_log_file` collects the failing calls with their arguments in one file.\n", + "* `cache_directory` plus `get_cache_data()` turns the results into a DataFrame and skips finished calculations when\n", + " the study is extended with `map()`.\n", + "* `batched()` groups results by completion order for follow-up steps.\n", + "\n", + "**Reference:** [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html),\n", + "[write log files](https://executorlib.readthedocs.io/en/latest/1-single-node.html#write-log-files), [cache](https://executorlib.readthedocs.io/en/latest/1-single-node.html#cache) and\n", + "[runtime-dependent batching](https://executorlib.readthedocs.io/en/latest/1-single-node.html#runtime-dependent-batching)." + ] + } + ], + "metadata": { + "executorlib_ci": { + "allocation": true, + "cores": 2 + }, + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/notebooks/story-4-prototype-then-scale.ipynb b/notebooks/story-4-prototype-then-scale.ipynb new file mode 100644 index 00000000..22986191 --- /dev/null +++ b/notebooks/story-4-prototype-then-scale.ipynb @@ -0,0 +1,230 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Story 4: Prototype on a Laptop, then Scale Up\n", + "**Who:** A PhD student developing a new workflow in a Jupyter notebook on their laptop.\n", + "\n", + "**What they want:** Iterate quickly on the workflow with small inputs, without waiting in a queue, and later run the\n", + "very same code on the cluster with production settings.\n", + "\n", + "**Why plain SLURM is painful:** Debugging a workflow by submitting jobs means waiting in the queue for every typo.\n", + "Functions defined in a notebook cannot simply be submitted, they first have to be moved to a script. And once the\n", + "workflow works locally, it has to be rewritten for the scheduler.\n", + "\n", + "**How executorlib helps:** The `SingleNodeExecutor` runs on any computer with the same interface as the HPC executors,\n", + "including functions defined in the notebook, resources, dependencies and caching. The `TestClusterExecutor` tests the\n", + "file-based mode of the `SlurmClusterExecutor` locally. Switching to the cluster changes one line.\n", + "\n", + "This notebook runs on **any computer** - no SLURM is required." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 1: Write the workflow in the notebook\n", + "executorlib serializes functions with [cloudpickle](https://github.com/cloudpipe/cloudpickle), so functions defined\n", + "directly in the notebook can be submitted - no separate module is required." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import time\n", + "\n", + "\n", + "def relax_structure(lattice_constant):\n", + " # Stand-in for an expensive structure relaxation.\n", + " time.sleep(2)\n", + " return lattice_constant * 0.98\n", + "\n", + "\n", + "def compute_energy(relaxed_lattice_constant):\n", + " # Stand-in for an expensive energy calculation.\n", + " time.sleep(2)\n", + " return (relaxed_lattice_constant - 3.95) ** 2 - 4.0" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 2: Iterate quickly with the cache\n", + "The `SingleNodeExecutor` uses the cores of the local computer. Futures are passed directly as arguments, just like on\n", + "the cluster. With a `cache_directory`, the results of finished calls are stored, so re-running the cell during\n", + "development only computes what is new." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from executorlib import SingleNodeExecutor\n", + "\n", + "cache_directory = \"./story4_cache\"\n", + "lattice_constant_lst = [3.9, 4.0, 4.1]\n", + "\n", + "\n", + "def run_workflow(exe, lattice_constant_lst):\n", + " relaxed_lst = [exe.submit(relax_structure, a) for a in lattice_constant_lst]\n", + " energy_lst = [exe.submit(compute_energy, relaxed) for relaxed in relaxed_lst]\n", + " return [energy.result() for energy in energy_lst]\n", + "\n", + "\n", + "start = time.time()\n", + "with SingleNodeExecutor(cache_directory=cache_directory) as exe:\n", + " print(run_workflow(exe, lattice_constant_lst))\n", + "print(f\"first run: {time.time() - start:.1f} seconds\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now extend the study by one lattice constant. Only the new relaxation and energy calculation are executed, the other\n", + "results are loaded from the cache:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "start = time.time()\n", + "with SingleNodeExecutor(cache_directory=cache_directory) as exe:\n", + " print(run_workflow(exe, lattice_constant_lst + [4.2]))\n", + "print(f\"second run: {time.time() - start:.1f} seconds\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Changing the code of a function changes its hash, so all calls of the modified function are executed again - the\n", + "cache never returns results of outdated code.\n", + "\n", + "## Step 3: Test the file-based mode of the cluster\n", + "The `SingleNodeExecutor` communicates with its workers via sockets, while the `SlurmClusterExecutor` communicates via\n", + "files in the `cache_directory` on the shared file system. The `TestClusterExecutor` uses the same file-based\n", + "communication as the `SlurmClusterExecutor`, but starts the functions as local processes instead of SLURM jobs. It\n", + "accepts the same `resource_dict`, so the call which will later be used on the cluster can be tested locally. If the workflow runs here, the remaining sources of errors on the cluster are the\n", + "submission template and the Python environment on the compute nodes." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from executorlib.api import TestClusterExecutor\n", + "\n", + "test_cache_directory = \"./story4_test_cache\"\n", + "\n", + "with TestClusterExecutor(\n", + " cache_directory=test_cache_directory,\n", + " resource_dict={\"cores\": 1, \"run_time_max\": 600},\n", + ") as exe:\n", + " print(run_workflow(exe, lattice_constant_lst))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The cache directory now contains one `_o.h5` file per function call. These are the files the `SlurmClusterExecutor`\n", + "exchanges between the login node and the compute nodes:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "\n", + "sorted(os.listdir(test_cache_directory))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 4: Switch to the cluster\n", + "On the login node of the cluster, only the executor changes. The function definitions and the `run_workflow()`\n", + "function stay exactly the same; the cluster-specific settings go into the `resource_dict` (see the cluster-specific\n", + "settings cell of [Story 1](story-1-submit-and-reconnect.ipynb) for a submission template):\n", + "\n", + "```python\n", + "from executorlib import SlurmClusterExecutor\n", + "\n", + "with SlurmClusterExecutor(\n", + " cache_directory=\"./cache\", # must be on a file system shared with the compute nodes\n", + " resource_dict={\"submission_template\": submission_template, \"cores\": 1, \"run_time_max\": 3600},\n", + ") as exe:\n", + " print(run_workflow(exe, lattice_constant_lst))\n", + "```\n", + "\n", + "Inside an allocation, for many short calculations, use the `SlurmJobExecutor` instead - like the `SingleNodeExecutor`\n", + "it communicates via sockets ([Story 3](story-3-parameter-study.ipynb))." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Clean up" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import shutil\n", + "\n", + "shutil.rmtree(cache_directory, ignore_errors=True)\n", + "shutil.rmtree(test_cache_directory, ignore_errors=True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## What you learned\n", + "* The `SingleNodeExecutor` runs the same workflow locally, including functions defined in a notebook.\n", + "* A `cache_directory` skips finished calculations while iterating on a workflow.\n", + "* The `TestClusterExecutor` from `executorlib.api` tests the file-based communication of the `SlurmClusterExecutor`\n", + " without a cluster.\n", + "* Moving to the cluster means replacing the executor class and adding the cluster-specific `resource_dict`.\n", + "\n", + "**Reference:** [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html) (including the\n", + "[TestClusterExecutor](https://executorlib.readthedocs.io/en/latest/1-single-node.html#testclusterexecutor) and the [cache](https://executorlib.readthedocs.io/en/latest/1-single-node.html#cache)),\n", + "[HPC Cluster Executor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html) and [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html)." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/notebooks/story-5-recover-failed-jobs.ipynb b/notebooks/story-5-recover-failed-jobs.ipynb new file mode 100644 index 00000000..d37f1aa5 --- /dev/null +++ b/notebooks/story-5-recover-failed-jobs.ipynb @@ -0,0 +1,333 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Story 5: Recover from Failed Jobs\n", + "**Who:** A scientist whose overnight workflow partially failed: one calculation raised a Python exception because of a\n", + "bug, another job was killed by the cluster - a node failure, the out-of-memory killer or the wall-time limit.\n", + "\n", + "**What they want:** Find out what failed and why, fix it, and rerun *only* the failed calculations while the\n", + "successful ones are reused.\n", + "\n", + "**Why plain SLURM is painful:** Failed jobs have to be identified by combing through `sacct` and log files. Then a new\n", + "batch script has to be written which contains only the failed parameter sets, and the results of both rounds have to\n", + "be merged by hand.\n", + "\n", + "**How executorlib helps:** Exceptions are returned through the futures and collected in an error log file, the status\n", + "of every call is recorded in the cache, and resubmitting the workflow only reruns the calls without a valid result -\n", + "provided their failed entries are removed from the cache, as shown below.\n", + "\n", + "This notebook runs on the **login node** of a SLURM cluster." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Cluster-specific settings\n", + "**Adapt the following cell to your cluster.** It collects everything which depends on the cluster rather than on your science. The values below are the ones used to test this notebook on a single-node SLURM test cluster. The submission template is a [Jinja2](https://jinja.palletsprojects.com) template which executorlib renders for every function call: add the lines your cluster requires, for example `#SBATCH --partition=`, `#SBATCH --account=` or `module load ...` commands before `{{command}}`. The [executorlib-cluster-setup](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#setup-with-claude-code) skill for Claude Code can analyse your cluster and generate a tested template." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "parameters" + ] + }, + "outputs": [], + "source": [ + "# Cluster-specific settings - adapt these values to your cluster.\n", + "submission_template = \"\"\"\\\n", + "#!/bin/bash\n", + "#SBATCH --output=time.out\n", + "#SBATCH --job-name={{job_name}}\n", + "#SBATCH --chdir={{working_directory}}\n", + "#SBATCH --get-user-env=L\n", + "#SBATCH --ntasks={{cores}}\n", + "{%- if run_time_max %}\n", + "#SBATCH --time={{ [1, run_time_max // 60]|max }}\n", + "{%- endif %}\n", + "{%- if dependency_list %}\n", + "#SBATCH --dependency=afterok:{{ dependency_list | join(',') }}\n", + "{%- endif %}\n", + "\n", + "{{command}}\n", + "\"\"\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 1: A workflow with two kinds of failures\n", + "`compute_energy()` contains a bug - it divides by the strain, which fails for zero strain. In addition, the job for\n", + "one strain is killed on its first attempt, which simulates a transient node failure or the out-of-memory killer. Each\n", + "call gets an explicit `cache_key`, which names its cache files. Unlike the default hash, the `cache_key` does not\n", + "change when the code of the function changes - this is what allows fixing the function later while keeping the\n", + "successful results." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "import signal\n", + "import time\n", + "\n", + "marker_file = os.path.abspath(\"story5_node_failure.marker\")\n", + "\n", + "\n", + "def simulate_node_failure(strain):\n", + " # Kill the job on its first attempt for one strain - like a node failure or the out-of-memory killer would.\n", + " if strain == 0.03 and not os.path.exists(marker_file):\n", + " open(marker_file, \"w\").close()\n", + " os.kill(os.getpid(), signal.SIGKILL)\n", + "\n", + "\n", + "def compute_energy(strain):\n", + " # Stand-in for a simulation - with a bug: it fails for strain == 0.\n", + " time.sleep(1)\n", + " simulate_node_failure(strain)\n", + " energy = 100.0 * strain**2\n", + " return {\"strain\": strain, \"energy\": energy, \"energy_per_strain\": energy / strain}\n", + "\n", + "\n", + "strain_lst = [0.0, 0.01, 0.02, 0.03]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from executorlib import SlurmClusterExecutor\n", + "\n", + "cache_directory = os.path.abspath(\"story5_cache\")\n", + "error_log_file = os.path.abspath(\"story5_errors.log\")\n", + "\n", + "with SlurmClusterExecutor(\n", + " cache_directory=cache_directory,\n", + " resource_dict={\"submission_template\": submission_template, \"run_time_max\": 300, \"error_log_file\": error_log_file},\n", + ") as exe:\n", + " future_dict = {\n", + " strain: exe.submit(compute_energy, strain, resource_dict={\"cache_key\": f\"strain_{strain}\"})\n", + " for strain in strain_lst\n", + " }\n", + " for strain, future in future_dict.items():\n", + " print(strain, repr(future.exception()))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Both failures surface through the future objects, so a workflow never waits forever:\n", + "\n", + "* the Python exception (`ZeroDivisionError`) is raised by `result()` like for a local function,\n", + "* for the killed job no result was written. executorlib queries SLURM for the status of jobs without result -\n", + " throttled to once every 30 seconds per job - and fails the future with a `RuntimeError` once SLURM reports the job as\n", + " failed or no longer knows it. Detecting such a job therefore takes up to a minute.\n", + "\n", + "## Step 2: Find out what failed\n", + "The `error_log_file` contains the traceback of every Python exception together with the function and its arguments:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "with open(error_log_file) as f:\n", + " print(f.read())" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The cache tells the full story. Each call is represented by one file, named after its `cache_key`:\n", + "\n", + "* `_o.h5` with an `output`: the call finished successfully (`status` is `finished`),\n", + "* `_o.h5` with an `error`: the Python function raised an exception, the exception is stored in the cache,\n", + "* `_i.h5` without output: the job was submitted but never wrote a result. Once the job left the queue the\n", + " `status` is `aborted`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas\n", + "from executorlib import get_cache_data_queue\n", + "\n", + "df = pandas.DataFrame(get_cache_data_queue(cache_directory=cache_directory, queue_type=\"slurm\"))\n", + "df[\"file\"] = df[\"filename\"].apply(os.path.basename)\n", + "df[[\"file\", \"queue_id\", \"status\", \"error\"]].sort_values(\"file\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 3: Clear the failed entries\n", + "What happens when a call is resubmitted with the same `cache_directory` depends on its cache file:\n", + "\n", + "| Cache file | Behaviour on resubmission |\n", + "|---|---|\n", + "| `_o.h5` with `output` | the result is loaded, no job is submitted |\n", + "| `_o.h5` with `error` | the **stored exception is raised again**, no job is submitted |\n", + "| `_i.h5` of a running job | the call is re-attached to the running job |\n", + "| `_i.h5` of a dead job | executorlib asks SLURM about the recorded job ID. Depending on the SLURM configuration the job is either resubmitted or - when the accounting database still reports the old job as failed - the old job is re-attached and the future fails again |\n", + "\n", + "So executorlib does not retry failed calls on its own: a failed call is only rerun after its cache file is removed.\n", + "This is deliberate - a deterministic exception would just fail again, and an expensive calculation should not be\n", + "resubmitted without a decision by the user. The following cell removes the entries of both kinds of failures. Calls\n", + "which depend on a failed call store the same exception, so they are removed as well. Unfinished jobs which are still\n", + "in the queue are not touched." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "for entry in get_cache_data_queue(cache_directory=cache_directory, queue_type=\"slurm\"):\n", + " python_error = \"error\" in entry\n", + " job_died = \"output\" not in entry and entry[\"status\"] == \"aborted\"\n", + " if python_error or job_died:\n", + " print(\"remove\", os.path.basename(entry[\"filename\"]))\n", + " os.remove(entry[\"filename\"])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To remove a single call, delete `/_o.h5` (exception) or call\n", + "`terminate_task_in_cache(cache_directory=..., cache_key=..., backend=\"slurm\")`, which cancels the job if it is still\n", + "in the queue and removes its `_i.h5` file.\n", + "\n", + "## Step 4: Fix the bug and rerun\n", + "The fixed function keeps the same `cache_key`s. Only the two removed calls are submitted again, the successful\n", + "results are loaded from the cache. Since the `resource_dict` is not part of the cache key, a job which was killed by\n", + "the wall-time or memory limit can be resubmitted with a larger `run_time_max` or more memory in the same way." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def compute_energy(strain):\n", + " # Fixed version: handles strain == 0.\n", + " time.sleep(1)\n", + " simulate_node_failure(strain)\n", + " energy = 100.0 * strain**2\n", + " return {\"strain\": strain, \"energy\": energy, \"energy_per_strain\": energy / strain if strain != 0 else 0.0}\n", + "\n", + "\n", + "with SlurmClusterExecutor(\n", + " cache_directory=cache_directory,\n", + " resource_dict={\"submission_template\": submission_template, \"run_time_max\": 300, \"error_log_file\": error_log_file},\n", + ") as exe:\n", + " future_dict = {\n", + " strain: exe.submit(compute_energy, strain, resource_dict={\"cache_key\": f\"strain_{strain}\"})\n", + " for strain in strain_lst\n", + " }\n", + " result_lst = [future.result() for future in future_dict.values()]\n", + "\n", + "pandas.DataFrame(result_lst)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The SLURM job IDs show which results were computed in the second round:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "df = pandas.DataFrame(get_cache_data_queue(cache_directory=cache_directory, queue_type=\"slurm\"))\n", + "df[\"file\"] = df[\"filename\"].apply(os.path.basename)\n", + "df[[\"file\", \"queue_id\", \"status\"]].sort_values(\"queue_id\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "**A note on dependencies:** when a job dies, SLURM keeps the jobs which depend on it pending with the reason\n", + "`DependencyNeverSatisfied`, unless the cluster is configured to cancel them. Cancel them with\n", + "`terminate_tasks_in_cache()` (see [Story 1](story-1-submit-and-reconnect.ipynb)), clear the failed entry and resubmit\n", + "the workflow." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Clean up" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import shutil\n", + "\n", + "shutil.rmtree(cache_directory, ignore_errors=True)\n", + "for file_name in [error_log_file, marker_file]:\n", + " if os.path.exists(file_name):\n", + " os.remove(file_name)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## What you learned\n", + "* Python exceptions and jobs killed by SLURM both surface as exceptions of the future objects.\n", + "* `error_log_file` collects the tracebacks with the function arguments; `get_cache_data_queue()` shows which calls\n", + " finished, raised an exception or died.\n", + "* Failed calls are not retried automatically: remove their cache files, then resubmit - successful calls come from the\n", + " cache.\n", + "* A `cache_key` keeps the identity of a call stable when the function code is fixed.\n", + "\n", + "**Reference:** [HPC Cluster Executor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html), [write log files](https://executorlib.readthedocs.io/en/latest/1-single-node.html#write-log-files),\n", + "[cache](https://executorlib.readthedocs.io/en/latest/1-single-node.html#cache) and the [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary)." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/notebooks/story-6-expensive-setup-once.ipynb b/notebooks/story-6-expensive-setup-once.ipynb new file mode 100644 index 00000000..6a0d13dc --- /dev/null +++ b/notebooks/story-6-expensive-setup-once.ipynb @@ -0,0 +1,245 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Story 6: Pay for an Expensive Setup Only Once\n", + "**Who:** A researcher who evaluates a machine-learned interatomic potential for thousands of structures. Loading the\n", + "potential takes much longer than a single evaluation.\n", + "\n", + "**What they want:** Load the potential once per worker and then stream many small evaluations through these workers.\n", + "If a worker crashes, the remaining work should continue.\n", + "\n", + "**Why plain SLURM is painful:** Every job or job step starts a fresh Python process, so the potential is loaded again\n", + "for every structure - and the setup dominates the run time. Keeping a pool of long-lived worker processes alive in an\n", + "allocation and feeding them work means writing a custom server, and restarting crashed workers is left to you.\n", + "\n", + "**How executorlib helps:** With `block_allocation=True` the `SlurmJobExecutor` starts `max_workers` long-lived workers\n", + "in the allocation. The `init_function` runs once per worker and its return values are passed as keyword arguments to\n", + "the submitted functions. `restart_limit` restarts crashed workers.\n", + "\n", + "This notebook has to run **inside a SLURM allocation** with at least two cores, for example started with\n", + "`salloc -n 2`." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Cluster-specific settings\n", + "**Adapt the following cell to your cluster and allocation.** The values below are the ones used to test this notebook in a two-core allocation of a single-node SLURM test cluster with MPICH. For OpenMPI >= 5 use `[\"--mpi=pmix\"]`; set `max_cores` to the number of cores of your allocation." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "parameters" + ] + }, + "outputs": [], + "source": [ + "# Cluster-specific settings - adapt these values to your cluster and allocation.\n", + "slurm_cmd_args = [\"--mpi=pmi2\"] # additional arguments for srun, e.g. the MPI plugin\n", + "max_cores = 2 # number of CPU cores of the allocation executorlib may use" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 1: The functions\n", + "`load_potential()` stands in for the expensive setup, `evaluate()` for the cheap evaluation which needs the loaded\n", + "potential." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import time\n", + "\n", + "\n", + "def load_potential():\n", + " # Stand-in for loading a large machine-learned potential from disk (slow).\n", + " time.sleep(3)\n", + " return {\"potential\": {\"epsilon\": 0.0104, \"sigma\": 3.4}}\n", + "\n", + "\n", + "def evaluate(distance, potential):\n", + " # Stand-in for a cheap evaluation which requires the loaded potential.\n", + " eps, sigma = potential[\"epsilon\"], potential[\"sigma\"]\n", + " return 4 * eps * ((sigma / distance) ** 12 - (sigma / distance) ** 6)\n", + "\n", + "\n", + "distance_lst = [3.4, 3.6, 3.8, 4.0, 4.2, 4.4]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 2: The naive way - setup in every call\n", + "Without block allocation every call is a separate `srun` job step with a fresh Python process, so every call has to\n", + "load the potential itself:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from executorlib import SlurmJobExecutor\n", + "\n", + "\n", + "def evaluate_with_setup(distance):\n", + " return evaluate(distance, **load_potential())\n", + "\n", + "\n", + "start = time.time()\n", + "with SlurmJobExecutor(max_cores=max_cores, resource_dict={\"cores\": 1, \"slurm_cmd_args\": slurm_cmd_args}) as exe:\n", + " energy_lst = list(exe.map(evaluate_with_setup, distance_lst))\n", + "print(f\"{len(energy_lst)} evaluations in {time.time() - start:.1f} seconds\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 3: Load once per worker with `block_allocation` and `init_function`\n", + "With `block_allocation=True` the executor starts `max_workers` workers, each with the resources defined in the\n", + "executor's `resource_dict`, and keeps them alive until the executor is shut down. The `init_function` is executed once\n", + "in every worker. It returns a dictionary, and each submitted function receives the entries matching its parameters -\n", + "here `potential` - as keyword arguments." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "start = time.time()\n", + "with SlurmJobExecutor(\n", + " max_workers=2,\n", + " block_allocation=True,\n", + " init_function=load_potential,\n", + " resource_dict={\"cores\": 1, \"slurm_cmd_args\": slurm_cmd_args},\n", + ") as exe:\n", + " energy_lst = list(exe.map(evaluate, distance_lst))\n", + "print(f\"{len(energy_lst)} evaluations in {time.time() - start:.1f} seconds\")\n", + "energy_lst" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The setup is now paid once per worker instead of once per call; with thousands of evaluations the setup cost becomes\n", + "negligible. Two restrictions follow from the workers being long-lived:\n", + "\n", + "* All workers share the resources defined for the executor - a `resource_dict` per `submit()` call is not supported.\n", + " Use a second executor for calls with different requirements.\n", + "* The `init_function` cannot be combined with a `cache_directory`: the cache key only covers the submitted function\n", + " and its arguments, not the state created by the `init_function`, so executorlib warns about stale results.\n", + "\n", + "## Step 4: Survive crashing workers with `restart_limit`\n", + "Compiled libraries occasionally crash with a segmentation fault, which takes down the whole worker process. With\n", + "`restart_limit` the executor starts a replacement worker - running the `init_function` again - and resubmits the task\n", + "which was running when the worker died. Here the worker is killed while evaluating one of the distances, once:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "import signal\n", + "\n", + "marker_file = os.path.abspath(\"story6_crash.marker\")\n", + "\n", + "\n", + "def evaluate_unstable(distance, potential):\n", + " # Crash the worker once, like a segmentation fault in a compiled library would.\n", + " if distance == 4.0 and not os.path.exists(marker_file):\n", + " open(marker_file, \"w\").close()\n", + " os.kill(os.getpid(), signal.SIGKILL)\n", + " return evaluate(distance, potential)\n", + "\n", + "\n", + "with SlurmJobExecutor(\n", + " max_workers=2,\n", + " block_allocation=True,\n", + " init_function=load_potential,\n", + " restart_limit=2,\n", + " resource_dict={\"cores\": 1, \"slurm_cmd_args\": slurm_cmd_args},\n", + ") as exe:\n", + " energy_lst = list(exe.map(evaluate_unstable, distance_lst))\n", + "energy_lst" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Without `restart_limit` (the default is `0`) a crashed worker is not replaced; its tasks are handed to the remaining\n", + "workers, and once no worker is left the remaining futures fail with an `ExecutorlibSocketError`." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Clean up" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "if os.path.exists(marker_file):\n", + " os.remove(marker_file)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## What you learned\n", + "* `block_allocation=True` keeps `max_workers` workers alive for the lifetime of the executor.\n", + "* The `init_function` runs once per worker and provides keyword arguments, such as a loaded model, to every call.\n", + "* `restart_limit` replaces crashed workers and resubmits the interrupted task.\n", + "* The same parameters are available for the `SingleNodeExecutor` and the `FluxJobExecutor`.\n", + "\n", + "**Reference:** [block allocation](https://executorlib.readthedocs.io/en/latest/1-single-node.html#block-allocation),\n", + "[HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html#block-allocation) and the API documentation of the\n", + "[SlurmJobExecutor](https://executorlib.readthedocs.io/en/latest/api.html)." + ] + } + ], + "metadata": { + "executorlib_ci": { + "allocation": true, + "cores": 2 + }, + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/notebooks/story-7-fan-out-inside-jobs.ipynb b/notebooks/story-7-fan-out-inside-jobs.ipynb new file mode 100644 index 00000000..b0f6b5b2 --- /dev/null +++ b/notebooks/story-7-fan-out-inside-jobs.ipynb @@ -0,0 +1,239 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Story 7: Large Jobs which Each Fan Out into Many Small Tasks\n", + "**Who:** A researcher running several sampling campaigns, one per chemical composition. Each campaign consists of\n", + "hundreds of short calculations and should run in its own large allocation.\n", + "\n", + "**What they want:** Submit the campaigns from the login node like any other job, and inside each job distribute the\n", + "small calculations over the cores of that job - without writing a batch script per campaign.\n", + "\n", + "**Why plain SLURM is painful:** Submitting the small calculations as individual jobs floods the queue. Requesting one\n", + "allocation per campaign means writing a batch script which starts and tracks many `srun` steps by hand, and passing\n", + "the results of each campaign back to the script on the login node through files.\n", + "\n", + "**How executorlib helps:** The two executors combine. The `SlurmClusterExecutor` on the login node submits one job per\n", + "campaign. The submitted function itself creates a `SlurmJobExecutor`, which distributes the small calculations as\n", + "`srun` job steps within the allocation of its job.\n", + "\n", + "This notebook runs on the **login node** of a SLURM cluster." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Cluster-specific settings\n", + "**Adapt the following cell to your cluster.** It collects everything which depends on the cluster rather than on your science. The values below are the ones used to test this notebook on a single-node SLURM test cluster. The submission template is a [Jinja2](https://jinja.palletsprojects.com) template which executorlib renders for every function call: add the lines your cluster requires, for example `#SBATCH --partition=`, `#SBATCH --account=` or `module load ...` commands before `{{command}}`. The [executorlib-cluster-setup](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#setup-with-claude-code) skill for Claude Code can analyse your cluster and generate a tested template.\n", + "\n", + "`slurm_cmd_args` are the additional `srun` arguments used by the `SlurmJobExecutor` inside each job, and `cores_per_campaign` is the size of the allocation requested for each campaign." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "parameters" + ] + }, + "outputs": [], + "source": [ + "# Cluster-specific settings - adapt these values to your cluster.\n", + "submission_template = \"\"\"\\\n", + "#!/bin/bash\n", + "#SBATCH --output=time.out\n", + "#SBATCH --job-name={{job_name}}\n", + "#SBATCH --chdir={{working_directory}}\n", + "#SBATCH --get-user-env=L\n", + "#SBATCH --ntasks={{cores}}\n", + "{%- if run_time_max %}\n", + "#SBATCH --time={{ [1, run_time_max // 60]|max }}\n", + "{%- endif %}\n", + "{%- if dependency_list %}\n", + "#SBATCH --dependency=afterok:{{ dependency_list | join(',') }}\n", + "{%- endif %}\n", + "\n", + "{{command}}\n", + "\"\"\"\n", + "slurm_cmd_args = [\"--mpi=pmi2\"] # additional srun arguments for the job steps inside each campaign\n", + "cores_per_campaign = 2 # CPU cores requested for each campaign job" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 1: The small task and the campaign\n", + "`run_campaign()` is executed inside a SLURM job. It uses all cores of its job for the small `sample_energy()` tasks and\n", + "returns only the aggregated result, so the cache on the shared file system only stores one result per campaign." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import time\n", + "\n", + "\n", + "def sample_energy(composition, seed):\n", + " # Stand-in for a short calculation, e.g. the energy of one random configuration.\n", + " time.sleep(0.5)\n", + " return -3.0 * composition + 0.01 * ((seed * 7919) % 13)\n", + "\n", + "\n", + "def run_campaign(composition, n_samples, max_cores, slurm_cmd_args):\n", + " # Executed as one SLURM job: distribute the samples over the cores of this job.\n", + " from executorlib import SlurmJobExecutor\n", + "\n", + " with SlurmJobExecutor(\n", + " max_cores=max_cores,\n", + " resource_dict={\"cores\": 1, \"slurm_cmd_args\": slurm_cmd_args},\n", + " ) as exe:\n", + " future_lst = [exe.submit(sample_energy, composition, seed) for seed in range(n_samples)]\n", + " energy_lst = [future.result() for future in future_lst]\n", + " return {\"composition\": composition, \"n_samples\": n_samples, \"mean_energy\": sum(energy_lst) / n_samples}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 2: Request the allocation for each campaign\n", + "The campaign function itself is a single serial Python process, so it is submitted with `cores=1` - with more cores\n", + "executorlib would start it as an MPI program on every rank. The size of the allocation for the small tasks is\n", + "requested with `threads_per_core`: the `SlurmClusterExecutor` requests `cores * threads_per_core` tasks in the\n", + "submission template (`#SBATCH --ntasks={{cores}}`), and the `SlurmJobExecutor` inside the job uses them." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "campaign_resources = {\"cores\": 1, \"threads_per_core\": cores_per_campaign, \"run_time_max\": 600}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 3: Submit the campaigns" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from executorlib import SlurmClusterExecutor\n", + "\n", + "cache_directory = \"./story7_cache\"\n", + "composition_lst = [0.1, 0.2]\n", + "\n", + "with SlurmClusterExecutor(\n", + " cache_directory=cache_directory,\n", + " resource_dict={\"submission_template\": submission_template},\n", + ") as exe:\n", + " campaign_lst = [\n", + " exe.submit(\n", + " run_campaign,\n", + " composition,\n", + " n_samples=4,\n", + " max_cores=cores_per_campaign,\n", + " slurm_cmd_args=slurm_cmd_args,\n", + " resource_dict=campaign_resources,\n", + " )\n", + " for composition in composition_lst\n", + " ]\n", + " result_lst = [campaign.result() for campaign in campaign_lst]\n", + "\n", + "result_lst" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "All features of the `SlurmClusterExecutor` apply to the campaigns: you can disconnect after the submission and\n", + "reconnect later ([Story 1](story-1-submit-and-reconnect.ipynb)), and campaigns can depend on each other\n", + "([Story 2](story-2-multi-resource-pipeline.ipynb)). `sacct -j ` lists the job steps (`.0`,\n", + "`.1`, ...) created by the `SlurmJobExecutor` inside each campaign job.\n", + "\n", + "## Thousands of tasks per campaign: nesting flux\n", + "Each `srun` job step is registered in the central SLURM database, which becomes a bottleneck for thousands of short\n", + "tasks per job. In this case start the hierarchical [flux](https://flux-framework.org) scheduler inside every campaign\n", + "job by wrapping the command in the submission template, and use the `FluxJobExecutor` inside `run_campaign()`:\n", + "\n", + "```\n", + "#SBATCH --ntasks={{cores}}\n", + "\n", + "srun flux start {{command}}\n", + "```\n", + "\n", + "```python\n", + "def run_campaign(composition, n_samples, max_cores):\n", + " from executorlib import FluxJobExecutor\n", + "\n", + " with FluxJobExecutor(max_cores=max_cores) as exe:\n", + " ...\n", + "```\n", + "\n", + "flux can be nested further: with `flux_executor_nesting=True` every function submitted to a `FluxJobExecutor` gets\n", + "its own flux instance and can again create a `FluxJobExecutor` for its own sub-tasks. See\n", + "[SLURM with flux](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html#slurm-with-flux) and [nested executors](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html#nested-executors)." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Clean up" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import shutil\n", + "\n", + "shutil.rmtree(cache_directory, ignore_errors=True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## What you learned\n", + "* A function submitted with the `SlurmClusterExecutor` can create a `SlurmJobExecutor` to use the cores of its own job.\n", + "* Serial driver functions are submitted with `cores=1`; the size of their allocation is requested with\n", + " `threads_per_core` (or a custom variable of your submission template).\n", + "* For thousands of tasks per job, flux can be started inside each job with `srun flux start`.\n", + "\n", + "**Reference:** [combine both](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#combine-both), [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) and\n", + "[HPC Cluster Executor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html)." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/notebooks/story-8-adaptive-workflows.ipynb b/notebooks/story-8-adaptive-workflows.ipynb new file mode 100644 index 00000000..57c2f9f3 --- /dev/null +++ b/notebooks/story-8-adaptive-workflows.ipynb @@ -0,0 +1,230 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Story 8: Adaptive Workflows - the Next Step Depends on the Results\n", + "**Who:** A researcher whose workflow is not known in advance: a convergence test which runs until the result stops\n", + "changing, a curve which is refined where it varies most, or a screening where follow-up calculations start for\n", + "whatever finished first.\n", + "\n", + "**What they want:** Write the decision logic in plain Python - `while` loops, `if` statements, recursion - and still\n", + "run the calculations in parallel on the cluster.\n", + "\n", + "**Why plain SLURM is painful:** A batch script cannot look at results it has not computed yet. Adaptive workflows end up\n", + "as a driver script which submits a batch of jobs, polls `squeue` until they finish, parses the outputs, decides and\n", + "submits the next batch - with the cluster idling between the rounds. Static workflow graphs (job arrays,\n", + "`--dependency`) cannot express decisions at all.\n", + "\n", + "**How executorlib helps:** The futures returned by `submit()` are ordinary Python objects. The driver logic simply\n", + "waits for the results it needs to make the next decision, while everything independent keeps running. `asyncio`\n", + "turns futures into awaitables for recursive refinement, and `batched()` groups results by completion order.\n", + "\n", + "This notebook has to run **inside a SLURM allocation** with at least two cores, for example started with\n", + "`salloc -n 2`. With a `SlurmClusterExecutor` the same patterns work from the login node, with one SLURM job per call." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Cluster-specific settings\n", + "**Adapt the following cell to your cluster and allocation.** The values below are the ones used to test this notebook in a two-core allocation of a single-node SLURM test cluster with MPICH. For OpenMPI >= 5 use `[\"--mpi=pmix\"]`; set `max_cores` to the number of cores of your allocation." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "parameters" + ] + }, + "outputs": [], + "source": [ + "# Cluster-specific settings - adapt these values to your cluster and allocation.\n", + "slurm_cmd_args = [\"--mpi=pmi2\"] # additional arguments for srun, e.g. the MPI plugin\n", + "max_cores = 2 # number of CPU cores of the allocation executorlib may use" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Pattern 1: A convergence loop\n", + "The plane-wave cutoff of a DFT calculation is increased until the energy changes by less than a tolerance. Each round\n", + "compares two cutoffs which are computed in parallel; the futures are kept in a dictionary, so no cutoff is computed\n", + "twice." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import time\n", + "from executorlib import SlurmJobExecutor\n", + "\n", + "\n", + "def compute_energy(cutoff):\n", + " # Stand-in for a DFT calculation whose total energy converges with the plane-wave cutoff.\n", + " time.sleep(0.5)\n", + " return -10.0 + 50.0 / cutoff**2\n", + "\n", + "\n", + "tolerance = 1e-4\n", + "future_dict = {}\n", + "\n", + "with SlurmJobExecutor(max_cores=max_cores, resource_dict={\"cores\": 1, \"slurm_cmd_args\": slurm_cmd_args}) as exe:\n", + "\n", + " def energy(cutoff):\n", + " if cutoff not in future_dict:\n", + " future_dict[cutoff] = exe.submit(compute_energy, cutoff)\n", + " return future_dict[cutoff]\n", + "\n", + " cutoff = 200\n", + " while True:\n", + " e_low, e_high = energy(cutoff), energy(cutoff + 100) # both run in parallel\n", + " difference = abs(e_high.result() - e_low.result())\n", + " print(f\"cutoff {cutoff}: energy difference {difference:.2e}\")\n", + " if difference < tolerance:\n", + " break\n", + " cutoff += 100\n", + "\n", + "print(\"converged cutoff:\", cutoff)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Pattern 2: Recursive refinement with `asyncio`\n", + "An energy curve is sampled adaptively: an interval is bisected only where the energy at the midpoint deviates from\n", + "the linear interpolation, so the calculations are spent where the curve is curved. `asyncio.wrap_future()` turns an\n", + "executorlib future into an awaitable, and `asyncio.gather()` refines both halves of an interval at the same time - so\n", + "independent branches of the recursion run in parallel on the cluster." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import asyncio\n", + "\n", + "\n", + "def potential_energy(distance):\n", + " # Stand-in for a calculation of the energy of a dimer at a given distance.\n", + " time.sleep(0.3)\n", + " return 4 * 0.0104 * ((3.4 / distance) ** 12 - (3.4 / distance) ** 6)\n", + "\n", + "\n", + "async def evaluate(exe, distance):\n", + " return await asyncio.wrap_future(exe.submit(potential_energy, distance))\n", + "\n", + "\n", + "async def refine(exe, x_left, e_left, x_right, e_right, depth, tolerance=5e-4):\n", + " x_mid = (x_left + x_right) / 2\n", + " e_mid = await evaluate(exe, x_mid)\n", + " if depth == 0 or abs(e_mid - (e_left + e_right) / 2) < tolerance:\n", + " return [(x_mid, e_mid)]\n", + " left, right = await asyncio.gather(\n", + " refine(exe, x_left, e_left, x_mid, e_mid, depth - 1, tolerance),\n", + " refine(exe, x_mid, e_mid, x_right, e_right, depth - 1, tolerance),\n", + " )\n", + " return left + [(x_mid, e_mid)] + right" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Jupyter supports `await` directly in a cell; in a Python script wrap the call in `asyncio.run()`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "with SlurmJobExecutor(max_cores=max_cores, resource_dict={\"cores\": 1, \"slurm_cmd_args\": slurm_cmd_args}) as exe:\n", + " x_min, x_max = 3.4, 6.0\n", + " e_min, e_max = await asyncio.gather(evaluate(exe, x_min), evaluate(exe, x_max))\n", + " curve = [(x_min, e_min)] + await refine(exe, x_min, e_min, x_max, e_max, depth=3) + [(x_max, e_max)]\n", + "\n", + "print(f\"{len(curve)} points:\")\n", + "for distance, energy_value in curve:\n", + " print(f\"{distance:.3f} {energy_value:+.5f}\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Pattern 3: Start follow-up work in the order results arrive\n", + "In a screening, the run time of the individual candidates varies. Rather than waiting for all of them, `batched()`\n", + "groups the futures into batches of `n` in the order in which they finish. Each batch is passed to a follow-up\n", + "calculation which starts as soon as its batch is complete, while slower candidates are still running." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def screen(candidate):\n", + " # Stand-in for a cheap screening calculation with a candidate-dependent run time.\n", + " time.sleep(0.2 * (candidate % 3))\n", + " return {\"candidate\": candidate, \"score\": (candidate * 37) % 11}\n", + "\n", + "\n", + "def refine_best(batch):\n", + " # Stand-in for an expensive follow-up calculation for the most promising candidate of a batch.\n", + " best = min(batch, key=lambda result: result[\"score\"])\n", + " time.sleep(0.5)\n", + " return best[\"candidate\"]\n", + "\n", + "\n", + "with SlurmJobExecutor(max_cores=max_cores, resource_dict={\"cores\": 1, \"slurm_cmd_args\": slurm_cmd_args}) as exe:\n", + " screening_lst = [exe.submit(screen, candidate) for candidate in range(9)]\n", + " refined_lst = [exe.submit(refine_best, batch) for batch in exe.batched(screening_lst, n=3)]\n", + " print(\"refined candidates:\", [refined.result() for refined in refined_lst])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## What you learned\n", + "* Futures can drive plain Python control flow - loops and `if` statements decide what to submit next.\n", + "* `asyncio.wrap_future()` and `asyncio.gather()` turn recursive algorithms into parallel workflows.\n", + "* `batched()` groups futures by completion order, so follow-up steps start without waiting for the slowest task.\n", + "\n", + "**Reference:** [advanced scheduling](https://executorlib.readthedocs.io/en/latest/1-single-node.html#advanced-scheduling) including\n", + "[runtime-dependent batching](https://executorlib.readthedocs.io/en/latest/1-single-node.html#runtime-dependent-batching) and\n", + "[recursion](https://executorlib.readthedocs.io/en/latest/1-single-node.html#recursion), and the [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html)." + ] + } + ], + "metadata": { + "executorlib_ci": { + "allocation": true, + "cores": 2 + }, + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/notebooks/story-9-document-and-share.ipynb b/notebooks/story-9-document-and-share.ipynb new file mode 100644 index 00000000..db75f811 --- /dev/null +++ b/notebooks/story-9-document-and-share.ipynb @@ -0,0 +1,287 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Story 9: Document and Share a Workflow\n", + "**Who:** A scientist who is about to publish results computed with an executorlib workflow, and a colleague who wants\n", + "to reproduce them - possibly with a different workflow tool.\n", + "\n", + "**What they want:** A machine-readable description of the workflow, and a record of what was actually executed: which\n", + "function with which inputs, which resources, how long it took and which SLURM job ran it.\n", + "\n", + "**Why plain SLURM is painful:** The workflow is spread over batch scripts, Python scripts and shell history. What\n", + "exactly ran, with which parameters and in which job, has to be reconstructed from log files - if they still exist.\n", + "\n", + "**How executorlib helps:** `export_workflow_filename` writes the workflow graph in the\n", + "[Python Workflow Definition](https://github.com/pythonworkflow/python-workflow-definition) JSON format, which other\n", + "workflow frameworks can import. The cache directory records every executed call, and `get_cache_data()` turns it into\n", + "an audit trail.\n", + "\n", + "This notebook runs on the **login node** of a SLURM cluster." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Cluster-specific settings\n", + "**Adapt the following cell to your cluster.** It collects everything which depends on the cluster rather than on your science. The values below are the ones used to test this notebook on a single-node SLURM test cluster. The submission template is a [Jinja2](https://jinja.palletsprojects.com) template which executorlib renders for every function call: add the lines your cluster requires, for example `#SBATCH --partition=`, `#SBATCH --account=` or `module load ...` commands before `{{command}}`. The [executorlib-cluster-setup](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#setup-with-claude-code) skill for Claude Code can analyse your cluster and generate a tested template." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "parameters" + ] + }, + "outputs": [], + "source": [ + "# Cluster-specific settings - adapt these values to your cluster.\n", + "submission_template = \"\"\"\\\n", + "#!/bin/bash\n", + "#SBATCH --output=time.out\n", + "#SBATCH --job-name={{job_name}}\n", + "#SBATCH --chdir={{working_directory}}\n", + "#SBATCH --get-user-env=L\n", + "#SBATCH --ntasks={{cores}}\n", + "{%- if run_time_max %}\n", + "#SBATCH --time={{ [1, run_time_max // 60]|max }}\n", + "{%- endif %}\n", + "{%- if dependency_list %}\n", + "#SBATCH --dependency=afterok:{{ dependency_list | join(',') }}\n", + "{%- endif %}\n", + "\n", + "{{command}}\n", + "\"\"\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 1: Put the functions in a module\n", + "To be reusable by others, the functions of a shared workflow belong in an importable Python module rather than in a\n", + "notebook. The exported workflow refers to the functions by their module and name. executorlib adds the current\n", + "directory to the `PYTHONPATH` of the submitted jobs, so the module is also found on the compute nodes." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%writefile story9_workflow.py\n", + "import time\n", + "\n", + "\n", + "def prepare_structure(lattice_constant):\n", + " # Stand-in for building an atomistic structure.\n", + " return {\"positions\": [lattice_constant * i for i in range(4)], \"n_steps\": 100}\n", + "\n", + "\n", + "def run_simulation(positions, n_steps):\n", + " # Stand-in for a simulation.\n", + " time.sleep(1)\n", + " return sum(-1.0 / (1.0 + x) for x in positions) * n_steps / 100\n", + "\n", + "\n", + "def analyse(energy, lattice_constant):\n", + " # Stand-in for post-processing.\n", + " return {\"lattice_constant\": lattice_constant, \"energy_per_atom\": energy / 4}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from executorlib import get_item_from_future\n", + "from story9_workflow import analyse, prepare_structure, run_simulation\n", + "\n", + "\n", + "def submit_workflow(exe, lattice_constant):\n", + " structure = exe.submit(prepare_structure, lattice_constant=lattice_constant)\n", + " energy = exe.submit(\n", + " run_simulation,\n", + " positions=get_item_from_future(structure, key=\"positions\"),\n", + " n_steps=get_item_from_future(structure, key=\"n_steps\"),\n", + " )\n", + " return exe.submit(analyse, energy=energy, lattice_constant=lattice_constant)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 2: Export the workflow definition\n", + "With `export_workflow_filename` the executor records the submitted calls and their connections and writes them to a\n", + "JSON file - like `plot_dependency_graph`, **nothing is executed**, the futures return `None`. The workflow graph is the\n", + "same for every executor, so the export can be done locally with the `SingleNodeExecutor`, even without cluster access." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from executorlib import SingleNodeExecutor\n", + "\n", + "workflow_file = \"story9_workflow.json\"\n", + "\n", + "with SingleNodeExecutor(export_workflow_filename=workflow_file) as exe:\n", + " submit_workflow(exe, lattice_constant=4.0)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "\n", + "with open(workflow_file) as f:\n", + " workflow_dict = json.load(f)\n", + "\n", + "print(json.dumps(workflow_dict, indent=1))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The JSON file lists the function nodes by module and name, the input values, and the edges which connect an output\n", + "(`sourcePort`, for example the `positions` entry of the dictionary returned by `prepare_structure`) to an input\n", + "argument (`targetPort`). Together with `story9_workflow.py` it describes the workflow completely, and the\n", + "[python-workflow-definition](https://github.com/pythonworkflow/python-workflow-definition) package can load it into\n", + "other workflow frameworks like [aiida](https://www.aiida.net), [jobflow](https://materialsproject.github.io/jobflow)\n", + "and [pyiron](https://pyiron.org).\n", + "\n", + "## Step 3: Run the workflow on the cluster" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from executorlib import SlurmClusterExecutor\n", + "\n", + "cache_directory = \"./story9_cache\"\n", + "\n", + "with SlurmClusterExecutor(\n", + " cache_directory=cache_directory,\n", + " resource_dict={\"submission_template\": submission_template, \"cores\": 1, \"run_time_max\": 300},\n", + ") as exe:\n", + " result_lst = [submit_workflow(exe, lattice_constant=a).result() for a in [3.9, 4.0]]\n", + "\n", + "result_lst" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 4: The cache as audit trail\n", + "Each executed call is stored in the cache directory together with its metadata. `get_cache_data()` returns one\n", + "dictionary per call with the fields:\n", + "\n", + "| Field | Content |\n", + "|---|---|\n", + "| `function` | the executed Python function |\n", + "| `input_args`, `input_kwargs` | the arguments - inputs provided by another call are stored as a reference to its result |\n", + "| `output` / `error` | the return value, or the exception if the call failed |\n", + "| `resource_dict` | the resources requested for the call |\n", + "| `runtime` | the run time of the function in seconds |\n", + "| `queue_id` | the SLURM job ID, for `sacct -j ` |\n", + "| `filename` | the cache file of the call |" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas\n", + "from executorlib import get_cache_data\n", + "\n", + "df = pandas.DataFrame(get_cache_data(cache_directory=cache_directory))\n", + "df[\"function\"] = df[\"function\"].apply(lambda fn: f\"{fn.__module__}.{fn.__name__}\")\n", + "df[\"cores\"] = df[\"resource_dict\"].apply(lambda resource_dict: resource_dict[\"cores\"])\n", + "df[\"run_time_max\"] = df[\"resource_dict\"].apply(lambda resource_dict: resource_dict.get(\"run_time_max\"))\n", + "df[[\"function\", \"output\", \"cores\", \"run_time_max\", \"runtime\", \"queue_id\"]].sort_values(\"queue_id\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Store this table - for example as CSV next to your results - together with the workflow JSON, the module and the\n", + "versions of your software. The cache itself uses [cloudpickle](https://github.com/cloudpipe/cloudpickle), whose format\n", + "can change between Python and executorlib versions, so it is an audit trail for the current project, not a long-term\n", + "archive." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Clean up" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import glob\n", + "import os\n", + "import shutil\n", + "\n", + "shutil.rmtree(cache_directory, ignore_errors=True)\n", + "for file_name in [workflow_file, \"story9_workflow.py\"] + glob.glob(\"__pycache__/story9_workflow.*.pyc\"):\n", + " if os.path.exists(file_name):\n", + " os.remove(file_name)\n", + "if os.path.isdir(\"__pycache__\") and len(os.listdir(\"__pycache__\")) == 0:\n", + " os.rmdir(\"__pycache__\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## What you learned\n", + "* `export_workflow_filename` writes the workflow graph as Python Workflow Definition JSON without executing it.\n", + "* Functions of shared workflows belong in an importable module.\n", + "* `get_cache_data()` provides function, inputs, outputs, errors, resources, run time and SLURM job ID of every call.\n", + "\n", + "**Reference:** [dependencies](https://executorlib.readthedocs.io/en/latest/1-single-node.html#dependencies),\n", + "[cache](https://executorlib.readthedocs.io/en/latest/1-single-node.html#cache),\n", + "[verifying the resource assignment](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#verifying-the-resource-assignment) and the\n", + "[Python Workflow Definition](https://github.com/pythonworkflow/python-workflow-definition)." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} From d2d103b4f7a4baf5ac736f8a3557750c42d99e92 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Thu, 19 Nov 2026 10:53:04 +0100 Subject: [PATCH 4/9] Link single node notebook to the user story notebooks Co-Authored-By: Claude Opus 5.5 --- notebooks/1-single-node.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/1-single-node.ipynb b/notebooks/1-single-node.ipynb index 935b997a..eea360bd 100644 --- a/notebooks/1-single-node.ipynb +++ b/notebooks/1-single-node.ipynb @@ -1 +1 @@ -{"metadata":{"kernelspec":{"display_name":"Python 3 (ipykernel)","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.13.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"6915218e-7cf3-4bf4-9618-7e6942b4762f","cell_type":"markdown","source":"# Single Node Executor\nThe `SingleNodeExecutor` in executorlib, is primarily used to enable rapid prototyping on a workstation computer to test your parallel Python program with executorlib before transferring it to an high performance computer (HPC). With the added capability of executorlib it is typically 10% slower than the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) from the Python standard library on a single node, when all acceleration features are enabled. This overhead is primarily related to the creation of new tasks. So the performance of executorlib improves when the individual Python function calls require extensive computations.\n\nAn advantage that executorlib has over the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) and the [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) from the Python standard libary, is the use of [cloudpickle](https://github.com/cloudpipe/cloudpickle) as serialization backend to transfer Python functions between processes. This enables the use of dynamically defined Python functions for example in the case of a Jupyter notebook. \n\nThe `SingleNodeExecutor` supports the same `submit()` interface, resource dictionary `resource_dict`, dependency handling and cache directory `cache_directory` as the HPC executors. A workflow developed with the `SingleNodeExecutor` can therefore be transferred to an HPC cluster by replacing the executor class and adding the cluster-specific settings. The [Getting Started on HPC](https://executorlib.readthedocs.io/en/latest/hpc-workflow.html) guide demonstrates this transition for a typical HPC workflow, while the examples in this chapter can be executed without access to an HPC cluster.","metadata":{}},{"id":"ccc686dd-8fc5-4755-8a19-f40010ebb1b8","cell_type":"markdown","source":"## Basic Functionality\nThe general functionality of executorlib follows the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) of the Python standard library. You can import the `SingleNodeExecutor` class directly from executorlib and then just replace the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) or [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) with the `SingleNodeExecutor` class to start using executorlib.","metadata":{}},{"id":"b1907f12-7378-423b-9b83-1b65fc0a20f5","cell_type":"code","source":"from executorlib import SingleNodeExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":1},{"id":"1654679f-38b3-4699-9bfe-b48cbde0b2db","cell_type":"markdown","source":"It is recommended to use the `SingleNodeExecutor` class in combination with a `with`-statement. This guarantees the processes created by the `SingleNodeExecutor` class to evaluate the Python functions are afterward closed and do not remain ghost processes. A function is then submitted using the `submit(fn, /, *args, **kwargs)` function which executes a given function `fn` as `fn(*args, **kwargs)`. The `submit()` function returns a [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object, as defined by the Python Standard Library. As a first example we submit the function `sum()` to calculate the sum of the list `[1, 1]`:","metadata":{}},{"id":"16f7d138-ed77-45ea-a554-d329f7237500","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\nCPU times: user 35.7 ms, sys: 38.1 ms, total: 73.8 ms\nWall time: 274 ms\n"}],"execution_count":2},{"id":"a1109584-9db2-4f9d-b3ed-494d96241396","cell_type":"markdown","source":"As expected the result of the summation `sum([1, 1])` is `2`. The same result is retrieved from the [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object received from the submission of the `sum()` as it is printed here `print(future.result())`. For most Python functions and especially the `sum()` function it is computationally not efficient to initialize the `SingleNodeExecutor` class only for the execution of a single function call, rather it is more computationally efficient to initialize the `SingleNodeExecutor` class once and then submit a number of functions. This can be achieved with a loop. For example the sum of the pairs `[2, 2]`, `[3, 3]` and `[4, 4]` can be achieved with a for-loop inside the context of the `SingleNodeExecutor()` class as provided by the `with`-statement.","metadata":{}},{"cell_type":"markdown","id":"9d4d4481-b637-4b15-aa14-0de62199411f","metadata":{},"source":["### Understanding Future Objects\n","Each call of the `submit()` function returns immediately - not with the result of the function but with a [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object. A `Future` is a placeholder for a result which is not yet available. The submitted function is executed in the background while the main Python program continues, this is what allows executorlib to evaluate many functions at the same time. The most important methods of a `Future` object are:\n","\n","| Method | Description |\n","|---|---|\n","| `future.result()` | Wait until the function is finished and return its result - or raise the exception if the function failed. |\n","| `future.done()` | Return `True` if the function already finished, without waiting for it. |\n","| `future.cancel()` | Try to cancel the function in case it has not started yet. |\n","\n","The key to parallel execution is to first submit all functions and only afterwards collect the results by calling `result()`. When `result()` is called directly after each `submit()`, the program waits for each function to finish before the next function is submitted, so the functions are executed one after another rather than in parallel. The example below illustrates this: directly after the submission the function is not yet finished, while after requesting the result with `result()` it is."]},{"cell_type":"code","execution_count":null,"id":"b653ab65-b6fb-40a2-999c-fa2a16f5d9aa","metadata":{"trusted":true},"outputs":[],"source":["with SingleNodeExecutor() as exe:\n"," future = exe.submit(sum, [1, 1])\n"," print(\"finished directly after submit:\", future.done())\n"," print(\"result:\", future.result())\n"," print(\"finished after result:\", future.done())"]},{"id":"cfccdf9a-b23b-4814-8c14-36703a8a5f9e","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(2, 5)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[4, 6, 8]\nCPU times: user 36.6 ms, sys: 10 ms, total: 46.6 ms\nWall time: 1.16 s\n"}],"execution_count":3},{"id":"7db58f70-8137-4f1c-a87b-0d282f2bc3c5","cell_type":"markdown","source":"If only the parameters change but the function, which is applied to these parameters, remains the same, like in the case above the `sum()` function is applied to three pairs of parameters, then the `map(fn, *iterables, timeout=None, chunksize=1)` function can be used to map the function to the different sets of parameters - as it is defined in the [Python standard library](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.map). ","metadata":{}},{"id":"abd0beb7-471d-490e-bb9c-96755bd7aacf","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n results = exe.map(sum, [[5, 5], [6, 6], [7, 7]])\n print(list(results))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[10, 12, 14]\nCPU times: user 35.4 ms, sys: 9.3 ms, total: 44.7 ms\nWall time: 1.2 s\n"}],"execution_count":4},{"id":"d07a3314-fbaf-4ff5-98dd-dea62194abcd","cell_type":"markdown","source":"The `map()` function also works naturally with [pandas](https://pandas.pydata.org) DataFrames. Rather than using `DataFrame.apply()` for row-wise operations, `map()` can be used to apply a function to each pair of values from two columns in parallel:","metadata":{}},{"id":"4e7d5ef4-6437-4fa2-b500-19b8cc53f377","cell_type":"code","source":"def sum_df(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":5},{"id":"1428ac7c-dd3c-48db-b41f-4ea975df2d78","cell_type":"code","source":"import pandas\n\ndf = pandas.DataFrame({\"a\": [1, 2, 3], \"b\": [4, 5, 6]})\n\nwith SingleNodeExecutor() as exe:\n df[\"c\"] = list(exe.map(sum_df, df[\"a\"], df[\"b\"]))\n print(df)","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":" a b c\n0 1 4 5\n1 2 5 7\n2 3 6 9\n"}],"execution_count":6},{"id":"ac86bf47-4eb6-4d7c-acae-760b880803a8","cell_type":"markdown","source":"These examples cover the general functionality of the `SingleNodeExecutor` class. Following the [Executor](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) interface as it is defined in the Python standard library.","metadata":{}},{"id":"5de0f0f2-bf5c-46b3-8171-a3a206ce6775","cell_type":"markdown","source":"## Parallel Functions\nWriting parallel software is not trivial. So rather than writing the whole Python program in a parallel way, executorlib allows developers to implement parallel execution on a function by function level. In this way individual functions can be replaced by parallel functions as needed without the need to modify the rest of the program. With the Local Mode executorlib supports two levels of parallel execution, parallel execution based on the Message Passing Interface (MPI) using the [mpi4py](https://mpi4py.readthedocs.io) package, or thread based parallel execution. Both levels of parallelism can be defined inside the function and do not require any modifications to the rest of the Python program. ","metadata":{}},{"id":"dc8e692f-bf6c-4838-bb82-6a6b8454a2e7","cell_type":"markdown","source":"### MPI Parallel Functions\nMPI is the default way to develop parallel programs for HPCs. Still it can be challenging to refactor a previously serial program to efficiently use MPI to achieve optimal computational efficiency for parallel execution, even with libraries like [mpi4py](https://mpi4py.readthedocs.io). To simplify the up-scaling of Python programs executorlib provides the option to use MPI parallel Python code inside a given Python function and then submit this parallel Python function to an `SingleNodeExecutor` for evaluation.\n\nThe following `calc_mpi()` function imports the [mpi4py](https://mpi4py.readthedocs.io) package and then uses the internal functionality of MPI to get the total number of parallel CPU cores in the current MPI group `MPI.COMM_WORLD.Get_size()` and the index of the current processor in the MPI group `MPI.COMM_WORLD.Get_rank()`.\n\nThe [mpi4py](https://mpi4py.readthedocs.io) package is an optional dependency of executorlib. The installation of the [mpi4py](https://mpi4py.readthedocs.io) package is covered in the installation section.","metadata":{}},{"id":"a251d083-489e-41c1-9e49-c86093858006","cell_type":"code","source":"def calc_mpi(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank","metadata":{"trusted":true},"outputs":[],"execution_count":7},{"id":"adbf8a10-04e1-4fd9-8768-4375bcba9ec3","cell_type":"markdown","source":"The computational resources for the execution of the `calc_mpi()` Python function are defined using the resource dictionary parameter `resource_dict={}`. The reseource dictionary can either be provided as additional parameter for the `submit()` function. It is important that the parameter name `resource_dict` is reserved exclusively for the `submit()` function and cannot be used in the function which is submitted, like the `calc_mpi()` function in this example:","metadata":{}},{"id":"266864f1-d29e-4934-9b5d-51f4ffb11f5c","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n fs = exe.submit(calc_mpi, 3, resource_dict={\"cores\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":8},{"id":"3a449e3f-d7a4-4056-a1d0-35dfca4dad22","cell_type":"markdown","source":"Another option is to set the resource dictionary parameter `resource_dict` during the initialization of the `Executor`. In this case it is internally set for every call of the `submit()` function, without the need to specify it again.","metadata":{}},{"id":"cb4ad978-bdf2-47bb-a7df-846641a54ec2","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"cores\": 2}) as exe:\n fs = exe.submit(calc_mpi, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":9},{"id":"c1d1d7b1-64fa-4e47-bbde-2a16036568d6","cell_type":"markdown","source":"In addition, to the compute cores `cores`, the resource dictionary parameter `resource_dict` can also define the threads per core as `threads_per_core`, the GPUs per core as `gpus_per_core`, the working directory with `cwd`, the option to use the OpenMPI oversubscribe feature with `openmpi_oversubscribe` and finally for the [Simple Linux Utility for Resource \nManagement (SLURM)](https://slurm.schedmd.com) queuing system the option to provide additional command line arguments with the `slurm_cmd_args` parameter - [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary).","metadata":{}},{"id":"4f5c5221-d99c-4614-82b1-9d6d3260c1bf","cell_type":"markdown","source":"### Thread Parallel Functions\nAn alternative option of parallelism is [thread based parallelism](https://docs.python.org/3/library/threading.html). executorlib supports thread based parallelism with the `threads_per_core` parameter in the resource dictionary `resource_dict`. Given the [global interpreter lock](https://docs.python.org/3/glossary.html#term-global-interpreter-lock) in the cPython implementation a common application of thread based parallelism in Python is using additional threads in linked libraries. The number of threads is commonly controlled with environment variables like `OMP_NUM_THREADS`, `OPENBLAS_NUM_THREADS`, `MKL_NUM_THREADS`, `VECLIB_MAXIMUM_THREADS` and `NUMEXPR_NUM_THREADS`. Specific libraries might require other environment variables. The environment variables can be set using the environment interface of the Python standard library `os.environ`.","metadata":{}},{"id":"7a7d21f6-9f1a-4f30-8024-9993e156dc75","cell_type":"code","source":"def calc_with_threads(i):\n import os\n\n os.environ[\"OMP_NUM_THREADS\"] = \"2\"\n os.environ[\"OPENBLAS_NUM_THREADS\"] = \"2\"\n os.environ[\"MKL_NUM_THREADS\"] = \"2\"\n os.environ[\"VECLIB_MAXIMUM_THREADS\"] = \"2\"\n os.environ[\"NUMEXPR_NUM_THREADS\"] = \"2\"\n import numpy as np\n\n return i","metadata":{"trusted":true},"outputs":[],"execution_count":10},{"id":"82ed8f46-836c-402e-9363-be6e16c2a0b0","cell_type":"markdown","source":"Again the resource dictionary parameter `resource_dict` can be set either in the `submit()` function:","metadata":{}},{"id":"b8ed330d-ee77-44a0-a02f-670fa945b043","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n fs = exe.submit(calc_with_threads, 3, resource_dict={\"threads_per_core\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"3\n"}],"execution_count":11},{"id":"63222cd5-664b-4aba-a80c-5814166b1239","cell_type":"markdown","source":"Or alternatively, the resource dictionary parameter `resource_dict` can also be set during the initialization of the `Executor` class:","metadata":{}},{"id":"31562f89-c01c-4e7a-bbdd-fa26ca99e68b","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"threads_per_core\": 2}) as exe:\n fs = exe.submit(calc_with_threads, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"3\n"}],"execution_count":12},{"id":"8b78a7b4-066e-4cbc-858e-606c8bbbbf0c","cell_type":"markdown","source":"For most cases MPI based parallelism leads to higher computational efficiency in comparison to thread based parallelism, still the choice of parallelism depends on the specific Python function which should be executed in parallel. Careful benchmarks are required to achieve the optimal performance for a given computational architecture. \n\nBeyond MPI based parallelism and thread based parallelism the [HPC Cluster Executors](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html) and the [HPC Job Executors](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) also provide the option to assign GPUs to the execution of individual Python functions.","metadata":{}},{"id":"ca9bc450-2762-4d49-b7f8-48cc83e068fd","cell_type":"markdown","source":"## Performance Optimization\nThe default settings of executorlib are chosen to favour stability over performance. Consequently, the performance of executorlib can be improved by setting additional parameters. It is commonly recommended to start with an initial implementation based on executorlib and then improve the performance by enabling specialized features.","metadata":{}},{"id":"e9b52ecf-3984-4695-98e7-315aa3712104","cell_type":"markdown","source":"### Block Allocation\nBy default each submitted Python function is executed in a dedicated process. This gurantees that the execution of the submitted Python function starts with a fresh process. Still the initialization of the Python process takes time. Especially when the call of the Python function requires only limited computational resources it makes sense to reuse the existing Python process for the execution of multiple Python functions. In executorlib this functionality is enabled by setting the `block_allocation` parameter to `Ture`. To limit the number of parallel Python processes when using block allocation it is recommended to set the `max_workers` parameter to restrict the number of available computing resources. ","metadata":{}},{"id":"0da4c7d0-2268-4ea8-b62d-5d94c79ebc72","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(max_workers=2, block_allocation=True) as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\nCPU times: user 31.5 ms, sys: 11.5 ms, total: 43 ms\nWall time: 709 ms\n"}],"execution_count":13},{"id":"d38163b3-1c04-431c-964b-2bad4f823a4d","cell_type":"markdown","source":"The same functionality also applies to MPI parallel Python functions. The important part is that while it is possible to assign more than one Python process to the execution of a Python function in block allocation mode, it is not possible to assign resources during the submission of the function with the `submit()` function. Starting again with the `calc_mpi()` function: ","metadata":{}},{"id":"cb8c4943-4c78-4203-95f2-1db758e588d9","cell_type":"code","source":"def calc_mpi(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank","metadata":{"trusted":true},"outputs":[],"execution_count":14},{"id":"9e1212c4-e3fb-4e21-be43-0a4f0a08b856","cell_type":"markdown","source":"Still the resource dictionary parameter can still be set during the initialisation of the `SingleNodeExecutor` class. Internally, this groups the created Python processes in fixed allocations and afterwards submit Python functions to these allocations.","metadata":{}},{"id":"5ebf7195-58f9-40f2-8203-2d4b9f0e9602","cell_type":"code","source":"with SingleNodeExecutor(max_workers=2, resource_dict={\"cores\": 2}, block_allocation=True) as exe:\n fs = exe.submit(calc_mpi, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":15},{"id":"b75fb95f-f2f5-4be9-9f2a-9c2e9961c644","cell_type":"markdown","source":"The weakness of memory from a previous Python function remaining in the Python process can at the same time be an advantage for working with large datasets. In executorlib this is achieved by introducing the `init_function` parameter. The `init_function` returns a dictionary of parameters which can afterwards be reused as keyword arguments `**kwargs` in the functions submitted to the `Executor`. When block allocation `block_allocation` is disabled this functionality is not available, as each function is executed in a separate process, so no data can be preloaded.","metadata":{}},{"id":"8aa754cc-eb1a-4fa1-bd72-272246df1d2f","cell_type":"code","source":"def init_function():\n return {\"j\": 4, \"k\": 3, \"l\": 2}","metadata":{"trusted":true},"outputs":[],"execution_count":16},{"id":"1854895a-7239-4b30-b60d-cf1a89234464","cell_type":"code","source":"def calc_with_preload(i, j, k):\n return i + j + k","metadata":{"trusted":true},"outputs":[],"execution_count":17},{"id":"d07cf107-3627-4cb0-906c-647497d6e0d2","cell_type":"markdown","source":"The function `calc_with_preload()` requires three inputs `i`, `j` and `k`. But when the function is submitted to the executor only two inputs are provided `fs = exe.submit(calc, 2, j=5)`. In this case the first input parameter is mapped to `i=2`, the second input parameter is specified explicitly `j=5` but the third input parameter `k` is not provided. So the `SingleNodeExecutor` automatically checks the keys set in the `init_function()` function. In this case the returned dictionary `{\"j\": 4, \"k\": 3, \"l\": 2}` defines `j=4`, `k=3` and `l=2`. For this specific call of the `calc_with_preload()` function, `i` and `j` are already provided so `j` is not required, but `k=3` is used from the `init_function()` and as the `calc_with_preload()` function does not define the `l` parameter this one is also ignored.","metadata":{}},{"id":"cc648799-a0c6-4878-a469-97457bce024f","cell_type":"code","source":"with SingleNodeExecutor(max_workers=2, init_function=init_function, block_allocation=True) as exe:\n fs = exe.submit(calc_with_preload, 2, j=5)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"10\n"}],"execution_count":18},{"id":"1073b8ca-1492-46e9-8d1f-f52ad48d28a2","cell_type":"markdown","source":"The result is `2+5+3=10` as `i=2` and `j=5` are provided during the submission and `k=3` is defined in the `init_function()` function.","metadata":{}},{"id":"24397d78-dff1-4834-830c-a8f390fe6b9c","cell_type":"markdown","source":"### Cache\nThe development of scientific workflows is commonly an interactive process, extending the functionality step by step. This lead to the development of interactive environments like [Jupyter](https://jupyter.org) which is fully supported by executorlib. Still many of the computationally intensive Python functions can take in the order of minutes to hours or even longer to execute, so reusing an existing Python process is not feasible. To address this challenge executorlib provides a file based cache to store the results of previously computed [concurrent future Futures](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects. The results are serialized using [cloudpickle](https://github.com/cloudpipe/cloudpickle) and stored in a user-defined cache directory `cache_directory` to be reloaded later on. Internally, the hierarchical data format (HDF5) is used via the [h5py](https://www.h5py.org), which is an optional dependency for executorlib. \n\nThe [h5py](https://www.h5py.org) package is an optional dependency of executorlib. The installation of the [h5py](https://www.h5py.org) package is covered in the installation section. ","metadata":{}},{"id":"ecdcef49-5c89-4538-b377-d53979673bf7","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(cache_directory=\"./file\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[2, 4, 6]\nCPU times: user 84.3 ms, sys: 33.6 ms, total: 118 ms\nWall time: 1.35 s\n"}],"execution_count":19},{"id":"32d0fb2e-5ac1-4249-b6c8-953c92fdfded","cell_type":"markdown","source":"When the same code is executed again, executorlib finds the existing results in the cache directory specified by the `cache_directory` parameter and reloads the result, accelerating the computation especially during the prototyping phase when similar computations are repeated frequently for testing. \n\nStill it is important to mention, that this cache is not designed to identify the submission of the same parameters within the context of one `with`-statement. It is the task of the user to minimize duplicate computations, the cache is only designed to restore previous calculation results when the Python process managing executorlib was stopped after the successful execution. ","metadata":{}},{"id":"c39babe8-4370-4d31-9520-9a7ce63378c8","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(cache_directory=\"./file\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[2, 4, 6]\nCPU times: user 44.2 ms, sys: 15.5 ms, total: 59.7 ms\nWall time: 1.3 s\n"}],"execution_count":20},{"id":"5144a035-633e-4e60-a362-f3b15b28848b","cell_type":"markdown","source":"An additional advantage of the cache is the option to gather the results of previously submitted functions. Using the `get_cache_data()` function the results of each Python function is converted to a dictionary. This list of dictionaries can be converted to a `pandas.DataFrame` for further processing:","metadata":{}},{"id":"f574b9e1-de55-4e38-aef7-a4bed540e040","cell_type":"code","source":"import pandas\nfrom executorlib import get_cache_data\n\ndf = pandas.DataFrame(get_cache_data(cache_directory=\"./file\"))\ndf","metadata":{"trusted":true},"outputs":[{"execution_count":21,"output_type":"execute_result","data":{"text/plain":" function input_args input_kwargs output resource_dict \\\n0 ([2, 2],) {} 4 {} \n1 ([3, 3],) {} 6 {} \n2 ([1, 1],) {} 2 {} \n\n runtime filename \n0 0.910742 /home/jovyan/file/sum89afbdf9da5eb1794f6976a3f... \n1 0.911247 /home/jovyan/file/sum0f7710227cda6456e5d071877... \n2 0.908284 /home/jovyan/file/sumf5ad27b855231a293ddd735a8... ","text/html":"
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
functioninput_argsinput_kwargsoutputresource_dictruntimefilename
0<built-in function sum>([2, 2],){}4{}0.910742/home/jovyan/file/sum89afbdf9da5eb1794f6976a3f...
1<built-in function sum>([3, 3],){}6{}0.911247/home/jovyan/file/sum0f7710227cda6456e5d071877...
2<built-in function sum>([1, 1],){}2{}0.908284/home/jovyan/file/sumf5ad27b855231a293ddd735a8...
\n
"},"metadata":{}}],"execution_count":21},{"id":"68092479-e846-494a-9ac9-d9638b102bd8","cell_type":"markdown","source":"After the development phase is concluded it is the task of the user to remove the cache directory defined with the `cache_directory` parameter. The cache directory is never removed by executorlib to prevent the repeation of expensive computations. Still as disk space on shared file systems in HPC environments is commonly limited it is recommended to remove the cache directory once the development process concluded. ","metadata":{}},{"id":"34a9316d-577f-4a63-af14-736fb4e6b219","cell_type":"code","source":"import os\nimport shutil\n\ncache_dir = \"./file\"\nif os.path.exists(cache_dir):\n print(os.listdir(cache_dir))\n try:\n shutil.rmtree(cache_dir)\n except OSError:\n pass","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"['sum89afbdf9da5eb1794f6976a3f01697c2_o.h5', 'sum0f7710227cda6456e5d07187702313f3_o.h5', 'sumf5ad27b855231a293ddd735a8554c9ea_o.h5']\n"}],"execution_count":22},{"id":"1cea95b5-4110-444c-82af-fa6718bfa17f","cell_type":"markdown","source":"Typically the use of the cache is recommended for development processes only and for production workflows the user should implement their own long-term storage solution. The binary format used by executorlib is based on [cloudpickle](https://github.com/cloudpipe/cloudpickle) and might change in future without further notice, rendering existing data in the cache unusable. Consequently, using the cache beyond the development process is not recommended. In addition the writing of the results to files might result in additional overhead for accessing the shared file system. ","metadata":{}},{"id":"71a8a0be-a933-4e83-9da5-50da35e9975b","cell_type":"markdown","source":"### Dependencies\nMany scientific Python programs consist of series of Python function calls with varying level of parallel computations or map-reduce patterns where the same function is first mapped to a number of parameters and afterwards the results are reduced in a single function. To extend the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) of the Python standard library to support this programming pattern, the `SingleNodeExecutor` class from executorlib supports submitting Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) objects to the `SingleNodeExecutor` which are resolved before submission. So the `SingleNodeExecutor` internally waits until all Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) objects are successfully executed before it triggers the execution of the submitted Python function.","metadata":{}},{"id":"d8b75a26-479d-405e-8895-a8d56b3f0f4b","cell_type":"code","source":"def calc_add(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":23},{"id":"36118ae0-c13c-4f7a-bcd3-3d7f4bb5a078","cell_type":"markdown","source":"For example the function which adds two numbers `calc_add()` is used in a loop which adds a counter to the previous numbers. In the first iteration the `future` parameter is set to `0` but already in the second iteration it is the Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object of the first iteration and so on. \n\nThe important part is that the user does not have to wait until the first function is executed but instead the waiting happens internally in the `SingleNodeExecutor`.","metadata":{}},{"id":"35fd5747-c57d-4926-8d83-d5c55a130ad6","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future = 0\n for i in range(1, 4):\n future = exe.submit(calc_add, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"6\n"}],"execution_count":24},{"id":"38e1bbb3-1028-4f50-93c1-d2427f399a7d","cell_type":"markdown","source":"As the reusing of existing [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object can lead to rather complex dependencies, executorlib provides the option to plot the dependency graph by setting the `plot_dependency_graph=True` during the initialization of the `SingleNodeExecutor` class.\n\nNo computation is executed when the `plot_dependency_graph=True` is set. This parameter is for debugging only. \n\nInternally, the [pygraphviz](https://pygraphviz.github.io/documentation/stable) package is used for the visualisation of these dependency graphs. It is an optional dependency of executorlib. The installation of the [pygraphviz](https://pygraphviz.github.io/documentation/stable) package is covered in the installation section. ","metadata":{}},{"id":"f67470b5-af1d-4add-9de8-7f259ca67324","cell_type":"code","source":"with SingleNodeExecutor(plot_dependency_graph=True) as exe:\n future = 0\n for i in range(1, 4):\n future = exe.submit(calc_add, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"None\n"},{"output_type":"display_data","data":{"text/plain":"","image/svg+xml":"\n\n\n\n\n0\n\ncalc_add\n\n\n\n1\n\ncalc_add\n\n\n\n0->1\n\n\nb\n\n\n\n2\n\ncalc_add\n\n\n\n1->2\n\n\nb\n\n\n\n3\n\n1\n\n\n\n3->0\n\n\na\n\n\n\n4\n\n0\n\n\n\n4->0\n\n\nb\n\n\n\n5\n\n2\n\n\n\n5->1\n\n\na\n\n\n\n6\n\n3\n\n\n\n6->2\n\n\na\n\n\n"},"metadata":{}}],"execution_count":25},{"id":"4c952a9d-2b58-401d-b7ec-fda740db774a","cell_type":"markdown","source":"## Advanced Scheduling\nGoing beyond just directed acyclic graphs (DAG) with one-to-many and many-to-one relationships, executorlib provides a number of advanced scheduling patterns. These are briefly introduced in the following.","metadata":{}},{"id":"4db2c87c-9a7d-4074-82d0-24357fa4f0e6","cell_type":"markdown","source":"### Runtime-dependent Batching \nTo maximize the throughput of dependent calculation tasks its important to idenify all tasks which can be executed at a given moment. Unfortunately, some of these dependencies can only be determined at run time, which is challenging for most schedulers. To demonstrate the runtime-dependent batching in executorlib we discuss the following example. Starting with a group of ten tasks and then grouping them into groups of three for processing. Still the order of the tasks, which tasks belong into which group, is only determined at run time. \n\nFor simplicity, we just use a simple function which directly returns the input.","metadata":{}},{"id":"857a5e0f-50d6-45ec-aac7-a7151f36c19f","cell_type":"code","source":"def reply(i):\n return i","metadata":{"trusted":true},"outputs":[],"execution_count":26},{"id":"544dacab-5601-4a9b-814f-88560eafb079","cell_type":"markdown","source":"After the group of ten tasks is submitted their future objects are stored in a list named `future_individual_lst`. This list is then provided to the `batched()` function of the `SingleNodeExecutor()` to generate batches of tasks which are then provided to the `sum` function for further processing. The results of this second step are stored in the `future_group_lst`. Finally, the results of these future objects are evaluated in the third step. ","metadata":{}},{"id":"17d1354a-0943-4b62-9b0d-7d39c8df23f2","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future_individual_lst = [\n exe.submit(reply, i) for i in range(10)\n ]\n future_group_lst = [\n exe.submit(sum, f) for f in exe.batched(future_individual_lst, n=3)\n ]\n print(sum([f.result() for f in future_group_lst]))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"45\n"}],"execution_count":27},{"id":"80e8b154-d659-4f3e-add2-701a454d770d","cell_type":"markdown","source":"### Split Future Objects\nIn analogy to the `batched()` function which combines multiple future objects in a batch for further processing, it is also necessary to split the future objects even before the evaluation is completed. Executorlib provides two utility functions, namely `split_future()` for tuples and lists and `get_item_from_future()` for dictionaries. \n\nStarting with a function which returns a tuple, named `get_a_tuple()`:","metadata":{}},{"id":"6ef541e3-a2be-4e05-9e77-65eaceff4248","cell_type":"code","source":"def get_a_tuple(i):\n return \"a\", \"b\", i","metadata":{"trusted":true},"outputs":[],"execution_count":28},{"id":"dd3e4312-1594-4b3b-baf3-5b3121ca8910","cell_type":"markdown","source":"This function is submitted to the `SingleNodeExecutor()` and while in this case it directly returns the tuple, the evaluation would commonly take much longer. By having the ability to split the output of the future object using the `split_future()` function, a number of future objects is generated one for each element of the tuple. This is enabled by providing the number of elements in the tuple as an additional parameter `n=3`. ","metadata":{}},{"id":"927c5931-d7fd-4bc1-ae0e-3dd2f4bc99ce","cell_type":"code","source":"from executorlib import split_future","metadata":{"trusted":true},"outputs":[],"execution_count":29},{"id":"64a9b46e-0de6-4abb-99d9-8aaa0c6cbccb","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future = exe.submit(get_a_tuple, 15)\n f1, f2, f3 = split_future(future=future, n=3)\n print(f1.result(), f2.result(), f3.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"a b 15\n"}],"execution_count":30},{"id":"a10d8f90-e790-4708-b193-90a7f014d699","cell_type":"markdown","source":"In analogy, to the `split_future()` function for lists and tuples, the `get_item_from_future()` function returns one item of a dicitionary which is returned by a function submitted to an `Executor()`. In this example the `get_a_dict()` function returns a dictionary, again in this example the dictionary is returned directly while commonly this would take much longer. ","metadata":{}},{"id":"51ec4dbf-d009-41c9-bc04-cf1b16fe782f","cell_type":"code","source":"def get_a_dict(i):\n return {\"a\": 1, \"b\": 2, \"c\": i}","metadata":{"trusted":true},"outputs":[],"execution_count":31},{"id":"5c90ab75-2a6b-4fbe-a7ee-7f91b2b4af43","cell_type":"markdown","source":"The `get_a_dict()` function is submitted to the `SingleNodeExecutor()`, it returns a future object named `future_dict`. Still as we know that the `result()` of this future object `future_dict` returns a dictionary, we can already access the items of this dictionary with the `get_item_from_future()` function. The `get_item_from_future()` function takes a future object as input in addition to the `key` of the dictionary which should be accessed, as a result the `get_item_from_future()` function returns a future object for the value related to the key. In this example these future objects are named `f1`, `f2` and `f3`. These fucture objects are evaluated afterwards.","metadata":{}},{"id":"a41251d2-a840-4c12-9625-c2e0585c489b","cell_type":"code","source":"from executorlib import get_item_from_future","metadata":{"trusted":true},"outputs":[],"execution_count":32},{"id":"a6e75c5e-ad0c-4723-99c5-8125b63fbeaf","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future_dict = exe.submit(get_a_dict, 15)\n f1 = get_item_from_future(future=future_dict, key=\"a\")\n f2 = get_item_from_future(future=future_dict, key=\"b\")\n f3 = get_item_from_future(future=future_dict, key=\"c\")\n print(f1.result(), f2.result(), f3.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"1 2 15\n"}],"execution_count":33},{"id":"a945c98d-dc73-4284-9d8c-52475a760f6b","cell_type":"markdown","source":"### Recursion\nIn addition to the `map()` function for parallel loops and the option to integrate `while` loops directly in the submission, it is sometimes helpful to use recursive algorthims to accelerate scientific simulation and analysis. To demonstrate the use of executorlib in combination with recursive algorithms, the quicksort algorithm is demonstrated. \n\nThe quicksort algorithm is implemented in two parts, a `quick_sort()` which splits the input `sequence` into two sets, one lower and one larger than the pivot element of the `sequence`. After the initial execution the `quick_sort()` function is again applied to both resulting sets until only a single element remains in the `sequence`. In this case the single element is returned. The pivot is defined as the first element of the `sequence`.\n\nTo simplify the submission of the `quick_sort()` function to the `SingleNodeExecutor()` dictionaries are used as return types, these dictionaries either contain only a single item with the key `\"result\"` when only a single element remains in the list, or three items, one `\"left\"` for a list lower than the pivot, one `\"right\"` for the items larger than the pivot and the `\"result\"` for the pivot itself. ","metadata":{}},{"id":"08b0c0a1-34ad-4b2a-847c-fe9c96956b27","cell_type":"code","source":"def quick_sort(sequence):\n length = len(sequence)\n if length <= 1:\n return {\"result\": sequence}\n else:\n pivot = sequence.pop() \n \n greater_items = []\n lesser_items = []\n\n for item in sequence:\n if item > pivot:\n greater_items.append(item)\n else:\n lesser_items.append(item)\n\n return {\"left\": lesser_items, \"right\": greater_items, \"result\": [pivot]}","metadata":{"trusted":true},"outputs":[],"execution_count":34},{"id":"54a8a765-0b9f-424a-86e5-8024c4d59018","cell_type":"markdown","source":"To enable the recursive submission to the `SingleNodeExecutor()` a `recusive_submit()` function is defined using the [asynchronous IO module](https://docs.python.org/3/library/asyncio.html) of the Python standard libary, indicated by the `async` keyword ahead of the function definition. It takes a `function`, the `sequence` and the `executor` as inputs. As a first step the function is submitted to the `executor` and the execution is halted until the first result is available by wrapping the future object using the `wrap_future()` function of the `asyncio` package and appling the `await` function. Then the corresponding result dictionary `result_dict` is evaluated: If the `result_dict` contains more than one key, then the `recusive_submit()` is evaluated for both the left side with lower values than the pivot element and the right side with elements higher than the pivot element. Again in both cases the `await` keyword is used to enable the parallel execution of both branches at the same time. Afterwards the result of both sides is combined with the pivot element. For the case that the dictionary only contains a single element, it is returned directly. ","metadata":{}},{"id":"4e142829-c9de-4969-ab3c-97f3e1ada90c","cell_type":"code","source":"import asyncio\n\nasync def recusive_submit(function, sequence, executor):\n result_dict = await asyncio.wrap_future(exe.submit(function, sequence))\n if len(result_dict) > 1:\n left = await recusive_submit(function=function, sequence=result_dict[\"left\"], executor=executor)\n right = await recusive_submit(function=function, sequence=result_dict[\"right\"], executor=executor)\n return left + result_dict[\"result\"] + right\n else:\n return result_dict[\"result\"]","metadata":{"trusted":true},"outputs":[],"execution_count":35},{"id":"531a8f7d-5b21-46d0-b632-32a1568571c8","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n loop = asyncio.get_event_loop()\n task = loop.create_task(recusive_submit(function=quick_sort, sequence=[0,9,3,8,2,7,5], executor=exe))\n print(await task)","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[0, 2, 3, 5, 7, 8, 9]\n"}],"execution_count":36},{"id":"725c8ac2-27e4-495b-b061-1fd6053f4c0b","cell_type":"markdown","source":"## Testing and Debugging\nThe up-scaling of Python functions from a single workstation to an High Performance Computer (HPC) can be challenging, so executorlib provides a number of debugging utilities to help you optimize your functions for execution with executorlib. ","metadata":{}},{"id":"2c96b460-ebd2-4c8a-a5e1-922a860808ab","cell_type":"markdown","source":"### Measure Data Transferred \nTransferring a large amount of data between two processes requires additional resources so it is helpful to measure the data transferred between the frontend and backend process. This is achieved by setting the `log_obj_size` parameter to `True`:","metadata":{}},{"id":"71905acf-2fef-4738-82ae-89e35e2e3d2d","cell_type":"code","source":"from executorlib import SingleNodeExecutor\n\nwith SingleNodeExecutor(log_obj_size=True) as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stderr","output_type":"stream","text":"Send dictionary of size: 101\nReceived dictionary of size: 59\nSend dictionary of size: 69\nReceived dictionary of size: 58\n"},{"name":"stdout","output_type":"stream","text":"2\n"}],"execution_count":37},{"id":"0e9f7192-2b7d-4caf-b2b8-ae9cb060e90f","cell_type":"markdown","source":"### Write Log Files\nLibraries like executorlib are commonly used to sample a large parameter space, in this case it is possible that out of a large number of parameters one combination throws an error. This error can be logged in a file which also contains the function and input parameters using the `\"error_log_file\"` parameter in the `resource_dict`. This allows to change the log file on a per-function bases.","metadata":{}},{"id":"2810acd5-a46e-4d85-b447-945248ffca15","cell_type":"code","source":"from executorlib import SingleNodeExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":38},{"id":"ef6b87a7-361e-4a3f-bad3-72ad87968e8c","cell_type":"code","source":"def my_funct(i, j): \n if i == 2 and j == 2:\n raise ValueError()\n else: \n return i * j + i + j","metadata":{"trusted":true},"outputs":[],"execution_count":39},{"id":"209ff76b-913a-46f7-9fff-250e207898b2","cell_type":"markdown","source":"A try and except statement is added to prevent the jupyter notebook from crashing:","metadata":{}},{"id":"30381a00-30cc-45a2-82ff-17371339f5c7","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"error_log_file\": \"error.out\"}) as exe:\n future_lst = []\n for i in range(4):\n for j in range(4):\n future_lst.append(exe.submit(my_funct, i=i, j=j))\n try:\n print([f.result() for f in future_lst])\n except ValueError:\n pass","metadata":{"trusted":true},"outputs":[],"execution_count":40},{"id":"36bfc556-aa86-4b50-972b-4b8f68ceec3d","cell_type":"markdown","source":"The content of the log file is a basic text file, so it can be read with any kind of file utility. The important part is that the log file contains not only the error message but in addition also the function name and the input parameters in the case `kwargs: {'i': 2, 'j': 2}` which helps for future debugging of the sampling function.","metadata":{}},{"id":"a61c06fc-3029-48ed-895f-9f6c065b7c47","cell_type":"code","source":"with open(\"error.out\") as f:\n content = f.readlines()","metadata":{"trusted":true},"outputs":[],"execution_count":41},{"id":"6a6cd10f-6fe3-4a17-a8e6-2536feb9a11a","cell_type":"code","source":"content","metadata":{"trusted":true},"outputs":[{"execution_count":42,"output_type":"execute_result","data":{"text/plain":"['function: \\n',\n 'args: ()\\n',\n \"kwargs: {'i': 2, 'j': 2}\\n\",\n 'Traceback (most recent call last):\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/backend/interactive_serial.py\", line 56, in main\\n',\n ' output = call_funct(input_dict=input_dict, funct=None, memory=memory)\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/standalone/interactive/backend.py\", line 33, in call_funct\\n',\n ' return funct(input_dict[\"fn\"], *input_dict[\"args\"], **input_dict[\"kwargs\"])\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/standalone/interactive/backend.py\", line 22, in funct\\n',\n ' return args[0].__call__(*args[1:], **kwargs)\\n',\n ' ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^\\n',\n ' File \"/tmp/ipykernel_463/3167739528.py\", line 3, in my_funct\\n',\n 'ValueError\\n']"},"metadata":{}}],"execution_count":42},{"id":"5aff120a-317f-47d4-9639-8eccfb136117","cell_type":"code","source":"import os\n\nif os.path.exists(\"error.out\"):\n os.remove(\"error.out\")","metadata":{"trusted":true},"outputs":[],"execution_count":43},{"id":"44cd41d7-4417-429e-8481-f2a49e5f769c","cell_type":"markdown","source":"### TestClusterExecutor\nWhile the `SingleNodeExecutor` internally behaves very similar to the `FluxJobExecutor` and `SlurmJobExecutor` the `FluxClusterExecutor` and `SlurmClusterExecutor` behave very different as they use the file system to exchange information rather than socket-based communication. This can lead to complications when it comes to debugging. To address this challenge executorlib provides the `TestClusterExecutor` which can be executed on a local workstation just like the `SingleNodeExecutor` but in the background it uses the same file based communication like the `SlurmClusterExecutor` and the `FluxClusterExecutor`:","metadata":{}},{"id":"2ae29fb0-54e5-468f-8727-a179b6ed363e","cell_type":"code","source":"from executorlib.api import TestClusterExecutor\n\nwith TestClusterExecutor(cache_directory=\"test\") as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\n"}],"execution_count":44}]} \ No newline at end of file +{"metadata":{"kernelspec":{"display_name":"Python 3 (ipykernel)","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.13.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"6915218e-7cf3-4bf4-9618-7e6942b4762f","cell_type":"markdown","source":"# Single Node Executor\nThe `SingleNodeExecutor` in executorlib, is primarily used to enable rapid prototyping on a workstation computer to test your parallel Python program with executorlib before transferring it to an high performance computer (HPC). With the added capability of executorlib it is typically 10% slower than the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) from the Python standard library on a single node, when all acceleration features are enabled. This overhead is primarily related to the creation of new tasks. So the performance of executorlib improves when the individual Python function calls require extensive computations.\n\nAn advantage that executorlib has over the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) and the [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) from the Python standard libary, is the use of [cloudpickle](https://github.com/cloudpipe/cloudpickle) as serialization backend to transfer Python functions between processes. This enables the use of dynamically defined Python functions for example in the case of a Jupyter notebook. \n\nThe `SingleNodeExecutor` supports the same `submit()` interface, resource dictionary `resource_dict`, dependency handling and cache directory `cache_directory` as the HPC executors. A workflow developed with the `SingleNodeExecutor` can therefore be transferred to an HPC cluster by replacing the executor class and adding the cluster-specific settings. The [user stories](https://executorlib.readthedocs.io/en/latest/story-4-prototype-then-scale.html), starting with [prototyping on a laptop and scaling up](https://executorlib.readthedocs.io/en/latest/story-4-prototype-then-scale.html), demonstrate this transition for typical HPC workflows, while the examples in this chapter can be executed without access to an HPC cluster.","metadata":{}},{"id":"ccc686dd-8fc5-4755-8a19-f40010ebb1b8","cell_type":"markdown","source":"## Basic Functionality\nThe general functionality of executorlib follows the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) of the Python standard library. You can import the `SingleNodeExecutor` class directly from executorlib and then just replace the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) or [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) with the `SingleNodeExecutor` class to start using executorlib.","metadata":{}},{"id":"b1907f12-7378-423b-9b83-1b65fc0a20f5","cell_type":"code","source":"from executorlib import SingleNodeExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":1},{"id":"1654679f-38b3-4699-9bfe-b48cbde0b2db","cell_type":"markdown","source":"It is recommended to use the `SingleNodeExecutor` class in combination with a `with`-statement. This guarantees the processes created by the `SingleNodeExecutor` class to evaluate the Python functions are afterward closed and do not remain ghost processes. A function is then submitted using the `submit(fn, /, *args, **kwargs)` function which executes a given function `fn` as `fn(*args, **kwargs)`. The `submit()` function returns a [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object, as defined by the Python Standard Library. As a first example we submit the function `sum()` to calculate the sum of the list `[1, 1]`:","metadata":{}},{"id":"16f7d138-ed77-45ea-a554-d329f7237500","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\nCPU times: user 35.7 ms, sys: 38.1 ms, total: 73.8 ms\nWall time: 274 ms\n"}],"execution_count":2},{"id":"a1109584-9db2-4f9d-b3ed-494d96241396","cell_type":"markdown","source":"As expected the result of the summation `sum([1, 1])` is `2`. The same result is retrieved from the [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object received from the submission of the `sum()` as it is printed here `print(future.result())`. For most Python functions and especially the `sum()` function it is computationally not efficient to initialize the `SingleNodeExecutor` class only for the execution of a single function call, rather it is more computationally efficient to initialize the `SingleNodeExecutor` class once and then submit a number of functions. This can be achieved with a loop. For example the sum of the pairs `[2, 2]`, `[3, 3]` and `[4, 4]` can be achieved with a for-loop inside the context of the `SingleNodeExecutor()` class as provided by the `with`-statement.","metadata":{}},{"cell_type":"markdown","id":"9d4d4481-b637-4b15-aa14-0de62199411f","metadata":{},"source":["### Understanding Future Objects\n","Each call of the `submit()` function returns immediately - not with the result of the function but with a [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object. A `Future` is a placeholder for a result which is not yet available. The submitted function is executed in the background while the main Python program continues, this is what allows executorlib to evaluate many functions at the same time. The most important methods of a `Future` object are:\n","\n","| Method | Description |\n","|---|---|\n","| `future.result()` | Wait until the function is finished and return its result - or raise the exception if the function failed. |\n","| `future.done()` | Return `True` if the function already finished, without waiting for it. |\n","| `future.cancel()` | Try to cancel the function in case it has not started yet. |\n","\n","The key to parallel execution is to first submit all functions and only afterwards collect the results by calling `result()`. When `result()` is called directly after each `submit()`, the program waits for each function to finish before the next function is submitted, so the functions are executed one after another rather than in parallel. The example below illustrates this: directly after the submission the function is not yet finished, while after requesting the result with `result()` it is."]},{"cell_type":"code","execution_count":null,"id":"b653ab65-b6fb-40a2-999c-fa2a16f5d9aa","metadata":{"trusted":true},"outputs":[],"source":["with SingleNodeExecutor() as exe:\n"," future = exe.submit(sum, [1, 1])\n"," print(\"finished directly after submit:\", future.done())\n"," print(\"result:\", future.result())\n"," print(\"finished after result:\", future.done())"]},{"id":"cfccdf9a-b23b-4814-8c14-36703a8a5f9e","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(2, 5)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[4, 6, 8]\nCPU times: user 36.6 ms, sys: 10 ms, total: 46.6 ms\nWall time: 1.16 s\n"}],"execution_count":3},{"id":"7db58f70-8137-4f1c-a87b-0d282f2bc3c5","cell_type":"markdown","source":"If only the parameters change but the function, which is applied to these parameters, remains the same, like in the case above the `sum()` function is applied to three pairs of parameters, then the `map(fn, *iterables, timeout=None, chunksize=1)` function can be used to map the function to the different sets of parameters - as it is defined in the [Python standard library](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.map). ","metadata":{}},{"id":"abd0beb7-471d-490e-bb9c-96755bd7aacf","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n results = exe.map(sum, [[5, 5], [6, 6], [7, 7]])\n print(list(results))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[10, 12, 14]\nCPU times: user 35.4 ms, sys: 9.3 ms, total: 44.7 ms\nWall time: 1.2 s\n"}],"execution_count":4},{"id":"d07a3314-fbaf-4ff5-98dd-dea62194abcd","cell_type":"markdown","source":"The `map()` function also works naturally with [pandas](https://pandas.pydata.org) DataFrames. Rather than using `DataFrame.apply()` for row-wise operations, `map()` can be used to apply a function to each pair of values from two columns in parallel:","metadata":{}},{"id":"4e7d5ef4-6437-4fa2-b500-19b8cc53f377","cell_type":"code","source":"def sum_df(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":5},{"id":"1428ac7c-dd3c-48db-b41f-4ea975df2d78","cell_type":"code","source":"import pandas\n\ndf = pandas.DataFrame({\"a\": [1, 2, 3], \"b\": [4, 5, 6]})\n\nwith SingleNodeExecutor() as exe:\n df[\"c\"] = list(exe.map(sum_df, df[\"a\"], df[\"b\"]))\n print(df)","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":" a b c\n0 1 4 5\n1 2 5 7\n2 3 6 9\n"}],"execution_count":6},{"id":"ac86bf47-4eb6-4d7c-acae-760b880803a8","cell_type":"markdown","source":"These examples cover the general functionality of the `SingleNodeExecutor` class. Following the [Executor](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) interface as it is defined in the Python standard library.","metadata":{}},{"id":"5de0f0f2-bf5c-46b3-8171-a3a206ce6775","cell_type":"markdown","source":"## Parallel Functions\nWriting parallel software is not trivial. So rather than writing the whole Python program in a parallel way, executorlib allows developers to implement parallel execution on a function by function level. In this way individual functions can be replaced by parallel functions as needed without the need to modify the rest of the program. With the Local Mode executorlib supports two levels of parallel execution, parallel execution based on the Message Passing Interface (MPI) using the [mpi4py](https://mpi4py.readthedocs.io) package, or thread based parallel execution. Both levels of parallelism can be defined inside the function and do not require any modifications to the rest of the Python program. ","metadata":{}},{"id":"dc8e692f-bf6c-4838-bb82-6a6b8454a2e7","cell_type":"markdown","source":"### MPI Parallel Functions\nMPI is the default way to develop parallel programs for HPCs. Still it can be challenging to refactor a previously serial program to efficiently use MPI to achieve optimal computational efficiency for parallel execution, even with libraries like [mpi4py](https://mpi4py.readthedocs.io). To simplify the up-scaling of Python programs executorlib provides the option to use MPI parallel Python code inside a given Python function and then submit this parallel Python function to an `SingleNodeExecutor` for evaluation.\n\nThe following `calc_mpi()` function imports the [mpi4py](https://mpi4py.readthedocs.io) package and then uses the internal functionality of MPI to get the total number of parallel CPU cores in the current MPI group `MPI.COMM_WORLD.Get_size()` and the index of the current processor in the MPI group `MPI.COMM_WORLD.Get_rank()`.\n\nThe [mpi4py](https://mpi4py.readthedocs.io) package is an optional dependency of executorlib. The installation of the [mpi4py](https://mpi4py.readthedocs.io) package is covered in the installation section.","metadata":{}},{"id":"a251d083-489e-41c1-9e49-c86093858006","cell_type":"code","source":"def calc_mpi(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank","metadata":{"trusted":true},"outputs":[],"execution_count":7},{"id":"adbf8a10-04e1-4fd9-8768-4375bcba9ec3","cell_type":"markdown","source":"The computational resources for the execution of the `calc_mpi()` Python function are defined using the resource dictionary parameter `resource_dict={}`. The reseource dictionary can either be provided as additional parameter for the `submit()` function. It is important that the parameter name `resource_dict` is reserved exclusively for the `submit()` function and cannot be used in the function which is submitted, like the `calc_mpi()` function in this example:","metadata":{}},{"id":"266864f1-d29e-4934-9b5d-51f4ffb11f5c","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n fs = exe.submit(calc_mpi, 3, resource_dict={\"cores\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":8},{"id":"3a449e3f-d7a4-4056-a1d0-35dfca4dad22","cell_type":"markdown","source":"Another option is to set the resource dictionary parameter `resource_dict` during the initialization of the `Executor`. In this case it is internally set for every call of the `submit()` function, without the need to specify it again.","metadata":{}},{"id":"cb4ad978-bdf2-47bb-a7df-846641a54ec2","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"cores\": 2}) as exe:\n fs = exe.submit(calc_mpi, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":9},{"id":"c1d1d7b1-64fa-4e47-bbde-2a16036568d6","cell_type":"markdown","source":"In addition, to the compute cores `cores`, the resource dictionary parameter `resource_dict` can also define the threads per core as `threads_per_core`, the GPUs per core as `gpus_per_core`, the working directory with `cwd`, the option to use the OpenMPI oversubscribe feature with `openmpi_oversubscribe` and finally for the [Simple Linux Utility for Resource \nManagement (SLURM)](https://slurm.schedmd.com) queuing system the option to provide additional command line arguments with the `slurm_cmd_args` parameter - [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary).","metadata":{}},{"id":"4f5c5221-d99c-4614-82b1-9d6d3260c1bf","cell_type":"markdown","source":"### Thread Parallel Functions\nAn alternative option of parallelism is [thread based parallelism](https://docs.python.org/3/library/threading.html). executorlib supports thread based parallelism with the `threads_per_core` parameter in the resource dictionary `resource_dict`. Given the [global interpreter lock](https://docs.python.org/3/glossary.html#term-global-interpreter-lock) in the cPython implementation a common application of thread based parallelism in Python is using additional threads in linked libraries. The number of threads is commonly controlled with environment variables like `OMP_NUM_THREADS`, `OPENBLAS_NUM_THREADS`, `MKL_NUM_THREADS`, `VECLIB_MAXIMUM_THREADS` and `NUMEXPR_NUM_THREADS`. Specific libraries might require other environment variables. The environment variables can be set using the environment interface of the Python standard library `os.environ`.","metadata":{}},{"id":"7a7d21f6-9f1a-4f30-8024-9993e156dc75","cell_type":"code","source":"def calc_with_threads(i):\n import os\n\n os.environ[\"OMP_NUM_THREADS\"] = \"2\"\n os.environ[\"OPENBLAS_NUM_THREADS\"] = \"2\"\n os.environ[\"MKL_NUM_THREADS\"] = \"2\"\n os.environ[\"VECLIB_MAXIMUM_THREADS\"] = \"2\"\n os.environ[\"NUMEXPR_NUM_THREADS\"] = \"2\"\n import numpy as np\n\n return i","metadata":{"trusted":true},"outputs":[],"execution_count":10},{"id":"82ed8f46-836c-402e-9363-be6e16c2a0b0","cell_type":"markdown","source":"Again the resource dictionary parameter `resource_dict` can be set either in the `submit()` function:","metadata":{}},{"id":"b8ed330d-ee77-44a0-a02f-670fa945b043","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n fs = exe.submit(calc_with_threads, 3, resource_dict={\"threads_per_core\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"3\n"}],"execution_count":11},{"id":"63222cd5-664b-4aba-a80c-5814166b1239","cell_type":"markdown","source":"Or alternatively, the resource dictionary parameter `resource_dict` can also be set during the initialization of the `Executor` class:","metadata":{}},{"id":"31562f89-c01c-4e7a-bbdd-fa26ca99e68b","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"threads_per_core\": 2}) as exe:\n fs = exe.submit(calc_with_threads, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"3\n"}],"execution_count":12},{"id":"8b78a7b4-066e-4cbc-858e-606c8bbbbf0c","cell_type":"markdown","source":"For most cases MPI based parallelism leads to higher computational efficiency in comparison to thread based parallelism, still the choice of parallelism depends on the specific Python function which should be executed in parallel. Careful benchmarks are required to achieve the optimal performance for a given computational architecture. \n\nBeyond MPI based parallelism and thread based parallelism the [HPC Cluster Executors](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html) and the [HPC Job Executors](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) also provide the option to assign GPUs to the execution of individual Python functions.","metadata":{}},{"id":"ca9bc450-2762-4d49-b7f8-48cc83e068fd","cell_type":"markdown","source":"## Performance Optimization\nThe default settings of executorlib are chosen to favour stability over performance. Consequently, the performance of executorlib can be improved by setting additional parameters. It is commonly recommended to start with an initial implementation based on executorlib and then improve the performance by enabling specialized features.","metadata":{}},{"id":"e9b52ecf-3984-4695-98e7-315aa3712104","cell_type":"markdown","source":"### Block Allocation\nBy default each submitted Python function is executed in a dedicated process. This gurantees that the execution of the submitted Python function starts with a fresh process. Still the initialization of the Python process takes time. Especially when the call of the Python function requires only limited computational resources it makes sense to reuse the existing Python process for the execution of multiple Python functions. In executorlib this functionality is enabled by setting the `block_allocation` parameter to `Ture`. To limit the number of parallel Python processes when using block allocation it is recommended to set the `max_workers` parameter to restrict the number of available computing resources. ","metadata":{}},{"id":"0da4c7d0-2268-4ea8-b62d-5d94c79ebc72","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(max_workers=2, block_allocation=True) as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\nCPU times: user 31.5 ms, sys: 11.5 ms, total: 43 ms\nWall time: 709 ms\n"}],"execution_count":13},{"id":"d38163b3-1c04-431c-964b-2bad4f823a4d","cell_type":"markdown","source":"The same functionality also applies to MPI parallel Python functions. The important part is that while it is possible to assign more than one Python process to the execution of a Python function in block allocation mode, it is not possible to assign resources during the submission of the function with the `submit()` function. Starting again with the `calc_mpi()` function: ","metadata":{}},{"id":"cb8c4943-4c78-4203-95f2-1db758e588d9","cell_type":"code","source":"def calc_mpi(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank","metadata":{"trusted":true},"outputs":[],"execution_count":14},{"id":"9e1212c4-e3fb-4e21-be43-0a4f0a08b856","cell_type":"markdown","source":"Still the resource dictionary parameter can still be set during the initialisation of the `SingleNodeExecutor` class. Internally, this groups the created Python processes in fixed allocations and afterwards submit Python functions to these allocations.","metadata":{}},{"id":"5ebf7195-58f9-40f2-8203-2d4b9f0e9602","cell_type":"code","source":"with SingleNodeExecutor(max_workers=2, resource_dict={\"cores\": 2}, block_allocation=True) as exe:\n fs = exe.submit(calc_mpi, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":15},{"id":"b75fb95f-f2f5-4be9-9f2a-9c2e9961c644","cell_type":"markdown","source":"The weakness of memory from a previous Python function remaining in the Python process can at the same time be an advantage for working with large datasets. In executorlib this is achieved by introducing the `init_function` parameter. The `init_function` returns a dictionary of parameters which can afterwards be reused as keyword arguments `**kwargs` in the functions submitted to the `Executor`. When block allocation `block_allocation` is disabled this functionality is not available, as each function is executed in a separate process, so no data can be preloaded.","metadata":{}},{"id":"8aa754cc-eb1a-4fa1-bd72-272246df1d2f","cell_type":"code","source":"def init_function():\n return {\"j\": 4, \"k\": 3, \"l\": 2}","metadata":{"trusted":true},"outputs":[],"execution_count":16},{"id":"1854895a-7239-4b30-b60d-cf1a89234464","cell_type":"code","source":"def calc_with_preload(i, j, k):\n return i + j + k","metadata":{"trusted":true},"outputs":[],"execution_count":17},{"id":"d07cf107-3627-4cb0-906c-647497d6e0d2","cell_type":"markdown","source":"The function `calc_with_preload()` requires three inputs `i`, `j` and `k`. But when the function is submitted to the executor only two inputs are provided `fs = exe.submit(calc, 2, j=5)`. In this case the first input parameter is mapped to `i=2`, the second input parameter is specified explicitly `j=5` but the third input parameter `k` is not provided. So the `SingleNodeExecutor` automatically checks the keys set in the `init_function()` function. In this case the returned dictionary `{\"j\": 4, \"k\": 3, \"l\": 2}` defines `j=4`, `k=3` and `l=2`. For this specific call of the `calc_with_preload()` function, `i` and `j` are already provided so `j` is not required, but `k=3` is used from the `init_function()` and as the `calc_with_preload()` function does not define the `l` parameter this one is also ignored.","metadata":{}},{"id":"cc648799-a0c6-4878-a469-97457bce024f","cell_type":"code","source":"with SingleNodeExecutor(max_workers=2, init_function=init_function, block_allocation=True) as exe:\n fs = exe.submit(calc_with_preload, 2, j=5)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"10\n"}],"execution_count":18},{"id":"1073b8ca-1492-46e9-8d1f-f52ad48d28a2","cell_type":"markdown","source":"The result is `2+5+3=10` as `i=2` and `j=5` are provided during the submission and `k=3` is defined in the `init_function()` function.","metadata":{}},{"id":"24397d78-dff1-4834-830c-a8f390fe6b9c","cell_type":"markdown","source":"### Cache\nThe development of scientific workflows is commonly an interactive process, extending the functionality step by step. This lead to the development of interactive environments like [Jupyter](https://jupyter.org) which is fully supported by executorlib. Still many of the computationally intensive Python functions can take in the order of minutes to hours or even longer to execute, so reusing an existing Python process is not feasible. To address this challenge executorlib provides a file based cache to store the results of previously computed [concurrent future Futures](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects. The results are serialized using [cloudpickle](https://github.com/cloudpipe/cloudpickle) and stored in a user-defined cache directory `cache_directory` to be reloaded later on. Internally, the hierarchical data format (HDF5) is used via the [h5py](https://www.h5py.org), which is an optional dependency for executorlib. \n\nThe [h5py](https://www.h5py.org) package is an optional dependency of executorlib. The installation of the [h5py](https://www.h5py.org) package is covered in the installation section. ","metadata":{}},{"id":"ecdcef49-5c89-4538-b377-d53979673bf7","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(cache_directory=\"./file\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[2, 4, 6]\nCPU times: user 84.3 ms, sys: 33.6 ms, total: 118 ms\nWall time: 1.35 s\n"}],"execution_count":19},{"id":"32d0fb2e-5ac1-4249-b6c8-953c92fdfded","cell_type":"markdown","source":"When the same code is executed again, executorlib finds the existing results in the cache directory specified by the `cache_directory` parameter and reloads the result, accelerating the computation especially during the prototyping phase when similar computations are repeated frequently for testing. \n\nStill it is important to mention, that this cache is not designed to identify the submission of the same parameters within the context of one `with`-statement. It is the task of the user to minimize duplicate computations, the cache is only designed to restore previous calculation results when the Python process managing executorlib was stopped after the successful execution. ","metadata":{}},{"id":"c39babe8-4370-4d31-9520-9a7ce63378c8","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(cache_directory=\"./file\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[2, 4, 6]\nCPU times: user 44.2 ms, sys: 15.5 ms, total: 59.7 ms\nWall time: 1.3 s\n"}],"execution_count":20},{"id":"5144a035-633e-4e60-a362-f3b15b28848b","cell_type":"markdown","source":"An additional advantage of the cache is the option to gather the results of previously submitted functions. Using the `get_cache_data()` function the results of each Python function is converted to a dictionary. This list of dictionaries can be converted to a `pandas.DataFrame` for further processing:","metadata":{}},{"id":"f574b9e1-de55-4e38-aef7-a4bed540e040","cell_type":"code","source":"import pandas\nfrom executorlib import get_cache_data\n\ndf = pandas.DataFrame(get_cache_data(cache_directory=\"./file\"))\ndf","metadata":{"trusted":true},"outputs":[{"execution_count":21,"output_type":"execute_result","data":{"text/plain":" function input_args input_kwargs output resource_dict \\\n0 ([2, 2],) {} 4 {} \n1 ([3, 3],) {} 6 {} \n2 ([1, 1],) {} 2 {} \n\n runtime filename \n0 0.910742 /home/jovyan/file/sum89afbdf9da5eb1794f6976a3f... \n1 0.911247 /home/jovyan/file/sum0f7710227cda6456e5d071877... \n2 0.908284 /home/jovyan/file/sumf5ad27b855231a293ddd735a8... ","text/html":"
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
functioninput_argsinput_kwargsoutputresource_dictruntimefilename
0<built-in function sum>([2, 2],){}4{}0.910742/home/jovyan/file/sum89afbdf9da5eb1794f6976a3f...
1<built-in function sum>([3, 3],){}6{}0.911247/home/jovyan/file/sum0f7710227cda6456e5d071877...
2<built-in function sum>([1, 1],){}2{}0.908284/home/jovyan/file/sumf5ad27b855231a293ddd735a8...
\n
"},"metadata":{}}],"execution_count":21},{"id":"68092479-e846-494a-9ac9-d9638b102bd8","cell_type":"markdown","source":"After the development phase is concluded it is the task of the user to remove the cache directory defined with the `cache_directory` parameter. The cache directory is never removed by executorlib to prevent the repeation of expensive computations. Still as disk space on shared file systems in HPC environments is commonly limited it is recommended to remove the cache directory once the development process concluded. ","metadata":{}},{"id":"34a9316d-577f-4a63-af14-736fb4e6b219","cell_type":"code","source":"import os\nimport shutil\n\ncache_dir = \"./file\"\nif os.path.exists(cache_dir):\n print(os.listdir(cache_dir))\n try:\n shutil.rmtree(cache_dir)\n except OSError:\n pass","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"['sum89afbdf9da5eb1794f6976a3f01697c2_o.h5', 'sum0f7710227cda6456e5d07187702313f3_o.h5', 'sumf5ad27b855231a293ddd735a8554c9ea_o.h5']\n"}],"execution_count":22},{"id":"1cea95b5-4110-444c-82af-fa6718bfa17f","cell_type":"markdown","source":"Typically the use of the cache is recommended for development processes only and for production workflows the user should implement their own long-term storage solution. The binary format used by executorlib is based on [cloudpickle](https://github.com/cloudpipe/cloudpickle) and might change in future without further notice, rendering existing data in the cache unusable. Consequently, using the cache beyond the development process is not recommended. In addition the writing of the results to files might result in additional overhead for accessing the shared file system. ","metadata":{}},{"id":"71a8a0be-a933-4e83-9da5-50da35e9975b","cell_type":"markdown","source":"### Dependencies\nMany scientific Python programs consist of series of Python function calls with varying level of parallel computations or map-reduce patterns where the same function is first mapped to a number of parameters and afterwards the results are reduced in a single function. To extend the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) of the Python standard library to support this programming pattern, the `SingleNodeExecutor` class from executorlib supports submitting Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) objects to the `SingleNodeExecutor` which are resolved before submission. So the `SingleNodeExecutor` internally waits until all Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) objects are successfully executed before it triggers the execution of the submitted Python function.","metadata":{}},{"id":"d8b75a26-479d-405e-8895-a8d56b3f0f4b","cell_type":"code","source":"def calc_add(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":23},{"id":"36118ae0-c13c-4f7a-bcd3-3d7f4bb5a078","cell_type":"markdown","source":"For example the function which adds two numbers `calc_add()` is used in a loop which adds a counter to the previous numbers. In the first iteration the `future` parameter is set to `0` but already in the second iteration it is the Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object of the first iteration and so on. \n\nThe important part is that the user does not have to wait until the first function is executed but instead the waiting happens internally in the `SingleNodeExecutor`.","metadata":{}},{"id":"35fd5747-c57d-4926-8d83-d5c55a130ad6","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future = 0\n for i in range(1, 4):\n future = exe.submit(calc_add, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"6\n"}],"execution_count":24},{"id":"38e1bbb3-1028-4f50-93c1-d2427f399a7d","cell_type":"markdown","source":"As the reusing of existing [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object can lead to rather complex dependencies, executorlib provides the option to plot the dependency graph by setting the `plot_dependency_graph=True` during the initialization of the `SingleNodeExecutor` class.\n\nNo computation is executed when the `plot_dependency_graph=True` is set. This parameter is for debugging only. \n\nInternally, the [pygraphviz](https://pygraphviz.github.io/documentation/stable) package is used for the visualisation of these dependency graphs. It is an optional dependency of executorlib. The installation of the [pygraphviz](https://pygraphviz.github.io/documentation/stable) package is covered in the installation section. ","metadata":{}},{"id":"f67470b5-af1d-4add-9de8-7f259ca67324","cell_type":"code","source":"with SingleNodeExecutor(plot_dependency_graph=True) as exe:\n future = 0\n for i in range(1, 4):\n future = exe.submit(calc_add, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"None\n"},{"output_type":"display_data","data":{"text/plain":"","image/svg+xml":"\n\n\n\n\n0\n\ncalc_add\n\n\n\n1\n\ncalc_add\n\n\n\n0->1\n\n\nb\n\n\n\n2\n\ncalc_add\n\n\n\n1->2\n\n\nb\n\n\n\n3\n\n1\n\n\n\n3->0\n\n\na\n\n\n\n4\n\n0\n\n\n\n4->0\n\n\nb\n\n\n\n5\n\n2\n\n\n\n5->1\n\n\na\n\n\n\n6\n\n3\n\n\n\n6->2\n\n\na\n\n\n"},"metadata":{}}],"execution_count":25},{"id":"4c952a9d-2b58-401d-b7ec-fda740db774a","cell_type":"markdown","source":"## Advanced Scheduling\nGoing beyond just directed acyclic graphs (DAG) with one-to-many and many-to-one relationships, executorlib provides a number of advanced scheduling patterns. These are briefly introduced in the following.","metadata":{}},{"id":"4db2c87c-9a7d-4074-82d0-24357fa4f0e6","cell_type":"markdown","source":"### Runtime-dependent Batching \nTo maximize the throughput of dependent calculation tasks its important to idenify all tasks which can be executed at a given moment. Unfortunately, some of these dependencies can only be determined at run time, which is challenging for most schedulers. To demonstrate the runtime-dependent batching in executorlib we discuss the following example. Starting with a group of ten tasks and then grouping them into groups of three for processing. Still the order of the tasks, which tasks belong into which group, is only determined at run time. \n\nFor simplicity, we just use a simple function which directly returns the input.","metadata":{}},{"id":"857a5e0f-50d6-45ec-aac7-a7151f36c19f","cell_type":"code","source":"def reply(i):\n return i","metadata":{"trusted":true},"outputs":[],"execution_count":26},{"id":"544dacab-5601-4a9b-814f-88560eafb079","cell_type":"markdown","source":"After the group of ten tasks is submitted their future objects are stored in a list named `future_individual_lst`. This list is then provided to the `batched()` function of the `SingleNodeExecutor()` to generate batches of tasks which are then provided to the `sum` function for further processing. The results of this second step are stored in the `future_group_lst`. Finally, the results of these future objects are evaluated in the third step. ","metadata":{}},{"id":"17d1354a-0943-4b62-9b0d-7d39c8df23f2","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future_individual_lst = [\n exe.submit(reply, i) for i in range(10)\n ]\n future_group_lst = [\n exe.submit(sum, f) for f in exe.batched(future_individual_lst, n=3)\n ]\n print(sum([f.result() for f in future_group_lst]))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"45\n"}],"execution_count":27},{"id":"80e8b154-d659-4f3e-add2-701a454d770d","cell_type":"markdown","source":"### Split Future Objects\nIn analogy to the `batched()` function which combines multiple future objects in a batch for further processing, it is also necessary to split the future objects even before the evaluation is completed. Executorlib provides two utility functions, namely `split_future()` for tuples and lists and `get_item_from_future()` for dictionaries. \n\nStarting with a function which returns a tuple, named `get_a_tuple()`:","metadata":{}},{"id":"6ef541e3-a2be-4e05-9e77-65eaceff4248","cell_type":"code","source":"def get_a_tuple(i):\n return \"a\", \"b\", i","metadata":{"trusted":true},"outputs":[],"execution_count":28},{"id":"dd3e4312-1594-4b3b-baf3-5b3121ca8910","cell_type":"markdown","source":"This function is submitted to the `SingleNodeExecutor()` and while in this case it directly returns the tuple, the evaluation would commonly take much longer. By having the ability to split the output of the future object using the `split_future()` function, a number of future objects is generated one for each element of the tuple. This is enabled by providing the number of elements in the tuple as an additional parameter `n=3`. ","metadata":{}},{"id":"927c5931-d7fd-4bc1-ae0e-3dd2f4bc99ce","cell_type":"code","source":"from executorlib import split_future","metadata":{"trusted":true},"outputs":[],"execution_count":29},{"id":"64a9b46e-0de6-4abb-99d9-8aaa0c6cbccb","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future = exe.submit(get_a_tuple, 15)\n f1, f2, f3 = split_future(future=future, n=3)\n print(f1.result(), f2.result(), f3.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"a b 15\n"}],"execution_count":30},{"id":"a10d8f90-e790-4708-b193-90a7f014d699","cell_type":"markdown","source":"In analogy, to the `split_future()` function for lists and tuples, the `get_item_from_future()` function returns one item of a dicitionary which is returned by a function submitted to an `Executor()`. In this example the `get_a_dict()` function returns a dictionary, again in this example the dictionary is returned directly while commonly this would take much longer. ","metadata":{}},{"id":"51ec4dbf-d009-41c9-bc04-cf1b16fe782f","cell_type":"code","source":"def get_a_dict(i):\n return {\"a\": 1, \"b\": 2, \"c\": i}","metadata":{"trusted":true},"outputs":[],"execution_count":31},{"id":"5c90ab75-2a6b-4fbe-a7ee-7f91b2b4af43","cell_type":"markdown","source":"The `get_a_dict()` function is submitted to the `SingleNodeExecutor()`, it returns a future object named `future_dict`. Still as we know that the `result()` of this future object `future_dict` returns a dictionary, we can already access the items of this dictionary with the `get_item_from_future()` function. The `get_item_from_future()` function takes a future object as input in addition to the `key` of the dictionary which should be accessed, as a result the `get_item_from_future()` function returns a future object for the value related to the key. In this example these future objects are named `f1`, `f2` and `f3`. These fucture objects are evaluated afterwards.","metadata":{}},{"id":"a41251d2-a840-4c12-9625-c2e0585c489b","cell_type":"code","source":"from executorlib import get_item_from_future","metadata":{"trusted":true},"outputs":[],"execution_count":32},{"id":"a6e75c5e-ad0c-4723-99c5-8125b63fbeaf","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future_dict = exe.submit(get_a_dict, 15)\n f1 = get_item_from_future(future=future_dict, key=\"a\")\n f2 = get_item_from_future(future=future_dict, key=\"b\")\n f3 = get_item_from_future(future=future_dict, key=\"c\")\n print(f1.result(), f2.result(), f3.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"1 2 15\n"}],"execution_count":33},{"id":"a945c98d-dc73-4284-9d8c-52475a760f6b","cell_type":"markdown","source":"### Recursion\nIn addition to the `map()` function for parallel loops and the option to integrate `while` loops directly in the submission, it is sometimes helpful to use recursive algorthims to accelerate scientific simulation and analysis. To demonstrate the use of executorlib in combination with recursive algorithms, the quicksort algorithm is demonstrated. \n\nThe quicksort algorithm is implemented in two parts, a `quick_sort()` which splits the input `sequence` into two sets, one lower and one larger than the pivot element of the `sequence`. After the initial execution the `quick_sort()` function is again applied to both resulting sets until only a single element remains in the `sequence`. In this case the single element is returned. The pivot is defined as the first element of the `sequence`.\n\nTo simplify the submission of the `quick_sort()` function to the `SingleNodeExecutor()` dictionaries are used as return types, these dictionaries either contain only a single item with the key `\"result\"` when only a single element remains in the list, or three items, one `\"left\"` for a list lower than the pivot, one `\"right\"` for the items larger than the pivot and the `\"result\"` for the pivot itself. ","metadata":{}},{"id":"08b0c0a1-34ad-4b2a-847c-fe9c96956b27","cell_type":"code","source":"def quick_sort(sequence):\n length = len(sequence)\n if length <= 1:\n return {\"result\": sequence}\n else:\n pivot = sequence.pop() \n \n greater_items = []\n lesser_items = []\n\n for item in sequence:\n if item > pivot:\n greater_items.append(item)\n else:\n lesser_items.append(item)\n\n return {\"left\": lesser_items, \"right\": greater_items, \"result\": [pivot]}","metadata":{"trusted":true},"outputs":[],"execution_count":34},{"id":"54a8a765-0b9f-424a-86e5-8024c4d59018","cell_type":"markdown","source":"To enable the recursive submission to the `SingleNodeExecutor()` a `recusive_submit()` function is defined using the [asynchronous IO module](https://docs.python.org/3/library/asyncio.html) of the Python standard libary, indicated by the `async` keyword ahead of the function definition. It takes a `function`, the `sequence` and the `executor` as inputs. As a first step the function is submitted to the `executor` and the execution is halted until the first result is available by wrapping the future object using the `wrap_future()` function of the `asyncio` package and appling the `await` function. Then the corresponding result dictionary `result_dict` is evaluated: If the `result_dict` contains more than one key, then the `recusive_submit()` is evaluated for both the left side with lower values than the pivot element and the right side with elements higher than the pivot element. Again in both cases the `await` keyword is used to enable the parallel execution of both branches at the same time. Afterwards the result of both sides is combined with the pivot element. For the case that the dictionary only contains a single element, it is returned directly. ","metadata":{}},{"id":"4e142829-c9de-4969-ab3c-97f3e1ada90c","cell_type":"code","source":"import asyncio\n\nasync def recusive_submit(function, sequence, executor):\n result_dict = await asyncio.wrap_future(exe.submit(function, sequence))\n if len(result_dict) > 1:\n left = await recusive_submit(function=function, sequence=result_dict[\"left\"], executor=executor)\n right = await recusive_submit(function=function, sequence=result_dict[\"right\"], executor=executor)\n return left + result_dict[\"result\"] + right\n else:\n return result_dict[\"result\"]","metadata":{"trusted":true},"outputs":[],"execution_count":35},{"id":"531a8f7d-5b21-46d0-b632-32a1568571c8","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n loop = asyncio.get_event_loop()\n task = loop.create_task(recusive_submit(function=quick_sort, sequence=[0,9,3,8,2,7,5], executor=exe))\n print(await task)","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[0, 2, 3, 5, 7, 8, 9]\n"}],"execution_count":36},{"id":"725c8ac2-27e4-495b-b061-1fd6053f4c0b","cell_type":"markdown","source":"## Testing and Debugging\nThe up-scaling of Python functions from a single workstation to an High Performance Computer (HPC) can be challenging, so executorlib provides a number of debugging utilities to help you optimize your functions for execution with executorlib. ","metadata":{}},{"id":"2c96b460-ebd2-4c8a-a5e1-922a860808ab","cell_type":"markdown","source":"### Measure Data Transferred \nTransferring a large amount of data between two processes requires additional resources so it is helpful to measure the data transferred between the frontend and backend process. This is achieved by setting the `log_obj_size` parameter to `True`:","metadata":{}},{"id":"71905acf-2fef-4738-82ae-89e35e2e3d2d","cell_type":"code","source":"from executorlib import SingleNodeExecutor\n\nwith SingleNodeExecutor(log_obj_size=True) as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stderr","output_type":"stream","text":"Send dictionary of size: 101\nReceived dictionary of size: 59\nSend dictionary of size: 69\nReceived dictionary of size: 58\n"},{"name":"stdout","output_type":"stream","text":"2\n"}],"execution_count":37},{"id":"0e9f7192-2b7d-4caf-b2b8-ae9cb060e90f","cell_type":"markdown","source":"### Write Log Files\nLibraries like executorlib are commonly used to sample a large parameter space, in this case it is possible that out of a large number of parameters one combination throws an error. This error can be logged in a file which also contains the function and input parameters using the `\"error_log_file\"` parameter in the `resource_dict`. This allows to change the log file on a per-function bases.","metadata":{}},{"id":"2810acd5-a46e-4d85-b447-945248ffca15","cell_type":"code","source":"from executorlib import SingleNodeExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":38},{"id":"ef6b87a7-361e-4a3f-bad3-72ad87968e8c","cell_type":"code","source":"def my_funct(i, j): \n if i == 2 and j == 2:\n raise ValueError()\n else: \n return i * j + i + j","metadata":{"trusted":true},"outputs":[],"execution_count":39},{"id":"209ff76b-913a-46f7-9fff-250e207898b2","cell_type":"markdown","source":"A try and except statement is added to prevent the jupyter notebook from crashing:","metadata":{}},{"id":"30381a00-30cc-45a2-82ff-17371339f5c7","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"error_log_file\": \"error.out\"}) as exe:\n future_lst = []\n for i in range(4):\n for j in range(4):\n future_lst.append(exe.submit(my_funct, i=i, j=j))\n try:\n print([f.result() for f in future_lst])\n except ValueError:\n pass","metadata":{"trusted":true},"outputs":[],"execution_count":40},{"id":"36bfc556-aa86-4b50-972b-4b8f68ceec3d","cell_type":"markdown","source":"The content of the log file is a basic text file, so it can be read with any kind of file utility. The important part is that the log file contains not only the error message but in addition also the function name and the input parameters in the case `kwargs: {'i': 2, 'j': 2}` which helps for future debugging of the sampling function.","metadata":{}},{"id":"a61c06fc-3029-48ed-895f-9f6c065b7c47","cell_type":"code","source":"with open(\"error.out\") as f:\n content = f.readlines()","metadata":{"trusted":true},"outputs":[],"execution_count":41},{"id":"6a6cd10f-6fe3-4a17-a8e6-2536feb9a11a","cell_type":"code","source":"content","metadata":{"trusted":true},"outputs":[{"execution_count":42,"output_type":"execute_result","data":{"text/plain":"['function: \\n',\n 'args: ()\\n',\n \"kwargs: {'i': 2, 'j': 2}\\n\",\n 'Traceback (most recent call last):\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/backend/interactive_serial.py\", line 56, in main\\n',\n ' output = call_funct(input_dict=input_dict, funct=None, memory=memory)\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/standalone/interactive/backend.py\", line 33, in call_funct\\n',\n ' return funct(input_dict[\"fn\"], *input_dict[\"args\"], **input_dict[\"kwargs\"])\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/standalone/interactive/backend.py\", line 22, in funct\\n',\n ' return args[0].__call__(*args[1:], **kwargs)\\n',\n ' ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^\\n',\n ' File \"/tmp/ipykernel_463/3167739528.py\", line 3, in my_funct\\n',\n 'ValueError\\n']"},"metadata":{}}],"execution_count":42},{"id":"5aff120a-317f-47d4-9639-8eccfb136117","cell_type":"code","source":"import os\n\nif os.path.exists(\"error.out\"):\n os.remove(\"error.out\")","metadata":{"trusted":true},"outputs":[],"execution_count":43},{"id":"44cd41d7-4417-429e-8481-f2a49e5f769c","cell_type":"markdown","source":"### TestClusterExecutor\nWhile the `SingleNodeExecutor` internally behaves very similar to the `FluxJobExecutor` and `SlurmJobExecutor` the `FluxClusterExecutor` and `SlurmClusterExecutor` behave very different as they use the file system to exchange information rather than socket-based communication. This can lead to complications when it comes to debugging. To address this challenge executorlib provides the `TestClusterExecutor` which can be executed on a local workstation just like the `SingleNodeExecutor` but in the background it uses the same file based communication like the `SlurmClusterExecutor` and the `FluxClusterExecutor`:","metadata":{}},{"id":"2ae29fb0-54e5-468f-8727-a179b6ed363e","cell_type":"code","source":"from executorlib.api import TestClusterExecutor\n\nwith TestClusterExecutor(cache_directory=\"test\") as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\n"}],"execution_count":44}]} \ No newline at end of file From 88075b98d2b5b35444b7ee69782145f9415a40bd Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Thu, 19 Nov 2026 10:53:13 +0100 Subject: [PATCH 5/9] Fix user story link in single node notebook Co-Authored-By: Claude Opus 5.5 --- notebooks/1-single-node.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/1-single-node.ipynb b/notebooks/1-single-node.ipynb index eea360bd..6a279a66 100644 --- a/notebooks/1-single-node.ipynb +++ b/notebooks/1-single-node.ipynb @@ -1 +1 @@ -{"metadata":{"kernelspec":{"display_name":"Python 3 (ipykernel)","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.13.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"6915218e-7cf3-4bf4-9618-7e6942b4762f","cell_type":"markdown","source":"# Single Node Executor\nThe `SingleNodeExecutor` in executorlib, is primarily used to enable rapid prototyping on a workstation computer to test your parallel Python program with executorlib before transferring it to an high performance computer (HPC). With the added capability of executorlib it is typically 10% slower than the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) from the Python standard library on a single node, when all acceleration features are enabled. This overhead is primarily related to the creation of new tasks. So the performance of executorlib improves when the individual Python function calls require extensive computations.\n\nAn advantage that executorlib has over the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) and the [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) from the Python standard libary, is the use of [cloudpickle](https://github.com/cloudpipe/cloudpickle) as serialization backend to transfer Python functions between processes. This enables the use of dynamically defined Python functions for example in the case of a Jupyter notebook. \n\nThe `SingleNodeExecutor` supports the same `submit()` interface, resource dictionary `resource_dict`, dependency handling and cache directory `cache_directory` as the HPC executors. A workflow developed with the `SingleNodeExecutor` can therefore be transferred to an HPC cluster by replacing the executor class and adding the cluster-specific settings. The [user stories](https://executorlib.readthedocs.io/en/latest/story-4-prototype-then-scale.html), starting with [prototyping on a laptop and scaling up](https://executorlib.readthedocs.io/en/latest/story-4-prototype-then-scale.html), demonstrate this transition for typical HPC workflows, while the examples in this chapter can be executed without access to an HPC cluster.","metadata":{}},{"id":"ccc686dd-8fc5-4755-8a19-f40010ebb1b8","cell_type":"markdown","source":"## Basic Functionality\nThe general functionality of executorlib follows the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) of the Python standard library. You can import the `SingleNodeExecutor` class directly from executorlib and then just replace the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) or [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) with the `SingleNodeExecutor` class to start using executorlib.","metadata":{}},{"id":"b1907f12-7378-423b-9b83-1b65fc0a20f5","cell_type":"code","source":"from executorlib import SingleNodeExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":1},{"id":"1654679f-38b3-4699-9bfe-b48cbde0b2db","cell_type":"markdown","source":"It is recommended to use the `SingleNodeExecutor` class in combination with a `with`-statement. This guarantees the processes created by the `SingleNodeExecutor` class to evaluate the Python functions are afterward closed and do not remain ghost processes. A function is then submitted using the `submit(fn, /, *args, **kwargs)` function which executes a given function `fn` as `fn(*args, **kwargs)`. The `submit()` function returns a [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object, as defined by the Python Standard Library. As a first example we submit the function `sum()` to calculate the sum of the list `[1, 1]`:","metadata":{}},{"id":"16f7d138-ed77-45ea-a554-d329f7237500","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\nCPU times: user 35.7 ms, sys: 38.1 ms, total: 73.8 ms\nWall time: 274 ms\n"}],"execution_count":2},{"id":"a1109584-9db2-4f9d-b3ed-494d96241396","cell_type":"markdown","source":"As expected the result of the summation `sum([1, 1])` is `2`. The same result is retrieved from the [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object received from the submission of the `sum()` as it is printed here `print(future.result())`. For most Python functions and especially the `sum()` function it is computationally not efficient to initialize the `SingleNodeExecutor` class only for the execution of a single function call, rather it is more computationally efficient to initialize the `SingleNodeExecutor` class once and then submit a number of functions. This can be achieved with a loop. For example the sum of the pairs `[2, 2]`, `[3, 3]` and `[4, 4]` can be achieved with a for-loop inside the context of the `SingleNodeExecutor()` class as provided by the `with`-statement.","metadata":{}},{"cell_type":"markdown","id":"9d4d4481-b637-4b15-aa14-0de62199411f","metadata":{},"source":["### Understanding Future Objects\n","Each call of the `submit()` function returns immediately - not with the result of the function but with a [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object. A `Future` is a placeholder for a result which is not yet available. The submitted function is executed in the background while the main Python program continues, this is what allows executorlib to evaluate many functions at the same time. The most important methods of a `Future` object are:\n","\n","| Method | Description |\n","|---|---|\n","| `future.result()` | Wait until the function is finished and return its result - or raise the exception if the function failed. |\n","| `future.done()` | Return `True` if the function already finished, without waiting for it. |\n","| `future.cancel()` | Try to cancel the function in case it has not started yet. |\n","\n","The key to parallel execution is to first submit all functions and only afterwards collect the results by calling `result()`. When `result()` is called directly after each `submit()`, the program waits for each function to finish before the next function is submitted, so the functions are executed one after another rather than in parallel. The example below illustrates this: directly after the submission the function is not yet finished, while after requesting the result with `result()` it is."]},{"cell_type":"code","execution_count":null,"id":"b653ab65-b6fb-40a2-999c-fa2a16f5d9aa","metadata":{"trusted":true},"outputs":[],"source":["with SingleNodeExecutor() as exe:\n"," future = exe.submit(sum, [1, 1])\n"," print(\"finished directly after submit:\", future.done())\n"," print(\"result:\", future.result())\n"," print(\"finished after result:\", future.done())"]},{"id":"cfccdf9a-b23b-4814-8c14-36703a8a5f9e","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(2, 5)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[4, 6, 8]\nCPU times: user 36.6 ms, sys: 10 ms, total: 46.6 ms\nWall time: 1.16 s\n"}],"execution_count":3},{"id":"7db58f70-8137-4f1c-a87b-0d282f2bc3c5","cell_type":"markdown","source":"If only the parameters change but the function, which is applied to these parameters, remains the same, like in the case above the `sum()` function is applied to three pairs of parameters, then the `map(fn, *iterables, timeout=None, chunksize=1)` function can be used to map the function to the different sets of parameters - as it is defined in the [Python standard library](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.map). ","metadata":{}},{"id":"abd0beb7-471d-490e-bb9c-96755bd7aacf","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n results = exe.map(sum, [[5, 5], [6, 6], [7, 7]])\n print(list(results))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[10, 12, 14]\nCPU times: user 35.4 ms, sys: 9.3 ms, total: 44.7 ms\nWall time: 1.2 s\n"}],"execution_count":4},{"id":"d07a3314-fbaf-4ff5-98dd-dea62194abcd","cell_type":"markdown","source":"The `map()` function also works naturally with [pandas](https://pandas.pydata.org) DataFrames. Rather than using `DataFrame.apply()` for row-wise operations, `map()` can be used to apply a function to each pair of values from two columns in parallel:","metadata":{}},{"id":"4e7d5ef4-6437-4fa2-b500-19b8cc53f377","cell_type":"code","source":"def sum_df(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":5},{"id":"1428ac7c-dd3c-48db-b41f-4ea975df2d78","cell_type":"code","source":"import pandas\n\ndf = pandas.DataFrame({\"a\": [1, 2, 3], \"b\": [4, 5, 6]})\n\nwith SingleNodeExecutor() as exe:\n df[\"c\"] = list(exe.map(sum_df, df[\"a\"], df[\"b\"]))\n print(df)","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":" a b c\n0 1 4 5\n1 2 5 7\n2 3 6 9\n"}],"execution_count":6},{"id":"ac86bf47-4eb6-4d7c-acae-760b880803a8","cell_type":"markdown","source":"These examples cover the general functionality of the `SingleNodeExecutor` class. Following the [Executor](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) interface as it is defined in the Python standard library.","metadata":{}},{"id":"5de0f0f2-bf5c-46b3-8171-a3a206ce6775","cell_type":"markdown","source":"## Parallel Functions\nWriting parallel software is not trivial. So rather than writing the whole Python program in a parallel way, executorlib allows developers to implement parallel execution on a function by function level. In this way individual functions can be replaced by parallel functions as needed without the need to modify the rest of the program. With the Local Mode executorlib supports two levels of parallel execution, parallel execution based on the Message Passing Interface (MPI) using the [mpi4py](https://mpi4py.readthedocs.io) package, or thread based parallel execution. Both levels of parallelism can be defined inside the function and do not require any modifications to the rest of the Python program. ","metadata":{}},{"id":"dc8e692f-bf6c-4838-bb82-6a6b8454a2e7","cell_type":"markdown","source":"### MPI Parallel Functions\nMPI is the default way to develop parallel programs for HPCs. Still it can be challenging to refactor a previously serial program to efficiently use MPI to achieve optimal computational efficiency for parallel execution, even with libraries like [mpi4py](https://mpi4py.readthedocs.io). To simplify the up-scaling of Python programs executorlib provides the option to use MPI parallel Python code inside a given Python function and then submit this parallel Python function to an `SingleNodeExecutor` for evaluation.\n\nThe following `calc_mpi()` function imports the [mpi4py](https://mpi4py.readthedocs.io) package and then uses the internal functionality of MPI to get the total number of parallel CPU cores in the current MPI group `MPI.COMM_WORLD.Get_size()` and the index of the current processor in the MPI group `MPI.COMM_WORLD.Get_rank()`.\n\nThe [mpi4py](https://mpi4py.readthedocs.io) package is an optional dependency of executorlib. The installation of the [mpi4py](https://mpi4py.readthedocs.io) package is covered in the installation section.","metadata":{}},{"id":"a251d083-489e-41c1-9e49-c86093858006","cell_type":"code","source":"def calc_mpi(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank","metadata":{"trusted":true},"outputs":[],"execution_count":7},{"id":"adbf8a10-04e1-4fd9-8768-4375bcba9ec3","cell_type":"markdown","source":"The computational resources for the execution of the `calc_mpi()` Python function are defined using the resource dictionary parameter `resource_dict={}`. The reseource dictionary can either be provided as additional parameter for the `submit()` function. It is important that the parameter name `resource_dict` is reserved exclusively for the `submit()` function and cannot be used in the function which is submitted, like the `calc_mpi()` function in this example:","metadata":{}},{"id":"266864f1-d29e-4934-9b5d-51f4ffb11f5c","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n fs = exe.submit(calc_mpi, 3, resource_dict={\"cores\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":8},{"id":"3a449e3f-d7a4-4056-a1d0-35dfca4dad22","cell_type":"markdown","source":"Another option is to set the resource dictionary parameter `resource_dict` during the initialization of the `Executor`. In this case it is internally set for every call of the `submit()` function, without the need to specify it again.","metadata":{}},{"id":"cb4ad978-bdf2-47bb-a7df-846641a54ec2","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"cores\": 2}) as exe:\n fs = exe.submit(calc_mpi, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":9},{"id":"c1d1d7b1-64fa-4e47-bbde-2a16036568d6","cell_type":"markdown","source":"In addition, to the compute cores `cores`, the resource dictionary parameter `resource_dict` can also define the threads per core as `threads_per_core`, the GPUs per core as `gpus_per_core`, the working directory with `cwd`, the option to use the OpenMPI oversubscribe feature with `openmpi_oversubscribe` and finally for the [Simple Linux Utility for Resource \nManagement (SLURM)](https://slurm.schedmd.com) queuing system the option to provide additional command line arguments with the `slurm_cmd_args` parameter - [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary).","metadata":{}},{"id":"4f5c5221-d99c-4614-82b1-9d6d3260c1bf","cell_type":"markdown","source":"### Thread Parallel Functions\nAn alternative option of parallelism is [thread based parallelism](https://docs.python.org/3/library/threading.html). executorlib supports thread based parallelism with the `threads_per_core` parameter in the resource dictionary `resource_dict`. Given the [global interpreter lock](https://docs.python.org/3/glossary.html#term-global-interpreter-lock) in the cPython implementation a common application of thread based parallelism in Python is using additional threads in linked libraries. The number of threads is commonly controlled with environment variables like `OMP_NUM_THREADS`, `OPENBLAS_NUM_THREADS`, `MKL_NUM_THREADS`, `VECLIB_MAXIMUM_THREADS` and `NUMEXPR_NUM_THREADS`. Specific libraries might require other environment variables. The environment variables can be set using the environment interface of the Python standard library `os.environ`.","metadata":{}},{"id":"7a7d21f6-9f1a-4f30-8024-9993e156dc75","cell_type":"code","source":"def calc_with_threads(i):\n import os\n\n os.environ[\"OMP_NUM_THREADS\"] = \"2\"\n os.environ[\"OPENBLAS_NUM_THREADS\"] = \"2\"\n os.environ[\"MKL_NUM_THREADS\"] = \"2\"\n os.environ[\"VECLIB_MAXIMUM_THREADS\"] = \"2\"\n os.environ[\"NUMEXPR_NUM_THREADS\"] = \"2\"\n import numpy as np\n\n return i","metadata":{"trusted":true},"outputs":[],"execution_count":10},{"id":"82ed8f46-836c-402e-9363-be6e16c2a0b0","cell_type":"markdown","source":"Again the resource dictionary parameter `resource_dict` can be set either in the `submit()` function:","metadata":{}},{"id":"b8ed330d-ee77-44a0-a02f-670fa945b043","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n fs = exe.submit(calc_with_threads, 3, resource_dict={\"threads_per_core\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"3\n"}],"execution_count":11},{"id":"63222cd5-664b-4aba-a80c-5814166b1239","cell_type":"markdown","source":"Or alternatively, the resource dictionary parameter `resource_dict` can also be set during the initialization of the `Executor` class:","metadata":{}},{"id":"31562f89-c01c-4e7a-bbdd-fa26ca99e68b","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"threads_per_core\": 2}) as exe:\n fs = exe.submit(calc_with_threads, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"3\n"}],"execution_count":12},{"id":"8b78a7b4-066e-4cbc-858e-606c8bbbbf0c","cell_type":"markdown","source":"For most cases MPI based parallelism leads to higher computational efficiency in comparison to thread based parallelism, still the choice of parallelism depends on the specific Python function which should be executed in parallel. Careful benchmarks are required to achieve the optimal performance for a given computational architecture. \n\nBeyond MPI based parallelism and thread based parallelism the [HPC Cluster Executors](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html) and the [HPC Job Executors](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) also provide the option to assign GPUs to the execution of individual Python functions.","metadata":{}},{"id":"ca9bc450-2762-4d49-b7f8-48cc83e068fd","cell_type":"markdown","source":"## Performance Optimization\nThe default settings of executorlib are chosen to favour stability over performance. Consequently, the performance of executorlib can be improved by setting additional parameters. It is commonly recommended to start with an initial implementation based on executorlib and then improve the performance by enabling specialized features.","metadata":{}},{"id":"e9b52ecf-3984-4695-98e7-315aa3712104","cell_type":"markdown","source":"### Block Allocation\nBy default each submitted Python function is executed in a dedicated process. This gurantees that the execution of the submitted Python function starts with a fresh process. Still the initialization of the Python process takes time. Especially when the call of the Python function requires only limited computational resources it makes sense to reuse the existing Python process for the execution of multiple Python functions. In executorlib this functionality is enabled by setting the `block_allocation` parameter to `Ture`. To limit the number of parallel Python processes when using block allocation it is recommended to set the `max_workers` parameter to restrict the number of available computing resources. ","metadata":{}},{"id":"0da4c7d0-2268-4ea8-b62d-5d94c79ebc72","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(max_workers=2, block_allocation=True) as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\nCPU times: user 31.5 ms, sys: 11.5 ms, total: 43 ms\nWall time: 709 ms\n"}],"execution_count":13},{"id":"d38163b3-1c04-431c-964b-2bad4f823a4d","cell_type":"markdown","source":"The same functionality also applies to MPI parallel Python functions. The important part is that while it is possible to assign more than one Python process to the execution of a Python function in block allocation mode, it is not possible to assign resources during the submission of the function with the `submit()` function. Starting again with the `calc_mpi()` function: ","metadata":{}},{"id":"cb8c4943-4c78-4203-95f2-1db758e588d9","cell_type":"code","source":"def calc_mpi(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank","metadata":{"trusted":true},"outputs":[],"execution_count":14},{"id":"9e1212c4-e3fb-4e21-be43-0a4f0a08b856","cell_type":"markdown","source":"Still the resource dictionary parameter can still be set during the initialisation of the `SingleNodeExecutor` class. Internally, this groups the created Python processes in fixed allocations and afterwards submit Python functions to these allocations.","metadata":{}},{"id":"5ebf7195-58f9-40f2-8203-2d4b9f0e9602","cell_type":"code","source":"with SingleNodeExecutor(max_workers=2, resource_dict={\"cores\": 2}, block_allocation=True) as exe:\n fs = exe.submit(calc_mpi, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":15},{"id":"b75fb95f-f2f5-4be9-9f2a-9c2e9961c644","cell_type":"markdown","source":"The weakness of memory from a previous Python function remaining in the Python process can at the same time be an advantage for working with large datasets. In executorlib this is achieved by introducing the `init_function` parameter. The `init_function` returns a dictionary of parameters which can afterwards be reused as keyword arguments `**kwargs` in the functions submitted to the `Executor`. When block allocation `block_allocation` is disabled this functionality is not available, as each function is executed in a separate process, so no data can be preloaded.","metadata":{}},{"id":"8aa754cc-eb1a-4fa1-bd72-272246df1d2f","cell_type":"code","source":"def init_function():\n return {\"j\": 4, \"k\": 3, \"l\": 2}","metadata":{"trusted":true},"outputs":[],"execution_count":16},{"id":"1854895a-7239-4b30-b60d-cf1a89234464","cell_type":"code","source":"def calc_with_preload(i, j, k):\n return i + j + k","metadata":{"trusted":true},"outputs":[],"execution_count":17},{"id":"d07cf107-3627-4cb0-906c-647497d6e0d2","cell_type":"markdown","source":"The function `calc_with_preload()` requires three inputs `i`, `j` and `k`. But when the function is submitted to the executor only two inputs are provided `fs = exe.submit(calc, 2, j=5)`. In this case the first input parameter is mapped to `i=2`, the second input parameter is specified explicitly `j=5` but the third input parameter `k` is not provided. So the `SingleNodeExecutor` automatically checks the keys set in the `init_function()` function. In this case the returned dictionary `{\"j\": 4, \"k\": 3, \"l\": 2}` defines `j=4`, `k=3` and `l=2`. For this specific call of the `calc_with_preload()` function, `i` and `j` are already provided so `j` is not required, but `k=3` is used from the `init_function()` and as the `calc_with_preload()` function does not define the `l` parameter this one is also ignored.","metadata":{}},{"id":"cc648799-a0c6-4878-a469-97457bce024f","cell_type":"code","source":"with SingleNodeExecutor(max_workers=2, init_function=init_function, block_allocation=True) as exe:\n fs = exe.submit(calc_with_preload, 2, j=5)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"10\n"}],"execution_count":18},{"id":"1073b8ca-1492-46e9-8d1f-f52ad48d28a2","cell_type":"markdown","source":"The result is `2+5+3=10` as `i=2` and `j=5` are provided during the submission and `k=3` is defined in the `init_function()` function.","metadata":{}},{"id":"24397d78-dff1-4834-830c-a8f390fe6b9c","cell_type":"markdown","source":"### Cache\nThe development of scientific workflows is commonly an interactive process, extending the functionality step by step. This lead to the development of interactive environments like [Jupyter](https://jupyter.org) which is fully supported by executorlib. Still many of the computationally intensive Python functions can take in the order of minutes to hours or even longer to execute, so reusing an existing Python process is not feasible. To address this challenge executorlib provides a file based cache to store the results of previously computed [concurrent future Futures](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects. The results are serialized using [cloudpickle](https://github.com/cloudpipe/cloudpickle) and stored in a user-defined cache directory `cache_directory` to be reloaded later on. Internally, the hierarchical data format (HDF5) is used via the [h5py](https://www.h5py.org), which is an optional dependency for executorlib. \n\nThe [h5py](https://www.h5py.org) package is an optional dependency of executorlib. The installation of the [h5py](https://www.h5py.org) package is covered in the installation section. ","metadata":{}},{"id":"ecdcef49-5c89-4538-b377-d53979673bf7","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(cache_directory=\"./file\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[2, 4, 6]\nCPU times: user 84.3 ms, sys: 33.6 ms, total: 118 ms\nWall time: 1.35 s\n"}],"execution_count":19},{"id":"32d0fb2e-5ac1-4249-b6c8-953c92fdfded","cell_type":"markdown","source":"When the same code is executed again, executorlib finds the existing results in the cache directory specified by the `cache_directory` parameter and reloads the result, accelerating the computation especially during the prototyping phase when similar computations are repeated frequently for testing. \n\nStill it is important to mention, that this cache is not designed to identify the submission of the same parameters within the context of one `with`-statement. It is the task of the user to minimize duplicate computations, the cache is only designed to restore previous calculation results when the Python process managing executorlib was stopped after the successful execution. ","metadata":{}},{"id":"c39babe8-4370-4d31-9520-9a7ce63378c8","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(cache_directory=\"./file\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[2, 4, 6]\nCPU times: user 44.2 ms, sys: 15.5 ms, total: 59.7 ms\nWall time: 1.3 s\n"}],"execution_count":20},{"id":"5144a035-633e-4e60-a362-f3b15b28848b","cell_type":"markdown","source":"An additional advantage of the cache is the option to gather the results of previously submitted functions. Using the `get_cache_data()` function the results of each Python function is converted to a dictionary. This list of dictionaries can be converted to a `pandas.DataFrame` for further processing:","metadata":{}},{"id":"f574b9e1-de55-4e38-aef7-a4bed540e040","cell_type":"code","source":"import pandas\nfrom executorlib import get_cache_data\n\ndf = pandas.DataFrame(get_cache_data(cache_directory=\"./file\"))\ndf","metadata":{"trusted":true},"outputs":[{"execution_count":21,"output_type":"execute_result","data":{"text/plain":" function input_args input_kwargs output resource_dict \\\n0 ([2, 2],) {} 4 {} \n1 ([3, 3],) {} 6 {} \n2 ([1, 1],) {} 2 {} \n\n runtime filename \n0 0.910742 /home/jovyan/file/sum89afbdf9da5eb1794f6976a3f... \n1 0.911247 /home/jovyan/file/sum0f7710227cda6456e5d071877... \n2 0.908284 /home/jovyan/file/sumf5ad27b855231a293ddd735a8... ","text/html":"
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
functioninput_argsinput_kwargsoutputresource_dictruntimefilename
0<built-in function sum>([2, 2],){}4{}0.910742/home/jovyan/file/sum89afbdf9da5eb1794f6976a3f...
1<built-in function sum>([3, 3],){}6{}0.911247/home/jovyan/file/sum0f7710227cda6456e5d071877...
2<built-in function sum>([1, 1],){}2{}0.908284/home/jovyan/file/sumf5ad27b855231a293ddd735a8...
\n
"},"metadata":{}}],"execution_count":21},{"id":"68092479-e846-494a-9ac9-d9638b102bd8","cell_type":"markdown","source":"After the development phase is concluded it is the task of the user to remove the cache directory defined with the `cache_directory` parameter. The cache directory is never removed by executorlib to prevent the repeation of expensive computations. Still as disk space on shared file systems in HPC environments is commonly limited it is recommended to remove the cache directory once the development process concluded. ","metadata":{}},{"id":"34a9316d-577f-4a63-af14-736fb4e6b219","cell_type":"code","source":"import os\nimport shutil\n\ncache_dir = \"./file\"\nif os.path.exists(cache_dir):\n print(os.listdir(cache_dir))\n try:\n shutil.rmtree(cache_dir)\n except OSError:\n pass","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"['sum89afbdf9da5eb1794f6976a3f01697c2_o.h5', 'sum0f7710227cda6456e5d07187702313f3_o.h5', 'sumf5ad27b855231a293ddd735a8554c9ea_o.h5']\n"}],"execution_count":22},{"id":"1cea95b5-4110-444c-82af-fa6718bfa17f","cell_type":"markdown","source":"Typically the use of the cache is recommended for development processes only and for production workflows the user should implement their own long-term storage solution. The binary format used by executorlib is based on [cloudpickle](https://github.com/cloudpipe/cloudpickle) and might change in future without further notice, rendering existing data in the cache unusable. Consequently, using the cache beyond the development process is not recommended. In addition the writing of the results to files might result in additional overhead for accessing the shared file system. ","metadata":{}},{"id":"71a8a0be-a933-4e83-9da5-50da35e9975b","cell_type":"markdown","source":"### Dependencies\nMany scientific Python programs consist of series of Python function calls with varying level of parallel computations or map-reduce patterns where the same function is first mapped to a number of parameters and afterwards the results are reduced in a single function. To extend the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) of the Python standard library to support this programming pattern, the `SingleNodeExecutor` class from executorlib supports submitting Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) objects to the `SingleNodeExecutor` which are resolved before submission. So the `SingleNodeExecutor` internally waits until all Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) objects are successfully executed before it triggers the execution of the submitted Python function.","metadata":{}},{"id":"d8b75a26-479d-405e-8895-a8d56b3f0f4b","cell_type":"code","source":"def calc_add(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":23},{"id":"36118ae0-c13c-4f7a-bcd3-3d7f4bb5a078","cell_type":"markdown","source":"For example the function which adds two numbers `calc_add()` is used in a loop which adds a counter to the previous numbers. In the first iteration the `future` parameter is set to `0` but already in the second iteration it is the Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object of the first iteration and so on. \n\nThe important part is that the user does not have to wait until the first function is executed but instead the waiting happens internally in the `SingleNodeExecutor`.","metadata":{}},{"id":"35fd5747-c57d-4926-8d83-d5c55a130ad6","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future = 0\n for i in range(1, 4):\n future = exe.submit(calc_add, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"6\n"}],"execution_count":24},{"id":"38e1bbb3-1028-4f50-93c1-d2427f399a7d","cell_type":"markdown","source":"As the reusing of existing [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object can lead to rather complex dependencies, executorlib provides the option to plot the dependency graph by setting the `plot_dependency_graph=True` during the initialization of the `SingleNodeExecutor` class.\n\nNo computation is executed when the `plot_dependency_graph=True` is set. This parameter is for debugging only. \n\nInternally, the [pygraphviz](https://pygraphviz.github.io/documentation/stable) package is used for the visualisation of these dependency graphs. It is an optional dependency of executorlib. The installation of the [pygraphviz](https://pygraphviz.github.io/documentation/stable) package is covered in the installation section. ","metadata":{}},{"id":"f67470b5-af1d-4add-9de8-7f259ca67324","cell_type":"code","source":"with SingleNodeExecutor(plot_dependency_graph=True) as exe:\n future = 0\n for i in range(1, 4):\n future = exe.submit(calc_add, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"None\n"},{"output_type":"display_data","data":{"text/plain":"","image/svg+xml":"\n\n\n\n\n0\n\ncalc_add\n\n\n\n1\n\ncalc_add\n\n\n\n0->1\n\n\nb\n\n\n\n2\n\ncalc_add\n\n\n\n1->2\n\n\nb\n\n\n\n3\n\n1\n\n\n\n3->0\n\n\na\n\n\n\n4\n\n0\n\n\n\n4->0\n\n\nb\n\n\n\n5\n\n2\n\n\n\n5->1\n\n\na\n\n\n\n6\n\n3\n\n\n\n6->2\n\n\na\n\n\n"},"metadata":{}}],"execution_count":25},{"id":"4c952a9d-2b58-401d-b7ec-fda740db774a","cell_type":"markdown","source":"## Advanced Scheduling\nGoing beyond just directed acyclic graphs (DAG) with one-to-many and many-to-one relationships, executorlib provides a number of advanced scheduling patterns. These are briefly introduced in the following.","metadata":{}},{"id":"4db2c87c-9a7d-4074-82d0-24357fa4f0e6","cell_type":"markdown","source":"### Runtime-dependent Batching \nTo maximize the throughput of dependent calculation tasks its important to idenify all tasks which can be executed at a given moment. Unfortunately, some of these dependencies can only be determined at run time, which is challenging for most schedulers. To demonstrate the runtime-dependent batching in executorlib we discuss the following example. Starting with a group of ten tasks and then grouping them into groups of three for processing. Still the order of the tasks, which tasks belong into which group, is only determined at run time. \n\nFor simplicity, we just use a simple function which directly returns the input.","metadata":{}},{"id":"857a5e0f-50d6-45ec-aac7-a7151f36c19f","cell_type":"code","source":"def reply(i):\n return i","metadata":{"trusted":true},"outputs":[],"execution_count":26},{"id":"544dacab-5601-4a9b-814f-88560eafb079","cell_type":"markdown","source":"After the group of ten tasks is submitted their future objects are stored in a list named `future_individual_lst`. This list is then provided to the `batched()` function of the `SingleNodeExecutor()` to generate batches of tasks which are then provided to the `sum` function for further processing. The results of this second step are stored in the `future_group_lst`. Finally, the results of these future objects are evaluated in the third step. ","metadata":{}},{"id":"17d1354a-0943-4b62-9b0d-7d39c8df23f2","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future_individual_lst = [\n exe.submit(reply, i) for i in range(10)\n ]\n future_group_lst = [\n exe.submit(sum, f) for f in exe.batched(future_individual_lst, n=3)\n ]\n print(sum([f.result() for f in future_group_lst]))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"45\n"}],"execution_count":27},{"id":"80e8b154-d659-4f3e-add2-701a454d770d","cell_type":"markdown","source":"### Split Future Objects\nIn analogy to the `batched()` function which combines multiple future objects in a batch for further processing, it is also necessary to split the future objects even before the evaluation is completed. Executorlib provides two utility functions, namely `split_future()` for tuples and lists and `get_item_from_future()` for dictionaries. \n\nStarting with a function which returns a tuple, named `get_a_tuple()`:","metadata":{}},{"id":"6ef541e3-a2be-4e05-9e77-65eaceff4248","cell_type":"code","source":"def get_a_tuple(i):\n return \"a\", \"b\", i","metadata":{"trusted":true},"outputs":[],"execution_count":28},{"id":"dd3e4312-1594-4b3b-baf3-5b3121ca8910","cell_type":"markdown","source":"This function is submitted to the `SingleNodeExecutor()` and while in this case it directly returns the tuple, the evaluation would commonly take much longer. By having the ability to split the output of the future object using the `split_future()` function, a number of future objects is generated one for each element of the tuple. This is enabled by providing the number of elements in the tuple as an additional parameter `n=3`. ","metadata":{}},{"id":"927c5931-d7fd-4bc1-ae0e-3dd2f4bc99ce","cell_type":"code","source":"from executorlib import split_future","metadata":{"trusted":true},"outputs":[],"execution_count":29},{"id":"64a9b46e-0de6-4abb-99d9-8aaa0c6cbccb","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future = exe.submit(get_a_tuple, 15)\n f1, f2, f3 = split_future(future=future, n=3)\n print(f1.result(), f2.result(), f3.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"a b 15\n"}],"execution_count":30},{"id":"a10d8f90-e790-4708-b193-90a7f014d699","cell_type":"markdown","source":"In analogy, to the `split_future()` function for lists and tuples, the `get_item_from_future()` function returns one item of a dicitionary which is returned by a function submitted to an `Executor()`. In this example the `get_a_dict()` function returns a dictionary, again in this example the dictionary is returned directly while commonly this would take much longer. ","metadata":{}},{"id":"51ec4dbf-d009-41c9-bc04-cf1b16fe782f","cell_type":"code","source":"def get_a_dict(i):\n return {\"a\": 1, \"b\": 2, \"c\": i}","metadata":{"trusted":true},"outputs":[],"execution_count":31},{"id":"5c90ab75-2a6b-4fbe-a7ee-7f91b2b4af43","cell_type":"markdown","source":"The `get_a_dict()` function is submitted to the `SingleNodeExecutor()`, it returns a future object named `future_dict`. Still as we know that the `result()` of this future object `future_dict` returns a dictionary, we can already access the items of this dictionary with the `get_item_from_future()` function. The `get_item_from_future()` function takes a future object as input in addition to the `key` of the dictionary which should be accessed, as a result the `get_item_from_future()` function returns a future object for the value related to the key. In this example these future objects are named `f1`, `f2` and `f3`. These fucture objects are evaluated afterwards.","metadata":{}},{"id":"a41251d2-a840-4c12-9625-c2e0585c489b","cell_type":"code","source":"from executorlib import get_item_from_future","metadata":{"trusted":true},"outputs":[],"execution_count":32},{"id":"a6e75c5e-ad0c-4723-99c5-8125b63fbeaf","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future_dict = exe.submit(get_a_dict, 15)\n f1 = get_item_from_future(future=future_dict, key=\"a\")\n f2 = get_item_from_future(future=future_dict, key=\"b\")\n f3 = get_item_from_future(future=future_dict, key=\"c\")\n print(f1.result(), f2.result(), f3.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"1 2 15\n"}],"execution_count":33},{"id":"a945c98d-dc73-4284-9d8c-52475a760f6b","cell_type":"markdown","source":"### Recursion\nIn addition to the `map()` function for parallel loops and the option to integrate `while` loops directly in the submission, it is sometimes helpful to use recursive algorthims to accelerate scientific simulation and analysis. To demonstrate the use of executorlib in combination with recursive algorithms, the quicksort algorithm is demonstrated. \n\nThe quicksort algorithm is implemented in two parts, a `quick_sort()` which splits the input `sequence` into two sets, one lower and one larger than the pivot element of the `sequence`. After the initial execution the `quick_sort()` function is again applied to both resulting sets until only a single element remains in the `sequence`. In this case the single element is returned. The pivot is defined as the first element of the `sequence`.\n\nTo simplify the submission of the `quick_sort()` function to the `SingleNodeExecutor()` dictionaries are used as return types, these dictionaries either contain only a single item with the key `\"result\"` when only a single element remains in the list, or three items, one `\"left\"` for a list lower than the pivot, one `\"right\"` for the items larger than the pivot and the `\"result\"` for the pivot itself. ","metadata":{}},{"id":"08b0c0a1-34ad-4b2a-847c-fe9c96956b27","cell_type":"code","source":"def quick_sort(sequence):\n length = len(sequence)\n if length <= 1:\n return {\"result\": sequence}\n else:\n pivot = sequence.pop() \n \n greater_items = []\n lesser_items = []\n\n for item in sequence:\n if item > pivot:\n greater_items.append(item)\n else:\n lesser_items.append(item)\n\n return {\"left\": lesser_items, \"right\": greater_items, \"result\": [pivot]}","metadata":{"trusted":true},"outputs":[],"execution_count":34},{"id":"54a8a765-0b9f-424a-86e5-8024c4d59018","cell_type":"markdown","source":"To enable the recursive submission to the `SingleNodeExecutor()` a `recusive_submit()` function is defined using the [asynchronous IO module](https://docs.python.org/3/library/asyncio.html) of the Python standard libary, indicated by the `async` keyword ahead of the function definition. It takes a `function`, the `sequence` and the `executor` as inputs. As a first step the function is submitted to the `executor` and the execution is halted until the first result is available by wrapping the future object using the `wrap_future()` function of the `asyncio` package and appling the `await` function. Then the corresponding result dictionary `result_dict` is evaluated: If the `result_dict` contains more than one key, then the `recusive_submit()` is evaluated for both the left side with lower values than the pivot element and the right side with elements higher than the pivot element. Again in both cases the `await` keyword is used to enable the parallel execution of both branches at the same time. Afterwards the result of both sides is combined with the pivot element. For the case that the dictionary only contains a single element, it is returned directly. ","metadata":{}},{"id":"4e142829-c9de-4969-ab3c-97f3e1ada90c","cell_type":"code","source":"import asyncio\n\nasync def recusive_submit(function, sequence, executor):\n result_dict = await asyncio.wrap_future(exe.submit(function, sequence))\n if len(result_dict) > 1:\n left = await recusive_submit(function=function, sequence=result_dict[\"left\"], executor=executor)\n right = await recusive_submit(function=function, sequence=result_dict[\"right\"], executor=executor)\n return left + result_dict[\"result\"] + right\n else:\n return result_dict[\"result\"]","metadata":{"trusted":true},"outputs":[],"execution_count":35},{"id":"531a8f7d-5b21-46d0-b632-32a1568571c8","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n loop = asyncio.get_event_loop()\n task = loop.create_task(recusive_submit(function=quick_sort, sequence=[0,9,3,8,2,7,5], executor=exe))\n print(await task)","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[0, 2, 3, 5, 7, 8, 9]\n"}],"execution_count":36},{"id":"725c8ac2-27e4-495b-b061-1fd6053f4c0b","cell_type":"markdown","source":"## Testing and Debugging\nThe up-scaling of Python functions from a single workstation to an High Performance Computer (HPC) can be challenging, so executorlib provides a number of debugging utilities to help you optimize your functions for execution with executorlib. ","metadata":{}},{"id":"2c96b460-ebd2-4c8a-a5e1-922a860808ab","cell_type":"markdown","source":"### Measure Data Transferred \nTransferring a large amount of data between two processes requires additional resources so it is helpful to measure the data transferred between the frontend and backend process. This is achieved by setting the `log_obj_size` parameter to `True`:","metadata":{}},{"id":"71905acf-2fef-4738-82ae-89e35e2e3d2d","cell_type":"code","source":"from executorlib import SingleNodeExecutor\n\nwith SingleNodeExecutor(log_obj_size=True) as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stderr","output_type":"stream","text":"Send dictionary of size: 101\nReceived dictionary of size: 59\nSend dictionary of size: 69\nReceived dictionary of size: 58\n"},{"name":"stdout","output_type":"stream","text":"2\n"}],"execution_count":37},{"id":"0e9f7192-2b7d-4caf-b2b8-ae9cb060e90f","cell_type":"markdown","source":"### Write Log Files\nLibraries like executorlib are commonly used to sample a large parameter space, in this case it is possible that out of a large number of parameters one combination throws an error. This error can be logged in a file which also contains the function and input parameters using the `\"error_log_file\"` parameter in the `resource_dict`. This allows to change the log file on a per-function bases.","metadata":{}},{"id":"2810acd5-a46e-4d85-b447-945248ffca15","cell_type":"code","source":"from executorlib import SingleNodeExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":38},{"id":"ef6b87a7-361e-4a3f-bad3-72ad87968e8c","cell_type":"code","source":"def my_funct(i, j): \n if i == 2 and j == 2:\n raise ValueError()\n else: \n return i * j + i + j","metadata":{"trusted":true},"outputs":[],"execution_count":39},{"id":"209ff76b-913a-46f7-9fff-250e207898b2","cell_type":"markdown","source":"A try and except statement is added to prevent the jupyter notebook from crashing:","metadata":{}},{"id":"30381a00-30cc-45a2-82ff-17371339f5c7","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"error_log_file\": \"error.out\"}) as exe:\n future_lst = []\n for i in range(4):\n for j in range(4):\n future_lst.append(exe.submit(my_funct, i=i, j=j))\n try:\n print([f.result() for f in future_lst])\n except ValueError:\n pass","metadata":{"trusted":true},"outputs":[],"execution_count":40},{"id":"36bfc556-aa86-4b50-972b-4b8f68ceec3d","cell_type":"markdown","source":"The content of the log file is a basic text file, so it can be read with any kind of file utility. The important part is that the log file contains not only the error message but in addition also the function name and the input parameters in the case `kwargs: {'i': 2, 'j': 2}` which helps for future debugging of the sampling function.","metadata":{}},{"id":"a61c06fc-3029-48ed-895f-9f6c065b7c47","cell_type":"code","source":"with open(\"error.out\") as f:\n content = f.readlines()","metadata":{"trusted":true},"outputs":[],"execution_count":41},{"id":"6a6cd10f-6fe3-4a17-a8e6-2536feb9a11a","cell_type":"code","source":"content","metadata":{"trusted":true},"outputs":[{"execution_count":42,"output_type":"execute_result","data":{"text/plain":"['function: \\n',\n 'args: ()\\n',\n \"kwargs: {'i': 2, 'j': 2}\\n\",\n 'Traceback (most recent call last):\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/backend/interactive_serial.py\", line 56, in main\\n',\n ' output = call_funct(input_dict=input_dict, funct=None, memory=memory)\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/standalone/interactive/backend.py\", line 33, in call_funct\\n',\n ' return funct(input_dict[\"fn\"], *input_dict[\"args\"], **input_dict[\"kwargs\"])\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/standalone/interactive/backend.py\", line 22, in funct\\n',\n ' return args[0].__call__(*args[1:], **kwargs)\\n',\n ' ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^\\n',\n ' File \"/tmp/ipykernel_463/3167739528.py\", line 3, in my_funct\\n',\n 'ValueError\\n']"},"metadata":{}}],"execution_count":42},{"id":"5aff120a-317f-47d4-9639-8eccfb136117","cell_type":"code","source":"import os\n\nif os.path.exists(\"error.out\"):\n os.remove(\"error.out\")","metadata":{"trusted":true},"outputs":[],"execution_count":43},{"id":"44cd41d7-4417-429e-8481-f2a49e5f769c","cell_type":"markdown","source":"### TestClusterExecutor\nWhile the `SingleNodeExecutor` internally behaves very similar to the `FluxJobExecutor` and `SlurmJobExecutor` the `FluxClusterExecutor` and `SlurmClusterExecutor` behave very different as they use the file system to exchange information rather than socket-based communication. This can lead to complications when it comes to debugging. To address this challenge executorlib provides the `TestClusterExecutor` which can be executed on a local workstation just like the `SingleNodeExecutor` but in the background it uses the same file based communication like the `SlurmClusterExecutor` and the `FluxClusterExecutor`:","metadata":{}},{"id":"2ae29fb0-54e5-468f-8727-a179b6ed363e","cell_type":"code","source":"from executorlib.api import TestClusterExecutor\n\nwith TestClusterExecutor(cache_directory=\"test\") as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\n"}],"execution_count":44}]} \ No newline at end of file +{"metadata":{"kernelspec":{"display_name":"Python 3 (ipykernel)","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.13.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"6915218e-7cf3-4bf4-9618-7e6942b4762f","cell_type":"markdown","source":"# Single Node Executor\nThe `SingleNodeExecutor` in executorlib, is primarily used to enable rapid prototyping on a workstation computer to test your parallel Python program with executorlib before transferring it to an high performance computer (HPC). With the added capability of executorlib it is typically 10% slower than the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) from the Python standard library on a single node, when all acceleration features are enabled. This overhead is primarily related to the creation of new tasks. So the performance of executorlib improves when the individual Python function calls require extensive computations.\n\nAn advantage that executorlib has over the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) and the [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) from the Python standard libary, is the use of [cloudpickle](https://github.com/cloudpipe/cloudpickle) as serialization backend to transfer Python functions between processes. This enables the use of dynamically defined Python functions for example in the case of a Jupyter notebook. \n\nThe `SingleNodeExecutor` supports the same `submit()` interface, resource dictionary `resource_dict`, dependency handling and cache directory `cache_directory` as the HPC executors. A workflow developed with the `SingleNodeExecutor` can therefore be transferred to an HPC cluster by replacing the executor class and adding the cluster-specific settings. The [user stories](https://executorlib.readthedocs.io/en/latest/story-1-submit-and-reconnect.html), in particular [prototyping on a laptop and scaling up](https://executorlib.readthedocs.io/en/latest/story-4-prototype-then-scale.html), demonstrate this transition for typical HPC workflows, while the examples in this chapter can be executed without access to an HPC cluster.","metadata":{}},{"id":"ccc686dd-8fc5-4755-8a19-f40010ebb1b8","cell_type":"markdown","source":"## Basic Functionality\nThe general functionality of executorlib follows the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) of the Python standard library. You can import the `SingleNodeExecutor` class directly from executorlib and then just replace the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) or [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) with the `SingleNodeExecutor` class to start using executorlib.","metadata":{}},{"id":"b1907f12-7378-423b-9b83-1b65fc0a20f5","cell_type":"code","source":"from executorlib import SingleNodeExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":1},{"id":"1654679f-38b3-4699-9bfe-b48cbde0b2db","cell_type":"markdown","source":"It is recommended to use the `SingleNodeExecutor` class in combination with a `with`-statement. This guarantees the processes created by the `SingleNodeExecutor` class to evaluate the Python functions are afterward closed and do not remain ghost processes. A function is then submitted using the `submit(fn, /, *args, **kwargs)` function which executes a given function `fn` as `fn(*args, **kwargs)`. The `submit()` function returns a [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object, as defined by the Python Standard Library. As a first example we submit the function `sum()` to calculate the sum of the list `[1, 1]`:","metadata":{}},{"id":"16f7d138-ed77-45ea-a554-d329f7237500","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\nCPU times: user 35.7 ms, sys: 38.1 ms, total: 73.8 ms\nWall time: 274 ms\n"}],"execution_count":2},{"id":"a1109584-9db2-4f9d-b3ed-494d96241396","cell_type":"markdown","source":"As expected the result of the summation `sum([1, 1])` is `2`. The same result is retrieved from the [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object received from the submission of the `sum()` as it is printed here `print(future.result())`. For most Python functions and especially the `sum()` function it is computationally not efficient to initialize the `SingleNodeExecutor` class only for the execution of a single function call, rather it is more computationally efficient to initialize the `SingleNodeExecutor` class once and then submit a number of functions. This can be achieved with a loop. For example the sum of the pairs `[2, 2]`, `[3, 3]` and `[4, 4]` can be achieved with a for-loop inside the context of the `SingleNodeExecutor()` class as provided by the `with`-statement.","metadata":{}},{"cell_type":"markdown","id":"9d4d4481-b637-4b15-aa14-0de62199411f","metadata":{},"source":["### Understanding Future Objects\n","Each call of the `submit()` function returns immediately - not with the result of the function but with a [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object. A `Future` is a placeholder for a result which is not yet available. The submitted function is executed in the background while the main Python program continues, this is what allows executorlib to evaluate many functions at the same time. The most important methods of a `Future` object are:\n","\n","| Method | Description |\n","|---|---|\n","| `future.result()` | Wait until the function is finished and return its result - or raise the exception if the function failed. |\n","| `future.done()` | Return `True` if the function already finished, without waiting for it. |\n","| `future.cancel()` | Try to cancel the function in case it has not started yet. |\n","\n","The key to parallel execution is to first submit all functions and only afterwards collect the results by calling `result()`. When `result()` is called directly after each `submit()`, the program waits for each function to finish before the next function is submitted, so the functions are executed one after another rather than in parallel. The example below illustrates this: directly after the submission the function is not yet finished, while after requesting the result with `result()` it is."]},{"cell_type":"code","execution_count":null,"id":"b653ab65-b6fb-40a2-999c-fa2a16f5d9aa","metadata":{"trusted":true},"outputs":[],"source":["with SingleNodeExecutor() as exe:\n"," future = exe.submit(sum, [1, 1])\n"," print(\"finished directly after submit:\", future.done())\n"," print(\"result:\", future.result())\n"," print(\"finished after result:\", future.done())"]},{"id":"cfccdf9a-b23b-4814-8c14-36703a8a5f9e","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(2, 5)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[4, 6, 8]\nCPU times: user 36.6 ms, sys: 10 ms, total: 46.6 ms\nWall time: 1.16 s\n"}],"execution_count":3},{"id":"7db58f70-8137-4f1c-a87b-0d282f2bc3c5","cell_type":"markdown","source":"If only the parameters change but the function, which is applied to these parameters, remains the same, like in the case above the `sum()` function is applied to three pairs of parameters, then the `map(fn, *iterables, timeout=None, chunksize=1)` function can be used to map the function to the different sets of parameters - as it is defined in the [Python standard library](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.map). ","metadata":{}},{"id":"abd0beb7-471d-490e-bb9c-96755bd7aacf","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n results = exe.map(sum, [[5, 5], [6, 6], [7, 7]])\n print(list(results))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[10, 12, 14]\nCPU times: user 35.4 ms, sys: 9.3 ms, total: 44.7 ms\nWall time: 1.2 s\n"}],"execution_count":4},{"id":"d07a3314-fbaf-4ff5-98dd-dea62194abcd","cell_type":"markdown","source":"The `map()` function also works naturally with [pandas](https://pandas.pydata.org) DataFrames. Rather than using `DataFrame.apply()` for row-wise operations, `map()` can be used to apply a function to each pair of values from two columns in parallel:","metadata":{}},{"id":"4e7d5ef4-6437-4fa2-b500-19b8cc53f377","cell_type":"code","source":"def sum_df(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":5},{"id":"1428ac7c-dd3c-48db-b41f-4ea975df2d78","cell_type":"code","source":"import pandas\n\ndf = pandas.DataFrame({\"a\": [1, 2, 3], \"b\": [4, 5, 6]})\n\nwith SingleNodeExecutor() as exe:\n df[\"c\"] = list(exe.map(sum_df, df[\"a\"], df[\"b\"]))\n print(df)","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":" a b c\n0 1 4 5\n1 2 5 7\n2 3 6 9\n"}],"execution_count":6},{"id":"ac86bf47-4eb6-4d7c-acae-760b880803a8","cell_type":"markdown","source":"These examples cover the general functionality of the `SingleNodeExecutor` class. Following the [Executor](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) interface as it is defined in the Python standard library.","metadata":{}},{"id":"5de0f0f2-bf5c-46b3-8171-a3a206ce6775","cell_type":"markdown","source":"## Parallel Functions\nWriting parallel software is not trivial. So rather than writing the whole Python program in a parallel way, executorlib allows developers to implement parallel execution on a function by function level. In this way individual functions can be replaced by parallel functions as needed without the need to modify the rest of the program. With the Local Mode executorlib supports two levels of parallel execution, parallel execution based on the Message Passing Interface (MPI) using the [mpi4py](https://mpi4py.readthedocs.io) package, or thread based parallel execution. Both levels of parallelism can be defined inside the function and do not require any modifications to the rest of the Python program. ","metadata":{}},{"id":"dc8e692f-bf6c-4838-bb82-6a6b8454a2e7","cell_type":"markdown","source":"### MPI Parallel Functions\nMPI is the default way to develop parallel programs for HPCs. Still it can be challenging to refactor a previously serial program to efficiently use MPI to achieve optimal computational efficiency for parallel execution, even with libraries like [mpi4py](https://mpi4py.readthedocs.io). To simplify the up-scaling of Python programs executorlib provides the option to use MPI parallel Python code inside a given Python function and then submit this parallel Python function to an `SingleNodeExecutor` for evaluation.\n\nThe following `calc_mpi()` function imports the [mpi4py](https://mpi4py.readthedocs.io) package and then uses the internal functionality of MPI to get the total number of parallel CPU cores in the current MPI group `MPI.COMM_WORLD.Get_size()` and the index of the current processor in the MPI group `MPI.COMM_WORLD.Get_rank()`.\n\nThe [mpi4py](https://mpi4py.readthedocs.io) package is an optional dependency of executorlib. The installation of the [mpi4py](https://mpi4py.readthedocs.io) package is covered in the installation section.","metadata":{}},{"id":"a251d083-489e-41c1-9e49-c86093858006","cell_type":"code","source":"def calc_mpi(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank","metadata":{"trusted":true},"outputs":[],"execution_count":7},{"id":"adbf8a10-04e1-4fd9-8768-4375bcba9ec3","cell_type":"markdown","source":"The computational resources for the execution of the `calc_mpi()` Python function are defined using the resource dictionary parameter `resource_dict={}`. The reseource dictionary can either be provided as additional parameter for the `submit()` function. It is important that the parameter name `resource_dict` is reserved exclusively for the `submit()` function and cannot be used in the function which is submitted, like the `calc_mpi()` function in this example:","metadata":{}},{"id":"266864f1-d29e-4934-9b5d-51f4ffb11f5c","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n fs = exe.submit(calc_mpi, 3, resource_dict={\"cores\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":8},{"id":"3a449e3f-d7a4-4056-a1d0-35dfca4dad22","cell_type":"markdown","source":"Another option is to set the resource dictionary parameter `resource_dict` during the initialization of the `Executor`. In this case it is internally set for every call of the `submit()` function, without the need to specify it again.","metadata":{}},{"id":"cb4ad978-bdf2-47bb-a7df-846641a54ec2","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"cores\": 2}) as exe:\n fs = exe.submit(calc_mpi, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":9},{"id":"c1d1d7b1-64fa-4e47-bbde-2a16036568d6","cell_type":"markdown","source":"In addition, to the compute cores `cores`, the resource dictionary parameter `resource_dict` can also define the threads per core as `threads_per_core`, the GPUs per core as `gpus_per_core`, the working directory with `cwd`, the option to use the OpenMPI oversubscribe feature with `openmpi_oversubscribe` and finally for the [Simple Linux Utility for Resource \nManagement (SLURM)](https://slurm.schedmd.com) queuing system the option to provide additional command line arguments with the `slurm_cmd_args` parameter - [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary).","metadata":{}},{"id":"4f5c5221-d99c-4614-82b1-9d6d3260c1bf","cell_type":"markdown","source":"### Thread Parallel Functions\nAn alternative option of parallelism is [thread based parallelism](https://docs.python.org/3/library/threading.html). executorlib supports thread based parallelism with the `threads_per_core` parameter in the resource dictionary `resource_dict`. Given the [global interpreter lock](https://docs.python.org/3/glossary.html#term-global-interpreter-lock) in the cPython implementation a common application of thread based parallelism in Python is using additional threads in linked libraries. The number of threads is commonly controlled with environment variables like `OMP_NUM_THREADS`, `OPENBLAS_NUM_THREADS`, `MKL_NUM_THREADS`, `VECLIB_MAXIMUM_THREADS` and `NUMEXPR_NUM_THREADS`. Specific libraries might require other environment variables. The environment variables can be set using the environment interface of the Python standard library `os.environ`.","metadata":{}},{"id":"7a7d21f6-9f1a-4f30-8024-9993e156dc75","cell_type":"code","source":"def calc_with_threads(i):\n import os\n\n os.environ[\"OMP_NUM_THREADS\"] = \"2\"\n os.environ[\"OPENBLAS_NUM_THREADS\"] = \"2\"\n os.environ[\"MKL_NUM_THREADS\"] = \"2\"\n os.environ[\"VECLIB_MAXIMUM_THREADS\"] = \"2\"\n os.environ[\"NUMEXPR_NUM_THREADS\"] = \"2\"\n import numpy as np\n\n return i","metadata":{"trusted":true},"outputs":[],"execution_count":10},{"id":"82ed8f46-836c-402e-9363-be6e16c2a0b0","cell_type":"markdown","source":"Again the resource dictionary parameter `resource_dict` can be set either in the `submit()` function:","metadata":{}},{"id":"b8ed330d-ee77-44a0-a02f-670fa945b043","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n fs = exe.submit(calc_with_threads, 3, resource_dict={\"threads_per_core\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"3\n"}],"execution_count":11},{"id":"63222cd5-664b-4aba-a80c-5814166b1239","cell_type":"markdown","source":"Or alternatively, the resource dictionary parameter `resource_dict` can also be set during the initialization of the `Executor` class:","metadata":{}},{"id":"31562f89-c01c-4e7a-bbdd-fa26ca99e68b","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"threads_per_core\": 2}) as exe:\n fs = exe.submit(calc_with_threads, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"3\n"}],"execution_count":12},{"id":"8b78a7b4-066e-4cbc-858e-606c8bbbbf0c","cell_type":"markdown","source":"For most cases MPI based parallelism leads to higher computational efficiency in comparison to thread based parallelism, still the choice of parallelism depends on the specific Python function which should be executed in parallel. Careful benchmarks are required to achieve the optimal performance for a given computational architecture. \n\nBeyond MPI based parallelism and thread based parallelism the [HPC Cluster Executors](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html) and the [HPC Job Executors](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) also provide the option to assign GPUs to the execution of individual Python functions.","metadata":{}},{"id":"ca9bc450-2762-4d49-b7f8-48cc83e068fd","cell_type":"markdown","source":"## Performance Optimization\nThe default settings of executorlib are chosen to favour stability over performance. Consequently, the performance of executorlib can be improved by setting additional parameters. It is commonly recommended to start with an initial implementation based on executorlib and then improve the performance by enabling specialized features.","metadata":{}},{"id":"e9b52ecf-3984-4695-98e7-315aa3712104","cell_type":"markdown","source":"### Block Allocation\nBy default each submitted Python function is executed in a dedicated process. This gurantees that the execution of the submitted Python function starts with a fresh process. Still the initialization of the Python process takes time. Especially when the call of the Python function requires only limited computational resources it makes sense to reuse the existing Python process for the execution of multiple Python functions. In executorlib this functionality is enabled by setting the `block_allocation` parameter to `Ture`. To limit the number of parallel Python processes when using block allocation it is recommended to set the `max_workers` parameter to restrict the number of available computing resources. ","metadata":{}},{"id":"0da4c7d0-2268-4ea8-b62d-5d94c79ebc72","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(max_workers=2, block_allocation=True) as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\nCPU times: user 31.5 ms, sys: 11.5 ms, total: 43 ms\nWall time: 709 ms\n"}],"execution_count":13},{"id":"d38163b3-1c04-431c-964b-2bad4f823a4d","cell_type":"markdown","source":"The same functionality also applies to MPI parallel Python functions. The important part is that while it is possible to assign more than one Python process to the execution of a Python function in block allocation mode, it is not possible to assign resources during the submission of the function with the `submit()` function. Starting again with the `calc_mpi()` function: ","metadata":{}},{"id":"cb8c4943-4c78-4203-95f2-1db758e588d9","cell_type":"code","source":"def calc_mpi(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank","metadata":{"trusted":true},"outputs":[],"execution_count":14},{"id":"9e1212c4-e3fb-4e21-be43-0a4f0a08b856","cell_type":"markdown","source":"Still the resource dictionary parameter can still be set during the initialisation of the `SingleNodeExecutor` class. Internally, this groups the created Python processes in fixed allocations and afterwards submit Python functions to these allocations.","metadata":{}},{"id":"5ebf7195-58f9-40f2-8203-2d4b9f0e9602","cell_type":"code","source":"with SingleNodeExecutor(max_workers=2, resource_dict={\"cores\": 2}, block_allocation=True) as exe:\n fs = exe.submit(calc_mpi, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":15},{"id":"b75fb95f-f2f5-4be9-9f2a-9c2e9961c644","cell_type":"markdown","source":"The weakness of memory from a previous Python function remaining in the Python process can at the same time be an advantage for working with large datasets. In executorlib this is achieved by introducing the `init_function` parameter. The `init_function` returns a dictionary of parameters which can afterwards be reused as keyword arguments `**kwargs` in the functions submitted to the `Executor`. When block allocation `block_allocation` is disabled this functionality is not available, as each function is executed in a separate process, so no data can be preloaded.","metadata":{}},{"id":"8aa754cc-eb1a-4fa1-bd72-272246df1d2f","cell_type":"code","source":"def init_function():\n return {\"j\": 4, \"k\": 3, \"l\": 2}","metadata":{"trusted":true},"outputs":[],"execution_count":16},{"id":"1854895a-7239-4b30-b60d-cf1a89234464","cell_type":"code","source":"def calc_with_preload(i, j, k):\n return i + j + k","metadata":{"trusted":true},"outputs":[],"execution_count":17},{"id":"d07cf107-3627-4cb0-906c-647497d6e0d2","cell_type":"markdown","source":"The function `calc_with_preload()` requires three inputs `i`, `j` and `k`. But when the function is submitted to the executor only two inputs are provided `fs = exe.submit(calc, 2, j=5)`. In this case the first input parameter is mapped to `i=2`, the second input parameter is specified explicitly `j=5` but the third input parameter `k` is not provided. So the `SingleNodeExecutor` automatically checks the keys set in the `init_function()` function. In this case the returned dictionary `{\"j\": 4, \"k\": 3, \"l\": 2}` defines `j=4`, `k=3` and `l=2`. For this specific call of the `calc_with_preload()` function, `i` and `j` are already provided so `j` is not required, but `k=3` is used from the `init_function()` and as the `calc_with_preload()` function does not define the `l` parameter this one is also ignored.","metadata":{}},{"id":"cc648799-a0c6-4878-a469-97457bce024f","cell_type":"code","source":"with SingleNodeExecutor(max_workers=2, init_function=init_function, block_allocation=True) as exe:\n fs = exe.submit(calc_with_preload, 2, j=5)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"10\n"}],"execution_count":18},{"id":"1073b8ca-1492-46e9-8d1f-f52ad48d28a2","cell_type":"markdown","source":"The result is `2+5+3=10` as `i=2` and `j=5` are provided during the submission and `k=3` is defined in the `init_function()` function.","metadata":{}},{"id":"24397d78-dff1-4834-830c-a8f390fe6b9c","cell_type":"markdown","source":"### Cache\nThe development of scientific workflows is commonly an interactive process, extending the functionality step by step. This lead to the development of interactive environments like [Jupyter](https://jupyter.org) which is fully supported by executorlib. Still many of the computationally intensive Python functions can take in the order of minutes to hours or even longer to execute, so reusing an existing Python process is not feasible. To address this challenge executorlib provides a file based cache to store the results of previously computed [concurrent future Futures](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects. The results are serialized using [cloudpickle](https://github.com/cloudpipe/cloudpickle) and stored in a user-defined cache directory `cache_directory` to be reloaded later on. Internally, the hierarchical data format (HDF5) is used via the [h5py](https://www.h5py.org), which is an optional dependency for executorlib. \n\nThe [h5py](https://www.h5py.org) package is an optional dependency of executorlib. The installation of the [h5py](https://www.h5py.org) package is covered in the installation section. ","metadata":{}},{"id":"ecdcef49-5c89-4538-b377-d53979673bf7","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(cache_directory=\"./file\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[2, 4, 6]\nCPU times: user 84.3 ms, sys: 33.6 ms, total: 118 ms\nWall time: 1.35 s\n"}],"execution_count":19},{"id":"32d0fb2e-5ac1-4249-b6c8-953c92fdfded","cell_type":"markdown","source":"When the same code is executed again, executorlib finds the existing results in the cache directory specified by the `cache_directory` parameter and reloads the result, accelerating the computation especially during the prototyping phase when similar computations are repeated frequently for testing. \n\nStill it is important to mention, that this cache is not designed to identify the submission of the same parameters within the context of one `with`-statement. It is the task of the user to minimize duplicate computations, the cache is only designed to restore previous calculation results when the Python process managing executorlib was stopped after the successful execution. ","metadata":{}},{"id":"c39babe8-4370-4d31-9520-9a7ce63378c8","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(cache_directory=\"./file\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[2, 4, 6]\nCPU times: user 44.2 ms, sys: 15.5 ms, total: 59.7 ms\nWall time: 1.3 s\n"}],"execution_count":20},{"id":"5144a035-633e-4e60-a362-f3b15b28848b","cell_type":"markdown","source":"An additional advantage of the cache is the option to gather the results of previously submitted functions. Using the `get_cache_data()` function the results of each Python function is converted to a dictionary. This list of dictionaries can be converted to a `pandas.DataFrame` for further processing:","metadata":{}},{"id":"f574b9e1-de55-4e38-aef7-a4bed540e040","cell_type":"code","source":"import pandas\nfrom executorlib import get_cache_data\n\ndf = pandas.DataFrame(get_cache_data(cache_directory=\"./file\"))\ndf","metadata":{"trusted":true},"outputs":[{"execution_count":21,"output_type":"execute_result","data":{"text/plain":" function input_args input_kwargs output resource_dict \\\n0 ([2, 2],) {} 4 {} \n1 ([3, 3],) {} 6 {} \n2 ([1, 1],) {} 2 {} \n\n runtime filename \n0 0.910742 /home/jovyan/file/sum89afbdf9da5eb1794f6976a3f... \n1 0.911247 /home/jovyan/file/sum0f7710227cda6456e5d071877... \n2 0.908284 /home/jovyan/file/sumf5ad27b855231a293ddd735a8... ","text/html":"
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
functioninput_argsinput_kwargsoutputresource_dictruntimefilename
0<built-in function sum>([2, 2],){}4{}0.910742/home/jovyan/file/sum89afbdf9da5eb1794f6976a3f...
1<built-in function sum>([3, 3],){}6{}0.911247/home/jovyan/file/sum0f7710227cda6456e5d071877...
2<built-in function sum>([1, 1],){}2{}0.908284/home/jovyan/file/sumf5ad27b855231a293ddd735a8...
\n
"},"metadata":{}}],"execution_count":21},{"id":"68092479-e846-494a-9ac9-d9638b102bd8","cell_type":"markdown","source":"After the development phase is concluded it is the task of the user to remove the cache directory defined with the `cache_directory` parameter. The cache directory is never removed by executorlib to prevent the repeation of expensive computations. Still as disk space on shared file systems in HPC environments is commonly limited it is recommended to remove the cache directory once the development process concluded. ","metadata":{}},{"id":"34a9316d-577f-4a63-af14-736fb4e6b219","cell_type":"code","source":"import os\nimport shutil\n\ncache_dir = \"./file\"\nif os.path.exists(cache_dir):\n print(os.listdir(cache_dir))\n try:\n shutil.rmtree(cache_dir)\n except OSError:\n pass","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"['sum89afbdf9da5eb1794f6976a3f01697c2_o.h5', 'sum0f7710227cda6456e5d07187702313f3_o.h5', 'sumf5ad27b855231a293ddd735a8554c9ea_o.h5']\n"}],"execution_count":22},{"id":"1cea95b5-4110-444c-82af-fa6718bfa17f","cell_type":"markdown","source":"Typically the use of the cache is recommended for development processes only and for production workflows the user should implement their own long-term storage solution. The binary format used by executorlib is based on [cloudpickle](https://github.com/cloudpipe/cloudpickle) and might change in future without further notice, rendering existing data in the cache unusable. Consequently, using the cache beyond the development process is not recommended. In addition the writing of the results to files might result in additional overhead for accessing the shared file system. ","metadata":{}},{"id":"71a8a0be-a933-4e83-9da5-50da35e9975b","cell_type":"markdown","source":"### Dependencies\nMany scientific Python programs consist of series of Python function calls with varying level of parallel computations or map-reduce patterns where the same function is first mapped to a number of parameters and afterwards the results are reduced in a single function. To extend the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) of the Python standard library to support this programming pattern, the `SingleNodeExecutor` class from executorlib supports submitting Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) objects to the `SingleNodeExecutor` which are resolved before submission. So the `SingleNodeExecutor` internally waits until all Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) objects are successfully executed before it triggers the execution of the submitted Python function.","metadata":{}},{"id":"d8b75a26-479d-405e-8895-a8d56b3f0f4b","cell_type":"code","source":"def calc_add(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":23},{"id":"36118ae0-c13c-4f7a-bcd3-3d7f4bb5a078","cell_type":"markdown","source":"For example the function which adds two numbers `calc_add()` is used in a loop which adds a counter to the previous numbers. In the first iteration the `future` parameter is set to `0` but already in the second iteration it is the Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object of the first iteration and so on. \n\nThe important part is that the user does not have to wait until the first function is executed but instead the waiting happens internally in the `SingleNodeExecutor`.","metadata":{}},{"id":"35fd5747-c57d-4926-8d83-d5c55a130ad6","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future = 0\n for i in range(1, 4):\n future = exe.submit(calc_add, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"6\n"}],"execution_count":24},{"id":"38e1bbb3-1028-4f50-93c1-d2427f399a7d","cell_type":"markdown","source":"As the reusing of existing [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object can lead to rather complex dependencies, executorlib provides the option to plot the dependency graph by setting the `plot_dependency_graph=True` during the initialization of the `SingleNodeExecutor` class.\n\nNo computation is executed when the `plot_dependency_graph=True` is set. This parameter is for debugging only. \n\nInternally, the [pygraphviz](https://pygraphviz.github.io/documentation/stable) package is used for the visualisation of these dependency graphs. It is an optional dependency of executorlib. The installation of the [pygraphviz](https://pygraphviz.github.io/documentation/stable) package is covered in the installation section. ","metadata":{}},{"id":"f67470b5-af1d-4add-9de8-7f259ca67324","cell_type":"code","source":"with SingleNodeExecutor(plot_dependency_graph=True) as exe:\n future = 0\n for i in range(1, 4):\n future = exe.submit(calc_add, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"None\n"},{"output_type":"display_data","data":{"text/plain":"","image/svg+xml":"\n\n\n\n\n0\n\ncalc_add\n\n\n\n1\n\ncalc_add\n\n\n\n0->1\n\n\nb\n\n\n\n2\n\ncalc_add\n\n\n\n1->2\n\n\nb\n\n\n\n3\n\n1\n\n\n\n3->0\n\n\na\n\n\n\n4\n\n0\n\n\n\n4->0\n\n\nb\n\n\n\n5\n\n2\n\n\n\n5->1\n\n\na\n\n\n\n6\n\n3\n\n\n\n6->2\n\n\na\n\n\n"},"metadata":{}}],"execution_count":25},{"id":"4c952a9d-2b58-401d-b7ec-fda740db774a","cell_type":"markdown","source":"## Advanced Scheduling\nGoing beyond just directed acyclic graphs (DAG) with one-to-many and many-to-one relationships, executorlib provides a number of advanced scheduling patterns. These are briefly introduced in the following.","metadata":{}},{"id":"4db2c87c-9a7d-4074-82d0-24357fa4f0e6","cell_type":"markdown","source":"### Runtime-dependent Batching \nTo maximize the throughput of dependent calculation tasks its important to idenify all tasks which can be executed at a given moment. Unfortunately, some of these dependencies can only be determined at run time, which is challenging for most schedulers. To demonstrate the runtime-dependent batching in executorlib we discuss the following example. Starting with a group of ten tasks and then grouping them into groups of three for processing. Still the order of the tasks, which tasks belong into which group, is only determined at run time. \n\nFor simplicity, we just use a simple function which directly returns the input.","metadata":{}},{"id":"857a5e0f-50d6-45ec-aac7-a7151f36c19f","cell_type":"code","source":"def reply(i):\n return i","metadata":{"trusted":true},"outputs":[],"execution_count":26},{"id":"544dacab-5601-4a9b-814f-88560eafb079","cell_type":"markdown","source":"After the group of ten tasks is submitted their future objects are stored in a list named `future_individual_lst`. This list is then provided to the `batched()` function of the `SingleNodeExecutor()` to generate batches of tasks which are then provided to the `sum` function for further processing. The results of this second step are stored in the `future_group_lst`. Finally, the results of these future objects are evaluated in the third step. ","metadata":{}},{"id":"17d1354a-0943-4b62-9b0d-7d39c8df23f2","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future_individual_lst = [\n exe.submit(reply, i) for i in range(10)\n ]\n future_group_lst = [\n exe.submit(sum, f) for f in exe.batched(future_individual_lst, n=3)\n ]\n print(sum([f.result() for f in future_group_lst]))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"45\n"}],"execution_count":27},{"id":"80e8b154-d659-4f3e-add2-701a454d770d","cell_type":"markdown","source":"### Split Future Objects\nIn analogy to the `batched()` function which combines multiple future objects in a batch for further processing, it is also necessary to split the future objects even before the evaluation is completed. Executorlib provides two utility functions, namely `split_future()` for tuples and lists and `get_item_from_future()` for dictionaries. \n\nStarting with a function which returns a tuple, named `get_a_tuple()`:","metadata":{}},{"id":"6ef541e3-a2be-4e05-9e77-65eaceff4248","cell_type":"code","source":"def get_a_tuple(i):\n return \"a\", \"b\", i","metadata":{"trusted":true},"outputs":[],"execution_count":28},{"id":"dd3e4312-1594-4b3b-baf3-5b3121ca8910","cell_type":"markdown","source":"This function is submitted to the `SingleNodeExecutor()` and while in this case it directly returns the tuple, the evaluation would commonly take much longer. By having the ability to split the output of the future object using the `split_future()` function, a number of future objects is generated one for each element of the tuple. This is enabled by providing the number of elements in the tuple as an additional parameter `n=3`. ","metadata":{}},{"id":"927c5931-d7fd-4bc1-ae0e-3dd2f4bc99ce","cell_type":"code","source":"from executorlib import split_future","metadata":{"trusted":true},"outputs":[],"execution_count":29},{"id":"64a9b46e-0de6-4abb-99d9-8aaa0c6cbccb","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future = exe.submit(get_a_tuple, 15)\n f1, f2, f3 = split_future(future=future, n=3)\n print(f1.result(), f2.result(), f3.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"a b 15\n"}],"execution_count":30},{"id":"a10d8f90-e790-4708-b193-90a7f014d699","cell_type":"markdown","source":"In analogy, to the `split_future()` function for lists and tuples, the `get_item_from_future()` function returns one item of a dicitionary which is returned by a function submitted to an `Executor()`. In this example the `get_a_dict()` function returns a dictionary, again in this example the dictionary is returned directly while commonly this would take much longer. ","metadata":{}},{"id":"51ec4dbf-d009-41c9-bc04-cf1b16fe782f","cell_type":"code","source":"def get_a_dict(i):\n return {\"a\": 1, \"b\": 2, \"c\": i}","metadata":{"trusted":true},"outputs":[],"execution_count":31},{"id":"5c90ab75-2a6b-4fbe-a7ee-7f91b2b4af43","cell_type":"markdown","source":"The `get_a_dict()` function is submitted to the `SingleNodeExecutor()`, it returns a future object named `future_dict`. Still as we know that the `result()` of this future object `future_dict` returns a dictionary, we can already access the items of this dictionary with the `get_item_from_future()` function. The `get_item_from_future()` function takes a future object as input in addition to the `key` of the dictionary which should be accessed, as a result the `get_item_from_future()` function returns a future object for the value related to the key. In this example these future objects are named `f1`, `f2` and `f3`. These fucture objects are evaluated afterwards.","metadata":{}},{"id":"a41251d2-a840-4c12-9625-c2e0585c489b","cell_type":"code","source":"from executorlib import get_item_from_future","metadata":{"trusted":true},"outputs":[],"execution_count":32},{"id":"a6e75c5e-ad0c-4723-99c5-8125b63fbeaf","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future_dict = exe.submit(get_a_dict, 15)\n f1 = get_item_from_future(future=future_dict, key=\"a\")\n f2 = get_item_from_future(future=future_dict, key=\"b\")\n f3 = get_item_from_future(future=future_dict, key=\"c\")\n print(f1.result(), f2.result(), f3.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"1 2 15\n"}],"execution_count":33},{"id":"a945c98d-dc73-4284-9d8c-52475a760f6b","cell_type":"markdown","source":"### Recursion\nIn addition to the `map()` function for parallel loops and the option to integrate `while` loops directly in the submission, it is sometimes helpful to use recursive algorthims to accelerate scientific simulation and analysis. To demonstrate the use of executorlib in combination with recursive algorithms, the quicksort algorithm is demonstrated. \n\nThe quicksort algorithm is implemented in two parts, a `quick_sort()` which splits the input `sequence` into two sets, one lower and one larger than the pivot element of the `sequence`. After the initial execution the `quick_sort()` function is again applied to both resulting sets until only a single element remains in the `sequence`. In this case the single element is returned. The pivot is defined as the first element of the `sequence`.\n\nTo simplify the submission of the `quick_sort()` function to the `SingleNodeExecutor()` dictionaries are used as return types, these dictionaries either contain only a single item with the key `\"result\"` when only a single element remains in the list, or three items, one `\"left\"` for a list lower than the pivot, one `\"right\"` for the items larger than the pivot and the `\"result\"` for the pivot itself. ","metadata":{}},{"id":"08b0c0a1-34ad-4b2a-847c-fe9c96956b27","cell_type":"code","source":"def quick_sort(sequence):\n length = len(sequence)\n if length <= 1:\n return {\"result\": sequence}\n else:\n pivot = sequence.pop() \n \n greater_items = []\n lesser_items = []\n\n for item in sequence:\n if item > pivot:\n greater_items.append(item)\n else:\n lesser_items.append(item)\n\n return {\"left\": lesser_items, \"right\": greater_items, \"result\": [pivot]}","metadata":{"trusted":true},"outputs":[],"execution_count":34},{"id":"54a8a765-0b9f-424a-86e5-8024c4d59018","cell_type":"markdown","source":"To enable the recursive submission to the `SingleNodeExecutor()` a `recusive_submit()` function is defined using the [asynchronous IO module](https://docs.python.org/3/library/asyncio.html) of the Python standard libary, indicated by the `async` keyword ahead of the function definition. It takes a `function`, the `sequence` and the `executor` as inputs. As a first step the function is submitted to the `executor` and the execution is halted until the first result is available by wrapping the future object using the `wrap_future()` function of the `asyncio` package and appling the `await` function. Then the corresponding result dictionary `result_dict` is evaluated: If the `result_dict` contains more than one key, then the `recusive_submit()` is evaluated for both the left side with lower values than the pivot element and the right side with elements higher than the pivot element. Again in both cases the `await` keyword is used to enable the parallel execution of both branches at the same time. Afterwards the result of both sides is combined with the pivot element. For the case that the dictionary only contains a single element, it is returned directly. ","metadata":{}},{"id":"4e142829-c9de-4969-ab3c-97f3e1ada90c","cell_type":"code","source":"import asyncio\n\nasync def recusive_submit(function, sequence, executor):\n result_dict = await asyncio.wrap_future(exe.submit(function, sequence))\n if len(result_dict) > 1:\n left = await recusive_submit(function=function, sequence=result_dict[\"left\"], executor=executor)\n right = await recusive_submit(function=function, sequence=result_dict[\"right\"], executor=executor)\n return left + result_dict[\"result\"] + right\n else:\n return result_dict[\"result\"]","metadata":{"trusted":true},"outputs":[],"execution_count":35},{"id":"531a8f7d-5b21-46d0-b632-32a1568571c8","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n loop = asyncio.get_event_loop()\n task = loop.create_task(recusive_submit(function=quick_sort, sequence=[0,9,3,8,2,7,5], executor=exe))\n print(await task)","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[0, 2, 3, 5, 7, 8, 9]\n"}],"execution_count":36},{"id":"725c8ac2-27e4-495b-b061-1fd6053f4c0b","cell_type":"markdown","source":"## Testing and Debugging\nThe up-scaling of Python functions from a single workstation to an High Performance Computer (HPC) can be challenging, so executorlib provides a number of debugging utilities to help you optimize your functions for execution with executorlib. ","metadata":{}},{"id":"2c96b460-ebd2-4c8a-a5e1-922a860808ab","cell_type":"markdown","source":"### Measure Data Transferred \nTransferring a large amount of data between two processes requires additional resources so it is helpful to measure the data transferred between the frontend and backend process. This is achieved by setting the `log_obj_size` parameter to `True`:","metadata":{}},{"id":"71905acf-2fef-4738-82ae-89e35e2e3d2d","cell_type":"code","source":"from executorlib import SingleNodeExecutor\n\nwith SingleNodeExecutor(log_obj_size=True) as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stderr","output_type":"stream","text":"Send dictionary of size: 101\nReceived dictionary of size: 59\nSend dictionary of size: 69\nReceived dictionary of size: 58\n"},{"name":"stdout","output_type":"stream","text":"2\n"}],"execution_count":37},{"id":"0e9f7192-2b7d-4caf-b2b8-ae9cb060e90f","cell_type":"markdown","source":"### Write Log Files\nLibraries like executorlib are commonly used to sample a large parameter space, in this case it is possible that out of a large number of parameters one combination throws an error. This error can be logged in a file which also contains the function and input parameters using the `\"error_log_file\"` parameter in the `resource_dict`. This allows to change the log file on a per-function bases.","metadata":{}},{"id":"2810acd5-a46e-4d85-b447-945248ffca15","cell_type":"code","source":"from executorlib import SingleNodeExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":38},{"id":"ef6b87a7-361e-4a3f-bad3-72ad87968e8c","cell_type":"code","source":"def my_funct(i, j): \n if i == 2 and j == 2:\n raise ValueError()\n else: \n return i * j + i + j","metadata":{"trusted":true},"outputs":[],"execution_count":39},{"id":"209ff76b-913a-46f7-9fff-250e207898b2","cell_type":"markdown","source":"A try and except statement is added to prevent the jupyter notebook from crashing:","metadata":{}},{"id":"30381a00-30cc-45a2-82ff-17371339f5c7","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"error_log_file\": \"error.out\"}) as exe:\n future_lst = []\n for i in range(4):\n for j in range(4):\n future_lst.append(exe.submit(my_funct, i=i, j=j))\n try:\n print([f.result() for f in future_lst])\n except ValueError:\n pass","metadata":{"trusted":true},"outputs":[],"execution_count":40},{"id":"36bfc556-aa86-4b50-972b-4b8f68ceec3d","cell_type":"markdown","source":"The content of the log file is a basic text file, so it can be read with any kind of file utility. The important part is that the log file contains not only the error message but in addition also the function name and the input parameters in the case `kwargs: {'i': 2, 'j': 2}` which helps for future debugging of the sampling function.","metadata":{}},{"id":"a61c06fc-3029-48ed-895f-9f6c065b7c47","cell_type":"code","source":"with open(\"error.out\") as f:\n content = f.readlines()","metadata":{"trusted":true},"outputs":[],"execution_count":41},{"id":"6a6cd10f-6fe3-4a17-a8e6-2536feb9a11a","cell_type":"code","source":"content","metadata":{"trusted":true},"outputs":[{"execution_count":42,"output_type":"execute_result","data":{"text/plain":"['function: \\n',\n 'args: ()\\n',\n \"kwargs: {'i': 2, 'j': 2}\\n\",\n 'Traceback (most recent call last):\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/backend/interactive_serial.py\", line 56, in main\\n',\n ' output = call_funct(input_dict=input_dict, funct=None, memory=memory)\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/standalone/interactive/backend.py\", line 33, in call_funct\\n',\n ' return funct(input_dict[\"fn\"], *input_dict[\"args\"], **input_dict[\"kwargs\"])\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/standalone/interactive/backend.py\", line 22, in funct\\n',\n ' return args[0].__call__(*args[1:], **kwargs)\\n',\n ' ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^\\n',\n ' File \"/tmp/ipykernel_463/3167739528.py\", line 3, in my_funct\\n',\n 'ValueError\\n']"},"metadata":{}}],"execution_count":42},{"id":"5aff120a-317f-47d4-9639-8eccfb136117","cell_type":"code","source":"import os\n\nif os.path.exists(\"error.out\"):\n os.remove(\"error.out\")","metadata":{"trusted":true},"outputs":[],"execution_count":43},{"id":"44cd41d7-4417-429e-8481-f2a49e5f769c","cell_type":"markdown","source":"### TestClusterExecutor\nWhile the `SingleNodeExecutor` internally behaves very similar to the `FluxJobExecutor` and `SlurmJobExecutor` the `FluxClusterExecutor` and `SlurmClusterExecutor` behave very different as they use the file system to exchange information rather than socket-based communication. This can lead to complications when it comes to debugging. To address this challenge executorlib provides the `TestClusterExecutor` which can be executed on a local workstation just like the `SingleNodeExecutor` but in the background it uses the same file based communication like the `SlurmClusterExecutor` and the `FluxClusterExecutor`:","metadata":{}},{"id":"2ae29fb0-54e5-468f-8727-a179b6ed363e","cell_type":"code","source":"from executorlib.api import TestClusterExecutor\n\nwith TestClusterExecutor(cache_directory=\"test\") as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\n"}],"execution_count":44}]} \ No newline at end of file From 83709c89d0759649a2509280d2e26e491c6cd8bc Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Thu, 19 Nov 2026 12:44:18 +0100 Subject: [PATCH 6/9] [Documentation] Add user stories for DataFrames, MPI executables and mpi4py functions - Story 10: parallel computations on pandas DataFrames - row-wise map() with the SingleNodeExecutor, fixed-size chunks as SLURM jobs joined with pandas.concat(), and a content-based cache_key (hash_pandas_object) so appended rows only compute the new chunks; results collected with get_cache_data(). - Story 11: couple Python to MPI executables - a small C MPI code is compiled and wrapped in a serial Python function, submitted with cores=1, threads_per_core and a per-simulation cwd, launched with srun --mpi=pmi2 inside the job. - Story 12: parallelize only the hot function with mpi4py, per-rank result lists, split_future() to pass the rank-0 result on, GPAW and SlurmJobExecutor snippets. - Link the stories from the toc, the README, and the GPAW / Quantum Espresso notebooks. Co-Authored-By: Claude Opus 5.5 --- README.md | 9 + docs/_toc.yml | 3 + notebooks/4-1-gpaw.ipynb | 2 +- notebooks/4-2-quantum-espresso.ipynb | 2 +- notebooks/story-10-pandas-dataframes.ipynb | 400 ++++++++++++++++++ ...story-11-couple-mpi-simulation-codes.ipynb | 381 +++++++++++++++++ notebooks/story-12-mpi4py-functions.ipynb | 311 ++++++++++++++ 7 files changed, 1106 insertions(+), 2 deletions(-) create mode 100644 notebooks/story-10-pandas-dataframes.ipynb create mode 100644 notebooks/story-11-couple-mpi-simulation-codes.ipynb create mode 100644 notebooks/story-12-mpi4py-functions.ipynb diff --git a/README.md b/README.md index b1f12023..2ba26792 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,12 @@ executorlib which are needed along the way: `asyncio` and batching in the order results arrive. 9. [Document and share a workflow](https://executorlib.readthedocs.io/en/latest/story-9-document-and-share.html) - export the workflow graph and use the cache as an audit trail. +10. [Parallel computations on pandas DataFrames](https://executorlib.readthedocs.io/en/latest/story-10-pandas-dataframes.html) - + replace `df.apply()`, submit chunks of rows as SLURM jobs and recompute only new rows with the cache. +11. [Couple Python to simulation codes which use MPI internally](https://executorlib.readthedocs.io/en/latest/story-11-couple-mpi-simulation-codes.html) - + wrap MPI executables written in C, C++ or Fortran in Python functions, each with its own working directory. +12. [Parallelize only the functions which need it with mpi4py](https://executorlib.readthedocs.io/en/latest/story-12-mpi4py-functions.html) - + MPI-parallel functions within a serial script, their per-rank results and mpi4py-enabled codes like GPAW. The cluster-specific settings like the partition, run time limits and the submission template are collected in one cell at the top of each story. Readers without access to an HPC cluster can start with @@ -226,6 +232,9 @@ cluster-specific configuration for the `SlurmClusterExecutor`. * [Large Jobs which Each Fan Out into Many Small Tasks](https://executorlib.readthedocs.io/en/latest/story-7-fan-out-inside-jobs.html) * [Adaptive Workflows](https://executorlib.readthedocs.io/en/latest/story-8-adaptive-workflows.html) * [Document and Share a Workflow](https://executorlib.readthedocs.io/en/latest/story-9-document-and-share.html) + * [Parallel Computations on pandas DataFrames](https://executorlib.readthedocs.io/en/latest/story-10-pandas-dataframes.html) + * [Couple Python to Simulation Codes which Use MPI Internally](https://executorlib.readthedocs.io/en/latest/story-11-couple-mpi-simulation-codes.html) + * [Parallelize Only the Functions which Need It with mpi4py](https://executorlib.readthedocs.io/en/latest/story-12-mpi4py-functions.html) * [Comparison](https://executorlib.readthedocs.io/en/latest/comparison.html#comparison) * [At a glace](https://executorlib.readthedocs.io/en/latest/comparison.html#at-a-glance) * [Concurrent futures](https://executorlib.readthedocs.io/en/latest/comparison.html#concurrent-futures-the-python-standard-library) diff --git a/docs/_toc.yml b/docs/_toc.yml index 2b8594d0..4c908482 100644 --- a/docs/_toc.yml +++ b/docs/_toc.yml @@ -15,6 +15,9 @@ parts: - file: story-7-fan-out-inside-jobs.ipynb - file: story-8-adaptive-workflows.ipynb - file: story-9-document-and-share.ipynb + - file: story-10-pandas-dataframes.ipynb + - file: story-11-couple-mpi-simulation-codes.ipynb + - file: story-12-mpi4py-functions.ipynb - caption: Background chapters: - file: comparison.md diff --git a/notebooks/4-1-gpaw.ipynb b/notebooks/4-1-gpaw.ipynb index 4b9bd942..e6274250 100644 --- a/notebooks/4-1-gpaw.ipynb +++ b/notebooks/4-1-gpaw.ipynb @@ -1 +1 @@ -{"metadata":{"kernelspec":{"name":"flux","display_name":"Flux","language":"python"},"language_info":{"name":"python","version":"3.10.16","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"745ca7d3-5046-4a8c-a370-d9d05b77a1b7","cell_type":"markdown","source":"# GPAW\nThe [gpaw](https://gpaw.readthedocs.io/index.html) density-functional theory (DFT) simulation code provides a Python interface supporting the [message passing interface (MPI) for Python - mpi4py](https://mpi4py.readthedocs.io) for parallelization. So `executorlib` is used to orchestrate multiple [gpaw](https://gpaw.readthedocs.io/index.html) simulation each using multiple CPU cores for parallelization. These kind of hierarchical workflows are one of the core strength of `executorlib`. While the same could be achieved by writing the whole simulation workflow using [mpi4py](https://mpi4py.readthedocs.io) this would drastically increase the complexity. With `executorlib` the user can quickly up-scale their simulation workflow without the need to address the parallel execution explicitly, rather the parallelization is introduced on a per-function level, by submitting the functions to the `FluxClusterExecutor` or `FluxJobExecutor`.","metadata":{}},{"id":"21852c01-efda-43fe-add9-d08123a82995","cell_type":"code","source":"import subprocess\nfrom ase.build import bulk\nfrom atomistics.workflows import (\n analyse_results_for_energy_volume_curve,\n get_tasks_for_energy_volume_curve,\n)\nimport matplotlib.pyplot as plt\nimport pprint\nfrom tqdm import tqdm\nfrom time import sleep","metadata":{"trusted":true},"outputs":[{"name":"stderr","output_type":"stream","text":"/srv/conda/envs/notebook/lib/python3.10/site-packages/atomistics/workflows/__init__.py:77: UserWarning: PhonopyWorkflow(), QuasiHarmonicWorkflow(), get_band_structure(), get_dynamical_matrix(), get_hesse_matrix(), get_thermal_properties_for_harmonic_approximation(), get_tasks_for_harmonic_approximation(), analyse_results_for_harmonic_approximation(), get_tasks_for_quasi_harmonic_approximation(), analyse_results_for_quasi_harmonic_approximation(), get_thermal_properties_for_quasi_harmonic_approximation(), plot_band_structure() and plot_dos() are not available as the import of the module named 'structuretoolkit' failed.\n raise_warning(module_list=phonopy_workflows, import_error=e)\n"}],"execution_count":1},{"id":"e15eed0da3c6547b","cell_type":"markdown","source":"The only function which is executed using [mpi4py](https://mpi4py.readthedocs.io) is the `evaluate_with_gpaw()` function:","metadata":{}},{"id":"aa435760-390f-4eff-88f4-96b15777de3e","cell_type":"code","source":"def evaluate_with_gpaw(task_dict, kpts, encut):\n import os\n os.environ[\"OMP_NUM_THREADS\"] = \"1\"\n os.environ[\"GPAW_MPI4PY\"] = \"1\"\n\n from mpi4py import MPI\n from gpaw import GPAW, PW\n from gpaw.mpi4pywrapper import MPI4PYWrapper\n\n structure = task_dict[\"calc_energy\"].copy()\n structure.calc = GPAW(\n xc=\"PBE\",\n mode=PW(encut),\n kpts=kpts,\n communicator=MPI4PYWrapper(MPI.COMM_WORLD),\n )\n return structure.get_potential_energy()","metadata":{"trusted":true},"outputs":[],"execution_count":2},{"id":"e9936ca22151d490","cell_type":"markdown","source":"As a first step of the workflow the equilibrium structure of four Aluminium atoms is strained by 5%.","metadata":{}},{"id":"a1d4e9a1-7275-4d9a-b038-db27185f00ae","cell_type":"code","source":"task_dict = get_tasks_for_energy_volume_curve(\n structure=bulk(\"Al\", a=4.03),\n num_points=7,\n vol_range=0.05,\n axes=(\"x\", \"y\", \"z\"),\n)","metadata":{"trusted":true},"outputs":[],"execution_count":3},{"id":"8bf60b7b0f5af31a","cell_type":"markdown","source":"The resulting dictionary of structures `task_dict` is transformed to simplify the parallel execution:","metadata":{}},{"id":"73ad1043-eacd-4758-a7b4-f64969beabab","cell_type":"code","source":"task_loop_dict = {k: {\"calc_energy\": v} for k, v in task_dict[\"calc_energy\"].items()}","metadata":{"trusted":true},"outputs":[],"execution_count":4},{"id":"af5ba456f3fafd39","cell_type":"markdown","source":"The status of the flux cluster is validated using the `flux resource list` command and the `flux jobs -a` command, just to highlight flux was initialized correctly and has access to the available resources.","metadata":{}},{"id":"8a93aa2b-2bce-4c87-943c-38364a4324ee","cell_type":"code","source":"pprint.pp(subprocess.check_output([\"flux\", \"resource\", \"list\"], universal_newlines=True).split(\"\\n\"))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[' STATE NNODES NCORES NGPUS NODELIST',\n ' free 1 24 0 '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' allocated 0 0 0 ',\n ' down 0 0 0 ',\n '']\n"}],"execution_count":5},{"id":"f7f072d5-ea3b-43f5-9ec1-0ea1036d7e25","cell_type":"code","source":"pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO', '']\n"}],"execution_count":6},{"id":"62c7297b-efae-4950-a513-3b84345ad7b4","cell_type":"markdown","source":"## FluxClusterExecutor\nThe [FluxClusterExecutor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#flux) is used in this demonstration primarily because flux can be installed on any workstation for testing. The [SlurmClusterExecutor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#slurm) could be used analogously.","metadata":{}},{"id":"9cd01061-c84a-4d8d-80e1-c269af3d8c29","cell_type":"code","source":"from executorlib import FluxClusterExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":7},{"id":"2670c218fbde5b02","cell_type":"markdown","source":"The for each strained structure a calculation task is submitted to the `FluxClusterExecutor`. After the successful submission the current status of the flux queue is printed using `flux jobs -a`. Finally, the results are collected by gathering the [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects.","metadata":{}},{"id":"11d7a7f3-5fbf-4377-ac98-71cd29caf433","cell_type":"code","source":"future_dict = {}\nwith FluxClusterExecutor() as exe:\n for k, v in task_loop_dict.items():\n future_dict[k] = exe.submit(\n evaluate_with_gpaw, \n task_dict=v, \n kpts=(3, 3, 3), \n encut=300,\n resource_dict={\"cores\": 2},\n )\n sleep(1)\n pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))\n result_dict = {\n k: f.result()\n for k, f in tqdm(future_dict.items())\n }\n sleep(1)\n pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO',\n ' ƒ3exNRKu jovyan executorl+ R 2 1 0.104s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3BjTcCf jovyan executorl+ R 2 1 1.191s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ31P2d51 jovyan executorl+ R 2 1 1.646s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n '']\n"},{"name":"stderr","output_type":"stream","text":"100%|██████████| 7/7 [01:08<00:00, 9.86s/it]\n"},{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO',\n ' ƒ6RrzUJb jovyan executorl+ R 2 1 1.108m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ5WD8Tno jovyan executorl+ R 2 1 1.145m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4YJoYUf jovyan executorl+ R 2 1 1.181m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4ESWCVd jovyan executorl+ R 2 1 1.193m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3exNRKu jovyan executorl+ R 2 1 1.215m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3BjTcCf jovyan executorl+ R 2 1 1.233m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ31P2d51 jovyan executorl+ R 2 1 1.241m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n '']\n"}],"execution_count":8},{"id":"8c80e3bcb483b069","cell_type":"markdown","source":"The resulting energies for the different volumes are fitted using a 3rd order polynomial to derive the bulk modulus as second derivative multiplied by the equilibrium volume.","metadata":{}},{"id":"5a5822c7-5ab6-483b-a3ab-8cef5fcaf269","cell_type":"code","source":"fit_dict = analyse_results_for_energy_volume_curve(\n output_dict={\"energy\": result_dict},\n task_dict=task_dict,\n fit_type=\"polynomial\",\n fit_order=3,\n)","metadata":{"trusted":true},"outputs":[],"execution_count":9},{"id":"571b7c25dcca8bb","cell_type":"markdown","source":"The final energy volume curve plot summarizes the results of this calculation.","metadata":{}},{"id":"d420b4c5-1a2f-4290-ba81-0c7f7bdf7ef3","cell_type":"code","source":"plt.plot(fit_dict[\"volume\"], fit_dict[\"energy\"], label=\"$B_0$= %0.2f GPa\" % fit_dict[\"bulkmodul_eq\"])\nplt.xlabel(\"Volume [$\\AA^3$]\")\nplt.ylabel(\"Energy [eV]\")\nplt.legend()","metadata":{"trusted":true},"outputs":[{"execution_count":10,"output_type":"execute_result","data":{"text/plain":""},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"
","image/png":"iVBORw0KGgoAAAANSUhEUgAAAlQAAAG2CAYAAAC5/Bg9AAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjYsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvq6yFwwAAAAlwSFlzAAAPYQAAD2EBqD+naQAAcBZJREFUeJzt3XlYVGX/BvB7Zhj2HWTfBGWT1R203Pc9N8pXTcu3zbe0MrUyLcvltb1ezfxlWVlaikta7pobCiiLK6DIIosgyCLIOuf3BzKJArIMHGa4P9c1VzJz5sx9hA5fn+c53yMRBEEAERERETWZVOwAREREROqOBRURERFRM7GgIiIiImomFlREREREzcSCioiIiKiZWFARERERNRMLKiIiIqJmYkFFRERE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+fPR15eHhwcHJTPKRQK2NraNmo/RNTyOOVHRGphypQpkMlk+OWXX7Bp0ybMmjVLWcx06tQJ2traOHnypHL78vJyREZGKqfKHtahQ4carQQKCgpw48aNZuf09vaGjo4OUlJS0KlTpxoPR0fHBu9nz549OHfuHKKiohAdHa18fPfdd0hPT0d2dnazsxKR6nCEiojUgqGhIaZOnYq3334b+fn5ePbZZ5WvGRgY4KWXXsKCBQtgbm4OJycn/Pe//0VxcbHyKsCHDRw4ED/88APGjBkDMzMzLFmyBDKZrNk5jYyM8Oabb2L+/PlQKBTo27cvCgoKcPr0aRgaGmLmzJmP3Ud5eTneeOMNLFiwAAEBATVeMzY2BgDExMTU2Z+LiFofCyoiUhvPPfccvvvuOwwdOhROTk41Xlu1ahUUCgWmT5+OwsJCdO/eHfv376+1ZxMALF68GImJiRg9ejRMTEywfPlylYxQAcDy5cthZWWFlStXIjExEaampujatSvefvvtBr3/q6++Ql5eHubOnfvIa46OjtDX10d0dDQLKqI2hPfyIyJqA/r374+AgIBHemOpkkQiwY4dOzB+/PgW+wyi9oprqIiI2oi1a9fC0NAQFy5cUOl+X3zxRRgaGqp0n0RUE0eoiIjagLS0NNy7dw8A4OTkBG1tbZXtOysrS9n409bWFgYGBirbNxFVYUFFRERE1Eyc8iMiIiJqJhZURERERM3EgoqIiIiomVhQERERETUTCyoiIiKiZmJBRURERNRMLKiIiIiImokFFREREVEzsaAiIiIiaiYWVERERETNxIKKiIiIqJn+H/ivFa1no03WAAAAAElFTkSuQmCC"},"metadata":{}}],"execution_count":10},{"id":"fed42763-52cf-44c2-961d-6d00918ba6df","cell_type":"markdown","source":"## FluxJobExecutor\nIn analogy to the [FluxClusterExecutor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#flux) the [FluxJobExecutor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html#flux) can be applied to distribute simulation within a given queuing system allocation. The calculation of the bulk modulus with [gpaw](https://gpaw.readthedocs.io) is implemented in the same way.","metadata":{}},{"id":"516a91d4-0be6-47a6-9c9c-f5b0082bfee7","cell_type":"code","source":"from executorlib import FluxJobExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":11},{"id":"21bdd0d42f9806e4","cell_type":"markdown","source":"The for each strained structure a calculation task is submitted to the `FluxJobExecutor`. After the successful submission the current status of the flux queue is printed using `flux jobs -a`. Finally, the results are collected by gathering the [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects.","metadata":{}},{"id":"2b0c559b-a117-4766-b679-314ab9e65e97","cell_type":"code","source":"future_dict = {}\nwith FluxJobExecutor() as exe:\n for k, v in task_loop_dict.items():\n future_dict[k] = exe.submit(\n evaluate_with_gpaw, \n task_dict=v, \n kpts=(3, 3, 3), \n encut=300,\n resource_dict={\"cores\": 2},\n )\n sleep(1)\n pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))\n result_dict = {\n k: f.result()\n for k, f in tqdm(future_dict.items())\n }\n sleep(1)\n pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO',\n ' ƒeqRVxAU jovyan python R 2 1 4.138s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqRVxAT jovyan python R 2 1 4.138s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqQ1xt8 jovyan python R 2 1 4.139s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqQ1xt7 jovyan python R 2 1 4.139s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqNXybn jovyan python R 2 1 4.139s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqNXybm jovyan python R 2 1 4.139s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqM3zKR jovyan python R 2 1 4.141s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ6RrzUJb jovyan executorl+ F 2 1 1.192m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4ESWCVd jovyan executorl+ F 2 1 1.268m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ5WD8Tno jovyan executorl+ F 2 1 1.218m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3exNRKu jovyan executorl+ F 2 1 1.264m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3BjTcCf jovyan executorl+ F 2 1 1.271m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4YJoYUf jovyan executorl+ F 2 1 1.212m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ31P2d51 jovyan executorl+ F 2 1 1.251m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n '']\n"},{"name":"stderr","output_type":"stream","text":"100%|██████████| 7/7 [00:25<00:00, 3.60s/it]\n"},{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO',\n ' ƒeqRVxAU jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqRVxAT jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqQ1xt8 jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqQ1xt7 jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqNXybn jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqNXybm jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqM3zKR jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ6RrzUJb jovyan executorl+ F 2 1 1.192m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4ESWCVd jovyan executorl+ F 2 1 1.268m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ5WD8Tno jovyan executorl+ F 2 1 1.218m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3exNRKu jovyan executorl+ F 2 1 1.264m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3BjTcCf jovyan executorl+ F 2 1 1.271m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4YJoYUf jovyan executorl+ F 2 1 1.212m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ31P2d51 jovyan executorl+ F 2 1 1.251m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n '']\n"}],"execution_count":12},{"id":"ca353da1941c1c7c","cell_type":"markdown","source":"The resulting energies for the different volumes are fitted using a 3rd order polynomial to derive the bulk modulus as second derivative multiplied by the equilibrium volume.","metadata":{}},{"id":"8bb73863-bfde-4e96-9323-5330b2051632","cell_type":"code","source":"fit_dict = analyse_results_for_energy_volume_curve(\n output_dict={\"energy\": result_dict},\n task_dict=task_dict,\n fit_type=\"polynomial\",\n fit_order=3,\n)","metadata":{"trusted":true},"outputs":[],"execution_count":13},{"id":"3d4189b5c74ba2a2","cell_type":"markdown","source":"The final energy volume curve plot summarizes the results of this calculation.","metadata":{}},{"id":"95000e45-dd86-4659-90f4-f2d144477703","cell_type":"code","source":"plt.plot(fit_dict[\"volume\"], fit_dict[\"energy\"], label=\"$B_0$= %0.2f GPa\" % fit_dict[\"bulkmodul_eq\"])\nplt.xlabel(\"Volume [$\\AA^3$]\")\nplt.ylabel(\"Energy [eV]\")\nplt.legend()","metadata":{"trusted":true},"outputs":[{"execution_count":14,"output_type":"execute_result","data":{"text/plain":""},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"
","image/png":"iVBORw0KGgoAAAANSUhEUgAAAlQAAAG2CAYAAAC5/Bg9AAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjYsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvq6yFwwAAAAlwSFlzAAAPYQAAD2EBqD+naQAAcBZJREFUeJzt3XlYVGX/BvB7Zhj2HWTfBGWT1R203Pc9N8pXTcu3zbe0MrUyLcvltb1ezfxlWVlaikta7pobCiiLK6DIIosgyCLIOuf3BzKJArIMHGa4P9c1VzJz5sx9hA5fn+c53yMRBEEAERERETWZVOwAREREROqOBRURERFRM7GgIiIiImomFlREREREzcSCioiIiKiZWFARERERNRMLKiIiIqJmYkFFRERE1ExaYgdoLxQKBdLT02FkZASJRCJ2HCIiImoAQRBQWFgIOzs7SKV1j0OxoGol6enpcHR0FDsGERERNUFqaiocHBzqfJ0FVSsxMjICUPUNMTY2FjkNERERNURBQQEcHR2Vv8frwoKqlVRP8xkbG7OgIiIiUjOPW67DRelEREREzcSCioiIiKiZWFARERERNRMLKiIiIqJmYkFFRERE1EwsqIiIiIiaiQUVERERUTOxoCIiIiJqJhZURERERM3EgoqIiIiomVhQERERETUTCyoiIiKiZuLNkYmIiEitrf/7Om7euYfn+naEi6WBKBlYUBEREZHaKq2oxIYTN3D7bil6djQXraDilB8RERGprb2xGbh9txQ2xroY7mMjWg4WVERERKSWBEHA96eSAADTg5whl4lX1rCgIiIiIrV0PuUOLqTlQ1tLiqd7OomahQUVERERqaWN90enxgfYwdxAW9QsLKiIiIhI7WTk38O+i5kAgFl9OoqchgUVERERqaGfwpJRqRDQ29UcXrbGYsdhQUVERETqpaS8Er+GpwAAng0Wf3QKYEFFREREamZXdBruFJfDwUwPQ7ytxY4DgAUVERERqZE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+/PgW+wyi9oprqIiI2oi1a9fC0NAQFy5cUOl+X3zxRRgaGqp0n0RUE0eoiIjagLS0NNy7dw8A4OTkBG1tbZXtOysrS9n409bWFgYGBirbNxFVYUFFRERE1Eyc8iMiIiJqJhZURERERM3EgoqIiIiomVhQERERETUTCyoiIiKiZmJBRURERNRMLKiIiIiImokFFREREVEzsaAiIiIiaiYWVERERETNxIKKiIiIqJn+H/ivFa1no03WAAAAAElFTkSuQmCC"},"metadata":{}}],"execution_count":14},{"id":"8e67f9a4-d449-420c-9f62-72d106d18636","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]} \ No newline at end of file +{"metadata":{"kernelspec":{"name":"flux","display_name":"Flux","language":"python"},"language_info":{"name":"python","version":"3.10.16","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"745ca7d3-5046-4a8c-a370-d9d05b77a1b7","cell_type":"markdown","source":"# GPAW\nThe [gpaw](https://gpaw.readthedocs.io/index.html) density-functional theory (DFT) simulation code provides a Python interface supporting the [message passing interface (MPI) for Python - mpi4py](https://mpi4py.readthedocs.io) for parallelization. So `executorlib` is used to orchestrate multiple [gpaw](https://gpaw.readthedocs.io/index.html) simulation each using multiple CPU cores for parallelization. These kind of hierarchical workflows are one of the core strength of `executorlib`. While the same could be achieved by writing the whole simulation workflow using [mpi4py](https://mpi4py.readthedocs.io) this would drastically increase the complexity. With `executorlib` the user can quickly up-scale their simulation workflow without the need to address the parallel execution explicitly, rather the parallelization is introduced on a per-function level, by submitting the functions to the `FluxClusterExecutor` or `FluxJobExecutor`. [Story 12](story-12-mpi4py-functions.ipynb) shows the same pattern step by step for your own mpi4py functions on a SLURM cluster, including what the futures of MPI-parallel functions return.","metadata":{}},{"id":"21852c01-efda-43fe-add9-d08123a82995","cell_type":"code","source":"import subprocess\nfrom ase.build import bulk\nfrom atomistics.workflows import (\n analyse_results_for_energy_volume_curve,\n get_tasks_for_energy_volume_curve,\n)\nimport matplotlib.pyplot as plt\nimport pprint\nfrom tqdm import tqdm\nfrom time import sleep","metadata":{"trusted":true},"outputs":[{"name":"stderr","output_type":"stream","text":"/srv/conda/envs/notebook/lib/python3.10/site-packages/atomistics/workflows/__init__.py:77: UserWarning: PhonopyWorkflow(), QuasiHarmonicWorkflow(), get_band_structure(), get_dynamical_matrix(), get_hesse_matrix(), get_thermal_properties_for_harmonic_approximation(), get_tasks_for_harmonic_approximation(), analyse_results_for_harmonic_approximation(), get_tasks_for_quasi_harmonic_approximation(), analyse_results_for_quasi_harmonic_approximation(), get_thermal_properties_for_quasi_harmonic_approximation(), plot_band_structure() and plot_dos() are not available as the import of the module named 'structuretoolkit' failed.\n raise_warning(module_list=phonopy_workflows, import_error=e)\n"}],"execution_count":1},{"id":"e15eed0da3c6547b","cell_type":"markdown","source":"The only function which is executed using [mpi4py](https://mpi4py.readthedocs.io) is the `evaluate_with_gpaw()` function:","metadata":{}},{"id":"aa435760-390f-4eff-88f4-96b15777de3e","cell_type":"code","source":"def evaluate_with_gpaw(task_dict, kpts, encut):\n import os\n os.environ[\"OMP_NUM_THREADS\"] = \"1\"\n os.environ[\"GPAW_MPI4PY\"] = \"1\"\n\n from mpi4py import MPI\n from gpaw import GPAW, PW\n from gpaw.mpi4pywrapper import MPI4PYWrapper\n\n structure = task_dict[\"calc_energy\"].copy()\n structure.calc = GPAW(\n xc=\"PBE\",\n mode=PW(encut),\n kpts=kpts,\n communicator=MPI4PYWrapper(MPI.COMM_WORLD),\n )\n return structure.get_potential_energy()","metadata":{"trusted":true},"outputs":[],"execution_count":2},{"id":"e9936ca22151d490","cell_type":"markdown","source":"As a first step of the workflow the equilibrium structure of four Aluminium atoms is strained by 5%.","metadata":{}},{"id":"a1d4e9a1-7275-4d9a-b038-db27185f00ae","cell_type":"code","source":"task_dict = get_tasks_for_energy_volume_curve(\n structure=bulk(\"Al\", a=4.03),\n num_points=7,\n vol_range=0.05,\n axes=(\"x\", \"y\", \"z\"),\n)","metadata":{"trusted":true},"outputs":[],"execution_count":3},{"id":"8bf60b7b0f5af31a","cell_type":"markdown","source":"The resulting dictionary of structures `task_dict` is transformed to simplify the parallel execution:","metadata":{}},{"id":"73ad1043-eacd-4758-a7b4-f64969beabab","cell_type":"code","source":"task_loop_dict = {k: {\"calc_energy\": v} for k, v in task_dict[\"calc_energy\"].items()}","metadata":{"trusted":true},"outputs":[],"execution_count":4},{"id":"af5ba456f3fafd39","cell_type":"markdown","source":"The status of the flux cluster is validated using the `flux resource list` command and the `flux jobs -a` command, just to highlight flux was initialized correctly and has access to the available resources.","metadata":{}},{"id":"8a93aa2b-2bce-4c87-943c-38364a4324ee","cell_type":"code","source":"pprint.pp(subprocess.check_output([\"flux\", \"resource\", \"list\"], universal_newlines=True).split(\"\\n\"))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[' STATE NNODES NCORES NGPUS NODELIST',\n ' free 1 24 0 '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' allocated 0 0 0 ',\n ' down 0 0 0 ',\n '']\n"}],"execution_count":5},{"id":"f7f072d5-ea3b-43f5-9ec1-0ea1036d7e25","cell_type":"code","source":"pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO', '']\n"}],"execution_count":6},{"id":"62c7297b-efae-4950-a513-3b84345ad7b4","cell_type":"markdown","source":"## FluxClusterExecutor\nThe [FluxClusterExecutor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#flux) is used in this demonstration primarily because flux can be installed on any workstation for testing. The [SlurmClusterExecutor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#slurm) could be used analogously.","metadata":{}},{"id":"9cd01061-c84a-4d8d-80e1-c269af3d8c29","cell_type":"code","source":"from executorlib import FluxClusterExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":7},{"id":"2670c218fbde5b02","cell_type":"markdown","source":"The for each strained structure a calculation task is submitted to the `FluxClusterExecutor`. After the successful submission the current status of the flux queue is printed using `flux jobs -a`. Finally, the results are collected by gathering the [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects.","metadata":{}},{"id":"11d7a7f3-5fbf-4377-ac98-71cd29caf433","cell_type":"code","source":"future_dict = {}\nwith FluxClusterExecutor() as exe:\n for k, v in task_loop_dict.items():\n future_dict[k] = exe.submit(\n evaluate_with_gpaw, \n task_dict=v, \n kpts=(3, 3, 3), \n encut=300,\n resource_dict={\"cores\": 2},\n )\n sleep(1)\n pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))\n result_dict = {\n k: f.result()\n for k, f in tqdm(future_dict.items())\n }\n sleep(1)\n pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO',\n ' ƒ3exNRKu jovyan executorl+ R 2 1 0.104s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3BjTcCf jovyan executorl+ R 2 1 1.191s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ31P2d51 jovyan executorl+ R 2 1 1.646s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n '']\n"},{"name":"stderr","output_type":"stream","text":"100%|██████████| 7/7 [01:08<00:00, 9.86s/it]\n"},{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO',\n ' ƒ6RrzUJb jovyan executorl+ R 2 1 1.108m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ5WD8Tno jovyan executorl+ R 2 1 1.145m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4YJoYUf jovyan executorl+ R 2 1 1.181m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4ESWCVd jovyan executorl+ R 2 1 1.193m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3exNRKu jovyan executorl+ R 2 1 1.215m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3BjTcCf jovyan executorl+ R 2 1 1.233m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ31P2d51 jovyan executorl+ R 2 1 1.241m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n '']\n"}],"execution_count":8},{"id":"8c80e3bcb483b069","cell_type":"markdown","source":"The resulting energies for the different volumes are fitted using a 3rd order polynomial to derive the bulk modulus as second derivative multiplied by the equilibrium volume.","metadata":{}},{"id":"5a5822c7-5ab6-483b-a3ab-8cef5fcaf269","cell_type":"code","source":"fit_dict = analyse_results_for_energy_volume_curve(\n output_dict={\"energy\": result_dict},\n task_dict=task_dict,\n fit_type=\"polynomial\",\n fit_order=3,\n)","metadata":{"trusted":true},"outputs":[],"execution_count":9},{"id":"571b7c25dcca8bb","cell_type":"markdown","source":"The final energy volume curve plot summarizes the results of this calculation.","metadata":{}},{"id":"d420b4c5-1a2f-4290-ba81-0c7f7bdf7ef3","cell_type":"code","source":"plt.plot(fit_dict[\"volume\"], fit_dict[\"energy\"], label=\"$B_0$= %0.2f GPa\" % fit_dict[\"bulkmodul_eq\"])\nplt.xlabel(\"Volume [$\\AA^3$]\")\nplt.ylabel(\"Energy [eV]\")\nplt.legend()","metadata":{"trusted":true},"outputs":[{"execution_count":10,"output_type":"execute_result","data":{"text/plain":""},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"
","image/png":"iVBORw0KGgoAAAANSUhEUgAAAlQAAAG2CAYAAAC5/Bg9AAAAOnRFWHRTb2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iImokFFREREVEzsaAiIiIiaiYWVERERETNxIKKiIiIqJn+H/ivFa1no03WAAAAAElFTkSuQmCC"},"metadata":{}}],"execution_count":10},{"id":"fed42763-52cf-44c2-961d-6d00918ba6df","cell_type":"markdown","source":"## FluxJobExecutor\nIn analogy to the [FluxClusterExecutor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#flux) the [FluxJobExecutor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html#flux) can be applied to distribute simulation within a given queuing system allocation. The calculation of the bulk modulus with [gpaw](https://gpaw.readthedocs.io) is implemented in the same way.","metadata":{}},{"id":"516a91d4-0be6-47a6-9c9c-f5b0082bfee7","cell_type":"code","source":"from executorlib import FluxJobExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":11},{"id":"21bdd0d42f9806e4","cell_type":"markdown","source":"The for each strained structure a calculation task is submitted to the `FluxJobExecutor`. After the successful submission the current status of the flux queue is printed using `flux jobs -a`. Finally, the results are collected by gathering the [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects.","metadata":{}},{"id":"2b0c559b-a117-4766-b679-314ab9e65e97","cell_type":"code","source":"future_dict = {}\nwith FluxJobExecutor() as exe:\n for k, v in task_loop_dict.items():\n future_dict[k] = exe.submit(\n evaluate_with_gpaw, \n task_dict=v, \n kpts=(3, 3, 3), \n encut=300,\n resource_dict={\"cores\": 2},\n )\n sleep(1)\n pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))\n result_dict = {\n k: f.result()\n for k, f in tqdm(future_dict.items())\n }\n sleep(1)\n pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO',\n ' ƒeqRVxAU jovyan python R 2 1 4.138s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqRVxAT jovyan python R 2 1 4.138s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqQ1xt8 jovyan python R 2 1 4.139s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqQ1xt7 jovyan python R 2 1 4.139s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqNXybn jovyan python R 2 1 4.139s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqNXybm jovyan python R 2 1 4.139s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqM3zKR jovyan python R 2 1 4.141s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ6RrzUJb jovyan executorl+ F 2 1 1.192m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4ESWCVd jovyan executorl+ F 2 1 1.268m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ5WD8Tno jovyan executorl+ F 2 1 1.218m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3exNRKu jovyan executorl+ F 2 1 1.264m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3BjTcCf jovyan executorl+ F 2 1 1.271m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4YJoYUf jovyan executorl+ F 2 1 1.212m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ31P2d51 jovyan executorl+ F 2 1 1.251m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n '']\n"},{"name":"stderr","output_type":"stream","text":"100%|██████████| 7/7 [00:25<00:00, 3.60s/it]\n"},{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO',\n ' ƒeqRVxAU jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqRVxAT jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqQ1xt8 jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqQ1xt7 jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqNXybn jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqNXybm jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqM3zKR jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ6RrzUJb jovyan executorl+ F 2 1 1.192m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4ESWCVd jovyan executorl+ F 2 1 1.268m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ5WD8Tno jovyan executorl+ F 2 1 1.218m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3exNRKu jovyan executorl+ F 2 1 1.264m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3BjTcCf jovyan executorl+ F 2 1 1.271m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4YJoYUf jovyan executorl+ F 2 1 1.212m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ31P2d51 jovyan executorl+ F 2 1 1.251m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n '']\n"}],"execution_count":12},{"id":"ca353da1941c1c7c","cell_type":"markdown","source":"The resulting energies for the different volumes are fitted using a 3rd order polynomial to derive the bulk modulus as second derivative multiplied by the equilibrium volume.","metadata":{}},{"id":"8bb73863-bfde-4e96-9323-5330b2051632","cell_type":"code","source":"fit_dict = analyse_results_for_energy_volume_curve(\n output_dict={\"energy\": result_dict},\n task_dict=task_dict,\n fit_type=\"polynomial\",\n fit_order=3,\n)","metadata":{"trusted":true},"outputs":[],"execution_count":13},{"id":"3d4189b5c74ba2a2","cell_type":"markdown","source":"The final energy volume curve plot summarizes the results of this calculation.","metadata":{}},{"id":"95000e45-dd86-4659-90f4-f2d144477703","cell_type":"code","source":"plt.plot(fit_dict[\"volume\"], fit_dict[\"energy\"], label=\"$B_0$= %0.2f GPa\" % fit_dict[\"bulkmodul_eq\"])\nplt.xlabel(\"Volume [$\\AA^3$]\")\nplt.ylabel(\"Energy [eV]\")\nplt.legend()","metadata":{"trusted":true},"outputs":[{"execution_count":14,"output_type":"execute_result","data":{"text/plain":""},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"
","image/png":"iVBORw0KGgoAAAANSUhEUgAAAlQAAAG2CAYAAAC5/Bg9AAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjYsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvq6yFwwAAAAlwSFlzAAAPYQAAD2EBqD+naQAAcBZJREFUeJzt3XlYVGX/BvB7Zhj2HWTfBGWT1R203Pc9N8pXTcu3zbe0MrUyLcvltb1ezfxlWVlaikta7pobCiiLK6DIIosgyCLIOuf3BzKJArIMHGa4P9c1VzJz5sx9hA5fn+c53yMRBEEAERERETWZVOwAREREROqOBRURERFRM7GgIiIiImomFlREREREzcSCioiIiKiZWFARERERNRMLKiIiIqJmYkFFRERE1ExaYgdoLxQKBdLT02FkZASJRCJ2HCIiImoAQRBQWFgIOzs7SKV1j0OxoGol6enpcHR0FDsGERERNUFqaiocHBzqfJ0FVSsxMjICUPUNMTY2FjkNERERNURBQQEcHR2Vv8frwoKqlVRP8xkbG7OgIiIiUjOPW67DRelEREREzcSCioiIiKiZWFARERERNRMLKiIiIqJmYkFFRERE1EwsqIiIiIiaiQUVERERUTOxoCIiIiJqJhZURERERM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n/Pe//0VxcbHyKsCHDRw4ED/88APGjBkDMzMzLFmyBDKZrNk5jYyM8Oabb2L+/PlQKBTo27cvCgoKcPr0aRgaGmLmzJmP3Ud5eTneeOMNLFiwAAEBATVeMzY2BgDExMTU2Z+LiFofCyoiUhvPPfccvvvuOwwdOhROTk41Xlu1ahUUCgWmT5+OwsJCdO/eHfv376+1ZxMALF68GImJiRg9ejRMTEywfPlylYxQAcDy5cthZWWFlStXIjExEaampujatSvefvvtBr3/q6++Ql5eHubOnfvIa46OjtDX10d0dDQLKqI2hPfyIyJqA/r374+AgIBHemOpkkQiwY4dOzB+/PgW+wyi9oprqIiI2oi1a9fC0NAQFy5cUOl+X3zxRRgaGqp0n0RUE0eoiIjagLS0NNy7dw8A4OTkBG1tbZXtOysrS9n409bWFgYGBirbNxFVYUFFRERE1Eyc8iMiIiJqJhZURERERM3EgoqIiIiomVhQERERETUTCyoiIiKiZmJBRURERNRMLKiIiIiImokFFREREVEzsaAiIiIiaiYWVERERETNxIKKiIiIqJn+H/ivFa1no03WAAAAAElFTkSuQmCC"},"metadata":{}}],"execution_count":14},{"id":"8e67f9a4-d449-420c-9f62-72d106d18636","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]} \ No newline at end of file diff --git a/notebooks/4-2-quantum-espresso.ipynb b/notebooks/4-2-quantum-espresso.ipynb index 67727ee6..72a5d5cd 100644 --- a/notebooks/4-2-quantum-espresso.ipynb +++ b/notebooks/4-2-quantum-espresso.ipynb @@ -6,7 +6,7 @@ "metadata": {}, "source": [ "# Quantum Espresso\n", - "The [quantum espresso](https://www.quantum-espresso.org) density-functional theory (DFT) simulation code is written in Fortran and uses the message passing interface (MPI) for parallelization, without any Python bindings. So `executorlib` is used to orchestrate multiple [quantum espresso](https://www.quantum-espresso.org) simulation each using multiple CPU cores for parallelization. These kind of hierarchical workflows are one of the core strength of `executorlib`. It is important to emphasize that the same could not be achieved with other frameworks like [mpi4py](https://mpi4py.readthedocs.io) as [quantum espresso](https://www.quantum-espresso.org) does not support external MPI communicators without modifications to the Fortran source code. With `executorlib` the user can quickly up-scale their simulation workflow without the need to address the parallel execution explicitly, rather the parallelization is introduced on a per-function level, by submitting the functions to the `FluxClusterExecutor` or `FluxJobExecutor`." + "The [quantum espresso](https://www.quantum-espresso.org) density-functional theory (DFT) simulation code is written in Fortran and uses the message passing interface (MPI) for parallelization, without any Python bindings. So `executorlib` is used to orchestrate multiple [quantum espresso](https://www.quantum-espresso.org) simulation each using multiple CPU cores for parallelization. These kind of hierarchical workflows are one of the core strength of `executorlib`. It is important to emphasize that the same could not be achieved with other frameworks like [mpi4py](https://mpi4py.readthedocs.io) as [quantum espresso](https://www.quantum-espresso.org) does not support external MPI communicators without modifications to the Fortran source code. With `executorlib` the user can quickly up-scale their simulation workflow without the need to address the parallel execution explicitly, rather the parallelization is introduced on a per-function level, by submitting the functions to the `FluxClusterExecutor` or `FluxJobExecutor`. [Story 11](story-11-couple-mpi-simulation-codes.ipynb) explains this pattern step by step for any MPI-parallel executable on a SLURM cluster, from compiling a small MPI code to requesting the cores with `threads_per_core`." ] }, { diff --git a/notebooks/story-10-pandas-dataframes.ipynb b/notebooks/story-10-pandas-dataframes.ipynb new file mode 100644 index 00000000..b3b76ece --- /dev/null +++ b/notebooks/story-10-pandas-dataframes.ipynb @@ -0,0 +1,400 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Story 10: Parallel Computations on pandas DataFrames\n", + "**Who:** A data-driven materials scientist who keeps the inputs of a screening study - sample IDs, compositions and\n", + "temperatures - in a [pandas](https://pandas.pydata.org) DataFrame and computes a new property for every row.\n", + "\n", + "**What they want:** Replace the slow `df.apply()` by a parallel version, move large tables to the cluster, and when\n", + "new rows are added to the table, compute only the new rows.\n", + "\n", + "**Why plain SLURM is painful:** The DataFrame has to be split into files, a batch script or job array has to read\n", + "one part per job, compute it and write a result file, and a final script has to stitch the parts back together in the\n", + "original order. Keeping track of which rows were already computed is left to the user.\n", + "\n", + "**How executorlib helps:** `map()` and `submit()` accept DataFrame columns and whole DataFrames as arguments and return\n", + "Python objects, so rows or chunks of rows are distributed without any files. The `SlurmClusterExecutor` submits one\n", + "SLURM job per chunk, the returned DataFrames are joined with `pandas.concat()`, and the cache skips chunks which were\n", + "computed before.\n", + "\n", + "This notebook runs on the **login node** of a SLURM cluster." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Cluster-specific settings\n", + "**Adapt the following cell to your cluster.** It collects everything which depends on the cluster rather than on your science. The values below are the ones used to test this notebook on a single-node SLURM test cluster. The submission template is a [Jinja2](https://jinja.palletsprojects.com) template which executorlib renders for every function call: add the lines your cluster requires, for example `#SBATCH --partition=`, `#SBATCH --account=` or `module load ...` commands before `{{command}}`. The [executorlib-cluster-setup](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#setup-with-claude-code) skill for Claude Code can analyse your cluster and generate a tested template." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "parameters" + ] + }, + "outputs": [], + "source": [ + "# Cluster-specific settings - adapt these values to your cluster.\n", + "submission_template = \"\"\"\\\n", + "#!/bin/bash\n", + "#SBATCH --output=time.out\n", + "#SBATCH --job-name={{job_name}}\n", + "#SBATCH --chdir={{working_directory}}\n", + "#SBATCH --get-user-env=L\n", + "#SBATCH --ntasks={{cores}}\n", + "{%- if run_time_max %}\n", + "#SBATCH --time={{ [1, run_time_max // 60]|max }}\n", + "{%- endif %}\n", + "{%- if dependency_list %}\n", + "#SBATCH --dependency=afterok:{{ dependency_list | join(',') }}\n", + "{%- endif %}\n", + "\n", + "{{command}}\n", + "\"\"\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 1: The table and the serial version\n", + "The property is computed by a cheap model - 50 milliseconds per row - which takes two columns of the table as input.\n", + "The serial version uses `df.apply()` with `axis=1` to call it once per row." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import time\n", + "\n", + "import numpy\n", + "import pandas\n", + "\n", + "\n", + "def compute_property(composition, temperature):\n", + " # Stand-in for a cheap model evaluated for every row, e.g. a fitted energy model.\n", + " time.sleep(0.05)\n", + " return -3.0 * composition + 0.4 * composition**2 + 1.0e-4 * temperature * (1.0 - composition)\n", + "\n", + "\n", + "df = pandas.DataFrame(\n", + " {\n", + " \"sample_id\": numpy.arange(13),\n", + " \"composition\": numpy.linspace(0.0, 0.6, 13),\n", + " \"temperature\": numpy.tile([300, 600, 900], 5)[:13],\n", + " }\n", + ")\n", + "df_serial = df.assign(\n", + " energy=df.apply(lambda row: compute_property(row[\"composition\"], row[\"temperature\"]), axis=1)\n", + ")\n", + "df_serial.head()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 2: Row-wise parallelism with `map()`\n", + "`map()` of the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.map)\n", + "iterates over several columns at once, just like the built-in `map()`, and returns the results in the order of the\n", + "rows - so the list can be assigned directly as a new column.\n", + "\n", + "Each row only takes 50 milliseconds. This is far less than the overhead of a SLURM job, so the rows are distributed\n", + "with the `SingleNodeExecutor` over the cores of the machine this notebook runs on - your workstation, or a compute\n", + "node when the notebook runs inside an allocation. On a shared login node keep this to light work like this small\n", + "example. `block_allocation=True` starts the two worker processes once and reuses them for all rows, instead of\n", + "starting a new Python process per row." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from executorlib import SingleNodeExecutor\n", + "\n", + "with SingleNodeExecutor(max_workers=2, block_allocation=True) as exe:\n", + " energy_lst = list(exe.map(compute_property, df[\"composition\"], df[\"temperature\"]))\n", + "\n", + "df_rowwise = df.assign(energy=energy_lst)\n", + "numpy.allclose(df_rowwise[\"energy\"], df_serial[\"energy\"])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "When individual rows need different resources, or you want to react to each result as it arrives, use `submit()`\n", + "with one future per row instead:\n", + "\n", + "```python\n", + "future_lst = [exe.submit(compute_property, row.composition, row.temperature) for row in df.itertuples()]\n", + "df_rowwise = df.assign(energy=[future.result() for future in future_lst])\n", + "```" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 3: Chunks of rows as SLURM jobs\n", + "For large tables the work moves to the cluster - but not row by row. Every task has an overhead: for the\n", + "`SingleNodeExecutor` it is milliseconds, for an `srun` job step of the `SlurmJobExecutor` inside an allocation around\n", + "a second, and for a SLURM job of the `SlurmClusterExecutor` it is the time in the queue plus starting Python and\n", + "reading and writing the cache - seconds to hours. In addition many clusters limit the number of jobs per user. So the\n", + "rows are grouped into chunks, and every chunk becomes one task:\n", + "\n", + "* **Too fine:** the overhead dominates and the queue is flooded. For SLURM jobs choose chunks which run for minutes to\n", + " hours.\n", + "* **Too coarse:** fewer chunks than available cores limit the parallelism, and a failing chunk means recomputing all\n", + " of its rows.\n", + "\n", + "A chunk does not have to use a single core: submit it with `threads_per_core` and process its rows with a\n", + "`SingleNodeExecutor` inside the function, as shown in [Story 7](story-7-fan-out-inside-jobs.ipynb).\n", + "\n", + "The chunks are fixed-size slices of the table taken with `iloc`. `numpy.array_split(df, n)` would split the table into a\n", + "fixed *number* of chunks instead - but then the chunk boundaries move whenever rows are added, so every chunk changes\n", + "and none of them can be reloaded from the cache in Step 4. With fixed-size slices, appending rows only changes the\n", + "last chunk. If the rows belong to natural groups, `df.groupby(column)` is the other good choice: one chunk per group,\n", + "and only the groups which receive new rows change.\n", + "\n", + "Each chunk is submitted with a `cache_key` computed from its content by `get_chunk_key()` - Step 4 explains why." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import hashlib\n", + "\n", + "\n", + "def process_chunk(chunk):\n", + " # Executed as one SLURM job: compute the property for all rows of the chunk.\n", + " energy_lst = [compute_property(c, t) for c, t in zip(chunk[\"composition\"], chunk[\"temperature\"])]\n", + " return chunk.assign(energy=energy_lst)\n", + "\n", + "\n", + "def split_into_chunks(df, chunk_size):\n", + " # Fixed-size chunks: appending rows only changes the last chunk and adds new ones.\n", + " return [df.iloc[start : start + chunk_size] for start in range(0, len(df), chunk_size)]\n", + "\n", + "\n", + "def get_chunk_key(chunk):\n", + " # Name the cache files of a chunk after its content: values, index, column names and dtypes.\n", + " content_hash = hashlib.md5(pandas.util.hash_pandas_object(chunk, index=True).to_numpy().tobytes())\n", + " content_hash.update(str(chunk.dtypes.to_dict()).encode())\n", + " return \"process_chunk_v1_\" + content_hash.hexdigest()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Every chunk is submitted as its own SLURM job with one core, the returned DataFrames are joined with `pandas.concat()`.\n", + "As `concat()` keeps the index of every chunk and the futures are collected in submission order, the result has the\n", + "rows in the original order." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from executorlib import SlurmClusterExecutor\n", + "\n", + "cache_directory = \"./story10_cache\"\n", + "chunk_size = 5 # rows per SLURM job - in production rather thousands of rows\n", + "\n", + "\n", + "def compute_in_chunks(df, chunk_size):\n", + " with SlurmClusterExecutor(\n", + " cache_directory=cache_directory,\n", + " resource_dict={\"submission_template\": submission_template, \"run_time_max\": 300},\n", + " ) as exe:\n", + " future_lst = [\n", + " exe.submit(process_chunk, chunk, resource_dict={\"cache_key\": get_chunk_key(chunk)})\n", + " for chunk in split_into_chunks(df, chunk_size)\n", + " ]\n", + " return pandas.concat([future.result() for future in future_lst])\n", + "\n", + "\n", + "df_chunked = compute_in_chunks(df, chunk_size)\n", + "numpy.allclose(df_chunked[\"energy\"], df_serial[\"energy\"])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 4: New rows arrive - compute only what is new\n", + "Four new samples are appended to the table with `pandas.concat()`.\n", + "\n", + "By default executorlib identifies a function call by a hash of the pickled function and its arguments. For a DataFrame\n", + "the pickle does not only contain the values, the index, the column names and the dtypes, but also the internal memory\n", + "layout of pandas - which columns are stored together in one block. `pandas.concat()` can change this layout, so the\n", + "first chunk of the extended table may get a new default hash although its content is identical, and every chunk would\n", + "be computed again. The check below compares the content with `equals()` and the pickled bytes which the default hash\n", + "is based on - depending on your pandas version the second value can be `False`.\n", + "\n", + "`get_chunk_key()` avoids this: [`pandas.util.hash_pandas_object()`](https://pandas.pydata.org/docs/reference/api/pandas.util.hash_pandas_object.html)\n", + "hashes the values and the index row by row, independent of the memory layout, and the column names and dtypes are\n", + "added to the hash. Chunks with the same rows, the same index labels and the same columns get the same key and are\n", + "reloaded from the cache. A changed value, a different index (for example after `reset_index()` or sorting) or a\n", + "changed dtype leads to a new key." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import cloudpickle\n", + "\n", + "new_rows = pandas.DataFrame(\n", + " {\"sample_id\": numpy.arange(13, 17), \"composition\": [0.65, 0.7, 0.75, 0.8], \"temperature\": [600, 900, 300, 600]}\n", + ")\n", + "df_extended = pandas.concat([df, new_rows], ignore_index=True)\n", + "\n", + "first_chunk_before = split_into_chunks(df, chunk_size)[0]\n", + "first_chunk_after = split_into_chunks(df_extended, chunk_size)[0]\n", + "{\n", + " \"same content\": first_chunk_before.equals(first_chunk_after),\n", + " \"same pickle (default hash)\": cloudpickle.dumps(first_chunk_before) == cloudpickle.dumps(first_chunk_after),\n", + " \"same cache_key\": get_chunk_key(first_chunk_before) == get_chunk_key(first_chunk_after),\n", + "}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The extended table is split into the chunks with rows 0-4, 5-9, 10-14 and 15-16. The first two are identical to\n", + "chunks computed in Step 3 and are loaded from the cache, only the last two are submitted as new SLURM jobs. The\n", + "previous last chunk with rows 10-12 is no longer requested - its result stays in the cache, but it is not used.\n", + "\n", + "An explicit `cache_key` replaces the default hash completely, so it no longer changes when the code of\n", + "`process_chunk()` changes. This is why the key contains a version, `v1`: increase it whenever you change the\n", + "computation, otherwise the old results are reloaded. [Story 5](story-5-recover-failed-jobs.ipynb) uses the same\n", + "property on purpose to fix a bug without recomputing the successful calls." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from executorlib import get_cache_data\n", + "\n", + "df_extended_result = compute_in_chunks(df_extended, chunk_size)\n", + "len(df_extended_result), len(get_cache_data(cache_directory=cache_directory))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 5: Collect the results from the cache\n", + "The cache can be read without an executor, for example from a new Python process the next day. `get_cache_data()`\n", + "returns one entry per cached call with its input arguments, its output and its run time. The first argument of every\n", + "call is the chunk, so its index shows which rows were computed by which job." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "df_cache = pandas.DataFrame(get_cache_data(cache_directory=cache_directory))\n", + "df_cache[\"first_row\"] = df_cache[\"input_args\"].apply(lambda args: args[0].index[0])\n", + "df_cache[\"last_row\"] = df_cache[\"input_args\"].apply(lambda args: args[0].index[-1])\n", + "df_cache[[\"first_row\", \"last_row\", \"runtime\"]].sort_values([\"first_row\", \"last_row\"])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The outputs are DataFrames, so they are joined with `pandas.concat()`. The superseded chunk with rows 10-12 overlaps\n", + "with the chunk with rows 10-14 - both computed the same values, so duplicated index labels are dropped." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "df_all = pandas.concat(df_cache[\"output\"].tolist())\n", + "df_all = df_all[~df_all.index.duplicated()].sort_index()\n", + "numpy.allclose(df_all[\"energy\"], df_extended_result[\"energy\"]), len(df_all)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Clean up" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import shutil\n", + "\n", + "shutil.rmtree(cache_directory, ignore_errors=True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## What you learned\n", + "* `map()` over DataFrame columns replaces `df.apply()`; the results come back in the order of the rows and are\n", + " assigned as a new column.\n", + "* Cheap rows are grouped into chunks - fixed-size `iloc` slices or `groupby()` groups - submitted as one task each and\n", + " joined with `pandas.concat()`. Choose the chunk size so that the work per task outweighs its overhead: minutes or\n", + " more for a SLURM job.\n", + "* The default cache key hashes the pickled DataFrame, including its internal memory layout. A `cache_key` derived from\n", + " `pandas.util.hash_pandas_object()` makes an extended table reuse the finished chunks.\n", + "* `get_cache_data()` collects the cached chunks into one DataFrame without an executor.\n", + "\n", + "**Reference:** [HPC Cluster Executor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html),\n", + "[cache](https://executorlib.readthedocs.io/en/latest/1-single-node.html#cache),\n", + "[block allocation](https://executorlib.readthedocs.io/en/latest/1-single-node.html#block-allocation) and the\n", + "[resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary)." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/notebooks/story-11-couple-mpi-simulation-codes.ipynb b/notebooks/story-11-couple-mpi-simulation-codes.ipynb new file mode 100644 index 00000000..79184fa8 --- /dev/null +++ b/notebooks/story-11-couple-mpi-simulation-codes.ipynb @@ -0,0 +1,381 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Story 11: Couple Python to Simulation Codes which Use MPI Internally\n", + "**Who:** A computational scientist whose physics lives in an established simulation code written in C, C++ or\n", + "Fortran and parallelized with MPI - [Quantum Espresso](https://www.quantum-espresso.org),\n", + "[LAMMPS](https://www.lammps.org), VASP, CP2K or an in-house code. The workflow around it - generating input files,\n", + "scanning parameters, analysing the outputs - is written in Python.\n", + "\n", + "**What they want:** Run many simulations from one Python script, each with several MPI ranks in its own directory, and\n", + "get the parsed results back as Python objects.\n", + "\n", + "**Why plain SLURM is painful:** For every simulation a directory is created, an input file written, a batch script\n", + "with an `srun` line generated and submitted. Afterwards a second script walks over the directories, checks which runs\n", + "finished and parses the outputs. The logic of the workflow is spread over Python, shell scripts and files. mpi4py does\n", + "not help either: the simulation code is a separate executable which cannot use a communicator created in Python.\n", + "\n", + "**How executorlib helps:** The simulation is wrapped in an ordinary Python function which writes the input file,\n", + "starts the executable with the MPI launcher and parses the output file. The `SlurmClusterExecutor` submits every call\n", + "of this function as a SLURM job with its own working directory and enough CPU cores for the MPI ranks of the\n", + "executable, and returns the parsed results as futures.\n", + "\n", + "This notebook runs on the **login node** of a SLURM cluster." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Cluster-specific settings\n", + "**Adapt the following cell to your cluster.** It collects everything which depends on the cluster rather than on your science. The values below are the ones used to test this notebook on a single-node SLURM test cluster. The submission template is a [Jinja2](https://jinja.palletsprojects.com) template which executorlib renders for every function call: add the lines your cluster requires, for example `#SBATCH --partition=`, `#SBATCH --account=` or `module load ...` commands before `{{command}}`. The [executorlib-cluster-setup](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#setup-with-claude-code) skill for Claude Code can analyse your cluster and generate a tested template.\n", + "\n", + "`mpi_launcher` starts the MPI executable inside each job, for example `[\"srun\"]` with the MPI plugin of your cluster or\n", + "`[\"mpiexec\"]`. `mpicc` compiles the small example code of Step 1 - on your cluster load the compiler and MPI modules\n", + "and use `[\"mpicc\"]`. On the test cluster the MPICH compiler wrapper of the conda environment is used with the system C\n", + "compiler (`-cc=gcc`), and the location of the MPI library is embedded in the executable (`-Wl,-rpath,...`), so the\n", + "executable uses the same MPI library as mpi4py. `cores_per_simulation` is the number of MPI ranks of every simulation." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "parameters" + ] + }, + "outputs": [], + "source": [ + "# Cluster-specific settings - adapt these values to your cluster.\n", + "import os\n", + "import sys\n", + "\n", + "submission_template = \"\"\"\\\n", + "#!/bin/bash\n", + "#SBATCH --output=time.out\n", + "#SBATCH --job-name={{job_name}}\n", + "#SBATCH --chdir={{working_directory}}\n", + "#SBATCH --get-user-env=L\n", + "#SBATCH --ntasks={{cores}}\n", + "{%- if run_time_max %}\n", + "#SBATCH --time={{ [1, run_time_max // 60]|max }}\n", + "{%- endif %}\n", + "{%- if dependency_list %}\n", + "#SBATCH --dependency=afterok:{{ dependency_list | join(',') }}\n", + "{%- endif %}\n", + "\n", + "{{command}}\n", + "\"\"\"\n", + "mpi_launcher = [\"srun\", \"--mpi=pmi2\"] # starts the MPI executable inside the job, e.g. [\"mpiexec\"]\n", + "mpicc = [\"mpicc\", \"-cc=gcc\", \"-Wl,-rpath,\" + os.path.join(sys.prefix, \"lib\")] # MPI C compiler, e.g. [\"mpicc\"]\n", + "cores_per_simulation = 2 # MPI ranks of each simulation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 1: The simulation code\n", + "In a real project the simulation code is already installed, for example with `module load quantum-espresso`. To keep\n", + "this notebook self-contained, it writes and compiles a minimal MPI program in C instead. Like a real simulation code,\n", + "it reads an input file from the current directory, distributes the work over its MPI ranks, combines the partial\n", + "results with `MPI_Reduce` and writes an output file: it computes pi by integrating `4 / (1 + x^2)` from 0 to 1 with\n", + "`n_intervals` intervals." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "c_source = r\"\"\"\n", + "#include \n", + "#include \n", + "\n", + "/* Minimal MPI \"simulation code\": integrate 4 / (1 + x^2) from 0 to 1, which equals pi. */\n", + "int main(int argc, char **argv) {\n", + " int rank, size;\n", + " long n_intervals = 0;\n", + " MPI_Init(&argc, &argv);\n", + " MPI_Comm_rank(MPI_COMM_WORLD, &rank);\n", + " MPI_Comm_size(MPI_COMM_WORLD, &size);\n", + " if (rank == 0) { /* read the input file */\n", + " FILE *input = fopen(\"input.txt\", \"r\");\n", + " if (input == NULL || fscanf(input, \"n_intervals %ld\", &n_intervals) != 1 || n_intervals < 1) {\n", + " fprintf(stderr, \"invalid input.txt\\n\");\n", + " MPI_Abort(MPI_COMM_WORLD, 1);\n", + " }\n", + " fclose(input);\n", + " }\n", + " MPI_Bcast(&n_intervals, 1, MPI_LONG, 0, MPI_COMM_WORLD);\n", + " double width = 1.0 / n_intervals, local_sum = 0.0, pi = 0.0;\n", + " for (long i = rank; i < n_intervals; i += size) { /* every rank handles every size-th interval */\n", + " double x = width * (i + 0.5);\n", + " local_sum += 4.0 / (1.0 + x * x);\n", + " }\n", + " local_sum *= width;\n", + " MPI_Reduce(&local_sum, &pi, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);\n", + " if (rank == 0) { /* write the output file */\n", + " FILE *output = fopen(\"output.txt\", \"w\");\n", + " fprintf(output, \"pi %.15f\\nmpi_ranks %d\\n\", pi, size);\n", + " fclose(output);\n", + " printf(\"computed pi with %ld intervals on %d MPI ranks\\n\", n_intervals, size);\n", + " }\n", + " MPI_Finalize();\n", + " return 0;\n", + "}\n", + "\"\"\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The code is compiled once on the login node. On clusters whose login and compute nodes have different CPU\n", + "architectures, compile it in a job instead - or use the installed module. The jobs run in other directories, so the\n", + "absolute path of the executable is used." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import subprocess\n", + "\n", + "code_directory = os.path.abspath(\"story11_code\")\n", + "os.makedirs(code_directory, exist_ok=True)\n", + "source_file = os.path.join(code_directory, \"pi_mpi.c\")\n", + "executable = os.path.join(code_directory, \"pi_mpi\")\n", + "\n", + "with open(source_file, \"w\") as f:\n", + " f.write(c_source)\n", + "subprocess.run(mpicc + [\"-O2\", \"-o\", executable, source_file], check=True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 2: Wrap the simulation in a Python function\n", + "The function covers one simulation from input to parsed result: it writes the input file, starts the executable with\n", + "`mpi_ranks` MPI ranks and parses the output file. The standard output of the simulation is written to a log file, and\n", + "`check=True` raises an exception if the simulation fails, which executorlib passes on to the future. The function\n", + "works in the current directory - executorlib sets it per call with `cwd` in Step 3.\n", + "\n", + "[ASE](https://wiki.fysik.dtu.dk/ase) provides such wrappers for many simulation codes as calculators: the\n", + "[Quantum Espresso example](4-2-quantum-espresso.ipynb) only sets the launch command of the calculator." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def run_pi_simulation(n_intervals, executable, mpi_launcher, mpi_ranks):\n", + " # Executed in the working directory of the SLURM job: write the input, run the MPI code, parse the output.\n", + " import subprocess\n", + "\n", + " with open(\"input.txt\", \"w\") as f:\n", + " f.write(f\"n_intervals {n_intervals}\\n\")\n", + " with open(\"simulation.log\", \"w\") as log:\n", + " subprocess.run(\n", + " mpi_launcher + [\"-n\", str(mpi_ranks), executable],\n", + " stdout=log,\n", + " stderr=subprocess.STDOUT,\n", + " check=True,\n", + " )\n", + " with open(\"output.txt\") as f:\n", + " output = dict(line.split() for line in f)\n", + " return {\"n_intervals\": n_intervals, \"pi\": float(output[\"pi\"]), \"mpi_ranks\": int(output[\"mpi_ranks\"])}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 3: Request the resources\n", + "The resources of the simulation are defined in the `resource_dict` - with one important difference to MPI-parallel\n", + "Python functions:\n", + "\n", + "* `cores` is set to **one**. `cores` is the number of MPI ranks executorlib uses to start the *Python function*. With\n", + " `cores=2` executorlib would start the function with `srun -n 2`, so two copies of the wrapper would each start the\n", + " simulation code.\n", + "* `threads_per_core` reserves the CPU cores for the executable. The `SlurmClusterExecutor` multiplies `cores` and\n", + " `threads_per_core` before it renders the submission template, so `{{cores}}` - and with it `#SBATCH --ntasks` -\n", + " equals `cores_per_simulation`. The `srun` call inside the job then uses these tasks for the MPI ranks of the\n", + " executable.\n", + "* `cwd` sets the working directory of the job: every simulation gets its own directory for its input, output and log\n", + " files, while the cache stays in the `cache_directory`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def get_resources(n_intervals):\n", + " return {\n", + " \"cores\": 1, # the Python wrapper itself is serial - it must not be started as MPI program\n", + " \"threads_per_core\": cores_per_simulation, # CPU cores for the MPI ranks of the executable\n", + " \"cwd\": os.path.abspath(os.path.join(\"story11_runs\", f\"n_intervals_{n_intervals}\")),\n", + " \"run_time_max\": 300,\n", + " }" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 4: Run the convergence study\n", + "The workflow logic stays in Python: one simulation per number of intervals, and a serial analysis step which compares\n", + "the results to the exact value. The futures of the simulations are passed to the analysis as arguments, so it is\n", + "submitted right away as a SLURM job which depends on the simulation jobs ([Story 2](story-2-multi-resource-pipeline.ipynb))." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from executorlib import SlurmClusterExecutor\n", + "\n", + "cache_directory = os.path.abspath(\"story11_cache\")\n", + "n_intervals_lst = [10, 100, 1000]\n", + "\n", + "\n", + "def analyse_convergence(*result_lst):\n", + " import math\n", + "\n", + " return {result[\"n_intervals\"]: abs(result[\"pi\"] - math.pi) for result in result_lst}\n", + "\n", + "\n", + "with SlurmClusterExecutor(\n", + " cache_directory=cache_directory,\n", + " resource_dict={\"submission_template\": submission_template},\n", + ") as exe:\n", + " simulation_lst = [\n", + " exe.submit(\n", + " run_pi_simulation,\n", + " n_intervals,\n", + " executable=executable,\n", + " mpi_launcher=mpi_launcher,\n", + " mpi_ranks=cores_per_simulation,\n", + " resource_dict=get_resources(n_intervals),\n", + " )\n", + " for n_intervals in n_intervals_lst\n", + " ]\n", + " error = exe.submit(analyse_convergence, *simulation_lst, resource_dict={\"cores\": 1, \"run_time_max\": 60})\n", + " result_lst = [simulation.result() for simulation in simulation_lst]\n", + " print(error.result())\n", + "\n", + "result_lst" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 5: Inspect a working directory\n", + "The raw files of every simulation remain in its working directory - next to `time.out`, the output of the SLURM job -\n", + "so they can be inspected, archived or parsed again with a different parser later." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "run_directory = get_resources(1000)[\"cwd\"]\n", + "print(sorted(os.listdir(run_directory)))\n", + "with open(os.path.join(run_directory, \"output.txt\")) as f:\n", + " print(f.read())" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Executing the cell of Step 4 again reloads all results from the cache without submitting a job. Keep in mind that the\n", + "cache key is a hash of the Python function and its arguments - the path of the executable, not its content. After\n", + "recompiling or updating the simulation code, use a new `cache_directory` or pass the version of the code as an\n", + "additional argument.\n", + "\n", + "## Other codes and other launchers\n", + "The pattern is the same for every MPI-parallel executable: Quantum Espresso (`pw.x`), LAMMPS (`lmp -in in.lammps`),\n", + "VASP, CP2K or GROMACS - only the input writer and the output parser change. The\n", + "[Quantum Espresso example](4-2-quantum-espresso.ipynb) is a complete real-world version of this story: it computes an\n", + "energy-volume curve with ASE, where the calculator starts `pw.x` with `flux run`, and uses the same `resource_dict`\n", + "with `cores=1`, `threads_per_core` and `cwd`. If your code also provides Python bindings which accept an mpi4py\n", + "communicator - like LAMMPS or [GPAW](4-1-gpaw.ipynb) - you can alternatively call it directly in an MPI-parallel\n", + "Python function, see [Story 12](story-12-mpi4py-functions.ipynb).\n", + "\n", + "Inside an existing allocation, the `SlurmJobExecutor` starts every function as an `srun` job step, and starting the\n", + "executable with another `srun` from within this job step is not reliably supported by SLURM. Start the\n", + "[flux](https://flux-framework.org) scheduler in the allocation instead (`srun flux start python my_workflow.py`), use\n", + "the `FluxJobExecutor` with the same `resource_dict` and `mpi_launcher = [\"flux\", \"run\"]`, as shown in the\n", + "[Quantum Espresso example](4-2-quantum-espresso.ipynb) and in\n", + "[SLURM with flux](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html#slurm-with-flux)." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Clean up" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import shutil\n", + "\n", + "for directory in [cache_directory, os.path.abspath(\"story11_runs\"), code_directory]:\n", + " shutil.rmtree(directory, ignore_errors=True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## What you learned\n", + "* An MPI-parallel executable is coupled to Python with a serial wrapper function, which writes the input, starts the\n", + " executable with the MPI launcher via `subprocess` and parses the output.\n", + "* Such wrappers are submitted with `cores=1`; the CPU cores for the executable are requested with `threads_per_core`,\n", + " which the `SlurmClusterExecutor` multiplies with `cores` for `{{cores}}` in the submission template.\n", + "* `cwd` gives every simulation its own working directory, which keeps the raw files for inspection.\n", + "* Futures of the simulations connect them to the analysis in Python, just like any other function.\n", + "\n", + "**Reference:** [Quantum Espresso example](4-2-quantum-espresso.ipynb),\n", + "[HPC Cluster Executor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html),\n", + "[cores, threads per core and maximum workers](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#cores-threads-per-core-and-maximum-workers)\n", + "and the [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary)." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/notebooks/story-12-mpi4py-functions.ipynb b/notebooks/story-12-mpi4py-functions.ipynb new file mode 100644 index 00000000..8989ed11 --- /dev/null +++ b/notebooks/story-12-mpi4py-functions.ipynb @@ -0,0 +1,311 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Story 12: Parallelize Only the Functions which Need It with mpi4py\n", + "**Who:** A scientist with a serial Python analysis script: load a structure, compute an interaction energy over all\n", + "pairs of particles, summarize. Profiling shows that the pair sum takes almost all of the run time.\n", + "\n", + "**What they want:** Parallelize only this one function with MPI, keep the rest of the script serial and unchanged, and\n", + "run it on the cluster.\n", + "\n", + "**Why plain SLURM is painful:** Running the whole script with `srun -n 64 python script.py` executes every line on\n", + "every rank: the serial parts have to be guarded with `if rank == 0`, the data is read 64 times or broadcast by hand,\n", + "and the serial steps block 64 cores while only one of them works. Splitting the script into an MPI script and serial\n", + "scripts means passing the data through files and chaining the jobs by hand.\n", + "\n", + "**How executorlib helps:** Only the hot function is written with [mpi4py](https://mpi4py.readthedocs.io). Submitted\n", + "with `resource_dict={\"cores\": N}`, executorlib starts it on N MPI ranks, hands the same arguments to every rank and\n", + "collects the return values. The rest of the script stays serial Python, and the MPI result is passed on to the next\n", + "serial step as a future.\n", + "\n", + "This notebook runs on the **login node** of a SLURM cluster." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Cluster-specific settings\n", + "**Adapt the following cell to your cluster.** It collects everything which depends on the cluster rather than on your science. The values below are the ones used to test this notebook on a single-node SLURM test cluster. The submission template is a [Jinja2](https://jinja.palletsprojects.com) template which executorlib renders for every function call: add the lines your cluster requires, for example `#SBATCH --partition=`, `#SBATCH --account=` or `module load ...` commands before `{{command}}`. The [executorlib-cluster-setup](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#setup-with-claude-code) skill for Claude Code can analyse your cluster and generate a tested template.\n", + "\n", + "The `pmi_mode` selects the process management interface which `srun` uses to start MPI-parallel functions. It depends on the MPI library your Python environment is linked to." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "parameters" + ] + }, + "outputs": [], + "source": [ + "# Cluster-specific settings - adapt these values to your cluster.\n", + "submission_template = \"\"\"\\\n", + "#!/bin/bash\n", + "#SBATCH --output=time.out\n", + "#SBATCH --job-name={{job_name}}\n", + "#SBATCH --chdir={{working_directory}}\n", + "#SBATCH --get-user-env=L\n", + "#SBATCH --ntasks={{cores}}\n", + "{%- if run_time_max %}\n", + "#SBATCH --time={{ [1, run_time_max // 60]|max }}\n", + "{%- endif %}\n", + "{%- if dependency_list %}\n", + "#SBATCH --dependency=afterok:{{ dependency_list | join(',') }}\n", + "{%- endif %}\n", + "\n", + "{{command}}\n", + "\"\"\"\n", + "pmi_mode = \"pmi2\" # MPI process management interface: \"pmi2\" for MPICH, \"pmix\" for OpenMPI >= 5" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 1: The serial script\n", + "Three functions: loading the particle positions, the pair sum - a Morse-like interaction between all pairs of\n", + "particles, which scales quadratically with the number of particles - and a summary." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy\n", + "\n", + "\n", + "def load_positions(n_particles, seed=42):\n", + " # Stand-in for reading a structure or a frame of a trajectory from disk.\n", + " rng = numpy.random.default_rng(seed)\n", + " return rng.uniform(0.0, 10.0, size=(n_particles, 3))\n", + "\n", + "\n", + "def compute_pair_energy(positions):\n", + " # The hot spot: a sum over all pairs of particles.\n", + " energy = 0.0\n", + " for i in range(len(positions)):\n", + " distance = numpy.linalg.norm(positions[i + 1 :] - positions[i], axis=1)\n", + " energy += numpy.sum(numpy.exp(-2.0 * (distance - 1.5)) - 2.0 * numpy.exp(-(distance - 1.5)))\n", + " return energy\n", + "\n", + "\n", + "def summarize(energy, n_particles):\n", + " return {\"n_particles\": n_particles, \"energy_per_particle\": energy / n_particles}\n", + "\n", + "\n", + "n_particles = 500\n", + "positions = load_positions(n_particles=n_particles)\n", + "summary_serial = summarize(compute_pair_energy(positions), n_particles=n_particles)\n", + "summary_serial" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 2: Rewrite only the hot function with mpi4py\n", + "The MPI version distributes the outer loop: rank `r` of `size` ranks handles the particles `r`, `r + size`,\n", + "`r + 2 * size`, ... and `comm.allreduce()` adds up the partial sums of all ranks. `mpi4py` is imported inside the\n", + "function, so the rest of the script does not depend on MPI.\n", + "\n", + "executorlib executes an MPI-parallel function on every rank and collects the return value of every rank: for\n", + "`cores > 1` the result of the future is a **list with one entry per MPI rank**, ordered by rank. A function which\n", + "returns `(i, size, rank)` on two ranks results in `[(i, 2, 0), (i, 2, 1)]`. After `allreduce()` every rank knows the\n", + "total energy, so returning it on every rank would give the same value twice. Large results should only be returned\n", + "once, to avoid transferring and storing copies: here rank 0 returns the energy and all other ranks return `None`, so\n", + "the result is `[energy, None]` - the list keeps one entry per rank. With `cores=1` the function is started without MPI\n", + "launcher, `COMM_WORLD` has a single rank and the result is the plain return value, not a list." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def compute_pair_energy_mpi(positions):\n", + " # Same sum as compute_pair_energy(), with the outer loop distributed over the MPI ranks.\n", + " from mpi4py import MPI\n", + "\n", + " comm = MPI.COMM_WORLD\n", + " rank, size = comm.Get_rank(), comm.Get_size()\n", + " local_energy = 0.0\n", + " for i in range(rank, len(positions), size):\n", + " distance = numpy.linalg.norm(positions[i + 1 :] - positions[i], axis=1)\n", + " local_energy += numpy.sum(numpy.exp(-2.0 * (distance - 1.5)) - 2.0 * numpy.exp(-(distance - 1.5)))\n", + " energy = comm.allreduce(local_energy)\n", + " return energy if rank == 0 else None" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 3: Submit only the MPI function with more cores\n", + "The script keeps its structure. `load_positions()` still runs in the notebook, the MPI function is submitted with two\n", + "MPI ranks, and `summarize()` is submitted with one core. `split_future()` selects the result of rank 0 from the list of\n", + "per-rank results without waiting for it, so `summarize()` is submitted right away as a SLURM job which depends on the\n", + "MPI job. executorlib starts the MPI function with `srun -n 2 --mpi=pmi2` inside its job, as defined by `pmi_mode`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from executorlib import SlurmClusterExecutor, split_future\n", + "\n", + "cache_directory = \"./story12_cache\"\n", + "mpi_ranks = 2\n", + "\n", + "positions = load_positions(n_particles=n_particles) # serial, unchanged\n", + "\n", + "with SlurmClusterExecutor(\n", + " cache_directory=cache_directory,\n", + " pmi_mode=pmi_mode,\n", + " resource_dict={\"submission_template\": submission_template, \"run_time_max\": 300},\n", + ") as exe:\n", + " energy_per_rank = exe.submit(compute_pair_energy_mpi, positions, resource_dict={\"cores\": mpi_ranks})\n", + " energy = split_future(energy_per_rank, n=mpi_ranks)[0] # the entry of rank 0\n", + " summary = exe.submit(summarize, energy, n_particles=n_particles, resource_dict={\"cores\": 1})\n", + " print(\"per rank:\", energy_per_rank.result())\n", + " print(\"summary:\", summary.result())" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The MPI version adds up the same numbers in a different order, so it agrees with the serial version up to rounding:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "numpy.isclose(summary.result()[\"energy_per_particle\"], summary_serial[\"energy_per_particle\"])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Step 4: Existing mpi4py-enabled codes\n", + "Many simulation codes with Python interfaces accept an mpi4py communicator, so they are submitted in exactly the same\n", + "way. The [GPAW example](4-1-gpaw.ipynb) computes an energy-volume curve with the density functional theory code\n", + "[GPAW](https://gpaw.readthedocs.io), passing `MPI.COMM_WORLD` to the calculator. With the `SlurmClusterExecutor` from\n", + "above it reads:\n", + "\n", + "```python\n", + "def evaluate_with_gpaw(structure, kpts, encut):\n", + " import os\n", + "\n", + " os.environ[\"OMP_NUM_THREADS\"] = \"1\"\n", + " os.environ[\"GPAW_MPI4PY\"] = \"1\"\n", + "\n", + " from mpi4py import MPI\n", + " from gpaw import GPAW, PW\n", + " from gpaw.mpi4pywrapper import MPI4PYWrapper\n", + "\n", + " structure = structure.copy()\n", + " structure.calc = GPAW(xc=\"PBE\", mode=PW(encut), kpts=kpts, communicator=MPI4PYWrapper(MPI.COMM_WORLD))\n", + " return structure.get_potential_energy()\n", + "\n", + "\n", + "with SlurmClusterExecutor(\n", + " cache_directory=cache_directory,\n", + " pmi_mode=pmi_mode,\n", + " resource_dict={\"submission_template\": submission_template},\n", + ") as exe:\n", + " future = exe.submit(evaluate_with_gpaw, bulk(\"Al\", a=4.05), kpts=(3, 3, 3), encut=300, resource_dict={\"cores\": 4})\n", + " energy = split_future(future, n=4)[0]\n", + "```\n", + "\n", + "GPAW returns the energy on every rank, so the result is a list of four identical energies. The same applies to\n", + "[LAMMPS](https://docs.lammps.org/Python_head.html), whose Python module takes the communicator as\n", + "`lammps(comm=MPI.COMM_WORLD)`, and to libraries like [petsc4py](https://petsc.org/release/petsc4py/). Codes without\n", + "Python bindings, which are started as MPI executables, are covered in\n", + "[Story 11](story-11-couple-mpi-simulation-codes.ipynb).\n", + "\n", + "## Inside an allocation: `SlurmJobExecutor`\n", + "When the script runs inside an existing allocation, for example started with `salloc -n 4`, the `SlurmJobExecutor`\n", + "starts the MPI function as an `srun` job step instead of a new job. The functions, the `resource_dict` and the futures\n", + "stay the same; the MPI plugin of `srun` is set with `slurm_cmd_args`:\n", + "\n", + "```python\n", + "from executorlib import SlurmJobExecutor\n", + "\n", + "with SlurmJobExecutor(max_cores=4, resource_dict={\"slurm_cmd_args\": [\"--mpi=pmi2\"]}) as exe:\n", + " energy_per_rank = exe.submit(compute_pair_energy_mpi, positions, resource_dict={\"cores\": 2})\n", + " summary = exe.submit(summarize, split_future(energy_per_rank, n=2)[0], n_particles=n_particles)\n", + " print(summary.result())\n", + "```\n", + "\n", + "The result of the MPI function is again a list with one entry per rank - the `SlurmJobExecutor` collects the return\n", + "values in the same way as the `SlurmClusterExecutor`." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Clean up" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import shutil\n", + "\n", + "shutil.rmtree(cache_directory, ignore_errors=True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## What you learned\n", + "* Only the functions which benefit from MPI are rewritten with mpi4py - importing `mpi4py` inside the function keeps the\n", + " rest of the script serial and free of MPI.\n", + "* `resource_dict={\"cores\": N}` starts a function on N MPI ranks; `pmi_mode` (or `slurm_cmd_args` for the\n", + " `SlurmJobExecutor`) defines how `srun` starts it.\n", + "* For `cores > 1` the result is a list with one entry per rank. Return large results only on rank 0 and select that\n", + " entry with `split_future()`, which passes it on to the next serial step without waiting.\n", + "* Codes with mpi4py support like GPAW or LAMMPS are submitted in the same way.\n", + "\n", + "**Reference:** [MPI parallel functions](https://executorlib.readthedocs.io/en/latest/1-single-node.html#mpi-parallel-functions),\n", + "[MPI-parallel Python on SLURM](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#mpi-parallel-python),\n", + "[split future objects](https://executorlib.readthedocs.io/en/latest/1-single-node.html#split-future-objects),\n", + "[GPAW example](4-1-gpaw.ipynb) and the\n", + "[message passing interface](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#message-passing-interface)\n", + "section of the trouble shooting guide." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} From 233c9042c68b003a0e516d2eab31251bd7719e32 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Thu, 19 Nov 2026 12:45:43 +0100 Subject: [PATCH 7/9] Order user stories by how likely users have the corresponding question Renumber the story notebooks: submission, parameter studies, pandas DataFrames and coupling to MPI codes come first; failure recovery, performance tuning and advanced patterns follow. Co-Authored-By: Claude Opus 5.5 --- README.md | 54 +++++++++---------- docs/_toc.yml | 22 ++++---- notebooks/1-single-node.ipynb | 2 +- notebooks/4-1-gpaw.ipynb | 2 +- notebooks/4-2-quantum-espresso.ipynb | 2 +- notebooks/story-1-submit-and-reconnect.ipynb | 2 +- ...ynb => story-10-fan-out-inside-jobs.ipynb} | 4 +- ...pynb => story-11-adaptive-workflows.ipynb} | 2 +- ...pynb => story-12-document-and-share.ipynb} | 2 +- ...dy.ipynb => story-2-parameter-study.ipynb} | 2 +- ....ipynb => story-3-pandas-dataframes.ipynb} | 6 +-- ...story-4-couple-mpi-simulation-codes.ipynb} | 6 +-- ...s.ipynb => story-5-mpi4py-functions.ipynb} | 4 +- ... => story-6-multi-resource-pipeline.ipynb} | 4 +- ...ynb => story-7-prototype-then-scale.ipynb} | 4 +- ...pynb => story-8-recover-failed-jobs.ipynb} | 2 +- ...ynb => story-9-expensive-setup-once.ipynb} | 2 +- 17 files changed, 61 insertions(+), 61 deletions(-) rename notebooks/{story-7-fan-out-inside-jobs.ipynb => story-10-fan-out-inside-jobs.ipynb} (98%) rename notebooks/{story-8-adaptive-workflows.ipynb => story-11-adaptive-workflows.ipynb} (99%) rename notebooks/{story-9-document-and-share.ipynb => story-12-document-and-share.ipynb} (99%) rename notebooks/{story-3-parameter-study.ipynb => story-2-parameter-study.ipynb} (99%) rename notebooks/{story-10-pandas-dataframes.ipynb => story-3-pandas-dataframes.ipynb} (99%) rename notebooks/{story-11-couple-mpi-simulation-codes.ipynb => story-4-couple-mpi-simulation-codes.ipynb} (98%) rename notebooks/{story-12-mpi4py-functions.ipynb => story-5-mpi4py-functions.ipynb} (98%) rename notebooks/{story-2-multi-resource-pipeline.ipynb => story-6-multi-resource-pipeline.ipynb} (99%) rename notebooks/{story-4-prototype-then-scale.ipynb => story-7-prototype-then-scale.ipynb} (98%) rename notebooks/{story-5-recover-failed-jobs.ipynb => story-8-recover-failed-jobs.ipynb} (99%) rename notebooks/{story-6-expensive-setup-once.ipynb => story-9-expensive-setup-once.ipynb} (99%) diff --git a/README.md b/README.md index 2ba26792..6265b265 100644 --- a/README.md +++ b/README.md @@ -60,32 +60,32 @@ The user stories each start from a typical challenge of HPC users and solve it e executorlib which are needed along the way: 1. [Submit a long-running function and come back later](https://executorlib.readthedocs.io/en/latest/story-1-submit-and-reconnect.html) - submit from the login node, disconnect, check the status, reconnect and cancel jobs. -2. [A pipeline whose steps need different resources](https://executorlib.readthedocs.io/en/latest/story-2-multi-resource-pipeline.html) - per-call - resources, MPI-parallel functions and SLURM job dependencies from future objects. -3. [A parameter study with many short calculations](https://executorlib.readthedocs.io/en/latest/story-3-parameter-study.html) - distribute +2. [A parameter study with many short calculations](https://executorlib.readthedocs.io/en/latest/story-2-parameter-study.html) - distribute calculations within one allocation, find failing parameter sets and collect the results in a DataFrame. -4. [Prototype on a laptop, then scale up](https://executorlib.readthedocs.io/en/latest/story-4-prototype-then-scale.html) - develop locally with +3. [Parallel computations on pandas DataFrames](https://executorlib.readthedocs.io/en/latest/story-3-pandas-dataframes.html) - + replace `df.apply()`, submit chunks of rows as SLURM jobs and recompute only new rows with the cache. +4. [Couple Python to simulation codes which use MPI internally](https://executorlib.readthedocs.io/en/latest/story-4-couple-mpi-simulation-codes.html) - + wrap MPI executables written in C, C++ or Fortran in Python functions, each with its own working directory. +5. [Parallelize only the functions which need it with mpi4py](https://executorlib.readthedocs.io/en/latest/story-5-mpi4py-functions.html) - + MPI-parallel functions within a serial script, their per-rank results and mpi4py-enabled codes like GPAW. +6. [A pipeline whose steps need different resources](https://executorlib.readthedocs.io/en/latest/story-6-multi-resource-pipeline.html) - per-call + resources, MPI-parallel functions and SLURM job dependencies from future objects. +7. [Prototype on a laptop, then scale up](https://executorlib.readthedocs.io/en/latest/story-7-prototype-then-scale.html) - develop locally with the same interface, test the file-based cluster mode and switch executors with one line. -5. [Recover from failed jobs](https://executorlib.readthedocs.io/en/latest/story-5-recover-failed-jobs.html) - diagnose exceptions and killed +8. [Recover from failed jobs](https://executorlib.readthedocs.io/en/latest/story-8-recover-failed-jobs.html) - diagnose exceptions and killed jobs, then rerun only the failed calculations. -6. [Pay for an expensive setup only once](https://executorlib.readthedocs.io/en/latest/story-6-expensive-setup-once.html) - long-lived workers +9. [Pay for an expensive setup only once](https://executorlib.readthedocs.io/en/latest/story-9-expensive-setup-once.html) - long-lived workers with an initialization function and automatic restarts. -7. [Large jobs which each fan out into many small tasks](https://executorlib.readthedocs.io/en/latest/story-7-fan-out-inside-jobs.html) - +10. [Large jobs which each fan out into many small tasks](https://executorlib.readthedocs.io/en/latest/story-10-fan-out-inside-jobs.html) - combine one SLURM job per campaign with many tasks inside each job. -8. [Adaptive workflows](https://executorlib.readthedocs.io/en/latest/story-8-adaptive-workflows.html) - convergence loops, recursion with +11. [Adaptive workflows](https://executorlib.readthedocs.io/en/latest/story-11-adaptive-workflows.html) - convergence loops, recursion with `asyncio` and batching in the order results arrive. -9. [Document and share a workflow](https://executorlib.readthedocs.io/en/latest/story-9-document-and-share.html) - export the workflow graph and +12. [Document and share a workflow](https://executorlib.readthedocs.io/en/latest/story-12-document-and-share.html) - export the workflow graph and use the cache as an audit trail. -10. [Parallel computations on pandas DataFrames](https://executorlib.readthedocs.io/en/latest/story-10-pandas-dataframes.html) - - replace `df.apply()`, submit chunks of rows as SLURM jobs and recompute only new rows with the cache. -11. [Couple Python to simulation codes which use MPI internally](https://executorlib.readthedocs.io/en/latest/story-11-couple-mpi-simulation-codes.html) - - wrap MPI executables written in C, C++ or Fortran in Python functions, each with its own working directory. -12. [Parallelize only the functions which need it with mpi4py](https://executorlib.readthedocs.io/en/latest/story-12-mpi4py-functions.html) - - MPI-parallel functions within a serial script, their per-rank results and mpi4py-enabled codes like GPAW. The cluster-specific settings like the partition, run time limits and the submission template are collected in one cell at the top of each story. Readers without access to an HPC cluster can start with -[Story 4](https://executorlib.readthedocs.io/en/latest/story-4-prototype-then-scale.html) or follow the examples below locally. +[Story 7](https://executorlib.readthedocs.io/en/latest/story-7-prototype-then-scale.html) or follow the examples below locally. ## Examples The Python standard library provides the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#executor-objects) @@ -224,17 +224,17 @@ cluster-specific configuration for the `SlurmClusterExecutor`. * [For Developers](https://executorlib.readthedocs.io/en/latest/installation.html#for-developers) * User Stories * [Submit a Long-running Function and Come Back Later](https://executorlib.readthedocs.io/en/latest/story-1-submit-and-reconnect.html) - * [A Pipeline whose Steps Need Different Resources](https://executorlib.readthedocs.io/en/latest/story-2-multi-resource-pipeline.html) - * [A Parameter Study with Many Short Calculations](https://executorlib.readthedocs.io/en/latest/story-3-parameter-study.html) - * [Prototype on a Laptop, then Scale Up](https://executorlib.readthedocs.io/en/latest/story-4-prototype-then-scale.html) - * [Recover from Failed Jobs](https://executorlib.readthedocs.io/en/latest/story-5-recover-failed-jobs.html) - * [Pay for an Expensive Setup Only Once](https://executorlib.readthedocs.io/en/latest/story-6-expensive-setup-once.html) - * [Large Jobs which Each Fan Out into Many Small Tasks](https://executorlib.readthedocs.io/en/latest/story-7-fan-out-inside-jobs.html) - * [Adaptive Workflows](https://executorlib.readthedocs.io/en/latest/story-8-adaptive-workflows.html) - * [Document and Share a Workflow](https://executorlib.readthedocs.io/en/latest/story-9-document-and-share.html) - * [Parallel Computations on pandas DataFrames](https://executorlib.readthedocs.io/en/latest/story-10-pandas-dataframes.html) - * [Couple Python to Simulation Codes which Use MPI Internally](https://executorlib.readthedocs.io/en/latest/story-11-couple-mpi-simulation-codes.html) - * [Parallelize Only the Functions which Need It with mpi4py](https://executorlib.readthedocs.io/en/latest/story-12-mpi4py-functions.html) + * [A Parameter Study with Many Short Calculations](https://executorlib.readthedocs.io/en/latest/story-2-parameter-study.html) + * [Parallel Computations on pandas DataFrames](https://executorlib.readthedocs.io/en/latest/story-3-pandas-dataframes.html) + * [Couple Python to Simulation Codes which Use MPI Internally](https://executorlib.readthedocs.io/en/latest/story-4-couple-mpi-simulation-codes.html) + * [Parallelize Only the Functions which Need It with mpi4py](https://executorlib.readthedocs.io/en/latest/story-5-mpi4py-functions.html) + * [A Pipeline whose Steps Need Different Resources](https://executorlib.readthedocs.io/en/latest/story-6-multi-resource-pipeline.html) + * [Prototype on a Laptop, then Scale Up](https://executorlib.readthedocs.io/en/latest/story-7-prototype-then-scale.html) + * [Recover from Failed Jobs](https://executorlib.readthedocs.io/en/latest/story-8-recover-failed-jobs.html) + * [Pay for an Expensive Setup Only Once](https://executorlib.readthedocs.io/en/latest/story-9-expensive-setup-once.html) + * [Large Jobs which Each Fan Out into Many Small Tasks](https://executorlib.readthedocs.io/en/latest/story-10-fan-out-inside-jobs.html) + * [Adaptive Workflows](https://executorlib.readthedocs.io/en/latest/story-11-adaptive-workflows.html) + * [Document and Share a Workflow](https://executorlib.readthedocs.io/en/latest/story-12-document-and-share.html) * [Comparison](https://executorlib.readthedocs.io/en/latest/comparison.html#comparison) * [At a glace](https://executorlib.readthedocs.io/en/latest/comparison.html#at-a-glance) * [Concurrent futures](https://executorlib.readthedocs.io/en/latest/comparison.html#concurrent-futures-the-python-standard-library) diff --git a/docs/_toc.yml b/docs/_toc.yml index 4c908482..4463f03a 100644 --- a/docs/_toc.yml +++ b/docs/_toc.yml @@ -7,17 +7,17 @@ parts: - caption: User Stories chapters: - file: story-1-submit-and-reconnect.ipynb - - file: story-2-multi-resource-pipeline.ipynb - - file: story-3-parameter-study.ipynb - - file: story-4-prototype-then-scale.ipynb - - file: story-5-recover-failed-jobs.ipynb - - file: story-6-expensive-setup-once.ipynb - - file: story-7-fan-out-inside-jobs.ipynb - - file: story-8-adaptive-workflows.ipynb - - file: story-9-document-and-share.ipynb - - file: story-10-pandas-dataframes.ipynb - - file: story-11-couple-mpi-simulation-codes.ipynb - - file: story-12-mpi4py-functions.ipynb + - file: story-2-parameter-study.ipynb + - file: story-3-pandas-dataframes.ipynb + - file: story-4-couple-mpi-simulation-codes.ipynb + - file: story-5-mpi4py-functions.ipynb + - file: story-6-multi-resource-pipeline.ipynb + - file: story-7-prototype-then-scale.ipynb + - file: story-8-recover-failed-jobs.ipynb + - file: story-9-expensive-setup-once.ipynb + - file: story-10-fan-out-inside-jobs.ipynb + - file: story-11-adaptive-workflows.ipynb + - file: story-12-document-and-share.ipynb - caption: Background chapters: - file: comparison.md diff --git a/notebooks/1-single-node.ipynb b/notebooks/1-single-node.ipynb index 6a279a66..f105853c 100644 --- a/notebooks/1-single-node.ipynb +++ b/notebooks/1-single-node.ipynb @@ -1 +1 @@ -{"metadata":{"kernelspec":{"display_name":"Python 3 (ipykernel)","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.13.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"6915218e-7cf3-4bf4-9618-7e6942b4762f","cell_type":"markdown","source":"# Single Node Executor\nThe `SingleNodeExecutor` in executorlib, is primarily used to enable rapid prototyping on a workstation computer to test your parallel Python program with executorlib before transferring it to an high performance computer (HPC). With the added capability of executorlib it is typically 10% slower than the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) from the Python standard library on a single node, when all acceleration features are enabled. This overhead is primarily related to the creation of new tasks. So the performance of executorlib improves when the individual Python function calls require extensive computations.\n\nAn advantage that executorlib has over the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) and the [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) from the Python standard libary, is the use of [cloudpickle](https://github.com/cloudpipe/cloudpickle) as serialization backend to transfer Python functions between processes. This enables the use of dynamically defined Python functions for example in the case of a Jupyter notebook. \n\nThe `SingleNodeExecutor` supports the same `submit()` interface, resource dictionary `resource_dict`, dependency handling and cache directory `cache_directory` as the HPC executors. A workflow developed with the `SingleNodeExecutor` can therefore be transferred to an HPC cluster by replacing the executor class and adding the cluster-specific settings. The [user stories](https://executorlib.readthedocs.io/en/latest/story-1-submit-and-reconnect.html), in particular [prototyping on a laptop and scaling up](https://executorlib.readthedocs.io/en/latest/story-4-prototype-then-scale.html), demonstrate this transition for typical HPC workflows, while the examples in this chapter can be executed without access to an HPC cluster.","metadata":{}},{"id":"ccc686dd-8fc5-4755-8a19-f40010ebb1b8","cell_type":"markdown","source":"## Basic Functionality\nThe general functionality of executorlib follows the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) of the Python standard library. You can import the `SingleNodeExecutor` class directly from executorlib and then just replace the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) or [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) with the `SingleNodeExecutor` class to start using executorlib.","metadata":{}},{"id":"b1907f12-7378-423b-9b83-1b65fc0a20f5","cell_type":"code","source":"from executorlib import SingleNodeExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":1},{"id":"1654679f-38b3-4699-9bfe-b48cbde0b2db","cell_type":"markdown","source":"It is recommended to use the `SingleNodeExecutor` class in combination with a `with`-statement. This guarantees the processes created by the `SingleNodeExecutor` class to evaluate the Python functions are afterward closed and do not remain ghost processes. A function is then submitted using the `submit(fn, /, *args, **kwargs)` function which executes a given function `fn` as `fn(*args, **kwargs)`. The `submit()` function returns a [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object, as defined by the Python Standard Library. As a first example we submit the function `sum()` to calculate the sum of the list `[1, 1]`:","metadata":{}},{"id":"16f7d138-ed77-45ea-a554-d329f7237500","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\nCPU times: user 35.7 ms, sys: 38.1 ms, total: 73.8 ms\nWall time: 274 ms\n"}],"execution_count":2},{"id":"a1109584-9db2-4f9d-b3ed-494d96241396","cell_type":"markdown","source":"As expected the result of the summation `sum([1, 1])` is `2`. The same result is retrieved from the [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object received from the submission of the `sum()` as it is printed here `print(future.result())`. For most Python functions and especially the `sum()` function it is computationally not efficient to initialize the `SingleNodeExecutor` class only for the execution of a single function call, rather it is more computationally efficient to initialize the `SingleNodeExecutor` class once and then submit a number of functions. This can be achieved with a loop. For example the sum of the pairs `[2, 2]`, `[3, 3]` and `[4, 4]` can be achieved with a for-loop inside the context of the `SingleNodeExecutor()` class as provided by the `with`-statement.","metadata":{}},{"cell_type":"markdown","id":"9d4d4481-b637-4b15-aa14-0de62199411f","metadata":{},"source":["### Understanding Future Objects\n","Each call of the `submit()` function returns immediately - not with the result of the function but with a [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object. A `Future` is a placeholder for a result which is not yet available. The submitted function is executed in the background while the main Python program continues, this is what allows executorlib to evaluate many functions at the same time. The most important methods of a `Future` object are:\n","\n","| Method | Description |\n","|---|---|\n","| `future.result()` | Wait until the function is finished and return its result - or raise the exception if the function failed. |\n","| `future.done()` | Return `True` if the function already finished, without waiting for it. |\n","| `future.cancel()` | Try to cancel the function in case it has not started yet. |\n","\n","The key to parallel execution is to first submit all functions and only afterwards collect the results by calling `result()`. When `result()` is called directly after each `submit()`, the program waits for each function to finish before the next function is submitted, so the functions are executed one after another rather than in parallel. The example below illustrates this: directly after the submission the function is not yet finished, while after requesting the result with `result()` it is."]},{"cell_type":"code","execution_count":null,"id":"b653ab65-b6fb-40a2-999c-fa2a16f5d9aa","metadata":{"trusted":true},"outputs":[],"source":["with SingleNodeExecutor() as exe:\n"," future = exe.submit(sum, [1, 1])\n"," print(\"finished directly after submit:\", future.done())\n"," print(\"result:\", future.result())\n"," print(\"finished after result:\", future.done())"]},{"id":"cfccdf9a-b23b-4814-8c14-36703a8a5f9e","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(2, 5)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[4, 6, 8]\nCPU times: user 36.6 ms, sys: 10 ms, total: 46.6 ms\nWall time: 1.16 s\n"}],"execution_count":3},{"id":"7db58f70-8137-4f1c-a87b-0d282f2bc3c5","cell_type":"markdown","source":"If only the parameters change but the function, which is applied to these parameters, remains the same, like in the case above the `sum()` function is applied to three pairs of parameters, then the `map(fn, *iterables, timeout=None, chunksize=1)` function can be used to map the function to the different sets of parameters - as it is defined in the [Python standard library](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.map). ","metadata":{}},{"id":"abd0beb7-471d-490e-bb9c-96755bd7aacf","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n results = exe.map(sum, [[5, 5], [6, 6], [7, 7]])\n print(list(results))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[10, 12, 14]\nCPU times: user 35.4 ms, sys: 9.3 ms, total: 44.7 ms\nWall time: 1.2 s\n"}],"execution_count":4},{"id":"d07a3314-fbaf-4ff5-98dd-dea62194abcd","cell_type":"markdown","source":"The `map()` function also works naturally with [pandas](https://pandas.pydata.org) DataFrames. Rather than using `DataFrame.apply()` for row-wise operations, `map()` can be used to apply a function to each pair of values from two columns in parallel:","metadata":{}},{"id":"4e7d5ef4-6437-4fa2-b500-19b8cc53f377","cell_type":"code","source":"def sum_df(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":5},{"id":"1428ac7c-dd3c-48db-b41f-4ea975df2d78","cell_type":"code","source":"import pandas\n\ndf = pandas.DataFrame({\"a\": [1, 2, 3], \"b\": [4, 5, 6]})\n\nwith SingleNodeExecutor() as exe:\n df[\"c\"] = list(exe.map(sum_df, df[\"a\"], df[\"b\"]))\n print(df)","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":" a b c\n0 1 4 5\n1 2 5 7\n2 3 6 9\n"}],"execution_count":6},{"id":"ac86bf47-4eb6-4d7c-acae-760b880803a8","cell_type":"markdown","source":"These examples cover the general functionality of the `SingleNodeExecutor` class. Following the [Executor](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) interface as it is defined in the Python standard library.","metadata":{}},{"id":"5de0f0f2-bf5c-46b3-8171-a3a206ce6775","cell_type":"markdown","source":"## Parallel Functions\nWriting parallel software is not trivial. So rather than writing the whole Python program in a parallel way, executorlib allows developers to implement parallel execution on a function by function level. In this way individual functions can be replaced by parallel functions as needed without the need to modify the rest of the program. With the Local Mode executorlib supports two levels of parallel execution, parallel execution based on the Message Passing Interface (MPI) using the [mpi4py](https://mpi4py.readthedocs.io) package, or thread based parallel execution. Both levels of parallelism can be defined inside the function and do not require any modifications to the rest of the Python program. ","metadata":{}},{"id":"dc8e692f-bf6c-4838-bb82-6a6b8454a2e7","cell_type":"markdown","source":"### MPI Parallel Functions\nMPI is the default way to develop parallel programs for HPCs. Still it can be challenging to refactor a previously serial program to efficiently use MPI to achieve optimal computational efficiency for parallel execution, even with libraries like [mpi4py](https://mpi4py.readthedocs.io). To simplify the up-scaling of Python programs executorlib provides the option to use MPI parallel Python code inside a given Python function and then submit this parallel Python function to an `SingleNodeExecutor` for evaluation.\n\nThe following `calc_mpi()` function imports the [mpi4py](https://mpi4py.readthedocs.io) package and then uses the internal functionality of MPI to get the total number of parallel CPU cores in the current MPI group `MPI.COMM_WORLD.Get_size()` and the index of the current processor in the MPI group `MPI.COMM_WORLD.Get_rank()`.\n\nThe [mpi4py](https://mpi4py.readthedocs.io) package is an optional dependency of executorlib. The installation of the [mpi4py](https://mpi4py.readthedocs.io) package is covered in the installation section.","metadata":{}},{"id":"a251d083-489e-41c1-9e49-c86093858006","cell_type":"code","source":"def calc_mpi(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank","metadata":{"trusted":true},"outputs":[],"execution_count":7},{"id":"adbf8a10-04e1-4fd9-8768-4375bcba9ec3","cell_type":"markdown","source":"The computational resources for the execution of the `calc_mpi()` Python function are defined using the resource dictionary parameter `resource_dict={}`. The reseource dictionary can either be provided as additional parameter for the `submit()` function. It is important that the parameter name `resource_dict` is reserved exclusively for the `submit()` function and cannot be used in the function which is submitted, like the `calc_mpi()` function in this example:","metadata":{}},{"id":"266864f1-d29e-4934-9b5d-51f4ffb11f5c","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n fs = exe.submit(calc_mpi, 3, resource_dict={\"cores\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":8},{"id":"3a449e3f-d7a4-4056-a1d0-35dfca4dad22","cell_type":"markdown","source":"Another option is to set the resource dictionary parameter `resource_dict` during the initialization of the `Executor`. In this case it is internally set for every call of the `submit()` function, without the need to specify it again.","metadata":{}},{"id":"cb4ad978-bdf2-47bb-a7df-846641a54ec2","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"cores\": 2}) as exe:\n fs = exe.submit(calc_mpi, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":9},{"id":"c1d1d7b1-64fa-4e47-bbde-2a16036568d6","cell_type":"markdown","source":"In addition, to the compute cores `cores`, the resource dictionary parameter `resource_dict` can also define the threads per core as `threads_per_core`, the GPUs per core as `gpus_per_core`, the working directory with `cwd`, the option to use the OpenMPI oversubscribe feature with `openmpi_oversubscribe` and finally for the [Simple Linux Utility for Resource \nManagement (SLURM)](https://slurm.schedmd.com) queuing system the option to provide additional command line arguments with the `slurm_cmd_args` parameter - [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary).","metadata":{}},{"id":"4f5c5221-d99c-4614-82b1-9d6d3260c1bf","cell_type":"markdown","source":"### Thread Parallel Functions\nAn alternative option of parallelism is [thread based parallelism](https://docs.python.org/3/library/threading.html). executorlib supports thread based parallelism with the `threads_per_core` parameter in the resource dictionary `resource_dict`. Given the [global interpreter lock](https://docs.python.org/3/glossary.html#term-global-interpreter-lock) in the cPython implementation a common application of thread based parallelism in Python is using additional threads in linked libraries. The number of threads is commonly controlled with environment variables like `OMP_NUM_THREADS`, `OPENBLAS_NUM_THREADS`, `MKL_NUM_THREADS`, `VECLIB_MAXIMUM_THREADS` and `NUMEXPR_NUM_THREADS`. Specific libraries might require other environment variables. The environment variables can be set using the environment interface of the Python standard library `os.environ`.","metadata":{}},{"id":"7a7d21f6-9f1a-4f30-8024-9993e156dc75","cell_type":"code","source":"def calc_with_threads(i):\n import os\n\n os.environ[\"OMP_NUM_THREADS\"] = \"2\"\n os.environ[\"OPENBLAS_NUM_THREADS\"] = \"2\"\n os.environ[\"MKL_NUM_THREADS\"] = \"2\"\n os.environ[\"VECLIB_MAXIMUM_THREADS\"] = \"2\"\n os.environ[\"NUMEXPR_NUM_THREADS\"] = \"2\"\n import numpy as np\n\n return i","metadata":{"trusted":true},"outputs":[],"execution_count":10},{"id":"82ed8f46-836c-402e-9363-be6e16c2a0b0","cell_type":"markdown","source":"Again the resource dictionary parameter `resource_dict` can be set either in the `submit()` function:","metadata":{}},{"id":"b8ed330d-ee77-44a0-a02f-670fa945b043","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n fs = exe.submit(calc_with_threads, 3, resource_dict={\"threads_per_core\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"3\n"}],"execution_count":11},{"id":"63222cd5-664b-4aba-a80c-5814166b1239","cell_type":"markdown","source":"Or alternatively, the resource dictionary parameter `resource_dict` can also be set during the initialization of the `Executor` class:","metadata":{}},{"id":"31562f89-c01c-4e7a-bbdd-fa26ca99e68b","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"threads_per_core\": 2}) as exe:\n fs = exe.submit(calc_with_threads, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"3\n"}],"execution_count":12},{"id":"8b78a7b4-066e-4cbc-858e-606c8bbbbf0c","cell_type":"markdown","source":"For most cases MPI based parallelism leads to higher computational efficiency in comparison to thread based parallelism, still the choice of parallelism depends on the specific Python function which should be executed in parallel. Careful benchmarks are required to achieve the optimal performance for a given computational architecture. \n\nBeyond MPI based parallelism and thread based parallelism the [HPC Cluster Executors](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html) and the [HPC Job Executors](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) also provide the option to assign GPUs to the execution of individual Python functions.","metadata":{}},{"id":"ca9bc450-2762-4d49-b7f8-48cc83e068fd","cell_type":"markdown","source":"## Performance Optimization\nThe default settings of executorlib are chosen to favour stability over performance. Consequently, the performance of executorlib can be improved by setting additional parameters. It is commonly recommended to start with an initial implementation based on executorlib and then improve the performance by enabling specialized features.","metadata":{}},{"id":"e9b52ecf-3984-4695-98e7-315aa3712104","cell_type":"markdown","source":"### Block Allocation\nBy default each submitted Python function is executed in a dedicated process. This gurantees that the execution of the submitted Python function starts with a fresh process. Still the initialization of the Python process takes time. Especially when the call of the Python function requires only limited computational resources it makes sense to reuse the existing Python process for the execution of multiple Python functions. In executorlib this functionality is enabled by setting the `block_allocation` parameter to `Ture`. To limit the number of parallel Python processes when using block allocation it is recommended to set the `max_workers` parameter to restrict the number of available computing resources. ","metadata":{}},{"id":"0da4c7d0-2268-4ea8-b62d-5d94c79ebc72","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(max_workers=2, block_allocation=True) as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\nCPU times: user 31.5 ms, sys: 11.5 ms, total: 43 ms\nWall time: 709 ms\n"}],"execution_count":13},{"id":"d38163b3-1c04-431c-964b-2bad4f823a4d","cell_type":"markdown","source":"The same functionality also applies to MPI parallel Python functions. The important part is that while it is possible to assign more than one Python process to the execution of a Python function in block allocation mode, it is not possible to assign resources during the submission of the function with the `submit()` function. Starting again with the `calc_mpi()` function: ","metadata":{}},{"id":"cb8c4943-4c78-4203-95f2-1db758e588d9","cell_type":"code","source":"def calc_mpi(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank","metadata":{"trusted":true},"outputs":[],"execution_count":14},{"id":"9e1212c4-e3fb-4e21-be43-0a4f0a08b856","cell_type":"markdown","source":"Still the resource dictionary parameter can still be set during the initialisation of the `SingleNodeExecutor` class. Internally, this groups the created Python processes in fixed allocations and afterwards submit Python functions to these allocations.","metadata":{}},{"id":"5ebf7195-58f9-40f2-8203-2d4b9f0e9602","cell_type":"code","source":"with SingleNodeExecutor(max_workers=2, resource_dict={\"cores\": 2}, block_allocation=True) as exe:\n fs = exe.submit(calc_mpi, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":15},{"id":"b75fb95f-f2f5-4be9-9f2a-9c2e9961c644","cell_type":"markdown","source":"The weakness of memory from a previous Python function remaining in the Python process can at the same time be an advantage for working with large datasets. In executorlib this is achieved by introducing the `init_function` parameter. The `init_function` returns a dictionary of parameters which can afterwards be reused as keyword arguments `**kwargs` in the functions submitted to the `Executor`. When block allocation `block_allocation` is disabled this functionality is not available, as each function is executed in a separate process, so no data can be preloaded.","metadata":{}},{"id":"8aa754cc-eb1a-4fa1-bd72-272246df1d2f","cell_type":"code","source":"def init_function():\n return {\"j\": 4, \"k\": 3, \"l\": 2}","metadata":{"trusted":true},"outputs":[],"execution_count":16},{"id":"1854895a-7239-4b30-b60d-cf1a89234464","cell_type":"code","source":"def calc_with_preload(i, j, k):\n return i + j + k","metadata":{"trusted":true},"outputs":[],"execution_count":17},{"id":"d07cf107-3627-4cb0-906c-647497d6e0d2","cell_type":"markdown","source":"The function `calc_with_preload()` requires three inputs `i`, `j` and `k`. But when the function is submitted to the executor only two inputs are provided `fs = exe.submit(calc, 2, j=5)`. In this case the first input parameter is mapped to `i=2`, the second input parameter is specified explicitly `j=5` but the third input parameter `k` is not provided. So the `SingleNodeExecutor` automatically checks the keys set in the `init_function()` function. In this case the returned dictionary `{\"j\": 4, \"k\": 3, \"l\": 2}` defines `j=4`, `k=3` and `l=2`. For this specific call of the `calc_with_preload()` function, `i` and `j` are already provided so `j` is not required, but `k=3` is used from the `init_function()` and as the `calc_with_preload()` function does not define the `l` parameter this one is also ignored.","metadata":{}},{"id":"cc648799-a0c6-4878-a469-97457bce024f","cell_type":"code","source":"with SingleNodeExecutor(max_workers=2, init_function=init_function, block_allocation=True) as exe:\n fs = exe.submit(calc_with_preload, 2, j=5)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"10\n"}],"execution_count":18},{"id":"1073b8ca-1492-46e9-8d1f-f52ad48d28a2","cell_type":"markdown","source":"The result is `2+5+3=10` as `i=2` and `j=5` are provided during the submission and `k=3` is defined in the `init_function()` function.","metadata":{}},{"id":"24397d78-dff1-4834-830c-a8f390fe6b9c","cell_type":"markdown","source":"### Cache\nThe development of scientific workflows is commonly an interactive process, extending the functionality step by step. This lead to the development of interactive environments like [Jupyter](https://jupyter.org) which is fully supported by executorlib. Still many of the computationally intensive Python functions can take in the order of minutes to hours or even longer to execute, so reusing an existing Python process is not feasible. To address this challenge executorlib provides a file based cache to store the results of previously computed [concurrent future Futures](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects. The results are serialized using [cloudpickle](https://github.com/cloudpipe/cloudpickle) and stored in a user-defined cache directory `cache_directory` to be reloaded later on. Internally, the hierarchical data format (HDF5) is used via the [h5py](https://www.h5py.org), which is an optional dependency for executorlib. \n\nThe [h5py](https://www.h5py.org) package is an optional dependency of executorlib. The installation of the [h5py](https://www.h5py.org) package is covered in the installation section. ","metadata":{}},{"id":"ecdcef49-5c89-4538-b377-d53979673bf7","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(cache_directory=\"./file\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[2, 4, 6]\nCPU times: user 84.3 ms, sys: 33.6 ms, total: 118 ms\nWall time: 1.35 s\n"}],"execution_count":19},{"id":"32d0fb2e-5ac1-4249-b6c8-953c92fdfded","cell_type":"markdown","source":"When the same code is executed again, executorlib finds the existing results in the cache directory specified by the `cache_directory` parameter and reloads the result, accelerating the computation especially during the prototyping phase when similar computations are repeated frequently for testing. \n\nStill it is important to mention, that this cache is not designed to identify the submission of the same parameters within the context of one `with`-statement. It is the task of the user to minimize duplicate computations, the cache is only designed to restore previous calculation results when the Python process managing executorlib was stopped after the successful execution. ","metadata":{}},{"id":"c39babe8-4370-4d31-9520-9a7ce63378c8","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(cache_directory=\"./file\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[2, 4, 6]\nCPU times: user 44.2 ms, sys: 15.5 ms, total: 59.7 ms\nWall time: 1.3 s\n"}],"execution_count":20},{"id":"5144a035-633e-4e60-a362-f3b15b28848b","cell_type":"markdown","source":"An additional advantage of the cache is the option to gather the results of previously submitted functions. Using the `get_cache_data()` function the results of each Python function is converted to a dictionary. This list of dictionaries can be converted to a `pandas.DataFrame` for further processing:","metadata":{}},{"id":"f574b9e1-de55-4e38-aef7-a4bed540e040","cell_type":"code","source":"import pandas\nfrom executorlib import get_cache_data\n\ndf = pandas.DataFrame(get_cache_data(cache_directory=\"./file\"))\ndf","metadata":{"trusted":true},"outputs":[{"execution_count":21,"output_type":"execute_result","data":{"text/plain":" function input_args input_kwargs output resource_dict \\\n0 ([2, 2],) {} 4 {} \n1 ([3, 3],) {} 6 {} \n2 ([1, 1],) {} 2 {} \n\n runtime filename \n0 0.910742 /home/jovyan/file/sum89afbdf9da5eb1794f6976a3f... \n1 0.911247 /home/jovyan/file/sum0f7710227cda6456e5d071877... \n2 0.908284 /home/jovyan/file/sumf5ad27b855231a293ddd735a8... ","text/html":"
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
functioninput_argsinput_kwargsoutputresource_dictruntimefilename
0<built-in function sum>([2, 2],){}4{}0.910742/home/jovyan/file/sum89afbdf9da5eb1794f6976a3f...
1<built-in function sum>([3, 3],){}6{}0.911247/home/jovyan/file/sum0f7710227cda6456e5d071877...
2<built-in function sum>([1, 1],){}2{}0.908284/home/jovyan/file/sumf5ad27b855231a293ddd735a8...
\n
"},"metadata":{}}],"execution_count":21},{"id":"68092479-e846-494a-9ac9-d9638b102bd8","cell_type":"markdown","source":"After the development phase is concluded it is the task of the user to remove the cache directory defined with the `cache_directory` parameter. The cache directory is never removed by executorlib to prevent the repeation of expensive computations. Still as disk space on shared file systems in HPC environments is commonly limited it is recommended to remove the cache directory once the development process concluded. ","metadata":{}},{"id":"34a9316d-577f-4a63-af14-736fb4e6b219","cell_type":"code","source":"import os\nimport shutil\n\ncache_dir = \"./file\"\nif os.path.exists(cache_dir):\n print(os.listdir(cache_dir))\n try:\n shutil.rmtree(cache_dir)\n except OSError:\n pass","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"['sum89afbdf9da5eb1794f6976a3f01697c2_o.h5', 'sum0f7710227cda6456e5d07187702313f3_o.h5', 'sumf5ad27b855231a293ddd735a8554c9ea_o.h5']\n"}],"execution_count":22},{"id":"1cea95b5-4110-444c-82af-fa6718bfa17f","cell_type":"markdown","source":"Typically the use of the cache is recommended for development processes only and for production workflows the user should implement their own long-term storage solution. The binary format used by executorlib is based on [cloudpickle](https://github.com/cloudpipe/cloudpickle) and might change in future without further notice, rendering existing data in the cache unusable. Consequently, using the cache beyond the development process is not recommended. In addition the writing of the results to files might result in additional overhead for accessing the shared file system. ","metadata":{}},{"id":"71a8a0be-a933-4e83-9da5-50da35e9975b","cell_type":"markdown","source":"### Dependencies\nMany scientific Python programs consist of series of Python function calls with varying level of parallel computations or map-reduce patterns where the same function is first mapped to a number of parameters and afterwards the results are reduced in a single function. To extend the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) of the Python standard library to support this programming pattern, the `SingleNodeExecutor` class from executorlib supports submitting Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) objects to the `SingleNodeExecutor` which are resolved before submission. So the `SingleNodeExecutor` internally waits until all Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) objects are successfully executed before it triggers the execution of the submitted Python function.","metadata":{}},{"id":"d8b75a26-479d-405e-8895-a8d56b3f0f4b","cell_type":"code","source":"def calc_add(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":23},{"id":"36118ae0-c13c-4f7a-bcd3-3d7f4bb5a078","cell_type":"markdown","source":"For example the function which adds two numbers `calc_add()` is used in a loop which adds a counter to the previous numbers. In the first iteration the `future` parameter is set to `0` but already in the second iteration it is the Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object of the first iteration and so on. \n\nThe important part is that the user does not have to wait until the first function is executed but instead the waiting happens internally in the `SingleNodeExecutor`.","metadata":{}},{"id":"35fd5747-c57d-4926-8d83-d5c55a130ad6","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future = 0\n for i in range(1, 4):\n future = exe.submit(calc_add, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"6\n"}],"execution_count":24},{"id":"38e1bbb3-1028-4f50-93c1-d2427f399a7d","cell_type":"markdown","source":"As the reusing of existing [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object can lead to rather complex dependencies, executorlib provides the option to plot the dependency graph by setting the `plot_dependency_graph=True` during the initialization of the `SingleNodeExecutor` class.\n\nNo computation is executed when the `plot_dependency_graph=True` is set. This parameter is for debugging only. \n\nInternally, the [pygraphviz](https://pygraphviz.github.io/documentation/stable) package is used for the visualisation of these dependency graphs. It is an optional dependency of executorlib. The installation of the [pygraphviz](https://pygraphviz.github.io/documentation/stable) package is covered in the installation section. ","metadata":{}},{"id":"f67470b5-af1d-4add-9de8-7f259ca67324","cell_type":"code","source":"with SingleNodeExecutor(plot_dependency_graph=True) as exe:\n future = 0\n for i in range(1, 4):\n future = exe.submit(calc_add, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"None\n"},{"output_type":"display_data","data":{"text/plain":"","image/svg+xml":"\n\n\n\n\n0\n\ncalc_add\n\n\n\n1\n\ncalc_add\n\n\n\n0->1\n\n\nb\n\n\n\n2\n\ncalc_add\n\n\n\n1->2\n\n\nb\n\n\n\n3\n\n1\n\n\n\n3->0\n\n\na\n\n\n\n4\n\n0\n\n\n\n4->0\n\n\nb\n\n\n\n5\n\n2\n\n\n\n5->1\n\n\na\n\n\n\n6\n\n3\n\n\n\n6->2\n\n\na\n\n\n"},"metadata":{}}],"execution_count":25},{"id":"4c952a9d-2b58-401d-b7ec-fda740db774a","cell_type":"markdown","source":"## Advanced Scheduling\nGoing beyond just directed acyclic graphs (DAG) with one-to-many and many-to-one relationships, executorlib provides a number of advanced scheduling patterns. These are briefly introduced in the following.","metadata":{}},{"id":"4db2c87c-9a7d-4074-82d0-24357fa4f0e6","cell_type":"markdown","source":"### Runtime-dependent Batching \nTo maximize the throughput of dependent calculation tasks its important to idenify all tasks which can be executed at a given moment. Unfortunately, some of these dependencies can only be determined at run time, which is challenging for most schedulers. To demonstrate the runtime-dependent batching in executorlib we discuss the following example. Starting with a group of ten tasks and then grouping them into groups of three for processing. Still the order of the tasks, which tasks belong into which group, is only determined at run time. \n\nFor simplicity, we just use a simple function which directly returns the input.","metadata":{}},{"id":"857a5e0f-50d6-45ec-aac7-a7151f36c19f","cell_type":"code","source":"def reply(i):\n return i","metadata":{"trusted":true},"outputs":[],"execution_count":26},{"id":"544dacab-5601-4a9b-814f-88560eafb079","cell_type":"markdown","source":"After the group of ten tasks is submitted their future objects are stored in a list named `future_individual_lst`. This list is then provided to the `batched()` function of the `SingleNodeExecutor()` to generate batches of tasks which are then provided to the `sum` function for further processing. The results of this second step are stored in the `future_group_lst`. Finally, the results of these future objects are evaluated in the third step. ","metadata":{}},{"id":"17d1354a-0943-4b62-9b0d-7d39c8df23f2","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future_individual_lst = [\n exe.submit(reply, i) for i in range(10)\n ]\n future_group_lst = [\n exe.submit(sum, f) for f in exe.batched(future_individual_lst, n=3)\n ]\n print(sum([f.result() for f in future_group_lst]))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"45\n"}],"execution_count":27},{"id":"80e8b154-d659-4f3e-add2-701a454d770d","cell_type":"markdown","source":"### Split Future Objects\nIn analogy to the `batched()` function which combines multiple future objects in a batch for further processing, it is also necessary to split the future objects even before the evaluation is completed. Executorlib provides two utility functions, namely `split_future()` for tuples and lists and `get_item_from_future()` for dictionaries. \n\nStarting with a function which returns a tuple, named `get_a_tuple()`:","metadata":{}},{"id":"6ef541e3-a2be-4e05-9e77-65eaceff4248","cell_type":"code","source":"def get_a_tuple(i):\n return \"a\", \"b\", i","metadata":{"trusted":true},"outputs":[],"execution_count":28},{"id":"dd3e4312-1594-4b3b-baf3-5b3121ca8910","cell_type":"markdown","source":"This function is submitted to the `SingleNodeExecutor()` and while in this case it directly returns the tuple, the evaluation would commonly take much longer. By having the ability to split the output of the future object using the `split_future()` function, a number of future objects is generated one for each element of the tuple. This is enabled by providing the number of elements in the tuple as an additional parameter `n=3`. ","metadata":{}},{"id":"927c5931-d7fd-4bc1-ae0e-3dd2f4bc99ce","cell_type":"code","source":"from executorlib import split_future","metadata":{"trusted":true},"outputs":[],"execution_count":29},{"id":"64a9b46e-0de6-4abb-99d9-8aaa0c6cbccb","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future = exe.submit(get_a_tuple, 15)\n f1, f2, f3 = split_future(future=future, n=3)\n print(f1.result(), f2.result(), f3.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"a b 15\n"}],"execution_count":30},{"id":"a10d8f90-e790-4708-b193-90a7f014d699","cell_type":"markdown","source":"In analogy, to the `split_future()` function for lists and tuples, the `get_item_from_future()` function returns one item of a dicitionary which is returned by a function submitted to an `Executor()`. In this example the `get_a_dict()` function returns a dictionary, again in this example the dictionary is returned directly while commonly this would take much longer. ","metadata":{}},{"id":"51ec4dbf-d009-41c9-bc04-cf1b16fe782f","cell_type":"code","source":"def get_a_dict(i):\n return {\"a\": 1, \"b\": 2, \"c\": i}","metadata":{"trusted":true},"outputs":[],"execution_count":31},{"id":"5c90ab75-2a6b-4fbe-a7ee-7f91b2b4af43","cell_type":"markdown","source":"The `get_a_dict()` function is submitted to the `SingleNodeExecutor()`, it returns a future object named `future_dict`. Still as we know that the `result()` of this future object `future_dict` returns a dictionary, we can already access the items of this dictionary with the `get_item_from_future()` function. The `get_item_from_future()` function takes a future object as input in addition to the `key` of the dictionary which should be accessed, as a result the `get_item_from_future()` function returns a future object for the value related to the key. In this example these future objects are named `f1`, `f2` and `f3`. These fucture objects are evaluated afterwards.","metadata":{}},{"id":"a41251d2-a840-4c12-9625-c2e0585c489b","cell_type":"code","source":"from executorlib import get_item_from_future","metadata":{"trusted":true},"outputs":[],"execution_count":32},{"id":"a6e75c5e-ad0c-4723-99c5-8125b63fbeaf","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future_dict = exe.submit(get_a_dict, 15)\n f1 = get_item_from_future(future=future_dict, key=\"a\")\n f2 = get_item_from_future(future=future_dict, key=\"b\")\n f3 = get_item_from_future(future=future_dict, key=\"c\")\n print(f1.result(), f2.result(), f3.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"1 2 15\n"}],"execution_count":33},{"id":"a945c98d-dc73-4284-9d8c-52475a760f6b","cell_type":"markdown","source":"### Recursion\nIn addition to the `map()` function for parallel loops and the option to integrate `while` loops directly in the submission, it is sometimes helpful to use recursive algorthims to accelerate scientific simulation and analysis. To demonstrate the use of executorlib in combination with recursive algorithms, the quicksort algorithm is demonstrated. \n\nThe quicksort algorithm is implemented in two parts, a `quick_sort()` which splits the input `sequence` into two sets, one lower and one larger than the pivot element of the `sequence`. After the initial execution the `quick_sort()` function is again applied to both resulting sets until only a single element remains in the `sequence`. In this case the single element is returned. The pivot is defined as the first element of the `sequence`.\n\nTo simplify the submission of the `quick_sort()` function to the `SingleNodeExecutor()` dictionaries are used as return types, these dictionaries either contain only a single item with the key `\"result\"` when only a single element remains in the list, or three items, one `\"left\"` for a list lower than the pivot, one `\"right\"` for the items larger than the pivot and the `\"result\"` for the pivot itself. ","metadata":{}},{"id":"08b0c0a1-34ad-4b2a-847c-fe9c96956b27","cell_type":"code","source":"def quick_sort(sequence):\n length = len(sequence)\n if length <= 1:\n return {\"result\": sequence}\n else:\n pivot = sequence.pop() \n \n greater_items = []\n lesser_items = []\n\n for item in sequence:\n if item > pivot:\n greater_items.append(item)\n else:\n lesser_items.append(item)\n\n return {\"left\": lesser_items, \"right\": greater_items, \"result\": [pivot]}","metadata":{"trusted":true},"outputs":[],"execution_count":34},{"id":"54a8a765-0b9f-424a-86e5-8024c4d59018","cell_type":"markdown","source":"To enable the recursive submission to the `SingleNodeExecutor()` a `recusive_submit()` function is defined using the [asynchronous IO module](https://docs.python.org/3/library/asyncio.html) of the Python standard libary, indicated by the `async` keyword ahead of the function definition. It takes a `function`, the `sequence` and the `executor` as inputs. As a first step the function is submitted to the `executor` and the execution is halted until the first result is available by wrapping the future object using the `wrap_future()` function of the `asyncio` package and appling the `await` function. Then the corresponding result dictionary `result_dict` is evaluated: If the `result_dict` contains more than one key, then the `recusive_submit()` is evaluated for both the left side with lower values than the pivot element and the right side with elements higher than the pivot element. Again in both cases the `await` keyword is used to enable the parallel execution of both branches at the same time. Afterwards the result of both sides is combined with the pivot element. For the case that the dictionary only contains a single element, it is returned directly. ","metadata":{}},{"id":"4e142829-c9de-4969-ab3c-97f3e1ada90c","cell_type":"code","source":"import asyncio\n\nasync def recusive_submit(function, sequence, executor):\n result_dict = await asyncio.wrap_future(exe.submit(function, sequence))\n if len(result_dict) > 1:\n left = await recusive_submit(function=function, sequence=result_dict[\"left\"], executor=executor)\n right = await recusive_submit(function=function, sequence=result_dict[\"right\"], executor=executor)\n return left + result_dict[\"result\"] + right\n else:\n return result_dict[\"result\"]","metadata":{"trusted":true},"outputs":[],"execution_count":35},{"id":"531a8f7d-5b21-46d0-b632-32a1568571c8","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n loop = asyncio.get_event_loop()\n task = loop.create_task(recusive_submit(function=quick_sort, sequence=[0,9,3,8,2,7,5], executor=exe))\n print(await task)","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[0, 2, 3, 5, 7, 8, 9]\n"}],"execution_count":36},{"id":"725c8ac2-27e4-495b-b061-1fd6053f4c0b","cell_type":"markdown","source":"## Testing and Debugging\nThe up-scaling of Python functions from a single workstation to an High Performance Computer (HPC) can be challenging, so executorlib provides a number of debugging utilities to help you optimize your functions for execution with executorlib. ","metadata":{}},{"id":"2c96b460-ebd2-4c8a-a5e1-922a860808ab","cell_type":"markdown","source":"### Measure Data Transferred \nTransferring a large amount of data between two processes requires additional resources so it is helpful to measure the data transferred between the frontend and backend process. This is achieved by setting the `log_obj_size` parameter to `True`:","metadata":{}},{"id":"71905acf-2fef-4738-82ae-89e35e2e3d2d","cell_type":"code","source":"from executorlib import SingleNodeExecutor\n\nwith SingleNodeExecutor(log_obj_size=True) as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stderr","output_type":"stream","text":"Send dictionary of size: 101\nReceived dictionary of size: 59\nSend dictionary of size: 69\nReceived dictionary of size: 58\n"},{"name":"stdout","output_type":"stream","text":"2\n"}],"execution_count":37},{"id":"0e9f7192-2b7d-4caf-b2b8-ae9cb060e90f","cell_type":"markdown","source":"### Write Log Files\nLibraries like executorlib are commonly used to sample a large parameter space, in this case it is possible that out of a large number of parameters one combination throws an error. This error can be logged in a file which also contains the function and input parameters using the `\"error_log_file\"` parameter in the `resource_dict`. This allows to change the log file on a per-function bases.","metadata":{}},{"id":"2810acd5-a46e-4d85-b447-945248ffca15","cell_type":"code","source":"from executorlib import SingleNodeExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":38},{"id":"ef6b87a7-361e-4a3f-bad3-72ad87968e8c","cell_type":"code","source":"def my_funct(i, j): \n if i == 2 and j == 2:\n raise ValueError()\n else: \n return i * j + i + j","metadata":{"trusted":true},"outputs":[],"execution_count":39},{"id":"209ff76b-913a-46f7-9fff-250e207898b2","cell_type":"markdown","source":"A try and except statement is added to prevent the jupyter notebook from crashing:","metadata":{}},{"id":"30381a00-30cc-45a2-82ff-17371339f5c7","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"error_log_file\": \"error.out\"}) as exe:\n future_lst = []\n for i in range(4):\n for j in range(4):\n future_lst.append(exe.submit(my_funct, i=i, j=j))\n try:\n print([f.result() for f in future_lst])\n except ValueError:\n pass","metadata":{"trusted":true},"outputs":[],"execution_count":40},{"id":"36bfc556-aa86-4b50-972b-4b8f68ceec3d","cell_type":"markdown","source":"The content of the log file is a basic text file, so it can be read with any kind of file utility. The important part is that the log file contains not only the error message but in addition also the function name and the input parameters in the case `kwargs: {'i': 2, 'j': 2}` which helps for future debugging of the sampling function.","metadata":{}},{"id":"a61c06fc-3029-48ed-895f-9f6c065b7c47","cell_type":"code","source":"with open(\"error.out\") as f:\n content = f.readlines()","metadata":{"trusted":true},"outputs":[],"execution_count":41},{"id":"6a6cd10f-6fe3-4a17-a8e6-2536feb9a11a","cell_type":"code","source":"content","metadata":{"trusted":true},"outputs":[{"execution_count":42,"output_type":"execute_result","data":{"text/plain":"['function: \\n',\n 'args: ()\\n',\n \"kwargs: {'i': 2, 'j': 2}\\n\",\n 'Traceback (most recent call last):\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/backend/interactive_serial.py\", line 56, in main\\n',\n ' output = call_funct(input_dict=input_dict, funct=None, memory=memory)\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/standalone/interactive/backend.py\", line 33, in call_funct\\n',\n ' return funct(input_dict[\"fn\"], *input_dict[\"args\"], **input_dict[\"kwargs\"])\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/standalone/interactive/backend.py\", line 22, in funct\\n',\n ' return args[0].__call__(*args[1:], **kwargs)\\n',\n ' ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^\\n',\n ' File \"/tmp/ipykernel_463/3167739528.py\", line 3, in my_funct\\n',\n 'ValueError\\n']"},"metadata":{}}],"execution_count":42},{"id":"5aff120a-317f-47d4-9639-8eccfb136117","cell_type":"code","source":"import os\n\nif os.path.exists(\"error.out\"):\n os.remove(\"error.out\")","metadata":{"trusted":true},"outputs":[],"execution_count":43},{"id":"44cd41d7-4417-429e-8481-f2a49e5f769c","cell_type":"markdown","source":"### TestClusterExecutor\nWhile the `SingleNodeExecutor` internally behaves very similar to the `FluxJobExecutor` and `SlurmJobExecutor` the `FluxClusterExecutor` and `SlurmClusterExecutor` behave very different as they use the file system to exchange information rather than socket-based communication. This can lead to complications when it comes to debugging. To address this challenge executorlib provides the `TestClusterExecutor` which can be executed on a local workstation just like the `SingleNodeExecutor` but in the background it uses the same file based communication like the `SlurmClusterExecutor` and the `FluxClusterExecutor`:","metadata":{}},{"id":"2ae29fb0-54e5-468f-8727-a179b6ed363e","cell_type":"code","source":"from executorlib.api import TestClusterExecutor\n\nwith TestClusterExecutor(cache_directory=\"test\") as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\n"}],"execution_count":44}]} \ No newline at end of file +{"metadata":{"kernelspec":{"display_name":"Python 3 (ipykernel)","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.13.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"6915218e-7cf3-4bf4-9618-7e6942b4762f","cell_type":"markdown","source":"# Single Node Executor\nThe `SingleNodeExecutor` in executorlib, is primarily used to enable rapid prototyping on a workstation computer to test your parallel Python program with executorlib before transferring it to an high performance computer (HPC). With the added capability of executorlib it is typically 10% slower than the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) from the Python standard library on a single node, when all acceleration features are enabled. This overhead is primarily related to the creation of new tasks. So the performance of executorlib improves when the individual Python function calls require extensive computations.\n\nAn advantage that executorlib has over the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) and the [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) from the Python standard libary, is the use of [cloudpickle](https://github.com/cloudpipe/cloudpickle) as serialization backend to transfer Python functions between processes. This enables the use of dynamically defined Python functions for example in the case of a Jupyter notebook. \n\nThe `SingleNodeExecutor` supports the same `submit()` interface, resource dictionary `resource_dict`, dependency handling and cache directory `cache_directory` as the HPC executors. A workflow developed with the `SingleNodeExecutor` can therefore be transferred to an HPC cluster by replacing the executor class and adding the cluster-specific settings. The [user stories](https://executorlib.readthedocs.io/en/latest/story-1-submit-and-reconnect.html), in particular [prototyping on a laptop and scaling up](https://executorlib.readthedocs.io/en/latest/story-7-prototype-then-scale.html), demonstrate this transition for typical HPC workflows, while the examples in this chapter can be executed without access to an HPC cluster.","metadata":{}},{"id":"ccc686dd-8fc5-4755-8a19-f40010ebb1b8","cell_type":"markdown","source":"## Basic Functionality\nThe general functionality of executorlib follows the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) of the Python standard library. You can import the `SingleNodeExecutor` class directly from executorlib and then just replace the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) or [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) with the `SingleNodeExecutor` class to start using executorlib.","metadata":{}},{"id":"b1907f12-7378-423b-9b83-1b65fc0a20f5","cell_type":"code","source":"from executorlib import SingleNodeExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":1},{"id":"1654679f-38b3-4699-9bfe-b48cbde0b2db","cell_type":"markdown","source":"It is recommended to use the `SingleNodeExecutor` class in combination with a `with`-statement. This guarantees the processes created by the `SingleNodeExecutor` class to evaluate the Python functions are afterward closed and do not remain ghost processes. A function is then submitted using the `submit(fn, /, *args, **kwargs)` function which executes a given function `fn` as `fn(*args, **kwargs)`. The `submit()` function returns a [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object, as defined by the Python Standard Library. As a first example we submit the function `sum()` to calculate the sum of the list `[1, 1]`:","metadata":{}},{"id":"16f7d138-ed77-45ea-a554-d329f7237500","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\nCPU times: user 35.7 ms, sys: 38.1 ms, total: 73.8 ms\nWall time: 274 ms\n"}],"execution_count":2},{"id":"a1109584-9db2-4f9d-b3ed-494d96241396","cell_type":"markdown","source":"As expected the result of the summation `sum([1, 1])` is `2`. The same result is retrieved from the [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object received from the submission of the `sum()` as it is printed here `print(future.result())`. For most Python functions and especially the `sum()` function it is computationally not efficient to initialize the `SingleNodeExecutor` class only for the execution of a single function call, rather it is more computationally efficient to initialize the `SingleNodeExecutor` class once and then submit a number of functions. This can be achieved with a loop. For example the sum of the pairs `[2, 2]`, `[3, 3]` and `[4, 4]` can be achieved with a for-loop inside the context of the `SingleNodeExecutor()` class as provided by the `with`-statement.","metadata":{}},{"cell_type":"markdown","id":"9d4d4481-b637-4b15-aa14-0de62199411f","metadata":{},"source":["### Understanding Future Objects\n","Each call of the `submit()` function returns immediately - not with the result of the function but with a [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object. A `Future` is a placeholder for a result which is not yet available. The submitted function is executed in the background while the main Python program continues, this is what allows executorlib to evaluate many functions at the same time. The most important methods of a `Future` object are:\n","\n","| Method | Description |\n","|---|---|\n","| `future.result()` | Wait until the function is finished and return its result - or raise the exception if the function failed. |\n","| `future.done()` | Return `True` if the function already finished, without waiting for it. |\n","| `future.cancel()` | Try to cancel the function in case it has not started yet. |\n","\n","The key to parallel execution is to first submit all functions and only afterwards collect the results by calling `result()`. When `result()` is called directly after each `submit()`, the program waits for each function to finish before the next function is submitted, so the functions are executed one after another rather than in parallel. The example below illustrates this: directly after the submission the function is not yet finished, while after requesting the result with `result()` it is."]},{"cell_type":"code","execution_count":null,"id":"b653ab65-b6fb-40a2-999c-fa2a16f5d9aa","metadata":{"trusted":true},"outputs":[],"source":["with SingleNodeExecutor() as exe:\n"," future = exe.submit(sum, [1, 1])\n"," print(\"finished directly after submit:\", future.done())\n"," print(\"result:\", future.result())\n"," print(\"finished after result:\", future.done())"]},{"id":"cfccdf9a-b23b-4814-8c14-36703a8a5f9e","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(2, 5)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[4, 6, 8]\nCPU times: user 36.6 ms, sys: 10 ms, total: 46.6 ms\nWall time: 1.16 s\n"}],"execution_count":3},{"id":"7db58f70-8137-4f1c-a87b-0d282f2bc3c5","cell_type":"markdown","source":"If only the parameters change but the function, which is applied to these parameters, remains the same, like in the case above the `sum()` function is applied to three pairs of parameters, then the `map(fn, *iterables, timeout=None, chunksize=1)` function can be used to map the function to the different sets of parameters - as it is defined in the [Python standard library](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.map). ","metadata":{}},{"id":"abd0beb7-471d-490e-bb9c-96755bd7aacf","cell_type":"code","source":"%%time\nwith SingleNodeExecutor() as exe:\n results = exe.map(sum, [[5, 5], [6, 6], [7, 7]])\n print(list(results))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[10, 12, 14]\nCPU times: user 35.4 ms, sys: 9.3 ms, total: 44.7 ms\nWall time: 1.2 s\n"}],"execution_count":4},{"id":"d07a3314-fbaf-4ff5-98dd-dea62194abcd","cell_type":"markdown","source":"The `map()` function also works naturally with [pandas](https://pandas.pydata.org) DataFrames. Rather than using `DataFrame.apply()` for row-wise operations, `map()` can be used to apply a function to each pair of values from two columns in parallel:","metadata":{}},{"id":"4e7d5ef4-6437-4fa2-b500-19b8cc53f377","cell_type":"code","source":"def sum_df(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":5},{"id":"1428ac7c-dd3c-48db-b41f-4ea975df2d78","cell_type":"code","source":"import pandas\n\ndf = pandas.DataFrame({\"a\": [1, 2, 3], \"b\": [4, 5, 6]})\n\nwith SingleNodeExecutor() as exe:\n df[\"c\"] = list(exe.map(sum_df, df[\"a\"], df[\"b\"]))\n print(df)","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":" a b c\n0 1 4 5\n1 2 5 7\n2 3 6 9\n"}],"execution_count":6},{"id":"ac86bf47-4eb6-4d7c-acae-760b880803a8","cell_type":"markdown","source":"These examples cover the general functionality of the `SingleNodeExecutor` class. Following the [Executor](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) interface as it is defined in the Python standard library.","metadata":{}},{"id":"5de0f0f2-bf5c-46b3-8171-a3a206ce6775","cell_type":"markdown","source":"## Parallel Functions\nWriting parallel software is not trivial. So rather than writing the whole Python program in a parallel way, executorlib allows developers to implement parallel execution on a function by function level. In this way individual functions can be replaced by parallel functions as needed without the need to modify the rest of the program. With the Local Mode executorlib supports two levels of parallel execution, parallel execution based on the Message Passing Interface (MPI) using the [mpi4py](https://mpi4py.readthedocs.io) package, or thread based parallel execution. Both levels of parallelism can be defined inside the function and do not require any modifications to the rest of the Python program. ","metadata":{}},{"id":"dc8e692f-bf6c-4838-bb82-6a6b8454a2e7","cell_type":"markdown","source":"### MPI Parallel Functions\nMPI is the default way to develop parallel programs for HPCs. Still it can be challenging to refactor a previously serial program to efficiently use MPI to achieve optimal computational efficiency for parallel execution, even with libraries like [mpi4py](https://mpi4py.readthedocs.io). To simplify the up-scaling of Python programs executorlib provides the option to use MPI parallel Python code inside a given Python function and then submit this parallel Python function to an `SingleNodeExecutor` for evaluation.\n\nThe following `calc_mpi()` function imports the [mpi4py](https://mpi4py.readthedocs.io) package and then uses the internal functionality of MPI to get the total number of parallel CPU cores in the current MPI group `MPI.COMM_WORLD.Get_size()` and the index of the current processor in the MPI group `MPI.COMM_WORLD.Get_rank()`.\n\nThe [mpi4py](https://mpi4py.readthedocs.io) package is an optional dependency of executorlib. The installation of the [mpi4py](https://mpi4py.readthedocs.io) package is covered in the installation section.","metadata":{}},{"id":"a251d083-489e-41c1-9e49-c86093858006","cell_type":"code","source":"def calc_mpi(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank","metadata":{"trusted":true},"outputs":[],"execution_count":7},{"id":"adbf8a10-04e1-4fd9-8768-4375bcba9ec3","cell_type":"markdown","source":"The computational resources for the execution of the `calc_mpi()` Python function are defined using the resource dictionary parameter `resource_dict={}`. The reseource dictionary can either be provided as additional parameter for the `submit()` function. It is important that the parameter name `resource_dict` is reserved exclusively for the `submit()` function and cannot be used in the function which is submitted, like the `calc_mpi()` function in this example:","metadata":{}},{"id":"266864f1-d29e-4934-9b5d-51f4ffb11f5c","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n fs = exe.submit(calc_mpi, 3, resource_dict={\"cores\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":8},{"id":"3a449e3f-d7a4-4056-a1d0-35dfca4dad22","cell_type":"markdown","source":"Another option is to set the resource dictionary parameter `resource_dict` during the initialization of the `Executor`. In this case it is internally set for every call of the `submit()` function, without the need to specify it again.","metadata":{}},{"id":"cb4ad978-bdf2-47bb-a7df-846641a54ec2","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"cores\": 2}) as exe:\n fs = exe.submit(calc_mpi, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":9},{"id":"c1d1d7b1-64fa-4e47-bbde-2a16036568d6","cell_type":"markdown","source":"In addition, to the compute cores `cores`, the resource dictionary parameter `resource_dict` can also define the threads per core as `threads_per_core`, the GPUs per core as `gpus_per_core`, the working directory with `cwd`, the option to use the OpenMPI oversubscribe feature with `openmpi_oversubscribe` and finally for the [Simple Linux Utility for Resource \nManagement (SLURM)](https://slurm.schedmd.com) queuing system the option to provide additional command line arguments with the `slurm_cmd_args` parameter - [resource dictionary](https://executorlib.readthedocs.io/en/latest/trouble_shooting.html#resource-dictionary).","metadata":{}},{"id":"4f5c5221-d99c-4614-82b1-9d6d3260c1bf","cell_type":"markdown","source":"### Thread Parallel Functions\nAn alternative option of parallelism is [thread based parallelism](https://docs.python.org/3/library/threading.html). executorlib supports thread based parallelism with the `threads_per_core` parameter in the resource dictionary `resource_dict`. Given the [global interpreter lock](https://docs.python.org/3/glossary.html#term-global-interpreter-lock) in the cPython implementation a common application of thread based parallelism in Python is using additional threads in linked libraries. The number of threads is commonly controlled with environment variables like `OMP_NUM_THREADS`, `OPENBLAS_NUM_THREADS`, `MKL_NUM_THREADS`, `VECLIB_MAXIMUM_THREADS` and `NUMEXPR_NUM_THREADS`. Specific libraries might require other environment variables. The environment variables can be set using the environment interface of the Python standard library `os.environ`.","metadata":{}},{"id":"7a7d21f6-9f1a-4f30-8024-9993e156dc75","cell_type":"code","source":"def calc_with_threads(i):\n import os\n\n os.environ[\"OMP_NUM_THREADS\"] = \"2\"\n os.environ[\"OPENBLAS_NUM_THREADS\"] = \"2\"\n os.environ[\"MKL_NUM_THREADS\"] = \"2\"\n os.environ[\"VECLIB_MAXIMUM_THREADS\"] = \"2\"\n os.environ[\"NUMEXPR_NUM_THREADS\"] = \"2\"\n import numpy as np\n\n return i","metadata":{"trusted":true},"outputs":[],"execution_count":10},{"id":"82ed8f46-836c-402e-9363-be6e16c2a0b0","cell_type":"markdown","source":"Again the resource dictionary parameter `resource_dict` can be set either in the `submit()` function:","metadata":{}},{"id":"b8ed330d-ee77-44a0-a02f-670fa945b043","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n fs = exe.submit(calc_with_threads, 3, resource_dict={\"threads_per_core\": 2})\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"3\n"}],"execution_count":11},{"id":"63222cd5-664b-4aba-a80c-5814166b1239","cell_type":"markdown","source":"Or alternatively, the resource dictionary parameter `resource_dict` can also be set during the initialization of the `Executor` class:","metadata":{}},{"id":"31562f89-c01c-4e7a-bbdd-fa26ca99e68b","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"threads_per_core\": 2}) as exe:\n fs = exe.submit(calc_with_threads, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"3\n"}],"execution_count":12},{"id":"8b78a7b4-066e-4cbc-858e-606c8bbbbf0c","cell_type":"markdown","source":"For most cases MPI based parallelism leads to higher computational efficiency in comparison to thread based parallelism, still the choice of parallelism depends on the specific Python function which should be executed in parallel. Careful benchmarks are required to achieve the optimal performance for a given computational architecture. \n\nBeyond MPI based parallelism and thread based parallelism the [HPC Cluster Executors](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html) and the [HPC Job Executors](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html) also provide the option to assign GPUs to the execution of individual Python functions.","metadata":{}},{"id":"ca9bc450-2762-4d49-b7f8-48cc83e068fd","cell_type":"markdown","source":"## Performance Optimization\nThe default settings of executorlib are chosen to favour stability over performance. Consequently, the performance of executorlib can be improved by setting additional parameters. It is commonly recommended to start with an initial implementation based on executorlib and then improve the performance by enabling specialized features.","metadata":{}},{"id":"e9b52ecf-3984-4695-98e7-315aa3712104","cell_type":"markdown","source":"### Block Allocation\nBy default each submitted Python function is executed in a dedicated process. This gurantees that the execution of the submitted Python function starts with a fresh process. Still the initialization of the Python process takes time. Especially when the call of the Python function requires only limited computational resources it makes sense to reuse the existing Python process for the execution of multiple Python functions. In executorlib this functionality is enabled by setting the `block_allocation` parameter to `Ture`. To limit the number of parallel Python processes when using block allocation it is recommended to set the `max_workers` parameter to restrict the number of available computing resources. ","metadata":{}},{"id":"0da4c7d0-2268-4ea8-b62d-5d94c79ebc72","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(max_workers=2, block_allocation=True) as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\nCPU times: user 31.5 ms, sys: 11.5 ms, total: 43 ms\nWall time: 709 ms\n"}],"execution_count":13},{"id":"d38163b3-1c04-431c-964b-2bad4f823a4d","cell_type":"markdown","source":"The same functionality also applies to MPI parallel Python functions. The important part is that while it is possible to assign more than one Python process to the execution of a Python function in block allocation mode, it is not possible to assign resources during the submission of the function with the `submit()` function. Starting again with the `calc_mpi()` function: ","metadata":{}},{"id":"cb8c4943-4c78-4203-95f2-1db758e588d9","cell_type":"code","source":"def calc_mpi(i):\n from mpi4py import MPI\n\n size = MPI.COMM_WORLD.Get_size()\n rank = MPI.COMM_WORLD.Get_rank()\n return i, size, rank","metadata":{"trusted":true},"outputs":[],"execution_count":14},{"id":"9e1212c4-e3fb-4e21-be43-0a4f0a08b856","cell_type":"markdown","source":"Still the resource dictionary parameter can still be set during the initialisation of the `SingleNodeExecutor` class. Internally, this groups the created Python processes in fixed allocations and afterwards submit Python functions to these allocations.","metadata":{}},{"id":"5ebf7195-58f9-40f2-8203-2d4b9f0e9602","cell_type":"code","source":"with SingleNodeExecutor(max_workers=2, resource_dict={\"cores\": 2}, block_allocation=True) as exe:\n fs = exe.submit(calc_mpi, 3)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[(3, 2, 0), (3, 2, 1)]\n"}],"execution_count":15},{"id":"b75fb95f-f2f5-4be9-9f2a-9c2e9961c644","cell_type":"markdown","source":"The weakness of memory from a previous Python function remaining in the Python process can at the same time be an advantage for working with large datasets. In executorlib this is achieved by introducing the `init_function` parameter. The `init_function` returns a dictionary of parameters which can afterwards be reused as keyword arguments `**kwargs` in the functions submitted to the `Executor`. When block allocation `block_allocation` is disabled this functionality is not available, as each function is executed in a separate process, so no data can be preloaded.","metadata":{}},{"id":"8aa754cc-eb1a-4fa1-bd72-272246df1d2f","cell_type":"code","source":"def init_function():\n return {\"j\": 4, \"k\": 3, \"l\": 2}","metadata":{"trusted":true},"outputs":[],"execution_count":16},{"id":"1854895a-7239-4b30-b60d-cf1a89234464","cell_type":"code","source":"def calc_with_preload(i, j, k):\n return i + j + k","metadata":{"trusted":true},"outputs":[],"execution_count":17},{"id":"d07cf107-3627-4cb0-906c-647497d6e0d2","cell_type":"markdown","source":"The function `calc_with_preload()` requires three inputs `i`, `j` and `k`. But when the function is submitted to the executor only two inputs are provided `fs = exe.submit(calc, 2, j=5)`. In this case the first input parameter is mapped to `i=2`, the second input parameter is specified explicitly `j=5` but the third input parameter `k` is not provided. So the `SingleNodeExecutor` automatically checks the keys set in the `init_function()` function. In this case the returned dictionary `{\"j\": 4, \"k\": 3, \"l\": 2}` defines `j=4`, `k=3` and `l=2`. For this specific call of the `calc_with_preload()` function, `i` and `j` are already provided so `j` is not required, but `k=3` is used from the `init_function()` and as the `calc_with_preload()` function does not define the `l` parameter this one is also ignored.","metadata":{}},{"id":"cc648799-a0c6-4878-a469-97457bce024f","cell_type":"code","source":"with SingleNodeExecutor(max_workers=2, init_function=init_function, block_allocation=True) as exe:\n fs = exe.submit(calc_with_preload, 2, j=5)\n print(fs.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"10\n"}],"execution_count":18},{"id":"1073b8ca-1492-46e9-8d1f-f52ad48d28a2","cell_type":"markdown","source":"The result is `2+5+3=10` as `i=2` and `j=5` are provided during the submission and `k=3` is defined in the `init_function()` function.","metadata":{}},{"id":"24397d78-dff1-4834-830c-a8f390fe6b9c","cell_type":"markdown","source":"### Cache\nThe development of scientific workflows is commonly an interactive process, extending the functionality step by step. This lead to the development of interactive environments like [Jupyter](https://jupyter.org) which is fully supported by executorlib. Still many of the computationally intensive Python functions can take in the order of minutes to hours or even longer to execute, so reusing an existing Python process is not feasible. To address this challenge executorlib provides a file based cache to store the results of previously computed [concurrent future Futures](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects. The results are serialized using [cloudpickle](https://github.com/cloudpipe/cloudpickle) and stored in a user-defined cache directory `cache_directory` to be reloaded later on. Internally, the hierarchical data format (HDF5) is used via the [h5py](https://www.h5py.org), which is an optional dependency for executorlib. \n\nThe [h5py](https://www.h5py.org) package is an optional dependency of executorlib. The installation of the [h5py](https://www.h5py.org) package is covered in the installation section. ","metadata":{}},{"id":"ecdcef49-5c89-4538-b377-d53979673bf7","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(cache_directory=\"./file\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[2, 4, 6]\nCPU times: user 84.3 ms, sys: 33.6 ms, total: 118 ms\nWall time: 1.35 s\n"}],"execution_count":19},{"id":"32d0fb2e-5ac1-4249-b6c8-953c92fdfded","cell_type":"markdown","source":"When the same code is executed again, executorlib finds the existing results in the cache directory specified by the `cache_directory` parameter and reloads the result, accelerating the computation especially during the prototyping phase when similar computations are repeated frequently for testing. \n\nStill it is important to mention, that this cache is not designed to identify the submission of the same parameters within the context of one `with`-statement. It is the task of the user to minimize duplicate computations, the cache is only designed to restore previous calculation results when the Python process managing executorlib was stopped after the successful execution. ","metadata":{}},{"id":"c39babe8-4370-4d31-9520-9a7ce63378c8","cell_type":"code","source":"%%time\nwith SingleNodeExecutor(cache_directory=\"./file\") as exe:\n future_lst = [exe.submit(sum, [i, i]) for i in range(1, 4)]\n print([f.result() for f in future_lst])","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[2, 4, 6]\nCPU times: user 44.2 ms, sys: 15.5 ms, total: 59.7 ms\nWall time: 1.3 s\n"}],"execution_count":20},{"id":"5144a035-633e-4e60-a362-f3b15b28848b","cell_type":"markdown","source":"An additional advantage of the cache is the option to gather the results of previously submitted functions. Using the `get_cache_data()` function the results of each Python function is converted to a dictionary. This list of dictionaries can be converted to a `pandas.DataFrame` for further processing:","metadata":{}},{"id":"f574b9e1-de55-4e38-aef7-a4bed540e040","cell_type":"code","source":"import pandas\nfrom executorlib import get_cache_data\n\ndf = pandas.DataFrame(get_cache_data(cache_directory=\"./file\"))\ndf","metadata":{"trusted":true},"outputs":[{"execution_count":21,"output_type":"execute_result","data":{"text/plain":" function input_args input_kwargs output resource_dict \\\n0 ([2, 2],) {} 4 {} \n1 ([3, 3],) {} 6 {} \n2 ([1, 1],) {} 2 {} \n\n runtime filename \n0 0.910742 /home/jovyan/file/sum89afbdf9da5eb1794f6976a3f... \n1 0.911247 /home/jovyan/file/sum0f7710227cda6456e5d071877... \n2 0.908284 /home/jovyan/file/sumf5ad27b855231a293ddd735a8... ","text/html":"
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
functioninput_argsinput_kwargsoutputresource_dictruntimefilename
0<built-in function sum>([2, 2],){}4{}0.910742/home/jovyan/file/sum89afbdf9da5eb1794f6976a3f...
1<built-in function sum>([3, 3],){}6{}0.911247/home/jovyan/file/sum0f7710227cda6456e5d071877...
2<built-in function sum>([1, 1],){}2{}0.908284/home/jovyan/file/sumf5ad27b855231a293ddd735a8...
\n
"},"metadata":{}}],"execution_count":21},{"id":"68092479-e846-494a-9ac9-d9638b102bd8","cell_type":"markdown","source":"After the development phase is concluded it is the task of the user to remove the cache directory defined with the `cache_directory` parameter. The cache directory is never removed by executorlib to prevent the repeation of expensive computations. Still as disk space on shared file systems in HPC environments is commonly limited it is recommended to remove the cache directory once the development process concluded. ","metadata":{}},{"id":"34a9316d-577f-4a63-af14-736fb4e6b219","cell_type":"code","source":"import os\nimport shutil\n\ncache_dir = \"./file\"\nif os.path.exists(cache_dir):\n print(os.listdir(cache_dir))\n try:\n shutil.rmtree(cache_dir)\n except OSError:\n pass","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"['sum89afbdf9da5eb1794f6976a3f01697c2_o.h5', 'sum0f7710227cda6456e5d07187702313f3_o.h5', 'sumf5ad27b855231a293ddd735a8554c9ea_o.h5']\n"}],"execution_count":22},{"id":"1cea95b5-4110-444c-82af-fa6718bfa17f","cell_type":"markdown","source":"Typically the use of the cache is recommended for development processes only and for production workflows the user should implement their own long-term storage solution. The binary format used by executorlib is based on [cloudpickle](https://github.com/cloudpipe/cloudpickle) and might change in future without further notice, rendering existing data in the cache unusable. Consequently, using the cache beyond the development process is not recommended. In addition the writing of the results to files might result in additional overhead for accessing the shared file system. ","metadata":{}},{"id":"71a8a0be-a933-4e83-9da5-50da35e9975b","cell_type":"markdown","source":"### Dependencies\nMany scientific Python programs consist of series of Python function calls with varying level of parallel computations or map-reduce patterns where the same function is first mapped to a number of parameters and afterwards the results are reduced in a single function. To extend the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor) of the Python standard library to support this programming pattern, the `SingleNodeExecutor` class from executorlib supports submitting Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) objects to the `SingleNodeExecutor` which are resolved before submission. So the `SingleNodeExecutor` internally waits until all Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) objects are successfully executed before it triggers the execution of the submitted Python function.","metadata":{}},{"id":"d8b75a26-479d-405e-8895-a8d56b3f0f4b","cell_type":"code","source":"def calc_add(a, b):\n return a + b","metadata":{"trusted":true},"outputs":[],"execution_count":23},{"id":"36118ae0-c13c-4f7a-bcd3-3d7f4bb5a078","cell_type":"markdown","source":"For example the function which adds two numbers `calc_add()` is used in a loop which adds a counter to the previous numbers. In the first iteration the `future` parameter is set to `0` but already in the second iteration it is the Python [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object of the first iteration and so on. \n\nThe important part is that the user does not have to wait until the first function is executed but instead the waiting happens internally in the `SingleNodeExecutor`.","metadata":{}},{"id":"35fd5747-c57d-4926-8d83-d5c55a130ad6","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future = 0\n for i in range(1, 4):\n future = exe.submit(calc_add, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"6\n"}],"execution_count":24},{"id":"38e1bbb3-1028-4f50-93c1-d2427f399a7d","cell_type":"markdown","source":"As the reusing of existing [concurrent futures Future](https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future) object can lead to rather complex dependencies, executorlib provides the option to plot the dependency graph by setting the `plot_dependency_graph=True` during the initialization of the `SingleNodeExecutor` class.\n\nNo computation is executed when the `plot_dependency_graph=True` is set. This parameter is for debugging only. \n\nInternally, the [pygraphviz](https://pygraphviz.github.io/documentation/stable) package is used for the visualisation of these dependency graphs. It is an optional dependency of executorlib. The installation of the [pygraphviz](https://pygraphviz.github.io/documentation/stable) package is covered in the installation section. ","metadata":{}},{"id":"f67470b5-af1d-4add-9de8-7f259ca67324","cell_type":"code","source":"with SingleNodeExecutor(plot_dependency_graph=True) as exe:\n future = 0\n for i in range(1, 4):\n future = exe.submit(calc_add, i, future)\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"None\n"},{"output_type":"display_data","data":{"text/plain":"","image/svg+xml":"\n\n\n\n\n0\n\ncalc_add\n\n\n\n1\n\ncalc_add\n\n\n\n0->1\n\n\nb\n\n\n\n2\n\ncalc_add\n\n\n\n1->2\n\n\nb\n\n\n\n3\n\n1\n\n\n\n3->0\n\n\na\n\n\n\n4\n\n0\n\n\n\n4->0\n\n\nb\n\n\n\n5\n\n2\n\n\n\n5->1\n\n\na\n\n\n\n6\n\n3\n\n\n\n6->2\n\n\na\n\n\n"},"metadata":{}}],"execution_count":25},{"id":"4c952a9d-2b58-401d-b7ec-fda740db774a","cell_type":"markdown","source":"## Advanced Scheduling\nGoing beyond just directed acyclic graphs (DAG) with one-to-many and many-to-one relationships, executorlib provides a number of advanced scheduling patterns. These are briefly introduced in the following.","metadata":{}},{"id":"4db2c87c-9a7d-4074-82d0-24357fa4f0e6","cell_type":"markdown","source":"### Runtime-dependent Batching \nTo maximize the throughput of dependent calculation tasks its important to idenify all tasks which can be executed at a given moment. Unfortunately, some of these dependencies can only be determined at run time, which is challenging for most schedulers. To demonstrate the runtime-dependent batching in executorlib we discuss the following example. Starting with a group of ten tasks and then grouping them into groups of three for processing. Still the order of the tasks, which tasks belong into which group, is only determined at run time. \n\nFor simplicity, we just use a simple function which directly returns the input.","metadata":{}},{"id":"857a5e0f-50d6-45ec-aac7-a7151f36c19f","cell_type":"code","source":"def reply(i):\n return i","metadata":{"trusted":true},"outputs":[],"execution_count":26},{"id":"544dacab-5601-4a9b-814f-88560eafb079","cell_type":"markdown","source":"After the group of ten tasks is submitted their future objects are stored in a list named `future_individual_lst`. This list is then provided to the `batched()` function of the `SingleNodeExecutor()` to generate batches of tasks which are then provided to the `sum` function for further processing. The results of this second step are stored in the `future_group_lst`. Finally, the results of these future objects are evaluated in the third step. ","metadata":{}},{"id":"17d1354a-0943-4b62-9b0d-7d39c8df23f2","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future_individual_lst = [\n exe.submit(reply, i) for i in range(10)\n ]\n future_group_lst = [\n exe.submit(sum, f) for f in exe.batched(future_individual_lst, n=3)\n ]\n print(sum([f.result() for f in future_group_lst]))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"45\n"}],"execution_count":27},{"id":"80e8b154-d659-4f3e-add2-701a454d770d","cell_type":"markdown","source":"### Split Future Objects\nIn analogy to the `batched()` function which combines multiple future objects in a batch for further processing, it is also necessary to split the future objects even before the evaluation is completed. Executorlib provides two utility functions, namely `split_future()` for tuples and lists and `get_item_from_future()` for dictionaries. \n\nStarting with a function which returns a tuple, named `get_a_tuple()`:","metadata":{}},{"id":"6ef541e3-a2be-4e05-9e77-65eaceff4248","cell_type":"code","source":"def get_a_tuple(i):\n return \"a\", \"b\", i","metadata":{"trusted":true},"outputs":[],"execution_count":28},{"id":"dd3e4312-1594-4b3b-baf3-5b3121ca8910","cell_type":"markdown","source":"This function is submitted to the `SingleNodeExecutor()` and while in this case it directly returns the tuple, the evaluation would commonly take much longer. By having the ability to split the output of the future object using the `split_future()` function, a number of future objects is generated one for each element of the tuple. This is enabled by providing the number of elements in the tuple as an additional parameter `n=3`. ","metadata":{}},{"id":"927c5931-d7fd-4bc1-ae0e-3dd2f4bc99ce","cell_type":"code","source":"from executorlib import split_future","metadata":{"trusted":true},"outputs":[],"execution_count":29},{"id":"64a9b46e-0de6-4abb-99d9-8aaa0c6cbccb","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future = exe.submit(get_a_tuple, 15)\n f1, f2, f3 = split_future(future=future, n=3)\n print(f1.result(), f2.result(), f3.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"a b 15\n"}],"execution_count":30},{"id":"a10d8f90-e790-4708-b193-90a7f014d699","cell_type":"markdown","source":"In analogy, to the `split_future()` function for lists and tuples, the `get_item_from_future()` function returns one item of a dicitionary which is returned by a function submitted to an `Executor()`. In this example the `get_a_dict()` function returns a dictionary, again in this example the dictionary is returned directly while commonly this would take much longer. ","metadata":{}},{"id":"51ec4dbf-d009-41c9-bc04-cf1b16fe782f","cell_type":"code","source":"def get_a_dict(i):\n return {\"a\": 1, \"b\": 2, \"c\": i}","metadata":{"trusted":true},"outputs":[],"execution_count":31},{"id":"5c90ab75-2a6b-4fbe-a7ee-7f91b2b4af43","cell_type":"markdown","source":"The `get_a_dict()` function is submitted to the `SingleNodeExecutor()`, it returns a future object named `future_dict`. Still as we know that the `result()` of this future object `future_dict` returns a dictionary, we can already access the items of this dictionary with the `get_item_from_future()` function. The `get_item_from_future()` function takes a future object as input in addition to the `key` of the dictionary which should be accessed, as a result the `get_item_from_future()` function returns a future object for the value related to the key. In this example these future objects are named `f1`, `f2` and `f3`. These fucture objects are evaluated afterwards.","metadata":{}},{"id":"a41251d2-a840-4c12-9625-c2e0585c489b","cell_type":"code","source":"from executorlib import get_item_from_future","metadata":{"trusted":true},"outputs":[],"execution_count":32},{"id":"a6e75c5e-ad0c-4723-99c5-8125b63fbeaf","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n future_dict = exe.submit(get_a_dict, 15)\n f1 = get_item_from_future(future=future_dict, key=\"a\")\n f2 = get_item_from_future(future=future_dict, key=\"b\")\n f3 = get_item_from_future(future=future_dict, key=\"c\")\n print(f1.result(), f2.result(), f3.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"1 2 15\n"}],"execution_count":33},{"id":"a945c98d-dc73-4284-9d8c-52475a760f6b","cell_type":"markdown","source":"### Recursion\nIn addition to the `map()` function for parallel loops and the option to integrate `while` loops directly in the submission, it is sometimes helpful to use recursive algorthims to accelerate scientific simulation and analysis. To demonstrate the use of executorlib in combination with recursive algorithms, the quicksort algorithm is demonstrated. \n\nThe quicksort algorithm is implemented in two parts, a `quick_sort()` which splits the input `sequence` into two sets, one lower and one larger than the pivot element of the `sequence`. After the initial execution the `quick_sort()` function is again applied to both resulting sets until only a single element remains in the `sequence`. In this case the single element is returned. The pivot is defined as the first element of the `sequence`.\n\nTo simplify the submission of the `quick_sort()` function to the `SingleNodeExecutor()` dictionaries are used as return types, these dictionaries either contain only a single item with the key `\"result\"` when only a single element remains in the list, or three items, one `\"left\"` for a list lower than the pivot, one `\"right\"` for the items larger than the pivot and the `\"result\"` for the pivot itself. ","metadata":{}},{"id":"08b0c0a1-34ad-4b2a-847c-fe9c96956b27","cell_type":"code","source":"def quick_sort(sequence):\n length = len(sequence)\n if length <= 1:\n return {\"result\": sequence}\n else:\n pivot = sequence.pop() \n \n greater_items = []\n lesser_items = []\n\n for item in sequence:\n if item > pivot:\n greater_items.append(item)\n else:\n lesser_items.append(item)\n\n return {\"left\": lesser_items, \"right\": greater_items, \"result\": [pivot]}","metadata":{"trusted":true},"outputs":[],"execution_count":34},{"id":"54a8a765-0b9f-424a-86e5-8024c4d59018","cell_type":"markdown","source":"To enable the recursive submission to the `SingleNodeExecutor()` a `recusive_submit()` function is defined using the [asynchronous IO module](https://docs.python.org/3/library/asyncio.html) of the Python standard libary, indicated by the `async` keyword ahead of the function definition. It takes a `function`, the `sequence` and the `executor` as inputs. As a first step the function is submitted to the `executor` and the execution is halted until the first result is available by wrapping the future object using the `wrap_future()` function of the `asyncio` package and appling the `await` function. Then the corresponding result dictionary `result_dict` is evaluated: If the `result_dict` contains more than one key, then the `recusive_submit()` is evaluated for both the left side with lower values than the pivot element and the right side with elements higher than the pivot element. Again in both cases the `await` keyword is used to enable the parallel execution of both branches at the same time. Afterwards the result of both sides is combined with the pivot element. For the case that the dictionary only contains a single element, it is returned directly. ","metadata":{}},{"id":"4e142829-c9de-4969-ab3c-97f3e1ada90c","cell_type":"code","source":"import asyncio\n\nasync def recusive_submit(function, sequence, executor):\n result_dict = await asyncio.wrap_future(exe.submit(function, sequence))\n if len(result_dict) > 1:\n left = await recusive_submit(function=function, sequence=result_dict[\"left\"], executor=executor)\n right = await recusive_submit(function=function, sequence=result_dict[\"right\"], executor=executor)\n return left + result_dict[\"result\"] + right\n else:\n return result_dict[\"result\"]","metadata":{"trusted":true},"outputs":[],"execution_count":35},{"id":"531a8f7d-5b21-46d0-b632-32a1568571c8","cell_type":"code","source":"with SingleNodeExecutor() as exe:\n loop = asyncio.get_event_loop()\n task = loop.create_task(recusive_submit(function=quick_sort, sequence=[0,9,3,8,2,7,5], executor=exe))\n print(await task)","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[0, 2, 3, 5, 7, 8, 9]\n"}],"execution_count":36},{"id":"725c8ac2-27e4-495b-b061-1fd6053f4c0b","cell_type":"markdown","source":"## Testing and Debugging\nThe up-scaling of Python functions from a single workstation to an High Performance Computer (HPC) can be challenging, so executorlib provides a number of debugging utilities to help you optimize your functions for execution with executorlib. ","metadata":{}},{"id":"2c96b460-ebd2-4c8a-a5e1-922a860808ab","cell_type":"markdown","source":"### Measure Data Transferred \nTransferring a large amount of data between two processes requires additional resources so it is helpful to measure the data transferred between the frontend and backend process. This is achieved by setting the `log_obj_size` parameter to `True`:","metadata":{}},{"id":"71905acf-2fef-4738-82ae-89e35e2e3d2d","cell_type":"code","source":"from executorlib import SingleNodeExecutor\n\nwith SingleNodeExecutor(log_obj_size=True) as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stderr","output_type":"stream","text":"Send dictionary of size: 101\nReceived dictionary of size: 59\nSend dictionary of size: 69\nReceived dictionary of size: 58\n"},{"name":"stdout","output_type":"stream","text":"2\n"}],"execution_count":37},{"id":"0e9f7192-2b7d-4caf-b2b8-ae9cb060e90f","cell_type":"markdown","source":"### Write Log Files\nLibraries like executorlib are commonly used to sample a large parameter space, in this case it is possible that out of a large number of parameters one combination throws an error. This error can be logged in a file which also contains the function and input parameters using the `\"error_log_file\"` parameter in the `resource_dict`. This allows to change the log file on a per-function bases.","metadata":{}},{"id":"2810acd5-a46e-4d85-b447-945248ffca15","cell_type":"code","source":"from executorlib import SingleNodeExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":38},{"id":"ef6b87a7-361e-4a3f-bad3-72ad87968e8c","cell_type":"code","source":"def my_funct(i, j): \n if i == 2 and j == 2:\n raise ValueError()\n else: \n return i * j + i + j","metadata":{"trusted":true},"outputs":[],"execution_count":39},{"id":"209ff76b-913a-46f7-9fff-250e207898b2","cell_type":"markdown","source":"A try and except statement is added to prevent the jupyter notebook from crashing:","metadata":{}},{"id":"30381a00-30cc-45a2-82ff-17371339f5c7","cell_type":"code","source":"with SingleNodeExecutor(resource_dict={\"error_log_file\": \"error.out\"}) as exe:\n future_lst = []\n for i in range(4):\n for j in range(4):\n future_lst.append(exe.submit(my_funct, i=i, j=j))\n try:\n print([f.result() for f in future_lst])\n except ValueError:\n pass","metadata":{"trusted":true},"outputs":[],"execution_count":40},{"id":"36bfc556-aa86-4b50-972b-4b8f68ceec3d","cell_type":"markdown","source":"The content of the log file is a basic text file, so it can be read with any kind of file utility. The important part is that the log file contains not only the error message but in addition also the function name and the input parameters in the case `kwargs: {'i': 2, 'j': 2}` which helps for future debugging of the sampling function.","metadata":{}},{"id":"a61c06fc-3029-48ed-895f-9f6c065b7c47","cell_type":"code","source":"with open(\"error.out\") as f:\n content = f.readlines()","metadata":{"trusted":true},"outputs":[],"execution_count":41},{"id":"6a6cd10f-6fe3-4a17-a8e6-2536feb9a11a","cell_type":"code","source":"content","metadata":{"trusted":true},"outputs":[{"execution_count":42,"output_type":"execute_result","data":{"text/plain":"['function: \\n',\n 'args: ()\\n',\n \"kwargs: {'i': 2, 'j': 2}\\n\",\n 'Traceback (most recent call last):\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/backend/interactive_serial.py\", line 56, in main\\n',\n ' output = call_funct(input_dict=input_dict, funct=None, memory=memory)\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/standalone/interactive/backend.py\", line 33, in call_funct\\n',\n ' return funct(input_dict[\"fn\"], *input_dict[\"args\"], **input_dict[\"kwargs\"])\\n',\n ' File \"/srv/conda/envs/notebook/lib/python3.13/site-packages/executorlib/standalone/interactive/backend.py\", line 22, in funct\\n',\n ' return args[0].__call__(*args[1:], **kwargs)\\n',\n ' ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^\\n',\n ' File \"/tmp/ipykernel_463/3167739528.py\", line 3, in my_funct\\n',\n 'ValueError\\n']"},"metadata":{}}],"execution_count":42},{"id":"5aff120a-317f-47d4-9639-8eccfb136117","cell_type":"code","source":"import os\n\nif os.path.exists(\"error.out\"):\n os.remove(\"error.out\")","metadata":{"trusted":true},"outputs":[],"execution_count":43},{"id":"44cd41d7-4417-429e-8481-f2a49e5f769c","cell_type":"markdown","source":"### TestClusterExecutor\nWhile the `SingleNodeExecutor` internally behaves very similar to the `FluxJobExecutor` and `SlurmJobExecutor` the `FluxClusterExecutor` and `SlurmClusterExecutor` behave very different as they use the file system to exchange information rather than socket-based communication. This can lead to complications when it comes to debugging. To address this challenge executorlib provides the `TestClusterExecutor` which can be executed on a local workstation just like the `SingleNodeExecutor` but in the background it uses the same file based communication like the `SlurmClusterExecutor` and the `FluxClusterExecutor`:","metadata":{}},{"id":"2ae29fb0-54e5-468f-8727-a179b6ed363e","cell_type":"code","source":"from executorlib.api import TestClusterExecutor\n\nwith TestClusterExecutor(cache_directory=\"test\") as exe:\n future = exe.submit(sum, [1, 1])\n print(future.result())","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"2\n"}],"execution_count":44}]} \ No newline at end of file diff --git a/notebooks/4-1-gpaw.ipynb b/notebooks/4-1-gpaw.ipynb index e6274250..942eb3d1 100644 --- a/notebooks/4-1-gpaw.ipynb +++ b/notebooks/4-1-gpaw.ipynb @@ -1 +1 @@ -{"metadata":{"kernelspec":{"name":"flux","display_name":"Flux","language":"python"},"language_info":{"name":"python","version":"3.10.16","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"745ca7d3-5046-4a8c-a370-d9d05b77a1b7","cell_type":"markdown","source":"# GPAW\nThe [gpaw](https://gpaw.readthedocs.io/index.html) density-functional theory (DFT) simulation code provides a Python interface supporting the [message passing interface (MPI) for Python - mpi4py](https://mpi4py.readthedocs.io) for parallelization. So `executorlib` is used to orchestrate multiple [gpaw](https://gpaw.readthedocs.io/index.html) simulation each using multiple CPU cores for parallelization. These kind of hierarchical workflows are one of the core strength of `executorlib`. While the same could be achieved by writing the whole simulation workflow using [mpi4py](https://mpi4py.readthedocs.io) this would drastically increase the complexity. With `executorlib` the user can quickly up-scale their simulation workflow without the need to address the parallel execution explicitly, rather the parallelization is introduced on a per-function level, by submitting the functions to the `FluxClusterExecutor` or `FluxJobExecutor`. [Story 12](story-12-mpi4py-functions.ipynb) shows the same pattern step by step for your own mpi4py functions on a SLURM cluster, including what the futures of MPI-parallel functions return.","metadata":{}},{"id":"21852c01-efda-43fe-add9-d08123a82995","cell_type":"code","source":"import subprocess\nfrom ase.build import bulk\nfrom atomistics.workflows import (\n analyse_results_for_energy_volume_curve,\n get_tasks_for_energy_volume_curve,\n)\nimport matplotlib.pyplot as plt\nimport pprint\nfrom tqdm import tqdm\nfrom time import sleep","metadata":{"trusted":true},"outputs":[{"name":"stderr","output_type":"stream","text":"/srv/conda/envs/notebook/lib/python3.10/site-packages/atomistics/workflows/__init__.py:77: UserWarning: PhonopyWorkflow(), QuasiHarmonicWorkflow(), get_band_structure(), get_dynamical_matrix(), get_hesse_matrix(), get_thermal_properties_for_harmonic_approximation(), get_tasks_for_harmonic_approximation(), analyse_results_for_harmonic_approximation(), get_tasks_for_quasi_harmonic_approximation(), analyse_results_for_quasi_harmonic_approximation(), get_thermal_properties_for_quasi_harmonic_approximation(), plot_band_structure() and plot_dos() are not available as the import of the module named 'structuretoolkit' failed.\n raise_warning(module_list=phonopy_workflows, import_error=e)\n"}],"execution_count":1},{"id":"e15eed0da3c6547b","cell_type":"markdown","source":"The only function which is executed using [mpi4py](https://mpi4py.readthedocs.io) is the `evaluate_with_gpaw()` function:","metadata":{}},{"id":"aa435760-390f-4eff-88f4-96b15777de3e","cell_type":"code","source":"def evaluate_with_gpaw(task_dict, kpts, encut):\n import os\n os.environ[\"OMP_NUM_THREADS\"] = \"1\"\n os.environ[\"GPAW_MPI4PY\"] = \"1\"\n\n from mpi4py import MPI\n from gpaw import GPAW, PW\n from gpaw.mpi4pywrapper import MPI4PYWrapper\n\n structure = task_dict[\"calc_energy\"].copy()\n structure.calc = GPAW(\n xc=\"PBE\",\n mode=PW(encut),\n kpts=kpts,\n communicator=MPI4PYWrapper(MPI.COMM_WORLD),\n )\n return structure.get_potential_energy()","metadata":{"trusted":true},"outputs":[],"execution_count":2},{"id":"e9936ca22151d490","cell_type":"markdown","source":"As a first step of the workflow the equilibrium structure of four Aluminium atoms is strained by 5%.","metadata":{}},{"id":"a1d4e9a1-7275-4d9a-b038-db27185f00ae","cell_type":"code","source":"task_dict = get_tasks_for_energy_volume_curve(\n structure=bulk(\"Al\", a=4.03),\n num_points=7,\n vol_range=0.05,\n axes=(\"x\", \"y\", \"z\"),\n)","metadata":{"trusted":true},"outputs":[],"execution_count":3},{"id":"8bf60b7b0f5af31a","cell_type":"markdown","source":"The resulting dictionary of structures `task_dict` is transformed to simplify the parallel execution:","metadata":{}},{"id":"73ad1043-eacd-4758-a7b4-f64969beabab","cell_type":"code","source":"task_loop_dict = {k: {\"calc_energy\": v} for k, v in task_dict[\"calc_energy\"].items()}","metadata":{"trusted":true},"outputs":[],"execution_count":4},{"id":"af5ba456f3fafd39","cell_type":"markdown","source":"The status of the flux cluster is validated using the `flux resource list` command and the `flux jobs -a` command, just to highlight flux was initialized correctly and has access to the available resources.","metadata":{}},{"id":"8a93aa2b-2bce-4c87-943c-38364a4324ee","cell_type":"code","source":"pprint.pp(subprocess.check_output([\"flux\", \"resource\", \"list\"], universal_newlines=True).split(\"\\n\"))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[' STATE NNODES NCORES NGPUS NODELIST',\n ' free 1 24 0 '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' allocated 0 0 0 ',\n ' down 0 0 0 ',\n '']\n"}],"execution_count":5},{"id":"f7f072d5-ea3b-43f5-9ec1-0ea1036d7e25","cell_type":"code","source":"pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO', '']\n"}],"execution_count":6},{"id":"62c7297b-efae-4950-a513-3b84345ad7b4","cell_type":"markdown","source":"## FluxClusterExecutor\nThe [FluxClusterExecutor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#flux) is used in this demonstration primarily because flux can be installed on any workstation for testing. The [SlurmClusterExecutor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#slurm) could be used analogously.","metadata":{}},{"id":"9cd01061-c84a-4d8d-80e1-c269af3d8c29","cell_type":"code","source":"from executorlib import FluxClusterExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":7},{"id":"2670c218fbde5b02","cell_type":"markdown","source":"The for each strained structure a calculation task is submitted to the `FluxClusterExecutor`. After the successful submission the current status of the flux queue is printed using `flux jobs -a`. Finally, the results are collected by gathering the [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects.","metadata":{}},{"id":"11d7a7f3-5fbf-4377-ac98-71cd29caf433","cell_type":"code","source":"future_dict = {}\nwith FluxClusterExecutor() as exe:\n for k, v in task_loop_dict.items():\n future_dict[k] = exe.submit(\n evaluate_with_gpaw, \n task_dict=v, \n kpts=(3, 3, 3), \n encut=300,\n resource_dict={\"cores\": 2},\n )\n sleep(1)\n pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))\n result_dict = {\n k: f.result()\n for k, f in tqdm(future_dict.items())\n }\n sleep(1)\n pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO',\n ' ƒ3exNRKu jovyan executorl+ R 2 1 0.104s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3BjTcCf jovyan executorl+ R 2 1 1.191s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ31P2d51 jovyan executorl+ R 2 1 1.646s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n '']\n"},{"name":"stderr","output_type":"stream","text":"100%|██████████| 7/7 [01:08<00:00, 9.86s/it]\n"},{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO',\n ' ƒ6RrzUJb jovyan executorl+ R 2 1 1.108m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ5WD8Tno jovyan executorl+ R 2 1 1.145m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4YJoYUf jovyan executorl+ R 2 1 1.181m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4ESWCVd jovyan executorl+ R 2 1 1.193m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3exNRKu jovyan executorl+ R 2 1 1.215m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3BjTcCf jovyan executorl+ R 2 1 1.233m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ31P2d51 jovyan executorl+ R 2 1 1.241m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n '']\n"}],"execution_count":8},{"id":"8c80e3bcb483b069","cell_type":"markdown","source":"The resulting energies for the different volumes are fitted using a 3rd order polynomial to derive the bulk modulus as second derivative multiplied by the equilibrium volume.","metadata":{}},{"id":"5a5822c7-5ab6-483b-a3ab-8cef5fcaf269","cell_type":"code","source":"fit_dict = analyse_results_for_energy_volume_curve(\n output_dict={\"energy\": result_dict},\n task_dict=task_dict,\n fit_type=\"polynomial\",\n fit_order=3,\n)","metadata":{"trusted":true},"outputs":[],"execution_count":9},{"id":"571b7c25dcca8bb","cell_type":"markdown","source":"The final energy volume curve plot summarizes the results of this calculation.","metadata":{}},{"id":"d420b4c5-1a2f-4290-ba81-0c7f7bdf7ef3","cell_type":"code","source":"plt.plot(fit_dict[\"volume\"], fit_dict[\"energy\"], label=\"$B_0$= %0.2f GPa\" % fit_dict[\"bulkmodul_eq\"])\nplt.xlabel(\"Volume [$\\AA^3$]\")\nplt.ylabel(\"Energy [eV]\")\nplt.legend()","metadata":{"trusted":true},"outputs":[{"execution_count":10,"output_type":"execute_result","data":{"text/plain":""},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"
","image/png":"iVBORw0KGgoAAAANSUhEUgAAAlQAAAG2CAYAAAC5/Bg9AAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjYsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvq6yFwwAAAAlwSFlzAAAPYQAAD2EBqD+naQAAcBZJREFUeJzt3XlYVGX/BvB7Zhj2HWTfBGWT1R203Pc9N8pXTcu3zbe0MrUyLcvltb1ezfxlWVlaikta7pobCiiLK6DIIosgyCLIOuf3BzKJArIMHGa4P9c1VzJz5sx9hA5fn+c53yMRBEEAERERETWZVOwAREREROqOBRURERFRM7GgIiIiImomFlREREREzcSCioiIiKiZWFARERERNRMLKiIiIqJmYkFFRERE1ExaYgdoLxQKBdLT02FkZASJRCJ2HCIiImoAQRBQWFgIOzs7SKV1j0OxoGol6enpcHR0FDsGERERNUFqaiocHBzqfJ0FVSsxMjICUPUNMTY2FjkNERERNURBQQEcHR2Vv8frwoKqlVRP8xkbG7OgIiIiUjOPW67DRelEREREzcSCioiIiKiZWFARERERNRMLKiIiIqJmYkFFRERE1EwsqIiIiIiaiQUVERERUTOxoCIiIiJqJhZURERERM3EgoqIiIiomVhQERERETUTCyoiIiKiZuLNkYmIiEitrf/7Om7euYfn+naEi6WBKBlYUBEREZHaKq2oxIYTN3D7bil6djQXraDilB8RERGprb2xGbh9txQ2xroY7mMjWg4WVERER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gDExMTU2Z+LiFofCyoiUhvPPfccvvvuOwwdOhROTk41Xlu1ahUUCgWmT5+OwsJCdO/eHfv376+1ZxMALF68GImJiRg9ejRMTEywfPlylYxQAcDy5cthZWWFlStXIjExEaampujatSvefvvtBr3/q6++Ql5eHubOnfvIa46OjtDX10d0dDQLKqI2hPfyIyJqA/r374+AgIBHemOpkkQiwY4dOzB+/PgW+wyi9oprqIiI2oi1a9fC0NAQFy5cUOl+X3zxRRgaGqp0n0RUE0eoiIjagLS0NNy7dw8A4OTkBG1tbZXtOysrS9n409bWFgYGBirbNxFVYUFFRERE1Eyc8iMiIiJqJhZURERERM3EgoqIiIiomVhQERERETUTCyoiIiKiZmJBRURERNRMLKiIiIiImokFFREREVEzsaAiIiIiaiYWVERERETNxIKKiIiIqJn+H/ivFa1no03WAAAAAElFTkSuQmCC"},"metadata":{}}],"execution_count":10},{"id":"fed42763-52cf-44c2-961d-6d00918ba6df","cell_type":"markdown","source":"## FluxJobExecutor\nIn analogy to the [FluxClusterExecutor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#flux) the [FluxJobExecutor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html#flux) can be applied to distribute simulation within a given queuing system allocation. The calculation of the bulk modulus with [gpaw](https://gpaw.readthedocs.io) is implemented in the same way.","metadata":{}},{"id":"516a91d4-0be6-47a6-9c9c-f5b0082bfee7","cell_type":"code","source":"from executorlib import FluxJobExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":11},{"id":"21bdd0d42f9806e4","cell_type":"markdown","source":"The for each strained structure a calculation task is submitted to the `FluxJobExecutor`. After the successful submission the current status of the flux queue is printed using `flux jobs -a`. Finally, the results are collected by gathering the [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects.","metadata":{}},{"id":"2b0c559b-a117-4766-b679-314ab9e65e97","cell_type":"code","source":"future_dict = {}\nwith FluxJobExecutor() as exe:\n for k, v in task_loop_dict.items():\n future_dict[k] = exe.submit(\n evaluate_with_gpaw, \n task_dict=v, \n kpts=(3, 3, 3), \n encut=300,\n resource_dict={\"cores\": 2},\n )\n sleep(1)\n pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))\n result_dict = {\n k: f.result()\n for k, f in tqdm(future_dict.items())\n }\n sleep(1)\n pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO',\n ' ƒeqRVxAU jovyan python R 2 1 4.138s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqRVxAT jovyan python R 2 1 4.138s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqQ1xt8 jovyan python R 2 1 4.139s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqQ1xt7 jovyan python R 2 1 4.139s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqNXybn jovyan python R 2 1 4.139s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqNXybm jovyan python R 2 1 4.139s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqM3zKR jovyan python R 2 1 4.141s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ6RrzUJb jovyan executorl+ F 2 1 1.192m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4ESWCVd jovyan executorl+ F 2 1 1.268m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ5WD8Tno jovyan executorl+ F 2 1 1.218m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3exNRKu jovyan executorl+ F 2 1 1.264m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3BjTcCf jovyan executorl+ F 2 1 1.271m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4YJoYUf jovyan executorl+ F 2 1 1.212m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ31P2d51 jovyan executorl+ F 2 1 1.251m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n '']\n"},{"name":"stderr","output_type":"stream","text":"100%|██████████| 7/7 [00:25<00:00, 3.60s/it]\n"},{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO',\n ' ƒeqRVxAU jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqRVxAT jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqQ1xt8 jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqQ1xt7 jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqNXybn jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqNXybm jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqM3zKR jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ6RrzUJb jovyan executorl+ F 2 1 1.192m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4ESWCVd jovyan executorl+ F 2 1 1.268m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ5WD8Tno jovyan executorl+ F 2 1 1.218m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3exNRKu jovyan executorl+ F 2 1 1.264m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3BjTcCf jovyan executorl+ F 2 1 1.271m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4YJoYUf jovyan executorl+ F 2 1 1.212m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ31P2d51 jovyan executorl+ F 2 1 1.251m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n '']\n"}],"execution_count":12},{"id":"ca353da1941c1c7c","cell_type":"markdown","source":"The resulting energies for the different volumes are fitted using a 3rd order polynomial to derive the bulk modulus as second derivative multiplied by the equilibrium volume.","metadata":{}},{"id":"8bb73863-bfde-4e96-9323-5330b2051632","cell_type":"code","source":"fit_dict = analyse_results_for_energy_volume_curve(\n output_dict={\"energy\": result_dict},\n task_dict=task_dict,\n fit_type=\"polynomial\",\n fit_order=3,\n)","metadata":{"trusted":true},"outputs":[],"execution_count":13},{"id":"3d4189b5c74ba2a2","cell_type":"markdown","source":"The final energy volume curve plot summarizes the results of this calculation.","metadata":{}},{"id":"95000e45-dd86-4659-90f4-f2d144477703","cell_type":"code","source":"plt.plot(fit_dict[\"volume\"], fit_dict[\"energy\"], label=\"$B_0$= %0.2f GPa\" % fit_dict[\"bulkmodul_eq\"])\nplt.xlabel(\"Volume [$\\AA^3$]\")\nplt.ylabel(\"Energy [eV]\")\nplt.legend()","metadata":{"trusted":true},"outputs":[{"execution_count":14,"output_type":"execute_result","data":{"text/plain":""},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"
","image/png":"iVBORw0KGgoAAAANSUhEUgAAAlQAAAG2CAYAAAC5/Bg9AAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjYsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvq6yFwwAAAAlwSFlzAAAPYQAAD2EBqD+naQAAcBZJREFUeJzt3XlYVGX/BvB7Zhj2HWTfBGWT1R203Pc9N8pXTcu3zbe0MrUyLcvltb1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cvX8bPP/9c4xh8fHweGaHq1q1brVcGElHrYUFFRGrhueeew9y5c/G///0P33//PZydnTFo0CAAUE4FSiSSGu8RBOGR56pJpVI83IavvLz8ke3kcnmNryUSSY3nqvevUChq/Hfv3r2wt7ev8V4dHZ36D/Ih8+fPR15eHhwcHJTPKRQK2NraNmo/RNTyOOVHRGphypQpkMlk+OWXX7Bp0ybMmjVLWcx06tQJ2traOHnypHL78vJyREZGKqfKHtahQ4carQQKCgpw48aNZuf09vaGjo4OUlJS0KlTpxoPR0fHBu9nz549OHfuHKKiohAdHa18fPfdd0hPT0d2dnazsxKR6nCEiojUgqGhIaZOnYq3334b+fn5ePbZZ5WvGRgY4KWXXsKCBQtgbm4OJycn/Pe//0VxcbHyKsCHDRw4ED/88APGjBkDMzMzLFmyBDKZrNk5jYyM8Oabb2L+/PlQKBTo27cvCgoKcPr0aRgaGmLmzJmP3Ud5eTneeOMNLFiwAAEBATVeMzY2BgDExMTU2Z+LiFofCyoiUhvPPfccvvvuOwwdOhROTk41Xlu1ahUUCgWmT5+OwsJCdO/eHfv376+1ZxMALF68GImJiRg9ejRMTEywfPlylYxQAcDy5cthZWWFlStXIjExEaampujatSvefvvtBr3/q6++Ql5eHubOnfvIa46OjtDX10d0dDQLKqI2hPfyIyJqA/r374+AgIBHemOpkkQiwY4dOzB+/PgW+wyi9oprqIiI2oi1a9fC0NAQFy5cUOl+X3zxRRgaGqp0n0RUE0eoiIjagLS0NNy7dw8A4OTkBG1tbZXtOysrS9n409bWFgYGBirbNxFVYUFFRERE1Eyc8iMiIiJqJhZURERERM3EgoqIiIiomVhQERERETUTCyoiIiKiZmJBRURERNRMLKiIiIiImokFFREREVEzsaAiIiIiaiYWVERERETNxIKKiIiIqJn+H/ivFa1no03WAAAAAElFTkSuQmCC"},"metadata":{}}],"execution_count":14},{"id":"8e67f9a4-d449-420c-9f62-72d106d18636","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]} \ No newline at end of file +{"metadata":{"kernelspec":{"name":"flux","display_name":"Flux","language":"python"},"language_info":{"name":"python","version":"3.10.16","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":5,"nbformat":4,"cells":[{"id":"745ca7d3-5046-4a8c-a370-d9d05b77a1b7","cell_type":"markdown","source":"# GPAW\nThe [gpaw](https://gpaw.readthedocs.io/index.html) density-functional theory (DFT) simulation code provides a Python interface supporting the [message passing interface (MPI) for Python - mpi4py](https://mpi4py.readthedocs.io) for parallelization. So `executorlib` is used to orchestrate multiple [gpaw](https://gpaw.readthedocs.io/index.html) simulation each using multiple CPU cores for parallelization. These kind of hierarchical workflows are one of the core strength of `executorlib`. While the same could be achieved by writing the whole simulation workflow using [mpi4py](https://mpi4py.readthedocs.io) this would drastically increase the complexity. With `executorlib` the user can quickly up-scale their simulation workflow without the need to address the parallel execution explicitly, rather the parallelization is introduced on a per-function level, by submitting the functions to the `FluxClusterExecutor` or `FluxJobExecutor`. [Story 5](story-5-mpi4py-functions.ipynb) shows the same pattern step by step for your own mpi4py functions on a SLURM cluster, including what the futures of MPI-parallel functions return.","metadata":{}},{"id":"21852c01-efda-43fe-add9-d08123a82995","cell_type":"code","source":"import subprocess\nfrom ase.build import bulk\nfrom atomistics.workflows import (\n analyse_results_for_energy_volume_curve,\n get_tasks_for_energy_volume_curve,\n)\nimport matplotlib.pyplot as plt\nimport pprint\nfrom tqdm import tqdm\nfrom time import sleep","metadata":{"trusted":true},"outputs":[{"name":"stderr","output_type":"stream","text":"/srv/conda/envs/notebook/lib/python3.10/site-packages/atomistics/workflows/__init__.py:77: UserWarning: PhonopyWorkflow(), QuasiHarmonicWorkflow(), get_band_structure(), get_dynamical_matrix(), get_hesse_matrix(), get_thermal_properties_for_harmonic_approximation(), get_tasks_for_harmonic_approximation(), analyse_results_for_harmonic_approximation(), get_tasks_for_quasi_harmonic_approximation(), analyse_results_for_quasi_harmonic_approximation(), get_thermal_properties_for_quasi_harmonic_approximation(), plot_band_structure() and plot_dos() are not available as the import of the module named 'structuretoolkit' failed.\n raise_warning(module_list=phonopy_workflows, import_error=e)\n"}],"execution_count":1},{"id":"e15eed0da3c6547b","cell_type":"markdown","source":"The only function which is executed using [mpi4py](https://mpi4py.readthedocs.io) is the `evaluate_with_gpaw()` function:","metadata":{}},{"id":"aa435760-390f-4eff-88f4-96b15777de3e","cell_type":"code","source":"def evaluate_with_gpaw(task_dict, kpts, encut):\n import os\n os.environ[\"OMP_NUM_THREADS\"] = \"1\"\n os.environ[\"GPAW_MPI4PY\"] = \"1\"\n\n from mpi4py import MPI\n from gpaw import GPAW, PW\n from gpaw.mpi4pywrapper import MPI4PYWrapper\n\n structure = task_dict[\"calc_energy\"].copy()\n structure.calc = GPAW(\n xc=\"PBE\",\n mode=PW(encut),\n kpts=kpts,\n communicator=MPI4PYWrapper(MPI.COMM_WORLD),\n )\n return structure.get_potential_energy()","metadata":{"trusted":true},"outputs":[],"execution_count":2},{"id":"e9936ca22151d490","cell_type":"markdown","source":"As a first step of the workflow the equilibrium structure of four Aluminium atoms is strained by 5%.","metadata":{}},{"id":"a1d4e9a1-7275-4d9a-b038-db27185f00ae","cell_type":"code","source":"task_dict = get_tasks_for_energy_volume_curve(\n structure=bulk(\"Al\", a=4.03),\n num_points=7,\n vol_range=0.05,\n axes=(\"x\", \"y\", \"z\"),\n)","metadata":{"trusted":true},"outputs":[],"execution_count":3},{"id":"8bf60b7b0f5af31a","cell_type":"markdown","source":"The resulting dictionary of structures `task_dict` is transformed to simplify the parallel execution:","metadata":{}},{"id":"73ad1043-eacd-4758-a7b4-f64969beabab","cell_type":"code","source":"task_loop_dict = {k: {\"calc_energy\": v} for k, v in task_dict[\"calc_energy\"].items()}","metadata":{"trusted":true},"outputs":[],"execution_count":4},{"id":"af5ba456f3fafd39","cell_type":"markdown","source":"The status of the flux cluster is validated using the `flux resource list` command and the `flux jobs -a` command, just to highlight flux was initialized correctly and has access to the available resources.","metadata":{}},{"id":"8a93aa2b-2bce-4c87-943c-38364a4324ee","cell_type":"code","source":"pprint.pp(subprocess.check_output([\"flux\", \"resource\", \"list\"], universal_newlines=True).split(\"\\n\"))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[' STATE NNODES NCORES NGPUS NODELIST',\n ' free 1 24 0 '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' allocated 0 0 0 ',\n ' down 0 0 0 ',\n '']\n"}],"execution_count":5},{"id":"f7f072d5-ea3b-43f5-9ec1-0ea1036d7e25","cell_type":"code","source":"pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO', '']\n"}],"execution_count":6},{"id":"62c7297b-efae-4950-a513-3b84345ad7b4","cell_type":"markdown","source":"## FluxClusterExecutor\nThe [FluxClusterExecutor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#flux) is used in this demonstration primarily because flux can be installed on any workstation for testing. The [SlurmClusterExecutor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#slurm) could be used analogously.","metadata":{}},{"id":"9cd01061-c84a-4d8d-80e1-c269af3d8c29","cell_type":"code","source":"from executorlib import FluxClusterExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":7},{"id":"2670c218fbde5b02","cell_type":"markdown","source":"The for each strained structure a calculation task is submitted to the `FluxClusterExecutor`. After the successful submission the current status of the flux queue is printed using `flux jobs -a`. Finally, the results are collected by gathering the [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects.","metadata":{}},{"id":"11d7a7f3-5fbf-4377-ac98-71cd29caf433","cell_type":"code","source":"future_dict = {}\nwith FluxClusterExecutor() as exe:\n for k, v in task_loop_dict.items():\n future_dict[k] = exe.submit(\n evaluate_with_gpaw, \n task_dict=v, \n kpts=(3, 3, 3), \n encut=300,\n resource_dict={\"cores\": 2},\n )\n sleep(1)\n pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))\n result_dict = {\n k: f.result()\n for k, f in tqdm(future_dict.items())\n }\n sleep(1)\n pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO',\n ' ƒ3exNRKu jovyan executorl+ R 2 1 0.104s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3BjTcCf jovyan executorl+ R 2 1 1.191s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ31P2d51 jovyan executorl+ R 2 1 1.646s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n '']\n"},{"name":"stderr","output_type":"stream","text":"100%|██████████| 7/7 [01:08<00:00, 9.86s/it]\n"},{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO',\n ' ƒ6RrzUJb jovyan executorl+ R 2 1 1.108m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ5WD8Tno jovyan executorl+ R 2 1 1.145m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4YJoYUf jovyan executorl+ R 2 1 1.181m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4ESWCVd jovyan executorl+ R 2 1 1.193m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3exNRKu jovyan executorl+ R 2 1 1.215m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3BjTcCf jovyan executorl+ R 2 1 1.233m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ31P2d51 jovyan executorl+ R 2 1 1.241m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n '']\n"}],"execution_count":8},{"id":"8c80e3bcb483b069","cell_type":"markdown","source":"The resulting energies for the different volumes are fitted using a 3rd order polynomial to derive the bulk modulus as second derivative multiplied by the equilibrium volume.","metadata":{}},{"id":"5a5822c7-5ab6-483b-a3ab-8cef5fcaf269","cell_type":"code","source":"fit_dict = analyse_results_for_energy_volume_curve(\n output_dict={\"energy\": result_dict},\n task_dict=task_dict,\n fit_type=\"polynomial\",\n fit_order=3,\n)","metadata":{"trusted":true},"outputs":[],"execution_count":9},{"id":"571b7c25dcca8bb","cell_type":"markdown","source":"The final energy volume curve plot summarizes the results of this calculation.","metadata":{}},{"id":"d420b4c5-1a2f-4290-ba81-0c7f7bdf7ef3","cell_type":"code","source":"plt.plot(fit_dict[\"volume\"], fit_dict[\"energy\"], label=\"$B_0$= %0.2f GPa\" % fit_dict[\"bulkmodul_eq\"])\nplt.xlabel(\"Volume [$\\AA^3$]\")\nplt.ylabel(\"Energy [eV]\")\nplt.legend()","metadata":{"trusted":true},"outputs":[{"execution_count":10,"output_type":"execute_result","data":{"text/plain":""},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"
","image/png":"iVBORw0KGgoAAAANSUhEUgAAAlQAAAG2CAYAAAC5/Bg9AAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjYsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvq6yFwwAAAAlwSFlzAAAPYQAAD2EBqD+naQAAcBZJREFUeJzt3XlYVGX/BvB7Zhj2HWTfBGWT1R203Pc9N8pXTcu3zbe0MrUyLcvltb1ezfxlWVlaikta7pobCiiLK6DIIosgyCLIOuf3BzKJArIMHGa4P9c1VzJz5sx9hA5fn+c53yMRBEEAERERETWZVOwAREREROqOBRURERFRM7GgIiIiImomFlREREREzcSCioiIiKiZWFARERERNRMLKiIiIqJmYkFFRERE1ExaYgdoLxQKBdLT02FkZASJRCJ2HCIi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VHRGphypQpkMlk+OWXX7Bp0ybMmjVLWcx06tQJ2traOHnypHL78vJyREZGKqfKHtahQ4carQQKCgpw48aNZuf09vaGjo4OUlJS0KlTpxoPR0fHBu9nz549OHfuHKKiohAdHa18fPfdd0hPT0d2dnazsxKR6nCEiojUgqGhIaZOnYq3334b+fn5ePbZZ5WvGRgY4KWXXsKCBQtgbm4OJycn/Pe//0VxcbHyKsCHDRw4ED/88APGjBkDMzMzLFmyBDKZrNk5jYyM8Oabb2L+/PlQKBTo27cvCgoKcPr0aRgaGmLmzJmP3Ud5eTneeOMNLFiwAAEBATVeMzY2BgDExMTU2Z+LiFofCyoiUhvPPfccvvvuOwwdOhROTk41Xlu1ahUUCgWmT5+OwsJCdO/eHfv376+1ZxMALF68GImJiRg9ejRMTEywfPlylYxQAcDy5cthZWWFlStXIjExEaampujatSvefvvtBr3/q6++Ql5eHubOnfvIa46OjtDX10d0dDQLKqI2hPfyIyJqA/r374+AgIBHemOpkkQiwY4dOzB+/PgW+wyi9oprqIiI2oi1a9fC0NAQFy5cUOl+X3zxRRgaGqp0n0RUE0eoiIjagLS0NNy7dw8A4OTkBG1tbZXtOysrS9n409bWFgYGBirbNxFVYUFFRERE1Eyc8iMiIiJqJhZURERERM3EgoqIiIiomVhQERERETUTCyoiIiKiZmJBRURERNRMLKiIiIiImokFFREREVEzsaAiIiIiaiYWVERERETNxIKKiIiIqJn+H/ivFa1no03WAAAAAElFTkSuQmCC"},"metadata":{}}],"execution_count":10},{"id":"fed42763-52cf-44c2-961d-6d00918ba6df","cell_type":"markdown","source":"## FluxJobExecutor\nIn analogy to the [FluxClusterExecutor](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#flux) the [FluxJobExecutor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html#flux) can be applied to distribute simulation within a given queuing system allocation. The calculation of the bulk modulus with [gpaw](https://gpaw.readthedocs.io) is implemented in the same way.","metadata":{}},{"id":"516a91d4-0be6-47a6-9c9c-f5b0082bfee7","cell_type":"code","source":"from executorlib import FluxJobExecutor","metadata":{"trusted":true},"outputs":[],"execution_count":11},{"id":"21bdd0d42f9806e4","cell_type":"markdown","source":"The for each strained structure a calculation task is submitted to the `FluxJobExecutor`. After the successful submission the current status of the flux queue is printed using `flux jobs -a`. Finally, the results are collected by gathering the [concurrent.futures.Future](https://docs.python.org/3/library/concurrent.futures.html#future-objects) objects.","metadata":{}},{"id":"2b0c559b-a117-4766-b679-314ab9e65e97","cell_type":"code","source":"future_dict = {}\nwith FluxJobExecutor() as exe:\n for k, v in task_loop_dict.items():\n future_dict[k] = exe.submit(\n evaluate_with_gpaw, \n task_dict=v, \n kpts=(3, 3, 3), \n encut=300,\n resource_dict={\"cores\": 2},\n )\n sleep(1)\n pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))\n result_dict = {\n k: f.result()\n for k, f in tqdm(future_dict.items())\n }\n sleep(1)\n pprint.pp(subprocess.check_output([\"flux\", \"jobs\", \"-a\"], universal_newlines=True).split(\"\\n\"))","metadata":{"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO',\n ' ƒeqRVxAU jovyan python R 2 1 4.138s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqRVxAT jovyan python R 2 1 4.138s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqQ1xt8 jovyan python R 2 1 4.139s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqQ1xt7 jovyan python R 2 1 4.139s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqNXybn jovyan python R 2 1 4.139s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqNXybm jovyan python R 2 1 4.139s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqM3zKR jovyan python R 2 1 4.141s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ6RrzUJb jovyan executorl+ F 2 1 1.192m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4ESWCVd jovyan executorl+ F 2 1 1.268m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ5WD8Tno jovyan executorl+ F 2 1 1.218m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3exNRKu jovyan executorl+ F 2 1 1.264m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3BjTcCf jovyan executorl+ F 2 1 1.271m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4YJoYUf jovyan executorl+ F 2 1 1.212m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ31P2d51 jovyan executorl+ F 2 1 1.251m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n '']\n"},{"name":"stderr","output_type":"stream","text":"100%|██████████| 7/7 [00:25<00:00, 3.60s/it]\n"},{"name":"stdout","output_type":"stream","text":"[' JOBID USER NAME ST NTASKS NNODES TIME INFO',\n ' ƒeqRVxAU jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqRVxAT jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqQ1xt8 jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqQ1xt7 jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqNXybn jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqNXybm jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒeqM3zKR jovyan python R 2 1 30.78s '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ6RrzUJb jovyan executorl+ F 2 1 1.192m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4ESWCVd jovyan executorl+ F 2 1 1.268m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ5WD8Tno jovyan executorl+ F 2 1 1.218m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3exNRKu jovyan executorl+ F 2 1 1.264m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ3BjTcCf jovyan executorl+ F 2 1 1.271m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ4YJoYUf jovyan executorl+ F 2 1 1.212m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n ' ƒ31P2d51 jovyan executorl+ F 2 1 1.251m '\n 'jupyter-jan-janssen-exe-ntegration-test-jc5mdph0',\n '']\n"}],"execution_count":12},{"id":"ca353da1941c1c7c","cell_type":"markdown","source":"The resulting energies for the different volumes are fitted using a 3rd order polynomial to derive the bulk modulus as second derivative multiplied by the equilibrium volume.","metadata":{}},{"id":"8bb73863-bfde-4e96-9323-5330b2051632","cell_type":"code","source":"fit_dict = analyse_results_for_energy_volume_curve(\n output_dict={\"energy\": result_dict},\n task_dict=task_dict,\n fit_type=\"polynomial\",\n fit_order=3,\n)","metadata":{"trusted":true},"outputs":[],"execution_count":13},{"id":"3d4189b5c74ba2a2","cell_type":"markdown","source":"The final energy volume curve plot summarizes the results of this calculation.","metadata":{}},{"id":"95000e45-dd86-4659-90f4-f2d144477703","cell_type":"code","source":"plt.plot(fit_dict[\"volume\"], fit_dict[\"energy\"], label=\"$B_0$= %0.2f GPa\" % fit_dict[\"bulkmodul_eq\"])\nplt.xlabel(\"Volume [$\\AA^3$]\")\nplt.ylabel(\"Energy [eV]\")\nplt.legend()","metadata":{"trusted":true},"outputs":[{"execution_count":14,"output_type":"execute_result","data":{"text/plain":""},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"
","image/png":"iVBORw0KGgoAAAANSUhEUgAAAlQAAAG2CAYAAAC5/Bg9AAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjYsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvq6yFwwAAAAlwSFlzAAAPYQAAD2EBqD+naQAAcBZJREFUeJzt3XlYVGX/BvB7Zhj2HWTfBGWT1R203Pc9N8pXTcu3zbe0MrUyLcvltb1ezfxlWVlaikta7pobCiiLK6DIIosgyCLIOuf3BzKJArIMHGa4P9c1VzJz5sx9hA5fn+c53yMRBEEAERERETWZVOwAREREROqOBRURERFRM7GgIiIiImomFlREREREzcSCioiIiKiZWFARERERNRMLKiIiIqJmYkFFRERE1ExaYgdoLxQKBdLT02FkZASJRCJ2HCIiImoAQRBQWFgIOzs7SKV1j0OxoGol6enpcHR0FDsGERERNUFqaiocHBzqfJ0FVSsxMjICUPUNMTY2FjkNERERNURBQQEcHR2Vv8frwoKqlVRP8xkbG7OgIiIiUjOPW67DRelEREREzcSCioiIiKiZWFARERERNRMLKiIiIqJmYkFFRERE1EwsqIiIiIiaiQUVERERUTOxoCIiIiJqJhZURERERM3EgoqIiIiomVhQERERETUTCyoiIiKiZuLNkYmIiEitrf/7Om7euYfn+naEi6WBKBlYUBEREZHaKq2oxIYTN3D7bil6djQXraDilB8RERGprb2xGbh9txQ2xroY7mMjWg4WVERERKSWBEHA96eSAADTg5whl4lX1rCgIiIiIrV0PuUOLqTlQ1tLiqd7OomahQUVERERqaWN90enxgfYwdxAW9QsLKiIiIhI7WTk38O+i5kAgFl9OoqchgUVERERqaGfwpJRqRDQ29UcXrbGYsdhQUVERETqpaS8Er+GpwAAng0Wf3QKYEFFREREamZXdBruFJfDwUwPQ7ytxY4DgAUVERERqZEHWyXMDHKBTCoRN9B9LKiIiIhIbYQl5u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cUOl+X3zxRRgaGqp0n0RUE0eoiIjagLS0NNy7dw8A4OTkBG1tbZXtOysrS9n409bWFgYGBirbNxFVYUFFRERE1Eyc8iMiIiJqJhZURERERM3EgoqIiIiomVhQERERETUTCyoiIiKiZmJBRURERNRMLKiIiIiImokFFREREVEzsaAiIiIiaiYWVERERETNxIKKiIiIqJn+H/ivFa1no03WAAAAAElFTkSuQmCC"},"metadata":{}}],"execution_count":14},{"id":"8e67f9a4-d449-420c-9f62-72d106d18636","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]} \ No newline at end of file diff --git a/notebooks/4-2-quantum-espresso.ipynb b/notebooks/4-2-quantum-espresso.ipynb index 72a5d5cd..27e6cf96 100644 --- a/notebooks/4-2-quantum-espresso.ipynb +++ b/notebooks/4-2-quantum-espresso.ipynb @@ -6,7 +6,7 @@ "metadata": {}, "source": [ "# Quantum Espresso\n", - "The [quantum espresso](https://www.quantum-espresso.org) density-functional theory (DFT) simulation code is written in Fortran and uses the message passing interface (MPI) for parallelization, without any Python bindings. So `executorlib` is used to orchestrate multiple [quantum espresso](https://www.quantum-espresso.org) simulation each using multiple CPU cores for parallelization. These kind of hierarchical workflows are one of the core strength of `executorlib`. It is important to emphasize that the same could not be achieved with other frameworks like [mpi4py](https://mpi4py.readthedocs.io) as [quantum espresso](https://www.quantum-espresso.org) does not support external MPI communicators without modifications to the Fortran source code. With `executorlib` the user can quickly up-scale their simulation workflow without the need to address the parallel execution explicitly, rather the parallelization is introduced on a per-function level, by submitting the functions to the `FluxClusterExecutor` or `FluxJobExecutor`. [Story 11](story-11-couple-mpi-simulation-codes.ipynb) explains this pattern step by step for any MPI-parallel executable on a SLURM cluster, from compiling a small MPI code to requesting the cores with `threads_per_core`." + "The [quantum espresso](https://www.quantum-espresso.org) density-functional theory (DFT) simulation code is written in Fortran and uses the message passing interface (MPI) for parallelization, without any Python bindings. So `executorlib` is used to orchestrate multiple [quantum espresso](https://www.quantum-espresso.org) simulation each using multiple CPU cores for parallelization. These kind of hierarchical workflows are one of the core strength of `executorlib`. It is important to emphasize that the same could not be achieved with other frameworks like [mpi4py](https://mpi4py.readthedocs.io) as [quantum espresso](https://www.quantum-espresso.org) does not support external MPI communicators without modifications to the Fortran source code. With `executorlib` the user can quickly up-scale their simulation workflow without the need to address the parallel execution explicitly, rather the parallelization is introduced on a per-function level, by submitting the functions to the `FluxClusterExecutor` or `FluxJobExecutor`. [Story 4](story-4-couple-mpi-simulation-codes.ipynb) explains this pattern step by step for any MPI-parallel executable on a SLURM cluster, from compiling a small MPI code to requesting the cores with `threads_per_core`." ] }, { diff --git a/notebooks/story-1-submit-and-reconnect.ipynb b/notebooks/story-1-submit-and-reconnect.ipynb index a4ce0c9f..bbcf2513 100644 --- a/notebooks/story-1-submit-and-reconnect.ipynb +++ b/notebooks/story-1-submit-and-reconnect.ipynb @@ -141,7 +141,7 @@ "`get_cache_data_queue()` combines the content of the cache directory with the output of `squeue`. It only needs the\n", "`cache_directory`, so it works from a new Python process as well. The `status` is `pending` or `running` while the job\n", "is in the queue, `finished` once the result was written and `aborted` when the job left the queue without a result -\n", - "see [Story 5](story-5-recover-failed-jobs.ipynb) for how to handle that case." + "see [Story 8](story-8-recover-failed-jobs.ipynb) for how to handle that case." ] }, { diff --git a/notebooks/story-7-fan-out-inside-jobs.ipynb b/notebooks/story-10-fan-out-inside-jobs.ipynb similarity index 98% rename from notebooks/story-7-fan-out-inside-jobs.ipynb rename to notebooks/story-10-fan-out-inside-jobs.ipynb index b0f6b5b2..3d5e8dab 100644 --- a/notebooks/story-7-fan-out-inside-jobs.ipynb +++ b/notebooks/story-10-fan-out-inside-jobs.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Story 7: Large Jobs which Each Fan Out into Many Small Tasks\n", + "# Story 10: Large Jobs which Each Fan Out into Many Small Tasks\n", "**Who:** A researcher running several sampling campaigns, one per chemical composition. Each campaign consists of\n", "hundreds of short calculations and should run in its own large allocation.\n", "\n", @@ -164,7 +164,7 @@ "source": [ "All features of the `SlurmClusterExecutor` apply to the campaigns: you can disconnect after the submission and\n", "reconnect later ([Story 1](story-1-submit-and-reconnect.ipynb)), and campaigns can depend on each other\n", - "([Story 2](story-2-multi-resource-pipeline.ipynb)). `sacct -j ` lists the job steps (`.0`,\n", + "([Story 6](story-6-multi-resource-pipeline.ipynb)). `sacct -j ` lists the job steps (`.0`,\n", "`.1`, ...) created by the `SlurmJobExecutor` inside each campaign job.\n", "\n", "## Thousands of tasks per campaign: nesting flux\n", diff --git a/notebooks/story-8-adaptive-workflows.ipynb b/notebooks/story-11-adaptive-workflows.ipynb similarity index 99% rename from notebooks/story-8-adaptive-workflows.ipynb rename to notebooks/story-11-adaptive-workflows.ipynb index 57c2f9f3..f7dc71a4 100644 --- a/notebooks/story-8-adaptive-workflows.ipynb +++ b/notebooks/story-11-adaptive-workflows.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Story 8: Adaptive Workflows - the Next Step Depends on the Results\n", + "# Story 11: Adaptive Workflows - the Next Step Depends on the Results\n", "**Who:** A researcher whose workflow is not known in advance: a convergence test which runs until the result stops\n", "changing, a curve which is refined where it varies most, or a screening where follow-up calculations start for\n", "whatever finished first.\n", diff --git a/notebooks/story-9-document-and-share.ipynb b/notebooks/story-12-document-and-share.ipynb similarity index 99% rename from notebooks/story-9-document-and-share.ipynb rename to notebooks/story-12-document-and-share.ipynb index db75f811..a078b883 100644 --- a/notebooks/story-9-document-and-share.ipynb +++ b/notebooks/story-12-document-and-share.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Story 9: Document and Share a Workflow\n", + "# Story 12: Document and Share a Workflow\n", "**Who:** A scientist who is about to publish results computed with an executorlib workflow, and a colleague who wants\n", "to reproduce them - possibly with a different workflow tool.\n", "\n", diff --git a/notebooks/story-3-parameter-study.ipynb b/notebooks/story-2-parameter-study.ipynb similarity index 99% rename from notebooks/story-3-parameter-study.ipynb rename to notebooks/story-2-parameter-study.ipynb index 60927bb5..03c1fe70 100644 --- a/notebooks/story-3-parameter-study.ipynb +++ b/notebooks/story-2-parameter-study.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Story 3: A Parameter Study with Many Short Calculations\n", + "# Story 2: A Parameter Study with Many Short Calculations\n", "**Who:** A researcher screening a grid of strains and temperatures. Each calculation takes seconds to minutes, but\n", "there are hundreds of them.\n", "\n", diff --git a/notebooks/story-10-pandas-dataframes.ipynb b/notebooks/story-3-pandas-dataframes.ipynb similarity index 99% rename from notebooks/story-10-pandas-dataframes.ipynb rename to notebooks/story-3-pandas-dataframes.ipynb index b3b76ece..d5c25ad2 100644 --- a/notebooks/story-10-pandas-dataframes.ipynb +++ b/notebooks/story-3-pandas-dataframes.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Story 10: Parallel Computations on pandas DataFrames\n", + "# Story 3: Parallel Computations on pandas DataFrames\n", "**Who:** A data-driven materials scientist who keeps the inputs of a screening study - sample IDs, compositions and\n", "temperatures - in a [pandas](https://pandas.pydata.org) DataFrame and computes a new property for every row.\n", "\n", @@ -161,7 +161,7 @@ " of its rows.\n", "\n", "A chunk does not have to use a single core: submit it with `threads_per_core` and process its rows with a\n", - "`SingleNodeExecutor` inside the function, as shown in [Story 7](story-7-fan-out-inside-jobs.ipynb).\n", + "`SingleNodeExecutor` inside the function, as shown in [Story 10](story-10-fan-out-inside-jobs.ipynb).\n", "\n", "The chunks are fixed-size slices of the table taken with `iloc`. `numpy.array_split(df, n)` would split the table into a\n", "fixed *number* of chunks instead - but then the chunk boundaries move whenever rows are added, so every chunk changes\n", @@ -289,7 +289,7 @@ "\n", "An explicit `cache_key` replaces the default hash completely, so it no longer changes when the code of\n", "`process_chunk()` changes. This is why the key contains a version, `v1`: increase it whenever you change the\n", - "computation, otherwise the old results are reloaded. [Story 5](story-5-recover-failed-jobs.ipynb) uses the same\n", + "computation, otherwise the old results are reloaded. [Story 8](story-8-recover-failed-jobs.ipynb) uses the same\n", "property on purpose to fix a bug without recomputing the successful calls." ] }, diff --git a/notebooks/story-11-couple-mpi-simulation-codes.ipynb b/notebooks/story-4-couple-mpi-simulation-codes.ipynb similarity index 98% rename from notebooks/story-11-couple-mpi-simulation-codes.ipynb rename to notebooks/story-4-couple-mpi-simulation-codes.ipynb index 79184fa8..9db58909 100644 --- a/notebooks/story-11-couple-mpi-simulation-codes.ipynb +++ b/notebooks/story-4-couple-mpi-simulation-codes.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Story 11: Couple Python to Simulation Codes which Use MPI Internally\n", + "# Story 4: Couple Python to Simulation Codes which Use MPI Internally\n", "**Who:** A computational scientist whose physics lives in an established simulation code written in C, C++ or\n", "Fortran and parallelized with MPI - [Quantum Espresso](https://www.quantum-espresso.org),\n", "[LAMMPS](https://www.lammps.org), VASP, CP2K or an in-house code. The workflow around it - generating input files,\n", @@ -238,7 +238,7 @@ "## Step 4: Run the convergence study\n", "The workflow logic stays in Python: one simulation per number of intervals, and a serial analysis step which compares\n", "the results to the exact value. The futures of the simulations are passed to the analysis as arguments, so it is\n", - "submitted right away as a SLURM job which depends on the simulation jobs ([Story 2](story-2-multi-resource-pipeline.ipynb))." + "submitted right away as a SLURM job which depends on the simulation jobs ([Story 6](story-6-multi-resource-pipeline.ipynb))." ] }, { @@ -318,7 +318,7 @@ "energy-volume curve with ASE, where the calculator starts `pw.x` with `flux run`, and uses the same `resource_dict`\n", "with `cores=1`, `threads_per_core` and `cwd`. If your code also provides Python bindings which accept an mpi4py\n", "communicator - like LAMMPS or [GPAW](4-1-gpaw.ipynb) - you can alternatively call it directly in an MPI-parallel\n", - "Python function, see [Story 12](story-12-mpi4py-functions.ipynb).\n", + "Python function, see [Story 5](story-5-mpi4py-functions.ipynb).\n", "\n", "Inside an existing allocation, the `SlurmJobExecutor` starts every function as an `srun` job step, and starting the\n", "executable with another `srun` from within this job step is not reliably supported by SLURM. Start the\n", diff --git a/notebooks/story-12-mpi4py-functions.ipynb b/notebooks/story-5-mpi4py-functions.ipynb similarity index 98% rename from notebooks/story-12-mpi4py-functions.ipynb rename to notebooks/story-5-mpi4py-functions.ipynb index 8989ed11..096a477a 100644 --- a/notebooks/story-12-mpi4py-functions.ipynb +++ b/notebooks/story-5-mpi4py-functions.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Story 12: Parallelize Only the Functions which Need It with mpi4py\n", + "# Story 5: Parallelize Only the Functions which Need It with mpi4py\n", "**Who:** A scientist with a serial Python analysis script: load a structure, compute an interaction energy over all\n", "pairs of particles, summarize. Profiling shows that the pair sum takes almost all of the run time.\n", "\n", @@ -236,7 +236,7 @@ "[LAMMPS](https://docs.lammps.org/Python_head.html), whose Python module takes the communicator as\n", "`lammps(comm=MPI.COMM_WORLD)`, and to libraries like [petsc4py](https://petsc.org/release/petsc4py/). Codes without\n", "Python bindings, which are started as MPI executables, are covered in\n", - "[Story 11](story-11-couple-mpi-simulation-codes.ipynb).\n", + "[Story 4](story-4-couple-mpi-simulation-codes.ipynb).\n", "\n", "## Inside an allocation: `SlurmJobExecutor`\n", "When the script runs inside an existing allocation, for example started with `salloc -n 4`, the `SlurmJobExecutor`\n", diff --git a/notebooks/story-2-multi-resource-pipeline.ipynb b/notebooks/story-6-multi-resource-pipeline.ipynb similarity index 99% rename from notebooks/story-2-multi-resource-pipeline.ipynb rename to notebooks/story-6-multi-resource-pipeline.ipynb index 981bb0f8..6a56eb8b 100644 --- a/notebooks/story-2-multi-resource-pipeline.ipynb +++ b/notebooks/story-6-multi-resource-pipeline.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Story 2: A Pipeline whose Steps Need Different Resources\n", + "# Story 6: A Pipeline whose Steps Need Different Resources\n", "**Who:** A computational chemist with a three-step workflow: a serial structure preparation, an MPI-parallel\n", "simulation and a serial analysis - repeated for several lattice constants, followed by a final step which selects the\n", "best candidate.\n", @@ -142,7 +142,7 @@ "Every key of the `resource_dict` is available in the submission template, so cluster-specific options like the\n", "partition, the memory or GPUs can be added there. Note that the `SlurmClusterExecutor` does not translate\n", "`gpus_per_core` into the job script by itself - add a line like `#SBATCH --gpus-per-task={{gpus}}` to the template\n", - "and request `{\"gpus\": 1}`. Inside an allocation the [SlurmJobExecutor](story-3-parameter-study.ipynb) translates\n", + "and request `{\"gpus\": 1}`. Inside an allocation the [SlurmJobExecutor](story-2-parameter-study.ipynb) translates\n", "`gpus_per_core` directly to `srun --gpus-per-task`." ] }, diff --git a/notebooks/story-4-prototype-then-scale.ipynb b/notebooks/story-7-prototype-then-scale.ipynb similarity index 98% rename from notebooks/story-4-prototype-then-scale.ipynb rename to notebooks/story-7-prototype-then-scale.ipynb index 22986191..99a2cb95 100644 --- a/notebooks/story-4-prototype-then-scale.ipynb +++ b/notebooks/story-7-prototype-then-scale.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Story 4: Prototype on a Laptop, then Scale Up\n", + "# Story 7: Prototype on a Laptop, then Scale Up\n", "**Who:** A PhD student developing a new workflow in a Jupyter notebook on their laptop.\n", "\n", "**What they want:** Iterate quickly on the workflow with small inputs, without waiting in a queue, and later run the\n", @@ -176,7 +176,7 @@ "```\n", "\n", "Inside an allocation, for many short calculations, use the `SlurmJobExecutor` instead - like the `SingleNodeExecutor`\n", - "it communicates via sockets ([Story 3](story-3-parameter-study.ipynb))." + "it communicates via sockets ([Story 2](story-2-parameter-study.ipynb))." ] }, { diff --git a/notebooks/story-5-recover-failed-jobs.ipynb b/notebooks/story-8-recover-failed-jobs.ipynb similarity index 99% rename from notebooks/story-5-recover-failed-jobs.ipynb rename to notebooks/story-8-recover-failed-jobs.ipynb index d37f1aa5..5435466d 100644 --- a/notebooks/story-5-recover-failed-jobs.ipynb +++ b/notebooks/story-8-recover-failed-jobs.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Story 5: Recover from Failed Jobs\n", + "# Story 8: Recover from Failed Jobs\n", "**Who:** A scientist whose overnight workflow partially failed: one calculation raised a Python exception because of a\n", "bug, another job was killed by the cluster - a node failure, the out-of-memory killer or the wall-time limit.\n", "\n", diff --git a/notebooks/story-6-expensive-setup-once.ipynb b/notebooks/story-9-expensive-setup-once.ipynb similarity index 99% rename from notebooks/story-6-expensive-setup-once.ipynb rename to notebooks/story-9-expensive-setup-once.ipynb index 6a0d13dc..0df245e4 100644 --- a/notebooks/story-6-expensive-setup-once.ipynb +++ b/notebooks/story-9-expensive-setup-once.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Story 6: Pay for an Expensive Setup Only Once\n", + "# Story 9: Pay for an Expensive Setup Only Once\n", "**Who:** A researcher who evaluates a machine-learned interatomic potential for thousands of structures. Loading the\n", "potential takes much longer than a single evaluation.\n", "\n", From 1f1e62ed695c3fb2a7ff2ab4184cdf11daa021b8 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Thu, 19 Nov 2026 16:40:00 +0100 Subject: [PATCH 8/9] Update readme page --- README.md | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 6265b265..56728756 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ The cluster-specific settings like the partition, run time limits and the submis cell at the top of each story. Readers without access to an HPC cluster can start with [Story 7](https://executorlib.readthedocs.io/en/latest/story-7-prototype-then-scale.html) or follow the examples below locally. -## Examples +## Which Executor should I use? The Python standard library provides the [Executor interface](https://docs.python.org/3/library/concurrent.futures.html#executor-objects) with the [ProcessPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor) and the [ThreadPoolExecutor](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor) for parallel @@ -97,8 +97,31 @@ submitting each function as individual job to the HPC job scheduler with an [HPC or by requesting a job from the HPC cluster and then distribute the Python functions within this job with an [HPC Job Executor](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html). To develop and test the same workflow on a laptop, workstation or single compute node before using cluster resources, executorlib also provides a -[Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html). The following examples can be -executed without cluster access, starting with the +[Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html). + +executorlib provides five `Executor` classes. They all share the same `submit()` / `map()` interface and only differ in +*where* the Python functions are executed and *how* the resources are requested. A common workflow is to develop and +test with the `SingleNodeExecutor` on a laptop and then switch to one of the HPC executors by changing only the class +name: + +| Executor | Where it runs | Scheduler command | Best for | +|---|---|---|---| +| [`SingleNodeExecutor`](https://executorlib.readthedocs.io/en/latest/1-single-node.html) | laptop, workstation or single compute node | `subprocess` | developing and testing a workflow | +| [`SlurmClusterExecutor`](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#slurm) | HPC login node | `sbatch` (one job per function) | long-running functions that should outlive the Python session | +| [`SlurmJobExecutor`](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html#slurm) | inside a SLURM allocation | `srun` (job steps) | many functions within one existing allocation | +| [`FluxClusterExecutor`](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#flux) | HPC login node or Flux instance | `flux submit` | long-running functions; disconnecting and reconnecting | +| [`FluxJobExecutor`](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html#flux) | inside a Flux allocation | `flux run` | high-throughput execution of many short functions | + +The **Cluster** executors submit each Python function as an individual job and communicate via the file system, so the +Python process which created the executor can be closed and the results reloaded later. The **Job** executors run inside +an existing allocation and communicate via sockets, which has lower overhead and is the better choice for many short +function calls. + +To set up the submission of Python functions on a new SLURM cluster, the [executorlib-cluster-setup](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#setup-with-claude-code) +skill for [Claude Code](https://docs.claude.com/en/docs/claude-code/overview) analyses the cluster and generates a tested, +cluster-specific configuration for the `SlurmClusterExecutor`. + +The following examples can be executed without cluster access, starting with the [Single Node Executor](https://executorlib.readthedocs.io/en/latest/1-single-node.html): ```python from executorlib import SingleNodeExecutor @@ -190,29 +213,6 @@ given allocation. Even when [SLURM](https://slurm.schedmd.com) is used as primar recommended to use [SLURM with flux](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html#slurm-with-flux) as hierarchical job scheduler within the allocations. -## Which Executor should I use? -executorlib provides five `Executor` classes. They all share the same `submit()` / `map()` interface and only differ in -*where* the Python functions are executed and *how* the resources are requested. A common workflow is to develop and -test with the `SingleNodeExecutor` on a laptop and then switch to one of the HPC executors by changing only the class -name: - -| Executor | Where it runs | Scheduler command | Best for | -|---|---|---|---| -| [`SingleNodeExecutor`](https://executorlib.readthedocs.io/en/latest/1-single-node.html) | laptop, workstation or single compute node | `subprocess` | developing and testing a workflow | -| [`SlurmClusterExecutor`](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#slurm) | HPC login node | `sbatch` (one job per function) | long-running functions that should outlive the Python session | -| [`SlurmJobExecutor`](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html#slurm) | inside a SLURM allocation | `srun` (job steps) | many functions within one existing allocation | -| [`FluxClusterExecutor`](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#flux) | HPC login node or Flux instance | `flux submit` | long-running functions; disconnecting and reconnecting | -| [`FluxJobExecutor`](https://executorlib.readthedocs.io/en/latest/3-hpc-job.html#flux) | inside a Flux allocation | `flux run` | high-throughput execution of many short functions | - -The **Cluster** executors submit each Python function as an individual job and communicate via the file system, so the -Python process which created the executor can be closed and the results reloaded later. The **Job** executors run inside -an existing allocation and communicate via sockets, which has lower overhead and is the better choice for many short -function calls. - -To set up the submission of Python functions on a new SLURM cluster, the [executorlib-cluster-setup](https://executorlib.readthedocs.io/en/latest/2-hpc-cluster.html#setup-with-claude-code) -skill for [Claude Code](https://docs.claude.com/en/docs/claude-code/overview) analyses the cluster and generates a tested, -cluster-specific configuration for the `SlurmClusterExecutor`. - ## Documentation * [Installation](https://executorlib.readthedocs.io/en/latest/installation.html) * [Minimal](https://executorlib.readthedocs.io/en/latest/installation.html#minimal) From 389264a17cb5b180db210ece19e7fff01857c3a8 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Thu, 19 Nov 2026 16:53:38 +0100 Subject: [PATCH 9/9] [Documentation] Address the reader directly in the user stories Rewrite the introductions of all user stories in second person instead of describing a third-person user, and adjust the README introduction accordingly. Co-Authored-By: Claude Opus 5.5 --- README.md | 4 +-- notebooks/story-1-submit-and-reconnect.ipynb | 23 +++++++-------- notebooks/story-10-fan-out-inside-jobs.ipynb | 17 ++++++----- notebooks/story-11-adaptive-workflows.ipynb | 28 +++++++++---------- notebooks/story-12-document-and-share.ipynb | 19 ++++++------- notebooks/story-2-parameter-study.ipynb | 20 ++++++------- notebooks/story-3-pandas-dataframes.ipynb | 19 ++++++------- .../story-4-couple-mpi-simulation-codes.ipynb | 28 +++++++++---------- notebooks/story-5-mpi4py-functions.ipynb | 26 ++++++++--------- .../story-6-multi-resource-pipeline.ipynb | 19 ++++++------- notebooks/story-7-prototype-then-scale.ipynb | 18 ++++++------ notebooks/story-8-recover-failed-jobs.ipynb | 21 ++++++-------- notebooks/story-9-expensive-setup-once.ipynb | 20 ++++++------- 13 files changed, 118 insertions(+), 144 deletions(-) diff --git a/README.md b/README.md index 56728756..62f99fc4 100644 --- a/README.md +++ b/README.md @@ -56,8 +56,8 @@ with SlurmClusterExecutor(cache_directory="./cache") as exe: future_lst = [exe.submit(calc, i) for i in range(1, 4)] print([f.result() for f in future_lst]) ``` -The user stories each start from a typical challenge of HPC users and solve it end-to-end, combining the features of -executorlib which are needed along the way: +Each user story starts from a challenge you are likely to face on an HPC cluster and solves it end-to-end, introducing +the features of executorlib as you need them: 1. [Submit a long-running function and come back later](https://executorlib.readthedocs.io/en/latest/story-1-submit-and-reconnect.html) - submit from the login node, disconnect, check the status, reconnect and cancel jobs. 2. [A parameter study with many short calculations](https://executorlib.readthedocs.io/en/latest/story-2-parameter-study.html) - distribute diff --git a/notebooks/story-1-submit-and-reconnect.ipynb b/notebooks/story-1-submit-and-reconnect.ipynb index bbcf2513..8cfc9654 100644 --- a/notebooks/story-1-submit-and-reconnect.ipynb +++ b/notebooks/story-1-submit-and-reconnect.ipynb @@ -5,21 +5,18 @@ "metadata": {}, "source": [ "# Story 1: Submit a Long-running Function and Come Back Later\n", - "**Who:** A scientist with a Python function which runs a simulation for hours, for example a molecular dynamics run\n", - "at a given temperature.\n", + "You have a Python function which runs a simulation for hours, for example a molecular dynamics run at a given\n", + "temperature. You want to run it for a few temperatures on the cluster, log out, and pick up the results the next\n", + "morning - directly as Python objects.\n", "\n", - "**What they want:** Run the function for a few temperatures on the cluster, log out, and pick up the results the next\n", - "morning, directly as Python objects.\n", + "**With plain SLURM** you wrap the function in a Python script which reads its inputs from files, wrap that script in a\n", + "batch script, submit it with `sbatch`, note down the job IDs, check them with `squeue` and finally parse the output\n", + "files back into Python. A single function call turns into three files and a manual bookkeeping exercise.\n", "\n", - "**Why plain SLURM is painful:** The function has to be wrapped in a Python script which reads its inputs from files,\n", - "the script in a batch script, the batch script is submitted with `sbatch`, the job IDs are noted down and checked with\n", - "`squeue`, and finally the output files are parsed back into Python. A single function call turns into three files and\n", - "a manual bookkeeping exercise.\n", - "\n", - "**How executorlib helps:** The `SlurmClusterExecutor` submits every function call as its own SLURM job and stores\n", - "inputs and outputs in a cache directory on the shared file system. Because the state lives on disk rather than in the\n", - "Python process, you can disconnect, check the status from any Python process, reconnect later and cancel jobs you no\n", - "longer need.\n", + "**With executorlib** the `SlurmClusterExecutor` submits every function call as its own SLURM job and stores inputs and\n", + "outputs in a cache directory on the shared file system. Because the state lives on disk rather than in your Python\n", + "process, you can disconnect, check the status from any Python process, reconnect later and cancel jobs you no longer\n", + "need.\n", "\n", "This notebook runs on the **login node** of a SLURM cluster - no allocation is required." ] diff --git a/notebooks/story-10-fan-out-inside-jobs.ipynb b/notebooks/story-10-fan-out-inside-jobs.ipynb index 3d5e8dab..bca2ce22 100644 --- a/notebooks/story-10-fan-out-inside-jobs.ipynb +++ b/notebooks/story-10-fan-out-inside-jobs.ipynb @@ -5,17 +5,16 @@ "metadata": {}, "source": [ "# Story 10: Large Jobs which Each Fan Out into Many Small Tasks\n", - "**Who:** A researcher running several sampling campaigns, one per chemical composition. Each campaign consists of\n", - "hundreds of short calculations and should run in its own large allocation.\n", + "You run several sampling campaigns, one per chemical composition. Each campaign consists of hundreds of short\n", + "calculations and should run in its own large allocation. You want to submit the campaigns from the login node like any\n", + "other job, and inside each job distribute the small calculations over the cores of that job - without writing a batch\n", + "script per campaign.\n", "\n", - "**What they want:** Submit the campaigns from the login node like any other job, and inside each job distribute the\n", - "small calculations over the cores of that job - without writing a batch script per campaign.\n", + "**With plain SLURM** submitting the small calculations as individual jobs floods the queue. Requesting one allocation\n", + "per campaign means writing a batch script which starts and tracks many `srun` steps by hand, and passing the results\n", + "of each campaign back to your script on the login node through files.\n", "\n", - "**Why plain SLURM is painful:** Submitting the small calculations as individual jobs floods the queue. Requesting one\n", - "allocation per campaign means writing a batch script which starts and tracks many `srun` steps by hand, and passing\n", - "the results of each campaign back to the script on the login node through files.\n", - "\n", - "**How executorlib helps:** The two executors combine. The `SlurmClusterExecutor` on the login node submits one job per\n", + "**With executorlib** the two executors combine. The `SlurmClusterExecutor` on the login node submits one job per\n", "campaign. The submitted function itself creates a `SlurmJobExecutor`, which distributes the small calculations as\n", "`srun` job steps within the allocation of its job.\n", "\n", diff --git a/notebooks/story-11-adaptive-workflows.ipynb b/notebooks/story-11-adaptive-workflows.ipynb index f7dc71a4..3a3ae8a2 100644 --- a/notebooks/story-11-adaptive-workflows.ipynb +++ b/notebooks/story-11-adaptive-workflows.ipynb @@ -5,21 +5,19 @@ "metadata": {}, "source": [ "# Story 11: Adaptive Workflows - the Next Step Depends on the Results\n", - "**Who:** A researcher whose workflow is not known in advance: a convergence test which runs until the result stops\n", - "changing, a curve which is refined where it varies most, or a screening where follow-up calculations start for\n", - "whatever finished first.\n", - "\n", - "**What they want:** Write the decision logic in plain Python - `while` loops, `if` statements, recursion - and still\n", - "run the calculations in parallel on the cluster.\n", - "\n", - "**Why plain SLURM is painful:** A batch script cannot look at results it has not computed yet. Adaptive workflows end up\n", - "as a driver script which submits a batch of jobs, polls `squeue` until they finish, parses the outputs, decides and\n", - "submits the next batch - with the cluster idling between the rounds. Static workflow graphs (job arrays,\n", - "`--dependency`) cannot express decisions at all.\n", - "\n", - "**How executorlib helps:** The futures returned by `submit()` are ordinary Python objects. The driver logic simply\n", - "waits for the results it needs to make the next decision, while everything independent keeps running. `asyncio`\n", - "turns futures into awaitables for recursive refinement, and `batched()` groups results by completion order.\n", + "Your workflow is not known in advance: a convergence test which runs until the result stops changing, a curve which is\n", + "refined where it varies most, or a screening where follow-up calculations start for whatever finished first. You want\n", + "to write the decision logic in plain Python - `while` loops, `if` statements, recursion - and still run the\n", + "calculations in parallel on the cluster.\n", + "\n", + "**With plain SLURM** a batch script cannot look at results it has not computed yet. Adaptive workflows end up as a\n", + "driver script which submits a batch of jobs, polls `squeue` until they finish, parses the outputs, decides and submits\n", + "the next batch - with the cluster idling between the rounds. Static workflow graphs (job arrays, `--dependency`)\n", + "cannot express decisions at all.\n", + "\n", + "**With executorlib** the futures returned by `submit()` are ordinary Python objects. Your driver logic simply waits\n", + "for the results it needs to make the next decision, while everything independent keeps running. `asyncio` turns\n", + "futures into awaitables for recursive refinement, and `batched()` groups results by completion order.\n", "\n", "This notebook has to run **inside a SLURM allocation** with at least two cores, for example started with\n", "`salloc -n 2`. With a `SlurmClusterExecutor` the same patterns work from the login node, with one SLURM job per call." diff --git a/notebooks/story-12-document-and-share.ipynb b/notebooks/story-12-document-and-share.ipynb index a078b883..fa2364f7 100644 --- a/notebooks/story-12-document-and-share.ipynb +++ b/notebooks/story-12-document-and-share.ipynb @@ -5,19 +5,16 @@ "metadata": {}, "source": [ "# Story 12: Document and Share a Workflow\n", - "**Who:** A scientist who is about to publish results computed with an executorlib workflow, and a colleague who wants\n", - "to reproduce them - possibly with a different workflow tool.\n", + "You are about to publish results computed with an executorlib workflow, and a colleague wants to reproduce them -\n", + "possibly with a different workflow tool. You need a machine-readable description of the workflow, and a record of what\n", + "was actually executed: which function with which inputs, which resources, how long it took and which SLURM job ran it.\n", "\n", - "**What they want:** A machine-readable description of the workflow, and a record of what was actually executed: which\n", - "function with which inputs, which resources, how long it took and which SLURM job ran it.\n", + "**With plain SLURM** the workflow is spread over batch scripts, Python scripts and your shell history. What exactly\n", + "ran, with which parameters and in which job, has to be reconstructed from log files - if they still exist.\n", "\n", - "**Why plain SLURM is painful:** The workflow is spread over batch scripts, Python scripts and shell history. What\n", - "exactly ran, with which parameters and in which job, has to be reconstructed from log files - if they still exist.\n", - "\n", - "**How executorlib helps:** `export_workflow_filename` writes the workflow graph in the\n", - "[Python Workflow Definition](https://github.com/pythonworkflow/python-workflow-definition) JSON format, which other\n", - "workflow frameworks can import. The cache directory records every executed call, and `get_cache_data()` turns it into\n", - "an audit trail.\n", + "**With executorlib** `export_workflow_filename` writes the workflow graph in the [Python Workflow\n", + "Definition](https://github.com/pythonworkflow/python-workflow-definition) JSON format, which other workflow frameworks\n", + "can import. The cache directory records every executed call, and `get_cache_data()` turns it into an audit trail.\n", "\n", "This notebook runs on the **login node** of a SLURM cluster." ] diff --git a/notebooks/story-2-parameter-study.ipynb b/notebooks/story-2-parameter-study.ipynb index 03c1fe70..973e0621 100644 --- a/notebooks/story-2-parameter-study.ipynb +++ b/notebooks/story-2-parameter-study.ipynb @@ -5,20 +5,18 @@ "metadata": {}, "source": [ "# Story 2: A Parameter Study with Many Short Calculations\n", - "**Who:** A researcher screening a grid of strains and temperatures. Each calculation takes seconds to minutes, but\n", - "there are hundreds of them.\n", + "You are screening a grid of strains and temperatures. Each calculation takes seconds to minutes, but there are\n", + "hundreds of them. You want to run the whole grid in one SLURM allocation, find out which parameter sets fail, and\n", + "collect the results in a table.\n", "\n", - "**What they want:** Run the whole grid in one SLURM allocation, find out which parameter sets fail, and collect the\n", - "results in a table.\n", + "**With plain SLURM** one `sbatch` job per calculation floods the queue, every job waits separately, and many clusters\n", + "limit the number of jobs you can submit. Job arrays force you to map an index to parameters and to collect the results\n", + "from files. A hand-written loop of `srun ... &` calls in one batch script leaves you to keep track of free cores, and\n", + "the one failing parameter set is buried in hundreds of log files.\n", "\n", - "**Why plain SLURM is painful:** One `sbatch` job per calculation floods the queue, every job waits separately, and many\n", - "clusters limit the number of jobs per user. Job arrays require mapping an index to parameters and collecting the\n", - "results from files. A hand-written loop of `srun ... &` calls in one batch script needs manual bookkeeping of free\n", - "cores, and the one failing parameter set is buried in hundreds of log files.\n", - "\n", - "**How executorlib helps:** The `SlurmJobExecutor` runs inside an existing allocation and distributes the function calls\n", + "**With executorlib** the `SlurmJobExecutor` runs inside your existing allocation and distributes the function calls\n", "over its cores as `srun` job steps - no new jobs enter the queue. Errors are collected in a single log file and\n", - "results are cached, so they can be loaded into a [pandas](https://pandas.pydata.org) DataFrame.\n", + "results are cached, so you can load them into a [pandas](https://pandas.pydata.org) DataFrame.\n", "\n", "This notebook has to run **inside a SLURM allocation** with at least two cores, for example started with\n", "`salloc -n 2` or from a batch script submitted with `sbatch -n 2`." diff --git a/notebooks/story-3-pandas-dataframes.ipynb b/notebooks/story-3-pandas-dataframes.ipynb index d5c25ad2..5458e03d 100644 --- a/notebooks/story-3-pandas-dataframes.ipynb +++ b/notebooks/story-3-pandas-dataframes.ipynb @@ -5,19 +5,18 @@ "metadata": {}, "source": [ "# Story 3: Parallel Computations on pandas DataFrames\n", - "**Who:** A data-driven materials scientist who keeps the inputs of a screening study - sample IDs, compositions and\n", - "temperatures - in a [pandas](https://pandas.pydata.org) DataFrame and computes a new property for every row.\n", + "You keep the inputs of a screening study - sample IDs, compositions and temperatures - in a\n", + "[pandas](https://pandas.pydata.org) DataFrame and compute a new property for every row. You want to replace the slow\n", + "`df.apply()` by a parallel version, move large tables to the cluster, and compute only the new rows whenever rows are\n", + "added to the table.\n", "\n", - "**What they want:** Replace the slow `df.apply()` by a parallel version, move large tables to the cluster, and when\n", - "new rows are added to the table, compute only the new rows.\n", + "**With plain SLURM** you split the DataFrame into files, write a batch script or job array which reads one part per\n", + "job, computes it and writes a result file, and finally stitch the parts back together in the original order. Keeping\n", + "track of which rows were already computed is up to you.\n", "\n", - "**Why plain SLURM is painful:** The DataFrame has to be split into files, a batch script or job array has to read\n", - "one part per job, compute it and write a result file, and a final script has to stitch the parts back together in the\n", - "original order. Keeping track of which rows were already computed is left to the user.\n", - "\n", - "**How executorlib helps:** `map()` and `submit()` accept DataFrame columns and whole DataFrames as arguments and return\n", + "**With executorlib** `map()` and `submit()` accept DataFrame columns and whole DataFrames as arguments and return\n", "Python objects, so rows or chunks of rows are distributed without any files. The `SlurmClusterExecutor` submits one\n", - "SLURM job per chunk, the returned DataFrames are joined with `pandas.concat()`, and the cache skips chunks which were\n", + "SLURM job per chunk, you join the returned DataFrames with `pandas.concat()`, and the cache skips chunks which were\n", "computed before.\n", "\n", "This notebook runs on the **login node** of a SLURM cluster." diff --git a/notebooks/story-4-couple-mpi-simulation-codes.ipynb b/notebooks/story-4-couple-mpi-simulation-codes.ipynb index 9db58909..552871fe 100644 --- a/notebooks/story-4-couple-mpi-simulation-codes.ipynb +++ b/notebooks/story-4-couple-mpi-simulation-codes.ipynb @@ -5,23 +5,21 @@ "metadata": {}, "source": [ "# Story 4: Couple Python to Simulation Codes which Use MPI Internally\n", - "**Who:** A computational scientist whose physics lives in an established simulation code written in C, C++ or\n", - "Fortran and parallelized with MPI - [Quantum Espresso](https://www.quantum-espresso.org),\n", - "[LAMMPS](https://www.lammps.org), VASP, CP2K or an in-house code. The workflow around it - generating input files,\n", - "scanning parameters, analysing the outputs - is written in Python.\n", + "The physics of your project lives in an established simulation code written in C, C++ or Fortran and parallelized with\n", + "MPI - [Quantum Espresso](https://www.quantum-espresso.org), [LAMMPS](https://www.lammps.org), VASP, CP2K or an\n", + "in-house code. The workflow around it - generating input files, scanning parameters, analysing the outputs - is\n", + "written in Python. You want to run many simulations from one Python script, each with several MPI ranks in its own\n", + "directory, and get the parsed results back as Python objects.\n", "\n", - "**What they want:** Run many simulations from one Python script, each with several MPI ranks in its own directory, and\n", - "get the parsed results back as Python objects.\n", + "**With plain SLURM** you create a directory for every simulation, write an input file, generate a batch script with an\n", + "`srun` line and submit it. Afterwards a second script walks over the directories, checks which runs finished and\n", + "parses the outputs. The logic of your workflow ends up spread over Python, shell scripts and files. mpi4py does not\n", + "help either: the simulation code is a separate executable which cannot use a communicator created in Python.\n", "\n", - "**Why plain SLURM is painful:** For every simulation a directory is created, an input file written, a batch script\n", - "with an `srun` line generated and submitted. Afterwards a second script walks over the directories, checks which runs\n", - "finished and parses the outputs. The logic of the workflow is spread over Python, shell scripts and files. mpi4py does\n", - "not help either: the simulation code is a separate executable which cannot use a communicator created in Python.\n", - "\n", - "**How executorlib helps:** The simulation is wrapped in an ordinary Python function which writes the input file,\n", - "starts the executable with the MPI launcher and parses the output file. The `SlurmClusterExecutor` submits every call\n", - "of this function as a SLURM job with its own working directory and enough CPU cores for the MPI ranks of the\n", - "executable, and returns the parsed results as futures.\n", + "**With executorlib** you wrap the simulation in an ordinary Python function which writes the input file, starts the\n", + "executable with the MPI launcher and parses the output file. The `SlurmClusterExecutor` submits every call of this\n", + "function as a SLURM job with its own working directory and enough CPU cores for the MPI ranks of the executable, and\n", + "returns the parsed results as futures.\n", "\n", "This notebook runs on the **login node** of a SLURM cluster." ] diff --git a/notebooks/story-5-mpi4py-functions.ipynb b/notebooks/story-5-mpi4py-functions.ipynb index 096a477a..6bc2dfa9 100644 --- a/notebooks/story-5-mpi4py-functions.ipynb +++ b/notebooks/story-5-mpi4py-functions.ipynb @@ -5,20 +5,18 @@ "metadata": {}, "source": [ "# Story 5: Parallelize Only the Functions which Need It with mpi4py\n", - "**Who:** A scientist with a serial Python analysis script: load a structure, compute an interaction energy over all\n", - "pairs of particles, summarize. Profiling shows that the pair sum takes almost all of the run time.\n", - "\n", - "**What they want:** Parallelize only this one function with MPI, keep the rest of the script serial and unchanged, and\n", - "run it on the cluster.\n", - "\n", - "**Why plain SLURM is painful:** Running the whole script with `srun -n 64 python script.py` executes every line on\n", - "every rank: the serial parts have to be guarded with `if rank == 0`, the data is read 64 times or broadcast by hand,\n", - "and the serial steps block 64 cores while only one of them works. Splitting the script into an MPI script and serial\n", - "scripts means passing the data through files and chaining the jobs by hand.\n", - "\n", - "**How executorlib helps:** Only the hot function is written with [mpi4py](https://mpi4py.readthedocs.io). Submitted\n", - "with `resource_dict={\"cores\": N}`, executorlib starts it on N MPI ranks, hands the same arguments to every rank and\n", - "collects the return values. The rest of the script stays serial Python, and the MPI result is passed on to the next\n", + "You have a serial Python analysis script: load a structure, compute an interaction energy over all pairs of particles,\n", + "summarize. Profiling shows that the pair sum takes almost all of the run time. You want to parallelize only this one\n", + "function with MPI, keep the rest of the script serial and unchanged, and run it on the cluster.\n", + "\n", + "**With plain SLURM** you run the whole script with `srun -n 64 python script.py`, which executes every line on every\n", + "rank: you have to guard the serial parts with `if rank == 0`, the data is read 64 times or broadcast by hand, and the\n", + "serial steps block 64 cores while only one of them works. Splitting the script into an MPI script and serial scripts\n", + "means passing the data through files and chaining the jobs by hand.\n", + "\n", + "**With executorlib** you write only the hot function with [mpi4py](https://mpi4py.readthedocs.io). Submitted with\n", + "`resource_dict={\"cores\": N}`, executorlib starts it on N MPI ranks, hands the same arguments to every rank and\n", + "collects the return values. The rest of your script stays serial Python, and the MPI result is passed on to the next\n", "serial step as a future.\n", "\n", "This notebook runs on the **login node** of a SLURM cluster." diff --git a/notebooks/story-6-multi-resource-pipeline.ipynb b/notebooks/story-6-multi-resource-pipeline.ipynb index 6a56eb8b..63bc2a82 100644 --- a/notebooks/story-6-multi-resource-pipeline.ipynb +++ b/notebooks/story-6-multi-resource-pipeline.ipynb @@ -5,19 +5,16 @@ "metadata": {}, "source": [ "# Story 6: A Pipeline whose Steps Need Different Resources\n", - "**Who:** A computational chemist with a three-step workflow: a serial structure preparation, an MPI-parallel\n", - "simulation and a serial analysis - repeated for several lattice constants, followed by a final step which selects the\n", - "best candidate.\n", + "Your workflow has three steps: a serial structure preparation, an MPI-parallel simulation and a serial analysis -\n", + "repeated for several lattice constants, followed by a final step which selects the best candidate. You want to give\n", + "every step exactly the resources it needs, and have each step start as soon as its inputs are ready.\n", "\n", - "**What they want:** Give every step exactly the resources it needs, and have each step start as soon as its inputs\n", - "are ready.\n", + "**With plain SLURM** every step needs its own batch script with its own `#SBATCH` header. You capture the job ID of\n", + "each submission, pass it to the next one as `--dependency=afterok:`, and write the intermediate results to\n", + "files only to parse them again. Running the whole workflow in one large MPI allocation avoids the bookkeeping, but\n", + "wastes core hours while the serial steps run.\n", "\n", - "**Why plain SLURM is painful:** Every step needs its own batch script with its own `#SBATCH` header. The job ID of\n", - "each submission has to be captured and passed to the next one as `--dependency=afterok:`, and the\n", - "intermediate results have to be written to files and parsed again. Running the whole workflow in one large MPI\n", - "allocation avoids the bookkeeping, but wastes core hours while the serial steps run.\n", - "\n", - "**How executorlib helps:** Resources are defined per function call with the `resource_dict`. Passing the future of one\n", + "**With executorlib** you define the resources per function call with the `resource_dict`. Passing the future of one\n", "call as argument to the next one turns into a SLURM job dependency, and the result is handed over through the cache.\n", "\n", "This notebook runs on the **login node** of a SLURM cluster." diff --git a/notebooks/story-7-prototype-then-scale.ipynb b/notebooks/story-7-prototype-then-scale.ipynb index 99a2cb95..585b77cf 100644 --- a/notebooks/story-7-prototype-then-scale.ipynb +++ b/notebooks/story-7-prototype-then-scale.ipynb @@ -5,18 +5,16 @@ "metadata": {}, "source": [ "# Story 7: Prototype on a Laptop, then Scale Up\n", - "**Who:** A PhD student developing a new workflow in a Jupyter notebook on their laptop.\n", + "You are developing a new workflow in a Jupyter notebook on your laptop. You want to iterate quickly with small inputs,\n", + "without waiting in a queue, and later run the very same code on the cluster with production settings.\n", "\n", - "**What they want:** Iterate quickly on the workflow with small inputs, without waiting in a queue, and later run the\n", - "very same code on the cluster with production settings.\n", + "**With plain SLURM** debugging a workflow by submitting jobs means waiting in the queue for every typo. Functions\n", + "defined in a notebook cannot simply be submitted, you first have to move them to a script. And once the workflow works\n", + "locally, you have to rewrite it for the scheduler.\n", "\n", - "**Why plain SLURM is painful:** Debugging a workflow by submitting jobs means waiting in the queue for every typo.\n", - "Functions defined in a notebook cannot simply be submitted, they first have to be moved to a script. And once the\n", - "workflow works locally, it has to be rewritten for the scheduler.\n", - "\n", - "**How executorlib helps:** The `SingleNodeExecutor` runs on any computer with the same interface as the HPC executors,\n", - "including functions defined in the notebook, resources, dependencies and caching. The `TestClusterExecutor` tests the\n", - "file-based mode of the `SlurmClusterExecutor` locally. Switching to the cluster changes one line.\n", + "**With executorlib** the `SingleNodeExecutor` runs on any computer with the same interface as the HPC executors,\n", + "including functions defined in the notebook, resources, dependencies and caching. The `TestClusterExecutor` lets you\n", + "test the file-based mode of the `SlurmClusterExecutor` locally. Switching to the cluster changes one line.\n", "\n", "This notebook runs on **any computer** - no SLURM is required." ] diff --git a/notebooks/story-8-recover-failed-jobs.ipynb b/notebooks/story-8-recover-failed-jobs.ipynb index 5435466d..521001f2 100644 --- a/notebooks/story-8-recover-failed-jobs.ipynb +++ b/notebooks/story-8-recover-failed-jobs.ipynb @@ -5,19 +5,16 @@ "metadata": {}, "source": [ "# Story 8: Recover from Failed Jobs\n", - "**Who:** A scientist whose overnight workflow partially failed: one calculation raised a Python exception because of a\n", - "bug, another job was killed by the cluster - a node failure, the out-of-memory killer or the wall-time limit.\n", + "Your overnight workflow partially failed: one calculation raised a Python exception because of a bug, another job was\n", + "killed by the cluster - a node failure, the out-of-memory killer or the wall-time limit. You want to find out what\n", + "failed and why, fix it, and rerun *only* the failed calculations while reusing the successful ones.\n", "\n", - "**What they want:** Find out what failed and why, fix it, and rerun *only* the failed calculations while the\n", - "successful ones are reused.\n", + "**With plain SLURM** you identify the failed jobs by combing through `sacct` and log files, write a new batch script\n", + "which contains only the failed parameter sets, and merge the results of both rounds by hand.\n", "\n", - "**Why plain SLURM is painful:** Failed jobs have to be identified by combing through `sacct` and log files. Then a new\n", - "batch script has to be written which contains only the failed parameter sets, and the results of both rounds have to\n", - "be merged by hand.\n", - "\n", - "**How executorlib helps:** Exceptions are returned through the futures and collected in an error log file, the status\n", - "of every call is recorded in the cache, and resubmitting the workflow only reruns the calls without a valid result -\n", - "provided their failed entries are removed from the cache, as shown below.\n", + "**With executorlib** exceptions are returned through the futures and collected in an error log file, the status of\n", + "every call is recorded in the cache, and resubmitting the workflow only reruns the calls without a valid result - once\n", + "you remove their failed entries from the cache, as shown below.\n", "\n", "This notebook runs on the **login node** of a SLURM cluster." ] @@ -192,7 +189,7 @@ "\n", "So executorlib does not retry failed calls on its own: a failed call is only rerun after its cache file is removed.\n", "This is deliberate - a deterministic exception would just fail again, and an expensive calculation should not be\n", - "resubmitted without a decision by the user. The following cell removes the entries of both kinds of failures. Calls\n", + "resubmitted without your decision. The following cell removes the entries of both kinds of failures. Calls\n", "which depend on a failed call store the same exception, so they are removed as well. Unfinished jobs which are still\n", "in the queue are not touched." ] diff --git a/notebooks/story-9-expensive-setup-once.ipynb b/notebooks/story-9-expensive-setup-once.ipynb index 0df245e4..8a3703a4 100644 --- a/notebooks/story-9-expensive-setup-once.ipynb +++ b/notebooks/story-9-expensive-setup-once.ipynb @@ -5,19 +5,17 @@ "metadata": {}, "source": [ "# Story 9: Pay for an Expensive Setup Only Once\n", - "**Who:** A researcher who evaluates a machine-learned interatomic potential for thousands of structures. Loading the\n", - "potential takes much longer than a single evaluation.\n", + "You evaluate a machine-learned interatomic potential for thousands of structures, and loading the potential takes much\n", + "longer than a single evaluation. You want to load the potential once per worker and then stream many small evaluations\n", + "through these workers. If a worker crashes, the remaining work should continue.\n", "\n", - "**What they want:** Load the potential once per worker and then stream many small evaluations through these workers.\n", - "If a worker crashes, the remaining work should continue.\n", + "**With plain SLURM** every job or job step starts a fresh Python process, so the potential is loaded again for every\n", + "structure - and the setup dominates the run time. Keeping a pool of long-lived worker processes alive in an allocation\n", + "and feeding them work means writing your own server, and restarting crashed workers is left to you.\n", "\n", - "**Why plain SLURM is painful:** Every job or job step starts a fresh Python process, so the potential is loaded again\n", - "for every structure - and the setup dominates the run time. Keeping a pool of long-lived worker processes alive in an\n", - "allocation and feeding them work means writing a custom server, and restarting crashed workers is left to you.\n", - "\n", - "**How executorlib helps:** With `block_allocation=True` the `SlurmJobExecutor` starts `max_workers` long-lived workers\n", - "in the allocation. The `init_function` runs once per worker and its return values are passed as keyword arguments to\n", - "the submitted functions. `restart_limit` restarts crashed workers.\n", + "**With executorlib** the `SlurmJobExecutor` with `block_allocation=True` starts `max_workers` long-lived workers in\n", + "your allocation. The `init_function` runs once per worker and its return values are passed as keyword arguments to the\n", + "submitted functions. `restart_limit` restarts crashed workers.\n", "\n", "This notebook has to run **inside a SLURM allocation** with at least two cores, for example started with\n", "`salloc -n 2`."