pub enum MpiThread {
Single = 0,
Funneled = 1,
Serialized = 2,
Multiple = 3,
}Expand description
Specifies the option for MPI_Init_thread
From https://enccs.github.io/intermediate-mpi/mpi-and-threads-pt1/
- MPI_THREAD_SINGLE - rank is not allowed to use threads, which is basically equivalent to calling MPI_Init. With MPI_THREAD_SINGLE, the rank may use MPI freely and will not use threads.
- MPI_THREAD_FUNNELED - rank can be multi-threaded but only the main thread may call MPI functions. Ideal for fork-join parallelism such as used in #pragma omp parallel, where all MPI calls are outside the OpenMP regions. With MPI_THREAD_FUNNELED, the rank can use MPI from only the main thread.
- MPI_THREAD_SERIALIZED - rank can be multi-threaded but only one thread at a time may call MPI functions. The rank must ensure that MPI is used in a thread-safe way. One approach is to ensure that MPI usage is mutually excluded by all the threads, eg. with a mutex. With MPI_THREAD_SERIALIZED, the rank can use MPI from any thread so long as it ensures the threads synchronize such that no thread calls MPI while another thread is doing so.
- MPI_THREAD_MULTIPLE - rank can be multi-threaded and any thread may call MPI functions. The MPI library ensures that this access is safe across threads. Note that this makes all MPI operations less efficient, even if only one thread makes MPI calls, so should be used only where necessary. With MPI_THREAD_MULTIPLE, the rank can use MPI from any thread. The MPI library ensures the necessary synchronization
Note: The performance may be affected with MPI_THREAD_MULTIPLE
Variants§
Single = 0
Only one thread will execute
Funneled = 1
The process may be multi-threaded, but only the main thread will make MPI calls (all MPI calls are funneled to the main thread)
Serialized = 2
The process may be multi-threaded, and multiple threads may make MPI calls, but only one at a time: MPI calls are not made concurrently from two distinct threads (all MPI calls are serialized)
Multiple = 3
Multiple threads may call MPI, with no restrictions
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for MpiThread
impl Send for MpiThread
impl Sync for MpiThread
impl Unpin for MpiThread
impl UnwindSafe for MpiThread
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more