Advanced
Object handling
MPI.free — Function.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.
MPI.refcount_inc — Function.refcount_inc()Increment the MPI reference counter. This should be called at initialization of any object which calls an MPI routine in its finalizer. A matching refcount_dec should be added to the finalizer.
For more details, see Finalizers.
MPI.refcount_dec — Function.refcount_dec()Decrement the MPI reference counter. This should be added after an MPI call in an object finalizer, with a matching refcount_inc when the object is initialized.
For more details, see Finalizers.
Buffers
MPI.Buffer — Type.MPI.BufferAn MPI buffer for communication operations.
Fields
dataa Julia object referencing a region of memory to be used for communication. It is required that the object can be
cconverted to anMPIPtr.countthe number of elements of
datatypein the buffer. Note that this may not correspond to the number of elements in the array if derived types are used.datatypethe
MPI.Datatypestored in the buffer.
Usage
Buffer(data, count::Integer, datatype::Datatype)Generic constructor.
Buffer(data)Construct a Buffer backed by data, automatically determining the appropriate count and datatype. Methods are provided for
RefArrayCuArrayif CuArrays.jl is loadedSubArrays of anArrayorCuArraywhere the layout is contiguous, sequential or blocked.
MPI.Buffer_send — Function.Buffer_send(data)Construct a Buffer object for a send operation from data, allowing cases where isbits(data).
MPI.MPIPtr — Type.MPI.MPIPtrA pointer to an MPI buffer. This type is used only as part of the implicit conversion in ccall: a Julia object can be passed to MPI by defining methods for Base.cconvert(::Type{MPIPtr}, ...)/Base.unsafe_convert(::Type{MPIPtr}, ...).
Currently supported are:
PtrRefArraySubArrayCuArrayif CuArrays.jl is loaded.
Additionally, certain sentinel values can be used, e.g. MPI_IN_PLACE or MPI_BOTTOM.
Datatype objects
MPI.Datatype — Type.DatatypeA Datatype represents the layout of the data in memory.
Usage
Datatype(T; commit=true)Either return the predefined Datatype or create a new Datatype for the Julia type T. If commit=true, then the Types.commit! operation will also be applied so that it can be used for communication operations.
Note that this can only be called on types for which isbitstype(T) is true.
MPI.Types.extent — Function.MPI.Types.create_contiguous — Function.MPI.Types.create_contiguous(count::Integer, oldtype::MPI.Datatype)Create a derived Datatype that replicates oldtype into count contiguous locations.
Note that MPI.Types.commit! must be used before the datatype can be used for communication.
External links
MPI.Types.create_vector — Function.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
MPI.Types.create_subarray — Function.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
MPI.Types.create_struct — Function.MPI.Types.create_struct(blocklengths, displacements, types)Creates a derived Datatype describing a struct layout.
Note that MPI.Types.commit! must be used before the datatype can be used for communication.
External links
MPI.Types.create_resized — Function.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
MPI.Types.commit! — Function.Operator objects
MPI.Op — Type.OpAn MPI reduction operator, for use with Reduce/Scan collective operations to wrap binary operators. MPI.jl will perform this conversion automatically.
Usage
Op(op, T=Any; iscommutative=false)Wrap the Julia reduction function op for arguments of type T. op is assumed to be associative, and if iscommutative is true, assumed to be commutative as well.
See also
Info objects
MPI.Info — Type.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`
endFor 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.
MPI.infoval — Function.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.