|
criptic v1
Cosmic Ray Interstellar Propagation Tool using Itô Calculus
|
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::fillResponse * | getFillResponse () |
| Retrieve responses that are ready to process. | |
Private Attributes | |
| const CRTree * | tree |
| 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::fillRequest > | inReqBuf |
| std::vector< int > | inReqRank |
| IdxType | inReqPtr |
| std::vector< MPIUtil::fillResponse > | inRespBuf |
| IdxType | inRespWritePtr |
| IdxType | inRespProcPtr |
| std::vector< omp_lock_t > | outReqBufLock |
| std::vector< omp_lock_t > | outRespBufLock |
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.
| CRTreeCommunicator::CRTreeCommunicator | ( | const CRTree * | tree_ | ) |
Constructor.
| CRTreeCommunicator::~CRTreeCommunicator | ( | ) |
Destructor.
| bool CRTreeCommunicator::allDone | ( | ) |
Report if all work on all ranks is done.
| void CRTreeCommunicator::finalizeCycle | ( | ) |
Finalize a communication cycle.
|
inline |
Retrieve the next fill request to process.
If not request is available, the pointer is set to nullptr, and the rank to -1.
|
inline |
Retrieve responses that are ready to process.
| void CRTreeCommunicator::initCycle | ( | ) |
Initialize a communication cycle.
| void CRTreeCommunicator::recv | ( | ) |
Receive incoming messages.
| 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.
| start | Starting index of packets in leaf |
| count | Number of packets in leaf |
| defer | List of which packets in the leaf are deferred |
| rank | External ranks to which to send request |
| h2Inv | Inverse squared bandwidth matrix |
| h2InvGrad | Inverse squared bandwidth matrix for gradients |
| hScale | Length scale for gradient errors |
| qMin | Lower 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
| void CRTreeCommunicator::registerResponse | ( | const int & | rank, |
| const MPIUtil::fillResponse & | resp | ||
| ) |
Register a response to an MPI request from a remote rank.
| rank | The rank to which the response should be sent |
| resp | The response to register |
| void CRTreeCommunicator::sendRequests | ( | ) |
Send all requests from the outgoing request buffers.
| void CRTreeCommunicator::sendResponses | ( | ) |
Send responses to requests from other ranks.
|
private |
Handles for "all done" messages we receive
|
private |
Handles for "all done" messages we send
|
private |
Incoming request buffer
|
private |
Pointer in incoming request list
|
private |
Ranks of proccesses that make the requests in inReqBuf
|
private |
Incoming response buffer
|
private |
Pointer to the location of the next incoming response to process
|
private |
Pointer to where incoming data should be written in the incoming response buffer
|
private |
Outgoing request buffer
|
private |
OMP locks for the outgoing request buffers
|
private |
Outgoing request handles
|
private |
Outgoing response buffer
|
private |
OMP locks for the outgoing response buffers
|
private |
MPI handles for outgoing responses
|
private |
Is each rank done?