COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Comm Class Reference

#include <Comm.hpp>

Inherits noncopyable.

Public Member Functions

 Comm (int argc, char **args)
 public constructor More...
 
 ~Comm ()
 destructor More...
 
Communicator communicator ()
 
std::string version () const
 Returns the MPI version. More...
 
void init (int argc=0, char **args=0)
 
void finalize ()
 
bool is_initialized () const
 Checks if the PE is initialized ( this is not the opposite of is_finalized ) More...
 
bool is_finalized () const
 Checks if the PE is finalized ( this is not the opposite of is_init ) More...
 
bool is_active () const
 
void barrier ()
 overload the barrier function More...
 
void barrier (Communicator comm)
 
Uint rank () const
 Return rank, additionally, if is_init==0. More...
 
Uint size () const
 Return the number of processes, or 1 if is_init==0. More...
 
void change_status (WorkerStatus::Type status)
 
WorkerStatus::Type status ()
 
Communicator spawn (int count, const char *command, char **args=nullptr, const char *hosts=nullptr)
 
Communicator get_parent () const
 Gets the parent COMM_WORLD of the process. More...
 
Collective all_to_all operations
template<typename T >
T * all_to_all (const T *in_values, const int in_n, T *out_values, const int stride=1)
 
template<typename T >
void all_to_all (const std::vector< T > &in_values, std::vector< T > &out_values, const int stride=1)
 
template<typename T >
T * all_to_all (const T *in_values, const int *in_n, T *out_values, int *out_n, const int stride=1)
 
template<typename T >
T * all_to_all (const T *in_values, const int *in_n, const int *in_map, T *out_values, int *out_n, const int *out_map, const int stride=1)
 
template<typename T >
void all_to_all (const std::vector< T > &in_values, const std::vector< int > &in_n, std::vector< T > &out_values, std::vector< int > &out_n, const int stride=1)
 
template<typename T >
void all_to_all (const std::vector< T > &in_values, const std::vector< int > &in_n, const std::vector< int > &in_map, std::vector< T > &out_values, std::vector< int > &out_n, const std::vector< int > &out_map, const int stride=1)
 
template<typename T >
void all_to_all (const std::vector< std::vector< T > > &send, std::vector< std::vector< T > > &recv)
 
Collective gather operations
template<typename T >
T * gather (const T *in_values, const int in_n, T *out_values, const int root, const int stride=1)
 
template<typename T >
void gather (const std::vector< T > &in_values, std::vector< T > &out_values, const int root, const int stride=1)
 
template<typename T >
T * gather (const T *in_values, const int in_n, T *out_values, int *out_n, const int root, const int stride=1)
 
template<typename T >
T * gather (const T *in_values, const int in_n, const int *in_map, T *out_values, int *out_n, const int *out_map, const int root, const int stride=1)
 
template<typename T >
void gather (const std::vector< T > &in_values, const int in_n, std::vector< T > &out_values, std::vector< int > &out_n, const int root, const int stride=1)
 
template<typename T >
void gather (const std::vector< T > &in_values, const int in_n, const std::vector< int > &in_map, std::vector< T > &out_values, std::vector< int > &out_n, const std::vector< int > &out_map, const int root, const int stride=1)
 
Collective all_gather operations
template<typename T >
T * all_gather (const T *in_values, const int in_n, T *out_values, const int stride=1)
 
template<typename T >
void all_gather (const std::vector< T > &in_values, std::vector< T > &out_values, const int stride=1)
 
template<typename T >
void all_gather (const T &in_value, std::vector< T > &out_values)
 
template<typename T >
T * all_gather (const T *in_values, const int in_n, T *out_values, int *out_n, const int stride=1)
 
template<typename T >
T * all_gather (const T *in_values, const int in_n, const int *in_map, T *out_values, int *out_n, const int *out_map, const int stride=1)
 
template<typename T >
void all_gather (const std::vector< T > &in_values, const int in_n, std::vector< T > &out_values, std::vector< int > &out_n, const int stride=1)
 
template<typename T >
void all_gather (const std::vector< T > &in_values, const int in_n, const std::vector< int > &in_map, std::vector< T > &out_values, std::vector< int > &out_n, const std::vector< int > &out_map, const int stride=1)
 
template<typename T >
void all_gather (const std::vector< T > &send, std::vector< std::vector< T > > &recv)
 
Collective scatter operations
template<typename T >
T * scatter (const T *in_values, const int in_n, T *out_values, const int root, const int stride=1)
 
template<typename T >
void scatter (const std::vector< T > &in_values, std::vector< T > &out_values, const int root, const int stride=1)
 
template<typename T >
T * scatter (const T *in_values, const int *in_n, T *out_values, int &out_n, const int root, const int stride=1)
 
template<typename T >
T * scatter (const T *in_values, const int *in_n, const int *in_map, T *out_values, int &out_n, const int *out_map, const int root, const int stride=1)
 
template<typename T >
void scatter (const std::vector< T > &in_values, const std::vector< int > &in_n, std::vector< T > &out_values, int &out_n, const int root, const int stride=1)
 
template<typename T >
void scatter (const std::vector< T > &in_values, const std::vector< int > &in_n, const std::vector< int > &in_map, std::vector< T > &out_values, int &out_n, const std::vector< int > &out_map, const int root, const int stride=1)
 
Collective reduce operations
template<typename T , typename Op >
T * reduce (const Op &op, const T *in_values, const int in_n, T *out_values, const int root, const int stride=1)
 
template<typename T , typename Op >
void reduce (const Op &op, const std::vector< T > &in_values, std::vector< T > &out_values, const int root, const int stride=1)
 
template<typename T , typename Op >
T * reduce (const Op &op, const T *in_values, const int in_n, const int *in_map, T *out_values, const int *out_map, const int root, const int stride=1)
 
template<typename T , typename Op >
void reduce (const Op &op, const std::vector< T > &in_values, const std::vector< int > &in_map, std::vector< T > &out_values, const std::vector< int > &out_map, const int root, const int stride=1)
 
Collective all_reduce operations
template<typename T , typename Op >
T * all_reduce (const Op &op, const T *in_values, const int in_n, T *out_values, const int stride=1)
 
template<typename T , typename Op >
void all_reduce (const Op &op, const std::vector< T > &in_values, std::vector< T > &out_values, const int stride=1)
 
template<typename T , typename Op >
T * all_reduce (const Op &op, const T *in_values, const int in_n, const int *in_map, T *out_values, const int *out_map, const int stride=1)
 
template<typename T , typename Op >
void all_reduce (const Op &op, const std::vector< T > &in_values, const std::vector< int > &in_map, std::vector< T > &out_values, const std::vector< int > &out_map, const int stride=1)
 
Collective broadcast operations
template<typename T >
T * broadcast (const T *in_values, const int in_n, T *out_values, const int root, const int stride=1)
 
template<typename T >
void broadcast (const std::vector< T > &in_values, std::vector< T > &out_values, const int root, const int stride=1)
 
template<typename T >
T * broadcast (const T *in_values, const int in_n, const int *in_map, T *out_values, const int *out_map, const int root, const int stride=1)
 
template<typename T >
void broadcast (const std::vector< T > &in_values, const std::vector< int > &in_map, std::vector< T > &out_values, const std::vector< int > &out_map, const int root, const int stride=1)
 

Static Public Member Functions

static Comminstance ()
 Return a reference to the current PE. More...
 

Private Member Functions

 Comm ()
 private constructor More...
 

Private Attributes

Communicator m_comm
 comm_world More...
 
WorkerStatus::Type m_current_status
 Current status, default value is #NOT_RUNNING. More...
 

Detailed Description

Base class for the PE Communication with MPI always occurs over a communicator This communicator can then be queried to determine how many processes are running (the "size" of the communicator) and to give a unique number to each process, from zero to the size of the communicator-1 (i.e., the "rank" of the process)

Definition at line 51 of file Comm.hpp.

Constructor & Destructor Documentation

Comm ( int  argc,
char **  args 
)

public constructor

Definition at line 20 of file Comm.cpp.

~Comm ( )

destructor

Definition at line 37 of file Comm.cpp.

Comm ( )
private

private constructor

Definition at line 29 of file Comm.cpp.

Member Function Documentation

T* all_gather ( const T *  in_values,
const int  in_n,
T *  out_values,
const int  stride = 1 
)
inline

Definition at line 192 of file Comm.hpp.

void all_gather ( const std::vector< T > &  in_values,
std::vector< T > &  out_values,
const int  stride = 1 
)
inline

Definition at line 196 of file Comm.hpp.

void all_gather ( const T &  in_value,
std::vector< T > &  out_values 
)
inline

Definition at line 200 of file Comm.hpp.

T* all_gather ( const T *  in_values,
const int  in_n,
T *  out_values,
int *  out_n,
const int  stride = 1 
)
inline

Definition at line 204 of file Comm.hpp.

T* all_gather ( const T *  in_values,
const int  in_n,
const int *  in_map,
T *  out_values,
int *  out_n,
const int *  out_map,
const int  stride = 1 
)
inline

Definition at line 208 of file Comm.hpp.

void all_gather ( const std::vector< T > &  in_values,
const int  in_n,
std::vector< T > &  out_values,
std::vector< int > &  out_n,
const int  stride = 1 
)
inline

Definition at line 212 of file Comm.hpp.

void all_gather ( const std::vector< T > &  in_values,
const int  in_n,
const std::vector< int > &  in_map,
std::vector< T > &  out_values,
std::vector< int > &  out_n,
const std::vector< int > &  out_map,
const int  stride = 1 
)
inline

Definition at line 216 of file Comm.hpp.

void all_gather ( const std::vector< T > &  send,
std::vector< std::vector< T > > &  recv 
)
inline

Definition at line 220 of file Comm.hpp.

T* all_reduce ( const Op &  op,
const T *  in_values,
const int  in_n,
T *  out_values,
const int  stride = 1 
)
inline

Definition at line 282 of file Comm.hpp.

void all_reduce ( const Op &  op,
const std::vector< T > &  in_values,
std::vector< T > &  out_values,
const int  stride = 1 
)
inline

Definition at line 286 of file Comm.hpp.

T* all_reduce ( const Op &  op,
const T *  in_values,
const int  in_n,
const int *  in_map,
T *  out_values,
const int *  out_map,
const int  stride = 1 
)
inline

Definition at line 290 of file Comm.hpp.

void all_reduce ( const Op &  op,
const std::vector< T > &  in_values,
const std::vector< int > &  in_map,
std::vector< T > &  out_values,
const std::vector< int > &  out_map,
const int  stride = 1 
)
inline

Definition at line 294 of file Comm.hpp.

T* all_to_all ( const T *  in_values,
const int  in_n,
T *  out_values,
const int  stride = 1 
)
inline

Definition at line 128 of file Comm.hpp.

void all_to_all ( const std::vector< T > &  in_values,
std::vector< T > &  out_values,
const int  stride = 1 
)
inline

Definition at line 132 of file Comm.hpp.

T* all_to_all ( const T *  in_values,
const int *  in_n,
T *  out_values,
int *  out_n,
const int  stride = 1 
)
inline

Definition at line 136 of file Comm.hpp.

T* all_to_all ( const T *  in_values,
const int *  in_n,
const int *  in_map,
T *  out_values,
int *  out_n,
const int *  out_map,
const int  stride = 1 
)
inline

Definition at line 140 of file Comm.hpp.

void all_to_all ( const std::vector< T > &  in_values,
const std::vector< int > &  in_n,
std::vector< T > &  out_values,
std::vector< int > &  out_n,
const int  stride = 1 
)
inline

Definition at line 144 of file Comm.hpp.

void all_to_all ( const std::vector< T > &  in_values,
const std::vector< int > &  in_n,
const std::vector< int > &  in_map,
std::vector< T > &  out_values,
std::vector< int > &  out_n,
const std::vector< int > &  out_map,
const int  stride = 1 
)
inline

Definition at line 148 of file Comm.hpp.

void all_to_all ( const std::vector< std::vector< T > > &  send,
std::vector< std::vector< T > > &  recv 
)
inline

Definition at line 152 of file Comm.hpp.

void barrier ( )

overload the barrier function

Definition at line 118 of file Comm.cpp.

void barrier ( Communicator  comm)

Sets a barrier on a custom communicator.

Parameters
commThe communicator to set the barrier on.

Definition at line 125 of file Comm.cpp.

T* broadcast ( const T *  in_values,
const int  in_n,
T *  out_values,
const int  root,
const int  stride = 1 
)
inline

Definition at line 304 of file Comm.hpp.

void broadcast ( const std::vector< T > &  in_values,
std::vector< T > &  out_values,
const int  root,
const int  stride = 1 
)
inline

Definition at line 308 of file Comm.hpp.

T* broadcast ( const T *  in_values,
const int  in_n,
const int *  in_map,
T *  out_values,
const int *  out_map,
const int  root,
const int  stride = 1 
)
inline

Definition at line 312 of file Comm.hpp.

void broadcast ( const std::vector< T > &  in_values,
const std::vector< int > &  in_map,
std::vector< T > &  out_values,
const std::vector< int > &  out_map,
const int  root,
const int  stride = 1 
)
inline

Definition at line 316 of file Comm.hpp.

void change_status ( WorkerStatus::Type  status)

Sets current process status.

Parameters
statusNew status
Todo:
the name WorkerStatus is inappropriate, better to name it for example ProcessStatus

Definition at line 156 of file Comm.cpp.

Communicator communicator ( )
inline
Returns
the generic communication channel

Definition at line 65 of file Comm.hpp.

void finalize ( )

Free the PE, careful because some mpi-s fail upon re-init after a proper finalize

Postcondition
will have not a valid state

Definition at line 96 of file Comm.cpp.

T* gather ( const T *  in_values,
const int  in_n,
T *  out_values,
const int  root,
const int  stride = 1 
)
inline

Definition at line 162 of file Comm.hpp.

void gather ( const std::vector< T > &  in_values,
std::vector< T > &  out_values,
const int  root,
const int  stride = 1 
)
inline

Definition at line 166 of file Comm.hpp.

T* gather ( const T *  in_values,
const int  in_n,
T *  out_values,
int *  out_n,
const int  root,
const int  stride = 1 
)
inline

Definition at line 170 of file Comm.hpp.

T* gather ( const T *  in_values,
const int  in_n,
const int *  in_map,
T *  out_values,
int *  out_n,
const int *  out_map,
const int  root,
const int  stride = 1 
)
inline

Definition at line 174 of file Comm.hpp.

void gather ( const std::vector< T > &  in_values,
const int  in_n,
std::vector< T > &  out_values,
std::vector< int > &  out_n,
const int  root,
const int  stride = 1 
)
inline

Definition at line 178 of file Comm.hpp.

void gather ( const std::vector< T > &  in_values,
const int  in_n,
const std::vector< int > &  in_map,
std::vector< T > &  out_values,
std::vector< int > &  out_n,
const std::vector< int > &  out_map,
const int  root,
const int  stride = 1 
)
inline

Definition at line 182 of file Comm.hpp.

Communicator get_parent ( ) const

Gets the parent COMM_WORLD of the process.

Definition at line 202 of file Comm.cpp.

void init ( int  argc = 0,
char **  args = 0 
)

Initialise the PE

Postcondition
will have a valid state

Definition at line 80 of file Comm.cpp.

Comm & instance ( )
static

Return a reference to the current PE.

Definition at line 44 of file Comm.cpp.

bool is_active ( ) const
inline

Checks if the PE is in valid state should be initialized and Communicator pointer is set

Definition at line 83 of file Comm.hpp.

bool is_finalized ( ) const

Checks if the PE is finalized ( this is not the opposite of is_init )

Definition at line 61 of file Comm.cpp.

bool is_initialized ( ) const

Checks if the PE is initialized ( this is not the opposite of is_finalized )

Definition at line 52 of file Comm.cpp.

Uint rank ( ) const

Return rank, additionally, if is_init==0.

Definition at line 135 of file Comm.cpp.

T* reduce ( const Op &  op,
const T *  in_values,
const int  in_n,
T *  out_values,
const int  root,
const int  stride = 1 
)
inline

Definition at line 260 of file Comm.hpp.

void reduce ( const Op &  op,
const std::vector< T > &  in_values,
std::vector< T > &  out_values,
const int  root,
const int  stride = 1 
)
inline

Definition at line 264 of file Comm.hpp.

T* reduce ( const Op &  op,
const T *  in_values,
const int  in_n,
const int *  in_map,
T *  out_values,
const int *  out_map,
const int  root,
const int  stride = 1 
)
inline

Definition at line 268 of file Comm.hpp.

void reduce ( const Op &  op,
const std::vector< T > &  in_values,
const std::vector< int > &  in_map,
std::vector< T > &  out_values,
const std::vector< int > &  out_map,
const int  root,
const int  stride = 1 
)
inline

Definition at line 272 of file Comm.hpp.

T* scatter ( const T *  in_values,
const int  in_n,
T *  out_values,
const int  root,
const int  stride = 1 
)
inline

Definition at line 230 of file Comm.hpp.

void scatter ( const std::vector< T > &  in_values,
std::vector< T > &  out_values,
const int  root,
const int  stride = 1 
)
inline

Definition at line 234 of file Comm.hpp.

T* scatter ( const T *  in_values,
const int *  in_n,
T *  out_values,
int &  out_n,
const int  root,
const int  stride = 1 
)
inline

Definition at line 238 of file Comm.hpp.

T* scatter ( const T *  in_values,
const int *  in_n,
const int *  in_map,
T *  out_values,
int &  out_n,
const int *  out_map,
const int  root,
const int  stride = 1 
)
inline

Definition at line 242 of file Comm.hpp.

void scatter ( const std::vector< T > &  in_values,
const std::vector< int > &  in_n,
std::vector< T > &  out_values,
int &  out_n,
const int  root,
const int  stride = 1 
)
inline

Definition at line 246 of file Comm.hpp.

void scatter ( const std::vector< T > &  in_values,
const std::vector< int > &  in_n,
const std::vector< int > &  in_map,
std::vector< T > &  out_values,
int &  out_n,
const std::vector< int > &  out_map,
const int  root,
const int  stride = 1 
)
inline

Definition at line 250 of file Comm.hpp.

Uint size ( ) const

Return the number of processes, or 1 if is_init==0.

Definition at line 145 of file Comm.cpp.

Communicator spawn ( int  count,
const char *  command,
char **  args = nullptr,
const char *  hosts = nullptr 
)

Spawns new processes by running a specific command.

Parameters
countNumber of processes to spawn.
commandThe command to run.
argsArray of arguments for the command. Can be null.
hostsList of target hosts, in comma-separated format. They need to be referenced in the host file given by the OMPI_MCA_orte_default_hostfile environment variable. If null or empty, processes are spawned on localhost.
Returns
Returns an intercommunicator between this universe and the one newly created.

Definition at line 171 of file Comm.cpp.

WorkerStatus::Type status ( )

Gives the current process status.

Returns
Returns the current process status

Definition at line 164 of file Comm.cpp.

std::string version ( ) const

Returns the MPI version.

Definition at line 70 of file Comm.cpp.

Member Data Documentation

Communicator m_comm
private

comm_world

Definition at line 327 of file Comm.hpp.

WorkerStatus::Type m_current_status
private

Current status, default value is #NOT_RUNNING.

Definition at line 329 of file Comm.hpp.


The documentation for this class was generated from the following files:
Send comments to:
COOLFluiD Web Admin