geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
geopm::Comm Class Referenceabstract

Abstract base class for interprocess communication in geopm. More...

#include <Comm.hpp>

Inheritance diagram for geopm::Comm:
Inheritance graph
[legend]

Public Types

enum  m_comm_split_type_e { M_COMM_SPLIT_TYPE_PPN1 , M_COMM_SPLIT_TYPE_SHARED , M_NUM_COMM_SPLIT_TYPE }
 
enum  m_split_color_e { M_SPLIT_COLOR_UNDEFINED = -16 }
 

Public Member Functions

 Comm ()=default
 Constructor for global communicator. More...
 
 Comm (const Comm &other)=default
 
Commoperator= (const Comm &other)=default
 
virtual ~Comm ()=default
 Default destructor. More...
 
virtual std::shared_ptr< Commsplit () const =0
 
virtual std::shared_ptr< Commsplit (int color, int key) const =0
 
virtual std::shared_ptr< Commsplit (const std::string &tag, int split_type) const =0
 
virtual std::shared_ptr< Commsplit (std::vector< int > dimensions, std::vector< int > periods, bool is_reorder) const =0
 
virtual std::shared_ptr< Commsplit_cart (std::vector< int > dimensions) const =0
 
virtual bool comm_supported (const std::string &description) const =0
 
virtual int cart_rank (const std::vector< int > &coords) const =0
 Process rank within Cartesian communicator. More...
 
virtual int rank (void) const =0
 Process rank within communicator. More...
 
virtual int num_rank (void) const =0
 Number of ranks in the communicator. More...
 
virtual void dimension_create (int num_ranks, std::vector< int > &dimension) const =0
 Populate vector of optimal dimensions given the number of ranks the communicator. More...
 
virtual void free_mem (void *base)=0
 Free memory that was allocated for message passing and RMA. More...
 
virtual void alloc_mem (size_t size, void **base)=0
 Allocate memory for message passing and RMA. More...
 
virtual size_t window_create (size_t size, void *base)=0
 Create window for message passing and RMA. More...
 
virtual void window_destroy (size_t window_id)=0
 Destroy window for message passing and RMA. More...
 
virtual void window_lock (size_t window_id, bool is_exclusive, int rank, int assert) const =0
 Begin epoch for message passing and RMA. More...
 
virtual void window_unlock (size_t window_id, int rank) const =0
 End epoch for message passing and RMA. More...
 
virtual void coordinate (int rank, std::vector< int > &coord) const =0
 Coordinate in Cartesian grid for specified rank. More...
 
virtual std::vector< int > coordinate (int rank) const =0
 
virtual void barrier (void) const =0
 Barrier for all ranks. More...
 
virtual void broadcast (void *buffer, size_t size, int root) const =0
 Broadcast a message to all ranks. More...
 
virtual bool test (bool is_true) const =0
 Test whether or not all ranks in the communicator present the same input and return true/false accordingly. More...
 
virtual void reduce_max (double *send_buf, double *recv_buf, size_t count, int root) const =0
 Reduce distributed messages across all ranks using specified operation, store result on all ranks. More...
 
virtual void gather (const void *send_buf, size_t send_size, void *recv_buf, size_t recv_size, int root) const =0
 Gather bytes from all processes. More...
 
virtual void gatherv (const void *send_buf, size_t send_size, void *recv_buf, const std::vector< size_t > &recv_sizes, const std::vector< off_t > &rank_offset, int root) const =0
 Gather bytes into specified location from all processes. More...
 
virtual void window_put (const void *send_buf, size_t send_size, int rank, off_t disp, size_t window_id) const =0
 Perform message passing or RMA. More...
 
virtual void tear_down (void)=0
 Clean up resources held by the comm. This allows static global objects to be cleaned up before the destructor is called. More...
 

Static Public Member Functions

static std::vector< std::string > comm_names (void)
 
static std::unique_ptr< Commmake_unique (const std::string &comm_name)
 
static std::unique_ptr< Commmake_unique (void)
 

Static Public Attributes

static const std::string M_PLUGIN_PREFIX = "libgeopmcomm_"
 

Detailed Description

Abstract base class for interprocess communication in geopm.

Member Enumeration Documentation

◆ m_comm_split_type_e

Enumerator
M_COMM_SPLIT_TYPE_PPN1 
M_COMM_SPLIT_TYPE_SHARED 
M_NUM_COMM_SPLIT_TYPE 

◆ m_split_color_e

Enumerator
M_SPLIT_COLOR_UNDEFINED 

Constructor & Destructor Documentation

◆ Comm() [1/2]

geopm::Comm::Comm ( )
default

Constructor for global communicator.

◆ Comm() [2/2]

geopm::Comm::Comm ( const Comm other)
default

◆ ~Comm()

virtual geopm::Comm::~Comm ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ alloc_mem()

virtual void geopm::Comm::alloc_mem ( size_t  size,
void **  base 
)
pure virtual

Allocate memory for message passing and RMA.

Parameters
[in]sizeSize of the desired memory allocation.
[out]baseAddress of allocated memory.

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ barrier()

virtual void geopm::Comm::barrier ( void  ) const
pure virtual

Barrier for all ranks.

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ broadcast()

virtual void geopm::Comm::broadcast ( void *  buffer,
size_t  size,
int  root 
) const
pure virtual

Broadcast a message to all ranks.

Parameters
[in,out]bufferStarting address of buffer to be broadcasted.
[in]sizeSize of the buffer.
[in]rootRank of the broadcast root (target).

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ cart_rank()

virtual int geopm::Comm::cart_rank ( const std::vector< int > &  coords) const
pure virtual

Process rank within Cartesian communicator.

Parameters
[in]coordsCoordinate of Cartesian communicator member whose rank we wish to know.

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ comm_names()

std::vector< std::string > geopm::Comm::comm_names ( void  )
static
Returns
a list of all valid plugin names in the Comm interface

◆ comm_supported()

virtual bool geopm::Comm::comm_supported ( const std::string &  description) const
pure virtual

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ coordinate() [1/2]

virtual std::vector<int> geopm::Comm::coordinate ( int  rank) const
pure virtual

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ coordinate() [2/2]

virtual void geopm::Comm::coordinate ( int  rank,
std::vector< int > &  coord 
) const
pure virtual

Coordinate in Cartesian grid for specified rank.

Parameters
[in]rankRank for which coordinates should be calculated
[in,out]coordCartesian coordinates of specified rank. The size of this vector should equal the number of dimensions that the Cartesian communicator was created with.

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ dimension_create()

virtual void geopm::Comm::dimension_create ( int  num_ranks,
std::vector< int > &  dimension 
) const
pure virtual

Populate vector of optimal dimensions given the number of ranks the communicator.

Parameters
[in]num_ranksNumber of ranks that must fit in Cartesian grid.
[in,out]dimensionNumber of ranks per dimension. The size of this vector dictates the number of dimensions in the grid. Fill indices with 0 for API to fill with suitable value.

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ free_mem()

virtual void geopm::Comm::free_mem ( void *  base)
pure virtual

Free memory that was allocated for message passing and RMA.

Parameters
[in]baseAddress of memory to be released.

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ gather()

virtual void geopm::Comm::gather ( const void *  send_buf,
size_t  send_size,
void *  recv_buf,
size_t  recv_size,
int  root 
) const
pure virtual

Gather bytes from all processes.

Parameters
[in]send_bufStart address of memory buffer to be transmitted.
[in]send_sizeSize of buffer to be sent.
[out]recv_bufStart address of memory buffer to receive data.
[in]recv_sizeThe size of the buffer to be received.
[in]rootRank of the target for the transmission.

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ gatherv()

virtual void geopm::Comm::gatherv ( const void *  send_buf,
size_t  send_size,
void *  recv_buf,
const std::vector< size_t > &  recv_sizes,
const std::vector< off_t > &  rank_offset,
int  root 
) const
pure virtual

Gather bytes into specified location from all processes.

Parameters
[in]send_bufStart address of memory buffer to be transmitted.
[in]send_sizeSize of buffer to be sent.
[out]recv_bufStart address of memory buffer to receive data.
[in]recv_sizesVector describing the buffer size per rank to be received.
[in]rank_offsetOffset per rank into target buffer for transmitted data.
[in]rootRank of the target for the transmission.

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ make_unique() [1/2]

std::unique_ptr< Comm > geopm::Comm::make_unique ( const std::string &  comm_name)
static

◆ make_unique() [2/2]

std::unique_ptr< Comm > geopm::Comm::make_unique ( void  )
static

◆ num_rank()

virtual int geopm::Comm::num_rank ( void  ) const
pure virtual

Number of ranks in the communicator.

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ operator=()

Comm& geopm::Comm::operator= ( const Comm other)
default

◆ rank()

virtual int geopm::Comm::rank ( void  ) const
pure virtual

Process rank within communicator.

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ reduce_max()

virtual void geopm::Comm::reduce_max ( double *  send_buf,
double *  recv_buf,
size_t  count,
int  root 
) const
pure virtual

Reduce distributed messages across all ranks using specified operation, store result on all ranks.

Parameters
[in]send_bufStart address of memory buffer to be transmitted.
[out]recv_bufStart address of memory buffer to receive data.
[in]countSize of buffer in bytes to be transmitted.

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ split() [1/4]

virtual std::shared_ptr<Comm> geopm::Comm::split ( ) const
pure virtual

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ split() [2/4]

virtual std::shared_ptr<Comm> geopm::Comm::split ( const std::string &  tag,
int  split_type 
) const
pure virtual

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ split() [3/4]

virtual std::shared_ptr<Comm> geopm::Comm::split ( int  color,
int  key 
) const
pure virtual

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ split() [4/4]

virtual std::shared_ptr<Comm> geopm::Comm::split ( std::vector< int >  dimensions,
std::vector< int >  periods,
bool  is_reorder 
) const
pure virtual

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ split_cart()

virtual std::shared_ptr<Comm> geopm::Comm::split_cart ( std::vector< int >  dimensions) const
pure virtual

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ tear_down()

virtual void geopm::Comm::tear_down ( void  )
pure virtual

Clean up resources held by the comm. This allows static global objects to be cleaned up before the destructor is called.

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ test()

virtual bool geopm::Comm::test ( bool  is_true) const
pure virtual

Test whether or not all ranks in the communicator present the same input and return true/false accordingly.

Parameters
[in]is_trueBoolean value to be reduced from all ranks.

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ window_create()

virtual size_t geopm::Comm::window_create ( size_t  size,
void *  base 
)
pure virtual

Create window for message passing and RMA.

Returns
window handle for subsequent operations on the window.
Parameters
[in]sizeSize of the memory area backing the RMA window.
[in]baseAddress of memory that has been allocated for the window.

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ window_destroy()

virtual void geopm::Comm::window_destroy ( size_t  window_id)
pure virtual

Destroy window for message passing and RMA.

Parameters
[in]window_idThe window handle for the target window.

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ window_lock()

virtual void geopm::Comm::window_lock ( size_t  window_id,
bool  is_exclusive,
int  rank,
int  assert 
) const
pure virtual

Begin epoch for message passing and RMA.

Parameters
[in]window_idThe window handle for the target window.
[in]is_exclusiveLock type for the window, true for exclusive lock, false for shared.
[in]rankRank of the locked window.
[in]assertUsed to optimize call.

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ window_put()

virtual void geopm::Comm::window_put ( const void *  send_buf,
size_t  send_size,
int  rank,
off_t  disp,
size_t  window_id 
) const
pure virtual

Perform message passing or RMA.

Parameters
[in]send_bufStarting address of buffer to be transmitted via window.
[in]send_sizeSize in bytes of buffer to be sent.
[in]rankTarget rank of the transmission.
[in]dispDisplacement from start of window.
[in]window_idThe window handle for the target window.

Implemented in geopm::MPIComm, and geopm::NullComm.

◆ window_unlock()

virtual void geopm::Comm::window_unlock ( size_t  window_id,
int  rank 
) const
pure virtual

End epoch for message passing and RMA.

Parameters
[in]window_idThe window handle for the target window.
[in]rankRank of the locked window.

Implemented in geopm::MPIComm, and geopm::NullComm.

Member Data Documentation

◆ M_PLUGIN_PREFIX

const std::string geopm::Comm::M_PLUGIN_PREFIX = "libgeopmcomm_"
static

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