1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
//! # mpi-rs — a pure-Rust Message Passing Interface
//!
//! This crate (published as **`mpi-rs`**, imported as **`mpi`**) is a
//! from-scratch, **pure-Rust** implementation of MPI whose public API mirrors
//! [`rsmpi`](https://github.com/rsmpi/rsmpi) (the `mpi` crate) so that existing
//! rsmpi programs compile and run against it with little or no change. Unlike
//! rsmpi, it does **not** link against a C MPI library (Open MPI / MPICH): the
//! runtime — process bootstrap, the byte transport, and every collective
//! algorithm — is implemented here in safe Rust on top of the standard library
//! only (the default build has zero external dependencies).
//!
//! ## Quick start
//!
//! ```no_run
//! use mpi::traits::*;
//!
//! let universe = mpi::initialize().unwrap();
//! let world = universe.world();
//! let size = world.size();
//! let rank = world.rank();
//!
//! if rank == 0 {
//! let msg = [1.0f64, 2.0, 3.0];
//! world.process_at_rank(1).send(&msg[..]);
//! } else if rank == 1 {
//! let (msg, status) = world.process_at_rank(0).receive_vec::<f64>();
//! println!("rank 1 received {:?} (status {:?})", msg, status);
//! }
//! ```
//!
//! Run it with the bundled launcher:
//!
//! ```text
//! mpiexec -n 4 ./target/debug/examples/hello
//! ```
//!
//! A program that is *not* launched under `mpiexec` runs as a singleton job
//! (world size 1, rank 0), exactly like a C MPI singleton `MPI_Init`.
use fmt;
// Internal runtime (networking + bootstrap). Not part of the public API.
// Optional POSIX shared-memory fast-path for same-host ranks.
// The process launcher, shared by the `mpiexec` / `mpirun` binaries.
// Dynamic process management (MPI_Comm_spawn). Internal helpers.
// Public API modules, mirroring rsmpi's module layout.
/// The integer type used to identify a process within a communicator
/// (`MPI_Comm_rank`).
pub type Rank = i32;
/// The integer type used to tag point-to-point messages.
pub type Tag = i32;
/// The integer type counting elements in a buffer (`int` in the C API).
pub type Count = i32;
/// A byte displacement / absolute address (`MPI_Aint`).
pub type Address = i64;
/// Errors that can occur while managing the MPI environment.
pub use ;
/// Derive macro for [`datatype::Equivalence`] (enabled by the `derive` feature).
///
/// ```ignore
/// use mpi::Equivalence;
///
/// #[derive(Clone, Copy, Equivalence)]
/// #[repr(C)]
/// struct Particle { x: f64, y: f64, id: u64 }
/// ```
pub use Equivalence;
/// A convenience re-export of the wildcard constants.
pub use ;