Struct mpi::collective::UserOperation
[−]
[src]
pub struct UserOperation<'a> { /* fields omitted */ }
A user-defined operation.
The lifetime 'a
of the operation is limited by the lifetime of the underlying closure.
For safety reasons, UserOperation
is in of itself not considered an Operation
, but a
reference of it is. This limitation may be lifted in the future when Request
objects can
store finalizers.
Note: When a UserOperation
is passed to a non-blocking API call, it must outlive the
completion of the request. This is normally enforced by the safe API, so this is only a concern
if you use the unsafe API. Do not rely on MPI's internal reference-counting here, because once
UserOperation
is destroyed, the closure object will be deallocated even if the MPI_Op
handle
is still alive due to outstanding references.
Examples
See examples/reduce.rs
and examples/immediate_reduce.rs
Methods
impl<'a> UserOperation<'a>
[src]
pub fn associative<F>(function: F) -> Self where
F: Fn(DynBuffer, DynBufferMut) + Sync + 'a,
[src]
F: Fn(DynBuffer, DynBufferMut) + Sync + 'a,
Define an operation using a closure. The operation must be associative.
This is a more readable shorthand for the new
method. Refer to new
for
more information.
pub fn commutative<F>(function: F) -> Self where
F: Fn(DynBuffer, DynBufferMut) + Sync + 'a,
[src]
F: Fn(DynBuffer, DynBufferMut) + Sync + 'a,
Define an operation using a closure. The operation must be both associative and commutative.
This is a more readable shorthand for the new
method. Refer to new
for
more information.
pub fn new<F>(commute: bool, function: F) -> Self where
F: Fn(DynBuffer, DynBufferMut) + Sync + 'a,
[src]
F: Fn(DynBuffer, DynBufferMut) + Sync + 'a,
Creates an associative and possibly commutative operation using a closure.
The closure receives two arguments invec
and inoutvec
as dynamically typed buffers. It
shall set inoutvec
to the value of f(invec, inoutvec)
, where f
is a binary associative
operation.
If the operation is also commutative, setting commute
to true
may yield performance
benefits.
Note: If the closure panics, the entire program will abort.
Standard section(s)
5.9.5
pub unsafe fn from_raw<T: 'a>(op: MPI_Op, anchor: Box<T>) -> Self
[src]
Creates a UserOperation
from raw parts.
Here, anchor
is an arbitrary object that is stored alongside the MPI_Op
.
This can be used to attach finalizers to the object.
Trait Implementations
impl<'a> Debug for UserOperation<'a>
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<'a> Drop for UserOperation<'a>
[src]
impl<'a> AsRaw for UserOperation<'a>
[src]
impl<'a, 'b> Operation for &'b UserOperation<'a>
[src]
fn is_commutative(&self) -> bool
[src]
Returns whether the operation is commutative. Read more