criptic v1
Cosmic Ray Interstellar Propagation Tool using Itô Calculus
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
criptic::CRTreeCommunicator Class Reference

Class to manage communications during tree walks. More...

#include <CRTreeCommunicator.H>

Public Member Functions

 CRTreeCommunicator (const CRTree *tree_)
 Constructor.
 
 ~CRTreeCommunicator ()
 Destructor.
 
void initCycle ()
 Initialize a communication cycle.
 
void finalizeCycle ()
 Finalize a communication cycle.
 
bool allDone ()
 Report if all work on all ranks is done.
 
void registerRequest (const IdxType &start, const IdxType &count, const std::vector< bool > &defer, const std::vector< int > &rank, const RealTensor2 &h2Inv, const RealTensor2 &h2InvGrad, const Real &hScale, const std::vector< FieldQty > &qMin)
 Register an MPI request for a deferred leaf.
 
void registerResponse (const int &rank, const MPIUtil::fillResponse &resp)
 Register a response to an MPI request from a remote rank.
 
void recv ()
 Receive incoming messages.
 
void sendRequests ()
 Send all requests from the outgoing request buffers.
 
void sendResponses ()
 Send responses to requests from other ranks.
 
std::pair< MPIUtil::fillRequest *, int > getFillRequest ()
 Retrieve the next fill request to process.
 
MPIUtil::fillResponsegetFillResponse ()
 Retrieve responses that are ready to process.
 

Private Attributes

const CRTreetree
 
std::vector< int > rankDone
 
std::vector< MPI_Request > doneSendHandle
 
std::vector< MPI_Request > doneRecvHandle
 
std::vector< std::vector< MPIUtil::fillRequest > > outReqBuf
 
std::vector< MPI_Request > outReqHandle
 
std::vector< std::list< std::vector< MPIUtil::fillResponse > > > outRespBuf
 
std::vector< std::vector< MPI_Request > > outRespHandle
 
std::vector< MPIUtil::fillRequestinReqBuf
 
std::vector< int > inReqRank
 
IdxType inReqPtr
 
std::vector< MPIUtil::fillResponseinRespBuf
 
IdxType inRespWritePtr
 
IdxType inRespProcPtr
 
std::vector< omp_lock_t > outReqBufLock
 
std::vector< omp_lock_t > outRespBufLock
 

Detailed Description

Class to manage communications during tree walks.

This class manages the communications that are required when evaluating field quatities using the CRTree. If, while using the tree to evaluate a field quantity (or its gradient), the tree determines that it cannot complete the evaluation just using parts of the tree stored on its own MPI rank, it registers the incomplete evaluation with the communicator. The communicator keeps track of these requests, sends them to the appropriate MPI rank, and recieves the responses.

Constructor & Destructor Documentation

◆ CRTreeCommunicator()

CRTreeCommunicator::CRTreeCommunicator ( const CRTree tree_)

Constructor.

◆ ~CRTreeCommunicator()

CRTreeCommunicator::~CRTreeCommunicator ( )

Destructor.

Member Function Documentation

◆ allDone()

bool CRTreeCommunicator::allDone ( )

Report if all work on all ranks is done.

Returns
True if all work on all ranks is done

◆ finalizeCycle()

void CRTreeCommunicator::finalizeCycle ( )

Finalize a communication cycle.

◆ getFillRequest()

std::pair< MPIUtil::fillRequest *, int > criptic::CRTreeCommunicator::getFillRequest ( )
inline

Retrieve the next fill request to process.

Returns
A pair of a pointer to the next request and its rank

If not request is available, the pointer is set to nullptr, and the rank to -1.

◆ getFillResponse()

MPIUtil::fillResponse * criptic::CRTreeCommunicator::getFillResponse ( )
inline

Retrieve responses that are ready to process.

Returns
Pointer to the next response, or null if none are available

◆ initCycle()

void CRTreeCommunicator::initCycle ( )

Initialize a communication cycle.

◆ recv()

void CRTreeCommunicator::recv ( )

Receive incoming messages.

◆ registerRequest()

void CRTreeCommunicator::registerRequest ( const IdxType start,
const IdxType count,
const std::vector< bool > &  defer,
const std::vector< int > &  rank,
const RealTensor2 h2Inv,
const RealTensor2 h2InvGrad,
const Real hScale,
const std::vector< FieldQty > &  qMin 
)

Register an MPI request for a deferred leaf.

Parameters
startStarting index of packets in leaf
countNumber of packets in leaf
deferList of which packets in the leaf are deferred
rankExternal ranks to which to send request
h2InvInverse squared bandwidth matrix
h2InvGradInverse squared bandwidth matrix for gradients
hScaleLength scale for gradient errors
qMinLower limit on the field quantity from the owning rank

The value of qMin passed here is non-normalized; normalization happens after the request is completed

◆ registerResponse()

void CRTreeCommunicator::registerResponse ( const int &  rank,
const MPIUtil::fillResponse resp 
)

Register a response to an MPI request from a remote rank.

Parameters
rankThe rank to which the response should be sent
respThe response to register

◆ sendRequests()

void CRTreeCommunicator::sendRequests ( )

Send all requests from the outgoing request buffers.

◆ sendResponses()

void CRTreeCommunicator::sendResponses ( )

Send responses to requests from other ranks.

Member Data Documentation

◆ doneRecvHandle

std::vector<MPI_Request> criptic::CRTreeCommunicator::doneRecvHandle
private

Handles for "all done" messages we receive

◆ doneSendHandle

std::vector<MPI_Request> criptic::CRTreeCommunicator::doneSendHandle
private

Handles for "all done" messages we send

◆ inReqBuf

std::vector<MPIUtil::fillRequest> criptic::CRTreeCommunicator::inReqBuf
private

Incoming request buffer

◆ inReqPtr

IdxType criptic::CRTreeCommunicator::inReqPtr
private

Pointer in incoming request list

◆ inReqRank

std::vector<int> criptic::CRTreeCommunicator::inReqRank
private

Ranks of proccesses that make the requests in inReqBuf

◆ inRespBuf

std::vector<MPIUtil::fillResponse> criptic::CRTreeCommunicator::inRespBuf
private

Incoming response buffer

◆ inRespProcPtr

IdxType criptic::CRTreeCommunicator::inRespProcPtr
private

Pointer to the location of the next incoming response to process

◆ inRespWritePtr

IdxType criptic::CRTreeCommunicator::inRespWritePtr
private

Pointer to where incoming data should be written in the incoming response buffer

◆ outReqBuf

std::vector<std::vector<MPIUtil::fillRequest> > criptic::CRTreeCommunicator::outReqBuf
private

Outgoing request buffer

◆ outReqBufLock

std::vector<omp_lock_t> criptic::CRTreeCommunicator::outReqBufLock
private

OMP locks for the outgoing request buffers

◆ outReqHandle

std::vector<MPI_Request> criptic::CRTreeCommunicator::outReqHandle
private

Outgoing request handles

◆ outRespBuf

std::vector<std::list<std::vector<MPIUtil::fillResponse> > > criptic::CRTreeCommunicator::outRespBuf
private

Outgoing response buffer

◆ outRespBufLock

std::vector<omp_lock_t> criptic::CRTreeCommunicator::outRespBufLock
private

OMP locks for the outgoing response buffers

◆ outRespHandle

std::vector<std::vector<MPI_Request> > criptic::CRTreeCommunicator::outRespHandle
private

MPI handles for outgoing responses

◆ rankDone

std::vector<int> criptic::CRTreeCommunicator::rankDone
private

Is each rank done?

◆ tree

const CRTree* criptic::CRTreeCommunicator::tree
private

Reference to the parent CRTree


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