Thin wrapper to a Message Passing Interface (MPI)
Contents
- Introduction
- Installation on Debian/Ubuntu/Linux
- Installation on macOS
- Setting Cargo.toml
- Examples
- Todo list
Introduction
MsgPass (Message Passing) is a thin Rust wrapper to MPI. We consider a small subset of MPI functions. This subset will grow as our projects require more functionality. We implement (by hand) C functions that Rust can easily call using the FFI (in the c_code
directory).
We try to test all functions as much as possible, but test coverage could be better. The tests must be called with mpiexec
, thus it is easy to use the run-tests.bash
script.
[!NOTE] Unlike the MPI standard, we use
mpi_init
to initialize the simulation with multiple threads. Thus, ourmpi_init
function callsMPI_Init_thread
withMPI_THREAD_MULTIPLE
. On the other hand, ourmpi_init_single_thread
callsMPI_Init
.
Documentation:
Installation on Debian/Ubuntu/Linux
On Ubuntu/Linux, install OpenMPI or MPICH (requires an environment variable). For instance,
or
For MPICH, the following environment variable is required:
Installation on macOS
On macOS, install the following packages:
Also, export the following environment variable:
Setting Cargo.toml
👆 Check the crate version and update your Cargo.toml accordingly:
[]
= "*"
Examples
See also:
The example below (available in the examples
directory) will send an array from ROOT to all the other processors.
use *;
Running the code above with mpiexec -np 4 ex_send_receive
(see run-examples.bash
), we get an output similar to the one below:
### ex_send_receive ######################################################
2: y = [1.0, 2.0, 3.0]
0: x = [1.0, 2.0, 3.0]
3: y = [1.0, 2.0, 3.0]
1: y = [1.0, 2.0, 3.0]
Todo list
- Implement basic functionality
- Initialize and finalize
- Abort and barrier
- Wrap more MPI functions
- Implement reduce
- Implement allreduce
- Implement send/receive
- Implement scatter/gather