Communications Layer
JuliaPetra abstracts communication with the Comm
and Distributor
interfaces. There are two communication implementations with JuliaPetra SerialComm
and MPIComm
. Note that most objects dependent on inter-process communication support the getComm
method.
Interface
JuliaPetra.Comm
— Type.The base type for types that represent communication in parallel computing.
All subtypes must have the following methods, with CommImpl standing in for the subtype:
barrier(comm::CommImpl)
Each processor must wait until all processors have arrived
broadcastAll(comm::CommImpl, myvals::AbstractArray{T}, Root::Integer)::Array{T} where T
Takes a list of input values from the root processor and sends to all other processors. The values are returned (including on the root process)
gatherAll(comm::CommImpl, myVals::AbstractArray{T})::Array{T} where T
Takes a list of input values from all processors and returns an ordered contiguous list of those values on each processor
sumAll(comm::CommImpl, partialsums::AbstractArray{T})::Array{T} where T
Take a list of input values from all processors and returns the sum on each processor. The method +(::T, ::T)::T can be assumed to exist
maxAll(comm::CommImpl, partialmaxes::AbstractArray{T})::Array{T} where T
Takes a list of input values from all processors and returns the max to all processors. The method <(::T, ::T)::Bool can be assumed to exist
minAll(comm::CommImpl, partialmins::AbstractArray{T})::Array{T} where T
Takes a list of input values from all processors and returns the min to all processors. The method <(::T, ::T)::Bool can be assumed to exist
scanSum(comm::CommImpl, myvals::AbstractArray{T})::Array{T} where T
Takes a list of input values from all processors, computes the scan sum and returns it to all processors such that processor i contains the sum of values from processor 1 up to and including processor i. The method +(::T, ::T)::T
is used for the addition.
myPid(comm::CommImpl{GID, PID, LID})::PID
Returns the process rank
numProc(comm::CommImpl{GID, PID, LID})::PID
Returns the total number of processes
createDistributor(comm::CommImpl{GID, PID, LID})::Distributor{GID, PID, LID}
Create a distributor object
JuliaPetra.Distributor
— Type.The base type for gather/scatter setup. All subtypes must have the following methods, with DistributorImpl standing in for the subtype:
createFromSends(dist::DistributorImpl,exportPIDs::AbstractArray{PID})::Integer where PID <:Integer
Sets up the Distributor object using a list of process IDs to which we export. Returns the number of IDs this processor will be receiving.
createFromRecvs(dist::DistributorImpl, remoteGIDs::AbstractArray{GID}, remotePIDs::AbstractArray{PID})::Tuple{AbstractArray{GID}, AbstractArray{PID}} where GID <: Integer where PID <: Integer
Sets up the Distributor object using a list of remote global IDs and corresponding PIDs. Returns a tuple with the global IDs and their respective processor IDs being sent by this processor.
resolvePosts(dist::DistributorImpl, exportObjs::AbstractArray)
Post buffer of export objects. Other, local work can be done before resolving the waits. Otherwise, as resolve
.
resolveWaits(dist::DistributorImpl)::AbstractArray
Wait on a set of posts
resolveReversePosts(dist::DistributorImpl, exportObjs::AbstractArray)
Do reverse post of buffer of export objects Other, local work can be done before resolving the waits. Otherwise, as resolveReverse
.
resolveReverseWaits(dist::DistributorImpl)::AbstractArray
Wait on a set of reverse posts.
Functions
JuliaPetra.getComm
— Function.getComm(obj)
Gets the Comm for the object, if applicable
JuliaPetra.barrier
— Function.barrier(::Comm)
Causes the process to pause until all processes have called barrier. Used to synchronize the processes
JuliaPetra.broadcastAll
— Function.broadcastAll(::Comm, myVals::T, root::Integer)::T
broadcastAll(comm::Comm, myVals::AbstractArray{T, 1}, root::Integer)::Array{T, 1}
Takes a list of input values from the root processor and sends it to each other processor. The broadcasted values are then returned, including on the root process.
JuliaPetra.gatherAll
— Function.gatherAll(::Comm, myVal::T)::Array{T, 1}
gatherAll(comm::Comm, myVals::AbstractArray{T, 1})::Array{T, 1}
Takes a list of input values from all processors and returns an ordered, contiguous list of those values.
JuliaPetra.sumAll
— Function.sumAll(::Comm, partialsum::T)::T
sumAll(comm::Comm, partialsums::AbstractArray{T, 1})::Array{T, 1}
Takes a list of input values from all processors and returns the sum on each processor. The method +(::T, ::T)::T
must exist.
JuliaPetra.maxAll
— Function.maxAll(::Comm, partialmax::T)::T
maxAll(comm::Comm, partialmaxes::AbstractArray{T, 1})::Array{T, 1}
Takes a list of input values from all processors and returns the max to all processors. The method <(::T, ::T)::Bool
must exist.
JuliaPetra.minAll
— Function.minAll(::Comm, partialmin::T)::T
minAll(comm::Comm, partialmins::AbstractArray{T, 1})::Array{T, 1}
Takes a list of input values from all processors and returns the min to all processors. The method <(::T, ::T)::Bool
must exist.
JuliaPetra.scanSum
— Function.scanSum(::Comm, myval::T)::T
scanSum(comm::Comm, myvals::AbstractArray{T, 1})::Array{T, 1}
Takes a list of input values from all processors, computes the scan sum and returns it to all processors such that processor i
contains the sum of values from processor 1 up to, and including, processor i
. The method +(::T, ::T)::T must exist
JuliaPetra.myPid
— Function.myPid(::Comm{GID, PID, LID})::PID
Returns the rank of the calling processor
JuliaPetra.numProc
— Function.numProc(::Comm{GID, PID, LID})::PID
Returns the total number of processes
JuliaPetra.createDistributor
— Function.createDistributor(comm::Comm{GID, PID, LID})::Distributor{GID, PID, LID}
Creates a distributor for the given Comm object
JuliaPetra.createFromSends
— Function.createFromSends(dist::Distributor, exportPIDs::AbstractArray{<:Integer})::Integer
Sets up the Distributor object using a list of process IDs to which we export and the number of IDs being exported. Returns the number of IDs this processor will be receiving
JuliaPetra.createFromRecvs
— Function.createFromRecvs(dist::Distributor{GID, PID, LID}, remoteGIDs::AbstractArray{<:Integer}, remotePIDs::AbstractArray{<:Integer})::Tuple{AbstractArray{GID}, AbstractArray{PID}}
Sets up the Distributor object using a list of remote global IDs and corresponding PIDs. Returns a tuple with the global IDs and their respective processor IDs being sent by me.
JuliaPetra.resolve
— Function.resolve(dist::Distributor, exportObjs::AbstractArray{T})::AbstractArray{T}
Execute the current plan on buffer of export objects and return the objects set to this processor
JuliaPetra.resolvePosts
— Function.resolvePosts(dist::Distributor, exportObjs::AbstractArray)
Post buffer of export objects. Other, local work can be done before resolving the waits. Otherwise, as resolve
.
JuliaPetra.resolveWaits
— Function.resolveWaits(dist::Distributor)::AbstractArray
Wait on a set of posts.
JuliaPetra.resolveReverse
— Function.resolveReverse(dist::Distributor, exportObjs::AbstractArray{T})::AbstractArray{T}
Execute the reverse of the current plan on buffer of export objects and return the objects set to this processor
JuliaPetra.resolveReversePosts
— Function.resolveReversePosts(dist::Distributor, exportObjs::AbstractArray)
Do reverse post of buffer of export objects Other, local work can be done before resolving the waits. Otherwise, as resolveReverse
.
JuliaPetra.resolveReverseWaits
— Function.resolveReverseWaits(dist::Distributor)::AbstractArray
Wait on a set of reverse posts.
Implementations
JuliaPetra.LocalComm
— Type.LocalComm(::Comm{GID, PID, LID})
Creates a comm object that creates an error when inter-process communication is attempted, but still allows access to the correct process ID information
JuliaPetra.SerialComm
— Type.SerialComm()
Gets an serial communication instance. Serial communication results in mostly no-ops for the communication operations
JuliaPetra.SerialDistributor
— Type.SerialDistributor()
Creates a distributor to work with SerialComm
JuliaPetra.MPIComm
— Type.MPIComm()
MPIComm(comm::MPI.Comm)
An implementation of Comm using MPI The no argument constructor uses MPI.COMM_WORLD
JuliaPetra.MPIDistributor
— Type.MPIDistributor{GID, PID, LID}(comm::MPIComm{GID, PID, LID})
Creates an Distributor to work with MPIComm. Created by createDistributor(::MPIComm{GID, PID, LID})