Repository navigation
[Documentation] Table to find the right approach and user story #1131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -56,6 +56,34 @@ 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]) | ||||||
| ``` | ||||||
|
|
||||||
| ### Find the right approach for your application | ||||||
| executorlib offers three ways to bring Python functions to an HPC cluster. Which one fits best depends on how long a | ||||||
| single calculation runs compared to the time it waits in the queue, how many calculations there are, whether they need | ||||||
| the same or different resources, and whether your cluster prefers a few large allocations or many small jobs: | ||||||
|
|
||||||
| | | One job per call | Workers submitted as jobs | Calls inside one allocation | | ||||||
| |---|---|---|---| | ||||||
| | **Executor** | `SlurmClusterExecutor` | `SlurmClusterExecutor(block_allocation=True)` | `SlurmJobExecutor` | | ||||||
| | **Run time per call** | minutes to days | seconds to minutes | seconds to hours | | ||||||
| | **Number of calls** | limited by the number of jobs the cluster allows per user | many | many | | ||||||
| | **Resources** | defined for every call | the same for all calls | defined for every call, within the allocation | | ||||||
| | **Waiting in the queue** | for every call | once per worker | once for the allocation | | ||||||
| | **The cluster prefers** | small jobs | small jobs, backfill or overflow partitions | large allocations | | ||||||
| | **Log out and come back later** | yes, the results are stored in the cache | no, the Python process has to keep running | no, the Python process runs inside the allocation | | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clarify that the logout row for The "Log out and come back later" cell for Replace the --- "a/README.md"
+++ "b/README.md"
@@ -70,7 +70,7 @@
| **Resources** | defined for every call | the same for all calls | defined for every call, within the allocation |
| **Waiting in the queue** | for every call | once per worker | once for the allocation |
| **The cluster prefers** | small jobs | small jobs, backfill or overflow partitions | large allocations |
-| **Log out and come back later** | yes, the results are stored in the cache | no, the Python process has to keep running | no, the Python process runs inside the allocation |
+| **Log out and come back later** | yes, the results are stored in the cache | no, the Python process has to keep running | yes, if the allocation continues, but the Python process has to keep running inside it |
| **Lost calculations** | rerun only the failed calls, the others are loaded from the cache | resubmitted automatically with `restart_limit` | resubmitted automatically with `restart_limit` and `block_allocation=True` |
| **Communication** | file system | sockets | sockets |
| **User stories** | [Story 1: long-running functions](https://executorlib.readthedocs.io/en/latest/story-1-submit-and-reconnect.html)<br>[Story 3: pandas DataFrames](https://executorlib.readthedocs.io/en/latest/story-3-pandas-dataframes.html)<br>[Story 4: MPI simulation codes](https://executorlib.readthedocs.io/en/latest/story-4-couple-mpi-simulation-codes.html)<br>[Story 5: mpi4py functions](https://executorlib.readthedocs.io/en/latest/story-5-mpi4py-functions.html)<br>[Story 6: multi-resource pipeline](https://executorlib.readthedocs.io/en/latest/story-6-multi-resource-pipeline.html)<br>[Story 8: recover failed jobs](https://executorlib.readthedocs.io/en/latest/story-8-recover-failed-jobs.html)<br>[Story 12: document and share](https://executorlib.readthedocs.io/en/latest/story-12-document-and-share.html) | [Story 13: overflow queue](https://executorlib.readthedocs.io/en/latest/story-13-overflow-queue-workers.html) | [Story 2: parameter study](https://executorlib.readthedocs.io/en/latest/story-2-parameter-study.html)<br>[Story 9: expensive setup once](https://executorlib.readthedocs.io/en/latest/story-9-expensive-setup-once.html)<br>[Story 11: adaptive workflows](https://executorlib.readthedocs.io/en/latest/story-11-adaptive-workflows.html) |Committable suggestion
|
||||||
| | **Lost calculations** | rerun only the failed calls, the others are loaded from the cache | resubmitted automatically with `restart_limit` | resubmitted automatically with `restart_limit` and `block_allocation=True` | | ||||||
| | **Communication** | file system | sockets | sockets | | ||||||
| | **User stories** | [Story 1: long-running functions](https://executorlib.readthedocs.io/en/latest/story-1-submit-and-reconnect.html)<br>[Story 3: pandas DataFrames](https://executorlib.readthedocs.io/en/latest/story-3-pandas-dataframes.html)<br>[Story 4: MPI simulation codes](https://executorlib.readthedocs.io/en/latest/story-4-couple-mpi-simulation-codes.html)<br>[Story 5: mpi4py functions](https://executorlib.readthedocs.io/en/latest/story-5-mpi4py-functions.html)<br>[Story 6: multi-resource pipeline](https://executorlib.readthedocs.io/en/latest/story-6-multi-resource-pipeline.html)<br>[Story 8: recover failed jobs](https://executorlib.readthedocs.io/en/latest/story-8-recover-failed-jobs.html)<br>[Story 12: document and share](https://executorlib.readthedocs.io/en/latest/story-12-document-and-share.html) | [Story 13: overflow queue](https://executorlib.readthedocs.io/en/latest/story-13-overflow-queue-workers.html) | [Story 2: parameter study](https://executorlib.readthedocs.io/en/latest/story-2-parameter-study.html)<br>[Story 9: expensive setup once](https://executorlib.readthedocs.io/en/latest/story-9-expensive-setup-once.html)<br>[Story 11: adaptive workflows](https://executorlib.readthedocs.io/en/latest/story-11-adaptive-workflows.html) | | ||||||
|
|
||||||
| The run times are rules of thumb: the longer the queue waits on your cluster, the longer a calculation has to run to | ||||||
| justify its own job. Whether a calculation is a Python function or an external executable makes no difference for the | ||||||
| choice - [Story 4](https://executorlib.readthedocs.io/en/latest/story-4-couple-mpi-simulation-codes.html) wraps MPI-parallel executables and | ||||||
| [Story 5](https://executorlib.readthedocs.io/en/latest/story-5-mpi4py-functions.html) MPI-parallel Python functions, both work with every approach. What counts | ||||||
| is the run time and the resources of a single call. The approaches can also be combined: | ||||||
| [Story 10: fan out inside jobs](https://executorlib.readthedocs.io/en/latest/story-10-fan-out-inside-jobs.html) submits one job per campaign, which then distributes many calls inside its allocation. The | ||||||
| `FluxClusterExecutor` and the `FluxJobExecutor` follow the same pattern for the [flux framework](https://flux-framework.org). | ||||||
| To develop a workflow before using the cluster, start with [Story 7: prototype then scale](https://executorlib.readthedocs.io/en/latest/story-7-prototype-then-scale.html). | ||||||
|
|
||||||
| 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 | ||||||
|
|
@@ -114,10 +142,13 @@ name: | |||||
| | [`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. | ||||||
| By default 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. With | ||||||
| `block_allocation=True` they instead submit long-lived worker jobs, which execute many Python functions and communicate | ||||||
| via sockets. 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. The table in the | ||||||
| section *Find the right approach for your application* above compares these approaches and links the matching user | ||||||
| stories. | ||||||
|
|
||||||
| 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, | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per-call resources conflict with block allocation in the approach table.
The third column describes
SlurmJobExecutorin its default mode, where each call can setresource_dict. The Lost calculations row recommendsblock_allocation=Truefor the same executor. In that mode, a nonempty per-callresource_dictraisesValueErrorat submission. The resources must be set on the executor instead. A user who follows both rows hits this error.Qualify the Resources cell so it applies only without block allocation:
Suggested README change
Committable suggestion