Skip to content
Snippets Groups Projects
Commit fe4d3762 authored by Jan Siwiec's avatar Jan Siwiec
Browse files

Update mpi4py-mpi-for-python.md

parent 5cb83428
No related branches found
No related tags found
4 merge requests!368Update prace.md to document the change from qprace to qprod as the default...,!367Update prace.md to document the change from qprace to qprod as the default...,!366Update prace.md to document the change from qprace to qprod as the default...,!323extended-acls-storage-section
......@@ -4,13 +4,13 @@
MPI for Python provides bindings of the Message Passing Interface (MPI) standard for the Python programming language, allowing any Python program to exploit multiple processors.
This package is constructed on top of the MPI-1/2 specifications and provides an object oriented interface which closely follows MPI-2 C++ bindings. It supports point-to-point (sends, receives) and collective (broadcasts, scatters, gathers) communications of any picklable Python object, as well as optimized communications of Python object exposing the single-segment buffer interface (NumPy arrays, builtin bytes/string/array objects).
This package is constructed on top of the MPI-1/2 specifications and provides an object-oriented interface, which closely follows MPI-2 C++ bindings. It supports point-to-point (sends, receives) and collective (broadcasts, scatters, gathers) communications of any picklable Python object, as well as optimized communications of Python object exposing the single-segment buffer interface (NumPy arrays, builtin bytes/string/array objects).
MPI4Py is available in standard Python modules on the clusters.
## Modules
MPI4Py is build for OpenMPI. Before you start with MPI4Py you need to load Python and OpenMPI modules.
MPI4Py is built for OpenMPI. Before you start with MPI4Py, you need to load the Python and OpenMPI modules.
```console
$ ml av Python/
......@@ -36,19 +36,19 @@ OpenMPI/1.8.6-GNU-5.1.0-2.25 OpenMPI/1.8.8-GNU-5.1.0-2.25 OpenMPI/1.10.1-GN
## Execution
You need to import MPI to your python program. Include the following line to the python script:
You need to import MPI to your Python program. Include the following line to the Python script:
```python
from mpi4py import MPI
```
The MPI4Py enabled python programs [execute as any other OpenMPI][1] code.The simpliest way is to run
The MPI4Py-enabled Python programs [execute as any other OpenMPI][1] code. The simpliest way is to run:
```console
$ mpiexec python <script>.py
```
For example
For example:
```console
$ mpiexec python hello_world.py
......@@ -106,7 +106,7 @@ $ ml OpenMPI
$ mpiexec -bycore -bind-to-core python hello_world.py
```
In this example, we run MPI4Py enabled code on 4 nodes, 16 cores per node (total of 64 processes), each python process is bound to a different core. More examples and documentation can be found on [MPI for Python webpage][a].
In this example, we run MPI4Py-enabled code on 4 nodes, 16 cores per node (total of 64 processes), each Python process is bound to a different core. More examples and documentation can be found on [MPI for Python webpage][a].
### Adding Numbers
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment