22 #ifndef TPETRA_DETAILS_DISTRIBUTOR_PLAN_HPP
23 #define TPETRA_DETAILS_DISTRIBUTOR_PLAN_HPP
25 #include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
26 #include "Teuchos_Array.hpp"
27 #include "Teuchos_Comm.hpp"
28 #include "Teuchos_RCP.hpp"
29 #include "TpetraCore_config.h"
31 #if defined(HAVE_TPETRACORE_MPI_ADVANCE)
32 #include <mpi_advance.h>
46 #if defined(HAVE_TPETRACORE_MPI_ADVANCE)
48 DISTRIBUTOR_MPIADVANCE_ALLTOALL,
49 DISTRIBUTOR_MPIADVANCE_NBRALLTOALLV
65 DISTRIBUTOR_NOT_INITIALIZED,
66 DISTRIBUTOR_INITIALIZED_BY_CREATE_FROM_SENDS,
67 DISTRIBUTOR_INITIALIZED_BY_CREATE_FROM_RECVS,
68 DISTRIBUTOR_INITIALIZED_BY_CREATE_FROM_SENDS_N_RECVS,
69 DISTRIBUTOR_INITIALIZED_BY_REVERSE,
70 DISTRIBUTOR_INITIALIZED_BY_COPY,
91 static constexpr
int DEFAULT_MPI_TAG = 0;
95 using IndexView = std::vector<size_t>;
96 using SubViewLimits = std::pair<IndexView, IndexView>;
101 size_t createFromSends(
const Teuchos::ArrayView<const int>& exportProcIDs);
102 void createFromRecvs(
const Teuchos::ArrayView<const int>& remoteProcIDs);
103 void createFromSendsAndRecvs(
const Teuchos::ArrayView<const int>& exportProcIDs,
104 const Teuchos::ArrayView<const int>& remoteProcIDs);
106 void setParameterList(
const Teuchos::RCP<Teuchos::ParameterList>& plist);
108 Teuchos::RCP<DistributorPlan> getReversePlan()
const;
110 Teuchos::RCP<const Teuchos::Comm<int>> getComm()
const {
return comm_; }
111 #if defined(HAVE_TPETRACORE_MPI_ADVANCE)
112 Teuchos::RCP<MPIX_Comm*> getMPIXComm()
const {
return mpixComm_; }
115 size_t getNumReceives()
const {
return numReceives_; }
116 size_t getNumSends()
const {
return numSendsToOtherProcs_; }
117 bool hasSelfMessage()
const {
return sendMessageToSelf_; }
118 size_t getMaxSendLength()
const {
return maxSendLength_; }
119 size_t getTotalReceiveLength()
const {
return totalReceiveLength_; }
120 Teuchos::ArrayView<const int> getProcsFrom()
const {
return procsFrom_; }
121 Teuchos::ArrayView<const int> getProcsTo()
const {
return procIdsToSendTo_; }
122 Teuchos::ArrayView<const size_t> getLengthsFrom()
const {
return lengthsFrom_; }
123 Teuchos::ArrayView<const size_t> getLengthsTo()
const {
return lengthsTo_; }
124 Teuchos::ArrayView<const size_t> getStartsTo()
const {
return startsTo_; }
125 Teuchos::ArrayView<const size_t> getIndicesTo()
const {
return indicesTo_; }
128 SubViewLimits getImportViewLimits(
size_t numPackets)
const;
129 SubViewLimits getImportViewLimits(
const Teuchos::ArrayView<const size_t> &numImportPacketsPerLID)
const;
130 SubViewLimits getExportViewLimits(
size_t numPackets)
const;
131 SubViewLimits getExportViewLimits(
const Teuchos::ArrayView<const size_t> &numExportPacketsPerLID)
const;
136 #if defined(HAVE_TPETRACORE_MPI_ADVANCE)
137 void initializeMpiAdvance();
140 Teuchos::RCP<const Teuchos::ParameterList> getValidParameters()
const;
142 void createReversePlan()
const;
154 void computeReceives();
156 Teuchos::RCP<const Teuchos::Comm<int>> comm_;
157 #if defined(HAVE_TPETRACORE_MPI_ADVANCE)
158 Teuchos::RCP<MPIX_Comm*> mpixComm_;
162 mutable Teuchos::RCP<DistributorPlan> reversePlan_;
169 bool sendMessageToSelf_;
170 size_t numSendsToOtherProcs_;
171 Teuchos::Array<int> procIdsToSendTo_;
181 Teuchos::Array<size_t> startsTo_;
188 Teuchos::Array<size_t> lengthsTo_;
193 size_t maxSendLength_;
210 Teuchos::Array<size_t> indicesTo_;
229 size_t totalReceiveLength_;
236 Teuchos::Array<size_t> lengthsFrom_;
243 Teuchos::Array<int> procsFrom_;
250 Teuchos::Array<size_t> startsFrom_;
257 Teuchos::Array<size_t> indicesFrom_;
EDistributorHowInitialized
Enum indicating how and whether a Distributor was initialized.
std::string DistributorSendTypeEnumToString(EDistributorSendType sendType)
Convert an EDistributorSendType enum value to a string.
std::string DistributorHowInitializedEnumToString(EDistributorHowInitialized how)
Convert an EDistributorHowInitialized enum value to a string.
EDistributorSendType
The type of MPI send that Distributor should use.