HMLP: High-performance Machine Learning Primitives
hmlp::mpi Namespace Reference

Classes

class  MPIObject
 
struct  NumberIntPair
 

Typedefs

typedef MPI_Status Status
 
typedef MPI_Request Request
 
typedef MPI_Comm Comm
 
typedef MPI_Datatype Datatype
 
typedef MPI_Op Op
 

Functions

template<typename T >
int SendData (Data< T > &senddata, int dest, mpi::Comm comm)
 
template<typename T >
int RecvData (Data< T > &recvdata, int source, mpi::Comm comm)
 
template<typename T >
int AlltoallData (size_t m, vector< Data< T >> &sendvector, vector< Data< T >> &recvvector, mpi::Comm comm)
 
int Init (int *argc, char ***argv)
 
int Initialized (int *flag)
 
int Finalize (void)
 
int Finalized (int *flag)
 
int Send (const void *buf, int count, Datatype datatype, int dest, int tag, Comm comm)
 
int Isend (const void *buf, int count, Datatype datatype, int dest, int tag, Comm comm, Request *request)
 
int Recv (void *buf, int count, Datatype datatype, int source, int tag, Comm comm, Status *status)
 
int Irecv (void *buf, int count, Datatype datatype, int source, int tag, Comm comm, Request *request)
 
int Sendrecv (void *sendbuf, int sendcount, Datatype sendtype, int dest, int sendtag, void *recvbuf, int recvcount, Datatype recvtype, int source, int recvtag, Comm comm, Status *status)
 
int Get_count (Status *status, Datatype datatype, int *count)
 
int Comm_size (Comm comm, int *size)
 
int Comm_rank (Comm comm, int *rank)
 
int Comm_dup (Comm comm, Comm *newcomm)
 
int Comm_split (Comm comm, int color, int key, Comm *newcomm)
 
int Type_contiguous (int count, Datatype oldtype, Datatype *newtype)
 
int Type_commit (Datatype *datatype)
 
int Test (Request *request, int *flag, Status *status)
 
int Bcast (void *buffer, int count, Datatype datatype, int root, Comm comm)
 
int Barrier (Comm comm)
 
int Ibarrier (Comm comm, Request *request)
 
int Reduce (void *sendbuf, void *recvbuf, int count, Datatype datatype, Op op, int root, Comm comm)
 
int Gather (const void *sendbuf, int sendcount, Datatype sendtype, void *recvbuf, int recvcount, Datatype recvtype, int root, Comm comm)
 
int Gatherv (void *sendbuf, int sendcount, Datatype sendtype, void *recvbuf, const int *recvcounts, const int *displs, Datatype recvtype, int root, Comm comm)
 
int Scan (void *sendbuf, void *recvbuf, int count, Datatype datatype, Op op, Comm comm)
 
int Allreduce (void *sendbuf, void *recvbuf, int count, Datatype datatype, Op op, Comm comm)
 
int Allgather (void *sendbuf, int sendcount, Datatype sendtype, void *recvbuf, int recvcount, Datatype recvtype, Comm comm)
 
int Allgatherv (void *sendbuf, int sendcount, Datatype sendtype, void *recvbuf, int *recvcounts, int *displs, Datatype recvtype, Comm comm)
 
int Alltoall (void *sendbuf, int sendcount, Datatype sendtype, void *recvbuf, int recvcount, Datatype recvtype, Comm comm)
 
int Alltoallv (void *sendbuf, int *sendcounts, int *sdispls, Datatype sendtype, void *recvbuf, int *recvcounts, int *rdispls, Datatype recvtype, Comm comm)
 
int Init_thread (int *argc, char ***argv, int required, int *provided)
 
int Probe (int source, int tag, Comm comm, Status *status)
 
int Iprobe (int source, int tag, Comm comm, int *flag, Status *status)
 
void PrintProgress (const char *s, mpi::Comm comm)
 
template<typename T >
Datatype GetMPIDatatype ()
 
template<typename TSEND >
int Send (TSEND *buf, int count, int dest, int tag, Comm comm)
 
template<typename TSEND >
int Isend (TSEND *buf, int count, int dest, int tag, Comm comm, Request *request)
 
template<typename TRECV >
int Recv (TRECV *buf, int count, int source, int tag, Comm comm, Status *status)
 
template<typename T >
int Bcast (T *buffer, int count, int root, Comm comm)
 
template<typename TSEND , typename TRECV >
int Sendrecv (TSEND *sendbuf, int sendcount, int dest, int sendtag, TRECV *recvbuf, int recvcount, int source, int recvtag, Comm comm, Status *status)
 
template<typename T >
int Reduce (T *sendbuf, T *recvbuf, int count, Op op, int root, Comm comm)
 
template<typename TSEND , typename TRECV >
int Gather (const TSEND *sendbuf, int sendcount, TRECV *recvbuf, int recvcount, int root, Comm comm)
 
template<typename TSEND , typename TRECV >
int Gatherv (TSEND *sendbuf, int sendcount, TRECV *recvbuf, const int *recvcounts, const int *displs, int root, Comm comm)
 
template<typename T >
int Allreduce (T *sendbuf, T *recvbuf, int count, Op op, Comm comm)
 
template<typename TSEND , typename TRECV >
int Allgather (TSEND *sendbuf, int sendcount, TRECV *recvbuf, int recvcount, Comm comm)
 
template<typename TSEND , typename TRECV >
int Allgatherv (TSEND *sendbuf, int sendcount, TRECV *recvbuf, int *recvcounts, int *displs, Comm comm)
 
template<typename TSEND , typename TRECV >
int Alltoall (TSEND *sendbuf, int sendcount, TRECV *recvbuf, int recvcount, Comm comm)
 
template<typename TSEND , typename TRECV >
int Alltoallv (TSEND *sendbuf, int *sendcounts, int *sdispls, TRECV *recvbuf, int *recvcounts, int *rdispls, Comm comm)
 
template<class T , class Allocator = std::allocator<T>>
int SendVector (std::vector< T, Allocator > &bufvector, int dest, int tag, Comm comm)
 This is a short hand for sending a vector, which involves two MPI_Send() calls. More...
 
template<class T , class Allocator = std::allocator<T>>
int RecvVector (std::vector< T, Allocator > &bufvector, int source, int tag, Comm comm, Status *status)
 This is a short hand for receving a vector, which involves two MPI_Recv() calls. More...
 
template<class T , class Allocator = std::allocator<T>>
int ExchangeVector (vector< T, Allocator > &sendvector, int dest, int sendtag, vector< T, Allocator > &recvvector, int source, int recvtag, Comm comm, Status *status)
 
template<typename T >
int GatherVector (vector< T > &sendvector, vector< T > &recvvector, int root, Comm comm)
 
template<class T , class Allocator = std::allocator<T>>
int AlltoallVector (const vector< vector< T, Allocator >> &sendvector, vector< vector< T, Allocator >> &recvvector, Comm comm)
 

Detailed Description

MPI compatable interface

Function Documentation

template<typename TSEND , typename TRECV >
int hmlp::mpi::Allgather ( TSEND *  sendbuf,
int  sendcount,
TRECV *  recvbuf,
int  recvcount,
Comm  comm 
)

end Allreduce()

template<typename TSEND , typename TRECV >
int hmlp::mpi::Allgatherv ( TSEND *  sendbuf,
int  sendcount,
TRECV *  recvbuf,
int *  recvcounts,
int *  displs,
Comm  comm 
)

end Allgather()

template<typename T >
int hmlp::mpi::Allreduce ( T *  sendbuf,
T *  recvbuf,
int  count,
Op  op,
Comm  comm 
)

end Gatherv()

template<typename TSEND , typename TRECV >
int hmlp::mpi::Alltoall ( TSEND *  sendbuf,
int  sendcount,
TRECV *  recvbuf,
int  recvcount,
Comm  comm 
)

end Allgatherv()

template<typename T >
int hmlp::mpi::AlltoallData ( size_t  m,
vector< Data< T >> &  sendvector,
vector< Data< T >> &  recvvector,
mpi::Comm  comm 
)

end RecvData() This interface supports hmlp::Data. [ m, n ] will be set after the routine.

determine the concatenated dimension

all data need to have the same m

Exchange sendcount.

Compute total receiving count.

Resize receving buffer.

template<typename TSEND , typename TRECV >
int hmlp::mpi::Alltoallv ( TSEND *  sendbuf,
int *  sendcounts,
int *  sdispls,
TRECV *  recvbuf,
int *  recvcounts,
int *  rdispls,
Comm  comm 
)

end Alltoall()

template<class T , class Allocator = std::allocator<T>>
int hmlp::mpi::AlltoallVector ( const vector< vector< T, Allocator >> &  sendvector,
vector< vector< T, Allocator >> &  recvvector,
Comm  comm 
)

end GatherVector() use default stl allocator

exchange sendcount

resize receving buffer

template<typename T >
int hmlp::mpi::Bcast ( T *  buffer,
int  count,
int  root,
Comm  comm 
)

end Recv()

int hmlp::mpi::Comm_rank ( Comm  comm,
int *  rank 
)

only one process with rank 0

int hmlp::mpi::Comm_size ( Comm  comm,
int *  size 
)

only one process with rank 0

template<class T , class Allocator = std::allocator<T>>
int hmlp::mpi::ExchangeVector ( vector< T, Allocator > &  sendvector,
int  dest,
int  sendtag,
vector< T, Allocator > &  recvvector,
int  source,
int  recvtag,
Comm  comm,
Status status 
)

end RecvVector() use default stl allocator

exechange size

resize receiving vector

exechange buffer

template<typename TSEND , typename TRECV >
int hmlp::mpi::Gather ( const TSEND *  sendbuf,
int  sendcount,
TRECV *  recvbuf,
int  recvcount,
int  root,
Comm  comm 
)

end Reduce()

template<typename T >
int hmlp::mpi::GatherVector ( vector< T > &  sendvector,
vector< T > &  recvvector,
int  root,
Comm  comm 
)

end ExchangeVector()

Use typeless Gather() for counting.

Accumulate received displs.

Resize recvvector to fit.

Gather vectors.

int hmlp::mpi::Init ( int *  argc,
char ***  argv 
)

MPI 1.0 functionality

int hmlp::mpi::Init_thread ( int *  argc,
char ***  argv,
int  required,
int *  provided 
)

MPI 2.0 and 3.0 functionality.

MPI 2.0 and 3.0 functionality

Set *provided to required.

Return without any error.

int hmlp::mpi::Iprobe ( int  source,
int  tag,
Comm  comm,
int *  flag,
Status status 
)

end Probe()

template<typename TSEND >
int hmlp::mpi::Isend ( TSEND *  buf,
int  count,
int  dest,
int  tag,
Comm  comm,
Request *  request 
)

end Send()

void hmlp::mpi::PrintProgress ( const char *  s,
mpi::Comm  comm 
)

end Iprobe() HMLP MPI extension

HMLP MPI extension

template<typename TRECV >
int hmlp::mpi::Recv ( TRECV *  buf,
int  count,
int  source,
int  tag,
Comm  comm,
Status status 
)

end Isend()

template<typename T >
int hmlp::mpi::RecvData ( Data< T > &  recvdata,
int  source,
mpi::Comm  comm 
)

end SendData()

template<class T , class Allocator = std::allocator<T>>
int hmlp::mpi::RecvVector ( std::vector< T, Allocator > &  bufvector,
int  source,
int  tag,
Comm  comm,
Status status 
)

This is a short hand for receving a vector, which involves two MPI_Recv() calls.

end SendVector() use default stl allocator

recv the count size first

resize receiving vector

now recv the vector itself

template<typename T >
int hmlp::mpi::Reduce ( T *  sendbuf,
T *  recvbuf,
int  count,
Op  op,
int  root,
Comm  comm 
)

end Sendrecv()

template<typename TSEND >
int hmlp::mpi::Send ( TSEND *  buf,
int  count,
int  dest,
int  tag,
Comm  comm 
)

end GetMPIDatatype()

template<typename TSEND , typename TRECV >
int hmlp::mpi::Sendrecv ( TSEND *  sendbuf,
int  sendcount,
int  dest,
int  sendtag,
TRECV *  recvbuf,
int  recvcount,
int  source,
int  recvtag,
Comm  comm,
Status status 
)

end Bcast()

template<class T , class Allocator = std::allocator<T>>
int hmlp::mpi::SendVector ( std::vector< T, Allocator > &  bufvector,
int  dest,
int  tag,
Comm  comm 
)

This is a short hand for sending a vector, which involves two MPI_Send() calls.

end Alltoallv() use default stl allocator

send the count size first

now send the vector itself

int hmlp::mpi::Test ( Request *  request,
int *  flag,
Status status 
)

Set *flag = 1 to prevent blocking.