Buffers

Buffers are used for sending and receiving data. MPI.jl provides the following buffer types:

MPI.IN_PLACEConstant
MPI.IN_PLACE

A sentinel value that can be passed as a buffer argument for certain collective operations to use the same buffer for send and receive operations.

source
MPI.BufferType
MPI.Buffer

An MPI buffer for communication with a single rank. It is used for point-to-point communication and some collective operations.

Fields

• data

a Julia object referencing a region of memory to be used for communication. It is required that the object can be cconverted to an MPIPtr.

• count

the number of elements of datatype in the buffer. Note that this may not correspond to the number of elements in the array if derived types are used.

• datatype

the MPI.Datatype stored 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

• Ref
• Array
• CUDA.CuArray if CUDA.jl is loaded
• SubArrays of an Array or CUDA.CuArray where the layout is contiguous, sequential or blocked.

source
MPI.UBufferType
MPI.UBuffer

An MPI buffer for chunked collective communication, where all chunks are of uniform size.

Fields

• data

A Julia object referencing a region of memory to be used for communication. It is required that the object can be cconverted to an MPIPtr.

• count

The number of elements of datatype in each chunk.

• nchunks

The maximum number of chunks stored in the buffer. This is used only for validation, and can be set to nothing to disable checks.

• datatype

The MPI.Datatype stored in the buffer.

Usage

UBuffer(data, count::Integer, nchunks::Union{Nothing, Integer}, datatype::Datatype)

Generic constructor.

UBuffer(data, count::Integer)

Construct a UBuffer backed by data, where count is the number of elements in each chunk.

source
MPI.VBufferType
MPI.VBuffer

An MPI buffer for chunked collective communication, where chunks can be of different sizes and at different offsets.

Fields

• data

A Julia object referencing a region of memory to be used for communication. It is required that the object can be cconverted to an MPIPtr.

• counts

An array containing the length of each chunk.

• displs

An array containing the (0-based) displacements of each chunk.

• datatype

The MPI.Datatype stored in the buffer.

Usage

VBuffer(data, counts[, displs[, datatype]])

Construct a VBuffer backed by data, where counts[j] is the number of elements in the jth chunk, and displs[j] is the 0-based displacement. In other words, the jth chunk occurs in indices displs[j]+1:displs[j]+counts[j].

The default value for displs[j] = sum(counts[1:j-1]).

source
MPI.RBufferType
MPI.RBuffer

An MPI buffer for reduction operations (MPI.Reduce!, MPI.Allreduce!, MPI.Scan!, MPI.Exscan!).

Fields

• senddata

A Julia object referencing a region of memory to be used for the send buffer. It is required that the object can be cconverted to an MPIPtr.

• recvdata

A Julia object referencing a region of memory to be used for the receive buffer. It is required that the object can be cconverted to an MPIPtr.

• count

the number of elements of datatype in the buffer. Note that this may not correspond to the number of elements in the array if derived types are used.

• datatype

the MPI.Datatype stored in the buffer.

Usage

RBuffer(senddata, recvdata[, count, datatype])

Generic constructor.

RBuffer(senddata, recvdata)

Construct a Buffer backed by senddata and recvdata, automatically determining the appropriate count and datatype.

source
MPI.MPIPtrType
MPI.MPIPtr

A 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:

• Ptr
• Ref
• Array
• SubArray
• CUDA.CuArray if CUDA.jl is loaded.

Additionally, certain sentinel values can be used, e.g. MPI_IN_PLACE or MPI_BOTTOM.

source