BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
commtools.hpp File Reference
#include <limits>
#include <type_traits>
#include <string>
#include "typedefs.hpp"
#include "assert.hpp"
#include "cl_Vector.hpp"
#include "cl_Matrix.hpp"
#include "cl_Communicator.hpp"
#include "commtypes.hpp"
Include dependency graph for commtools.hpp:

Go to the source code of this file.

Classes

struct  belfem::is_scalar< T >
struct  belfem::is_scalar< Vector< T > >
struct  belfem::is_scalar< Matrix< T > >

Namespaces

namespace  belfem
 USER GUIDES:

Functions

proc_t belfem::comm_size ()
 Returns the number of processes in the communicator.
proc_t belfem::comm_rank ()
 Returns the rank of the current process in the communicator.
void belfem::comm_check (const int aErrorCode)
 Checks the MPI error code and reports any errors.
void belfem::comm_barrier ()
 Synchronizes all processes in the communicator.
void belfem::comm_drain_check (const char *aLabel)
 Debug-build tripwire for the two-tags-per-pair ordering contract of the point-to-point fabric ( see comm_tag() in commtools.cpp ).
int belfem::comm_tag (const proc_t aSource, const proc_t aTarget)
 Generates a unique tag for MPI communication between two processes.
Cell< int > belfem::comm_split (const index_t aLength)
 Splits a message into chunks for MPI communication.
index_t belfem::comm_splitcount (const Vector< index_t > &aLengths, const proc_t aRoot)
 Calculates the total number of chunks needed for a set of message lengths.
index_t belfem::comm_splitcount (index_t aLength)
template<typename T>
void belfem::broadcast (T &aMessage, const proc_t aRoot=0, typename std::enable_if< is_scalar< T >::value >::type *=nullptr)
 Broadcasts a scalar value to all processes.
template<typename T>
void belfem::broadcast (T *aMessage, const proc_t aRoot, const proc_t aLength)
template<typename T>
void belfem::allreduce (const T *aSend, T *aRecv, const int aCount)
 Collective MAX-reduction visible on every rank.
template<typename T>
void belfem::allreduce_min (const T *aSend, T *aRecv, const int aCount)
 Collective MIN-reduction visible on every rank.
template<typename T>
void belfem::send (const T aData, const proc_t aTarget=0, typename std::enable_if< is_scalar< T >::value >::type *=nullptr)
 Sends a scalar value to a specific target process.
template<typename T>
void belfem::receive (T &aData, const proc_t aSource=0, typename std::enable_if< is_scalar< T >::value >::type *=nullptr)
 Receives a scalar value from a specific source process.
template<typename T>
void belfem::send (T *aData, const index_t aLength, const proc_t aTarget)
 Sends a raw array to a specified target process using MPI.
template<typename T>
void belfem::receive (T *aData, index_t &aLength, const proc_t aSource)
 Receives a raw array from a specified source process using MPI.
template<typename T>
void belfem::send (Cell< T > &aData, const proc_t aTarget=0)
 Sends a cell to a specific target process.
template<typename T>
void belfem::receive (Cell< T > &aData, const proc_t aSource=0)
 Receives a cell from a specific source process.
template<typename T>
void belfem::broadcast (Cell< T > &aData, const proc_t aRoot=0)
 Broadcasts a cell to all processes.
template<typename T>
void belfem::distribute (Cell< T > &aData)
 Distributes elements of a cell to other processes.
template<typename T>
void belfem::collect (Cell< T > &aData, const T aMyValue=0)
 Collects scalar values from all processes into a cell.
template<typename T>
void belfem::send (Vector< T > &aData, const proc_t aTarget=0)
 Sends a vector to a specific target process.
template<typename T>
void belfem::receive (Vector< T > &aData, const proc_t aSource=0)
 Receives a vector from a specific source process.
template<typename T>
void belfem::broadcast (Vector< T > &aData, const proc_t aRoot=0)
 Broadcasts a vector to all processes.
template<typename T>
void belfem::distribute (Vector< T > &aData)
 Distributes elements of a vector to other processes.
template<typename T>
void belfem::collect (Vector< T > &aData, const T aMyValue=0)
 Collects scalar values from all processes into a vector.
template<typename T>
void belfem::distribute (Cell< Vector< T > > &aData)
 Distributes a collection of vectors to other processes.
template<typename T>
void belfem::distribute (Cell< Cell< T > > &aData)
 Distributes a collection of cells to other processes.
template<typename T, typename U>
void belfem::distribute (const T *aData, const Vector< U > &aOffsets)
 Distributes a raw vector based on lengths and offsets.
template<typename T, typename U>
void belfem::collect (T *aData, const Vector< U > &aOffsets)
template<typename T>
void belfem::collect (Cell< Vector< T > > &aData, Vector< T > aMyData={})
 Collects vectors from all processes into a cell.
template<typename T>
void belfem::share (Vector< T > &aData)
template<typename T>
void belfem::share (Cell< T > &aData)
template<typename T>
void belfem::broadcast (Matrix< T > &aData, const proc_t aRoot=0)
 Broadcasts a matrix to all processes.
template<typename T>
void belfem::send (Matrix< T > &aData, const proc_t aTarget=0)
template<typename T>
void belfem::receive (Matrix< T > &aData, const proc_t aSource=0)
 Receives a matrix from a specific source process.
template<typename T>
void belfem::distribute (Cell< Matrix< T > > &aData)
 Distributes a collection of matrices to other processes.
template<typename T>
void belfem::collect (Cell< Matrix< T > > &aData)
 Collects matrices from all processes into a cell.
void belfem::broadcast (Cell< string > &aData, const proc_t aRoot)
void belfem::send (const string &aMessage, const proc_t aTarget)
void belfem::receive (string &aMessage, const proc_t aSource)

Variables

belfem::Communicator gComm
constexpr int belfem::gMaxCommChunkLength = 64 * 1024

Variable Documentation

◆ gComm

belfem::Communicator gComm
extern