Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

docs: document more for multiprocessing #4190

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/third-party/lammps-command.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
See [Environment variables](../env.md) for the runtime environment variables.
:::

:::{note}
Each MPI rank can only use at most one GPU card.
See [How to control the parallelism of a job](../troubleshooting/howtoset_num_nodes.md) for details.
:::

## units

All units in LAMMPS except `lj` are supported. `lj` is not supported.
Expand Down
21 changes: 19 additions & 2 deletions doc/troubleshooting/howtoset_num_nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,26 @@ DeePMD-kit has three levels of parallelism.
To get the best performance, one should control the number of threads used by DeePMD-kit.
One should make sure the product of the parallel numbers is less than or equal to the number of cores available.

## MPI (optional)
## MPI or multiprocessing (optional)

Parallelism for MPI is optional and used for multiple nodes, multiple GPU cards, or sometimes multiple CPU cores.

To enable MPI support for training, one should [install horovod](../install/install-from-source.md#install-horovod-and-mpi4py) in advance. Note that the parallelism mode is data parallelism, so it is not expected to see the training time per batch decreases.
::::{tab-set}

:::{tab-item} TensorFlow {{ tensorflow_icon }}

To enable MPI support for training in the TensorFlow interface, one should [install horovod](../install/install-from-source.md#install-horovod-and-mpi4py) in advance.

:::
:::{tab-item} PyTorch {{ pytorch_icon }}

Multiprocessing support for training in the PyTorch backend is implemented with [torchrun](https://pytorch.org/docs/stable/elastic/run.html).

:::
::::

Note that the parallelism mode is data parallelism, so it is not expected to see the training time per batch decreases.
See [Parallel training](../train/parallel-training.md) for details.

MPI support for inference is not directly supported by DeePMD-kit, but indirectly supported by the third-party software. For example, [LAMMPS enables running simulations in parallel](https://docs.lammps.org/Developer_parallel.html) using the MPI parallel communication standard with distributed data. That software has to build against MPI.

Expand All @@ -22,6 +37,8 @@ Note that `mpirun` here should be the same as the MPI used to build software. Fo

Sometimes, `$num_nodes` and the nodes information can be directly given by the HPC scheduler system, if the MPI used here is the same as the MPI used to build the scheduler system. Otherwise, one have to manually assign these information.

Each process can use at most one GPU card.

## Parallelism between independent operators

For CPU devices, TensorFlow and PyTorch use multiple streams to run independent operators (OP).
Expand Down