From cd95b73559a44a3b33a98c2a648794f6513eed87 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 7 Oct 2024 15:28:23 -0400 Subject: [PATCH] docs: document more for multiprocessing Fix #4182. Signed-off-by: Jinzhe Zeng --- doc/third-party/lammps-command.md | 5 +++++ doc/troubleshooting/howtoset_num_nodes.md | 21 +++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/doc/third-party/lammps-command.md b/doc/third-party/lammps-command.md index 4baba00e05..6a16605bfc 100644 --- a/doc/third-party/lammps-command.md +++ b/doc/third-party/lammps-command.md @@ -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. diff --git a/doc/troubleshooting/howtoset_num_nodes.md b/doc/troubleshooting/howtoset_num_nodes.md index 0c547650fb..b09fb80cb6 100644 --- a/doc/troubleshooting/howtoset_num_nodes.md +++ b/doc/troubleshooting/howtoset_num_nodes.md @@ -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. @@ -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).