MADNESS  version 0.9
Classes | Public Member Functions | Friends | List of all members
SafeMPI::Intracomm Class Reference

Wrapper around MPI_Comm. Has a shallow copy constructor; use Create(Get_group()) for deep copy. More...

#include <safempi.h>

Inheritance diagram for SafeMPI::Intracomm:
Inheritance graph
[legend]

Public Member Functions

 Intracomm (const WorldInitObject &)
 
 Intracomm (const MPI_Comm &comm, bool take_ownership_of_comm=true)
 
 Intracomm (const Intracomm &other)
 
 ~Intracomm ()
 
Intracomm Create (Group group) const
 
bool operator== (const Intracomm &other) const
 
Group Get_group () const
 
MPI_CommGet_mpi_comm () const
 
int Get_rank () const
 
int Get_size () const
 
Request Isend (const void *buf, const int count, const MPI_Datatype datatype, const int dest, const int tag) const
 
Request Irecv (void *buf, const int count, const MPI_Datatype datatype, const int src, const int tag) const
 
void Send (const void *buf, const int count, const MPI_Datatype datatype, int dest, int tag) const
 
void Recv (void *buf, const int count, const MPI_Datatype datatype, const int source, const int tag, MPI_Status &status) const
 
void Recv (void *buf, const int count, const MPI_Datatype datatype, const int source, const int tag) const
 
void Bcast (void *buf, size_t count, const MPI_Datatype datatype, const int root) const
 
void Reduce (const void *sendbuf, void *recvbuf, const int count, const MPI_Datatype datatype, const MPI_Op op, const int root) const
 
void Allreduce (const void *sendbuf, void *recvbuf, const int count, const MPI_Datatype datatype, const MPI_Op op) const
 
bool Get_attr (int key, void *value) const
 
void Abort (int code=1) const
 
void Barrier () const
 
int unique_tag ()
 Returns a unique tag for temporary use (1023<tag<=4095) More...
 
int unique_reserved_tag ()
 Returns a unique tag reserved for long-term use (0<tag<1000) More...
 
void binary_tree_info (int root, int &parent, int &child0, int &child1)
 Construct info about a binary tree with given root. More...
 

Friends

void SafeMPI::detail::init_comm_world ()
 
int Finalize ()
 Analogous to MPI_Finalize. More...
 

Detailed Description

Wrapper around MPI_Comm. Has a shallow copy constructor; use Create(Get_group()) for deep copy.

Constructor & Destructor Documentation

SafeMPI::Intracomm::Intracomm ( const WorldInitObject &  init)
SafeMPI::Intracomm::Intracomm ( const MPI_Comm comm,
bool  take_ownership_of_comm = true 
)
inlineexplicit
SafeMPI::Intracomm::Intracomm ( const Intracomm other)
inline
SafeMPI::Intracomm::~Intracomm ( )
inline

Member Function Documentation

void SafeMPI::Intracomm::Abort ( int  code = 1) const
inline

References MPI_Abort().

Referenced by madness::error().

void SafeMPI::Intracomm::Allreduce ( const void *  sendbuf,
void *  recvbuf,
const int  count,
const MPI_Datatype  datatype,
const MPI_Op  op 
) const
inline
void SafeMPI::Intracomm::Barrier ( ) const
inline

References MADNESS_MPI_TEST, MPI_Barrier(), and SAFE_MPI_GLOBAL_MUTEX.

Referenced by main().

void SafeMPI::Intracomm::Bcast ( void *  buf,
size_t  count,
const MPI_Datatype  datatype,
const int  root 
) const
inline
void SafeMPI::Intracomm::binary_tree_info ( int  root,
int &  parent,
int &  child0,
int &  child1 
)

Construct info about a binary tree with given root.

Constructs a binary tree spanning the communicator with process root as the root of the tree. Returns the logical parent and children in the tree of the calling process. If there is no parent/child the value -1 will be set.

References Get_rank(), Get_size(), np, and mpfr::root().

Referenced by madness::WorldGopInterface::broadcast(), and madness::WorldGopInterface::fence().

Intracomm SafeMPI::Intracomm::Create ( Group  group) const
inline

This collective operation creates a new Intracomm from an Intracomm::Group object. Must be called by all processes that belong to this communicator, but not all must use the same group . Thus this Intracomm can be partitioned into several Intracomm objects with one call.

Parameters
groupIntracomm::Group describing the Intracomm object to be created (Intracomm::Get_group() and Intracomm::Group::Incl() )
Returns
a new Intracomm object

References SafeMPI::Group::group(), MADNESS_MPI_TEST, MPI_Comm_create(), MPI_Comm_rank(), MPI_Comm_size(), and SAFE_MPI_GLOBAL_MUTEX.

bool SafeMPI::Intracomm::Get_attr ( int  key,
void *  value 
) const
inline
Group SafeMPI::Intracomm::Get_group ( ) const
inline

This local operation returns the Intracomm::Group object corresponding to this intracommunicator

Returns
the Intracomm::Group object corresponding to this intracommunicator

References SAFE_MPI_GLOBAL_MUTEX.

Referenced by madness::WorldAmInterface::WorldAmInterface().

MPI_Comm& SafeMPI::Intracomm::Get_mpi_comm ( ) const
inline
int SafeMPI::Intracomm::Get_rank ( ) const
inline
int SafeMPI::Intracomm::Get_size ( ) const
inline
Request SafeMPI::Intracomm::Irecv ( void *  buf,
const int  count,
const MPI_Datatype  datatype,
const int  src,
const int  tag 
) const
inline
Request SafeMPI::Intracomm::Isend ( const void *  buf,
const int  count,
const MPI_Datatype  datatype,
const int  dest,
const int  tag 
) const
inline
bool SafeMPI::Intracomm::operator== ( const Intracomm other) const
inline
void SafeMPI::Intracomm::Recv ( void *  buf,
const int  count,
const MPI_Datatype  datatype,
const int  source,
const int  tag,
MPI_Status status 
) const
inline
void SafeMPI::Intracomm::Recv ( void *  buf,
const int  count,
const MPI_Datatype  datatype,
const int  source,
const int  tag 
) const
inline
void SafeMPI::Intracomm::Reduce ( const void *  sendbuf,
void *  recvbuf,
const int  count,
const MPI_Datatype  datatype,
const MPI_Op  op,
const int  root 
) const
inline
void SafeMPI::Intracomm::Send ( const void *  buf,
const int  count,
const MPI_Datatype  datatype,
int  dest,
int  tag 
) const
inline
int SafeMPI::Intracomm::unique_reserved_tag ( )
inline

Returns a unique tag reserved for long-term use (0<tag<1000)

Get a tag from this routine for long-term/repeated use.

Tags in [1000,1023] are statically assigned.

int SafeMPI::Intracomm::unique_tag ( )
inline

Returns a unique tag for temporary use (1023<tag<=4095)

These tags are intended for one time use to avoid tag collisions with other messages around the same time period. It simply increments/wraps a counter and returns the next legal value.

So that send and receiver agree on the tag all processes need to call this routine in the same sequence.

Referenced by madness::WorldGopInterface::broadcast(), madness::WorldGopInterface::fence(), and madness::archive::ArchiveStoreImpl< ParallelOutputArchive, WorldContainer< keyT, valueT > >::store().

Friends And Related Function Documentation

int Finalize ( )
friend

Analogous to MPI_Finalize.

This returns status rather than throw an exception upon failure because this is a "destructor", and throwing from destructors is evil.

Returns
0 if successful, nonzero otherwise (see MPI_Finalize() for the return codes).

The documentation for this class was generated from the following files: