Advanced

Object handling

MPI.freeFunction
MPI.free(obj)

Free the MPI object handle obj. This is typically used as the finalizer, and so need not be called directly unless otherwise noted.

source

Datatype objects

MPI.DatatypeType
Datatype

A Datatype represents the layout of the data in memory.

Usage

Datatype(T)

Either return the predefined Datatype corresponding to T, or create a new Datatype for the Julia type T, calling Types.commit! so that it can be used for communication operations.

Note that this can only be called on types for which isbitstype(T) is true.

source
MPI.to_typeFunction
to_type(datatype::Datatype)

Return the Julia type corresponding to the MPI Datatype datatype, or nothing if it doesn't correspond directly.

source
MPI.Types.extentFunction
lb, extent = MPI.Types.extent(dt::MPI.Datatype)

Gets the lowerbound lb and the extent extent in bytes.

External links

source
MPI.Types.create_vectorFunction
MPI.Types.create_vector(count::Integer, blocklength::Integer, stride::Integer, oldtype::MPI.Datatype)

Create a derived Datatype that replicates oldtype into locations that consist of equally spaced blocks.

Note that MPI.Types.commit! must be used before the datatype can be used for communication.

Example

datatype = MPI.Types.create_vector(3, 2, 5, MPI.Datatype(Int64))
MPI.Types.commit!(datatype)

will create a datatype with the following layout

|<----->|  block length

+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| X | X |   |   |   | X | X |   |   |   | X | X |   |   |   |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

|<---- stride ----->|

where each segment represents an Int64.

(image by Jonathan Dursi, https://stackoverflow.com/a/10788351/392585)

External links

source
MPI.Types.create_subarrayFunction
MPI.Types.create_subarray(sizes, subsizes, offset, oldtype::Datatype;
                          rowmajor=false)

Creates a derived Datatype describing an N-dimensional subarray of size subsizes of an N-dimensional array of size sizes and element type oldtype, with the first element offset by offset (i.e. the 0-based index of the first element).

Column-major indexing (used by Julia and Fortran) is assumed; use the keyword rowmajor=true to specify row-major layout (used by C and numpy).

Note that MPI.Types.commit! must be used before the datatype can be used for communication.

External links

source
MPI.Types.create_resizedFunction
MPI.Types.create_resized(oldtype::Datatype, lb::Integer, extent::Integer)

Creates a new Datatype that is identical to oldtype, except that the lower bound of this new datatype is set to be lb, and its upper bound is set to be lb + extent.

Note that MPI.Types.commit! must be used before the datatype can be used for communication.

See also

External links

source

Operator objects

Info objects

MPI.InfoType
Info <: AbstractDict{Symbol,String}

MPI.Info objects store key-value pairs, and are typically used for passing optional arguments to MPI functions.

Usage

These will typically be hidden from user-facing APIs by splatting keywords, e.g.

function f(args...; kwargs...)
    info = Info(kwargs...)
    # pass `info` object to `ccall`
end

For manual usage, Info objects act like Julia Dict objects:

info = Info(init=true) # keyword argument is required
info[key] = value
x = info[key]
delete!(info, key)

If init=false is used in the costructor (the default), a "null" Info object will be returned: no keys can be added to such an object.

source
MPI.infovalFunction
infoval(x)

Convert Julia object x to a string representation for storing in an Info object.

The MPI specification allows passing strings, Boolean values, integers, and lists.

source

Error handler objects

MPI.ErrorHandlerType
MPI.Errhandler

An MPI error handler object. Currently only two are supported:

  • ERRORS_ARE_FATAL (default): program will immediately abort
  • ERRORS_RETURN: program will throw an MPIError.
source
MPI.set_errorhandler!Function
MPI.set_errorhandler!(comm::MPI.Comm, errh::ErrorHandler)
MPI.set_errorhandler!(win::MPI.Win, errh::ErrorHandler)
MPI.set_errorhandler!(file::MPI.File.FileHandle, errh::ErrorHandler)

Set the ErrorHandler for the relevant MPI object.

See also

source