Skip to content

Commit

Permalink
Fixup examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
joaander committed May 21, 2024
1 parent 039f36a commit d8e6051
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion doc/src/guide/concepts/hoomd-example.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def action(*jobs):
"""Execute actions on directories in parallel using HOOMD-blue."""
processes_per_directory = os.environ['ACTION_PROCESSES_PER_DIRECTORY']
communicator = hoomd.communicator.Communicator(ranks_per_partition=processes_per_directory)
action_implementation(jobs[communicator.partition])
action_implementation(jobs[communicator.partition], communicator)
# ANCHOR_END: action


Expand Down
17 changes: 9 additions & 8 deletions doc/src/guide/concepts/process-parallelism.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ Use **MPI** parallelism to launch:

[mpi4py]: https://mpi4py.readthedocs.io

## Processing multiple directories in parallel with **mpi4py**.
## Processing multiple directories in parallel with Python and **mpi4py**.

You can execute serial actions on many directories in parallel with the **[mpi4py]**.
Here is an example using **signac**:
You can execute serial actions on many directories in parallel using **[mpi4py]**.
Use the communicators **rank** to index into the array of directories. Here is an
example using **signac**:

```python
{{#include mpi4py-example.py:action}}
Expand All @@ -42,7 +43,7 @@ Pair this with a workflow action like this to process many directories in parall

```toml
[[action]]
launcher = ["mpi"]
launchers = ["mpi"]
[action.group]
maximum_size = 128
[action.resources]
Expand All @@ -60,17 +61,17 @@ to **mpi4py** above:

```toml
[[action]]
launcher = ["mpi"]
launchers = ["mpi"]
[action.group]
maximum_size = 128
[action.resources]
processes.per_directory = 4
walltime.per_submission = "08:00:00"
```
the only change is `processes.per_directory = 4`.

In your Python code, use the `ranks_per_partition` flag to HOOMD-blue's `Communicator`.
Here is an example using signac:
In your Python code, use the `ranks_per_partition` flag to HOOMD-blue's `Communicator`
to assign 4 ranks (processes) to each partition (directory). Then use the partition
index into the array of directories. Here is an example using **signac**:

```python
{{#include hoomd-example.py:action}}
Expand Down

0 comments on commit d8e6051

Please sign in to comment.