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]

[src]

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.

[src]

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.

[src]

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

[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]

[src]

Formats the value using the given formatter. Read more

impl<'a> Drop for UserOperation<'a>
[src]

[src]

Executes the destructor for this type. Read more

impl<'a> AsRaw for UserOperation<'a>
[src]

The raw MPI C API type

[src]

The raw value

impl<'a, 'b> Operation for &'b UserOperation<'a>
[src]

[src]

Returns whether the operation is commutative. Read more