Expand description
Message Passing Interface bindings for Rust
The Message Passing Interface (MPI) is a specification for a message-passing style concurrency library. Implementations of MPI are often used to structure parallel computation on High Performance Computing systems. The MPI specification describes bindings for the C programming language (and through it C++) as well as for the Fortran programming language. This library tries to bridge the gap into a more rustic world.
§Usage
Add the mpi
crate as a dependency in your Cargo.toml
:
[dependencies]
mpi = "0.8.0"
Then use it in your program like this:
use mpi::traits::*;
fn main() {
let universe = mpi::initialize().unwrap();
let world = universe.world();
let size = world.size();
let rank = world.rank();
if size != 2 {
panic!("Size of MPI_COMM_WORLD must be 2, but is {}!", size);
}
match rank {
0 => {
let msg = vec![4.0f64, 8.0, 15.0];
world.process_at_rank(rank + 1).send(&msg[..]);
}
1 => {
let (msg, status) = world.any_process().receive_vec::<f64>();
println!(
"Process {} got message {:?}.\nStatus is: {:?}",
rank, msg, status
);
}
_ => unreachable!(),
}
}
§Features
The bindings follow the MPI 3.1 specification.
Currently supported:
- Groups, Contexts, Communicators:
- Group and (Intra-)Communicator management from section 6 is mostly complete.
- no Inter-Communicators
- no process topologies
- Point to point communication:
- standard, buffered, synchronous and ready mode send in blocking and non-blocking variants
- receive in blocking and non-blocking variants
- send-receive
- probe
- matched probe/receive
- Collective communication:
- barrier
- broadcast
- (all) gather
- scatter
- all to all
- varying counts operations
- reductions/scans
- blocking and non-blocking variants
- Datatypes: Bridging between Rust types and MPI basic types as well as custom MPI datatypes which can act as views into buffers.
Not supported (yet):
- One-sided communication (RMA)
- MPI parallel I/O
- A million small things
The sub-modules contain a more detailed description of which features are and are not supported.
§Further Reading
While every publicly defined item in this crate should have some documentation attached to it, most of the descriptions are quite terse for now and to the uninitiated will only make sense in combination with the MPI specification.
Re-exports§
pub use crate::topology::Rank;
Modules§
- attribute
- Attribute caching on communicators
- collective
- Collective communication
- datatype
- The core function of MPI is getting data from point A to point B (where A and B are e.g. single processes, multiple processes, the filesystem, …). It offers facilities to describe that data (layout in memory, behavior under certain operators) that go beyound a start address and a number of bytes.
- environment
- Environmental management
- ffi
- The raw C language MPI API
- point_
to_ point - Point to point communication
- raw
- Bridge between rust types and raw values
- request
- Request objects for non-blocking operations
- topology
- Organizing processes as groups and communicators
- traits
- Re-exports all traits.
Enums§
- MpiError
- Errors
- Threading
- Describes the various levels of multithreading that can be supported by an MPI library.
Functions§
- initialize
- Initialize MPI.
- initialize_
with_ threading - Initialize MPI with desired level of multithreading support.
- time
- Time in seconds since an arbitrary time in the past.
- time_
resolution - Resolution of timer used in
time()
in seconds