10 #include "Tpetra_Details_DistributorActor.hpp"
11 #include "Teuchos_TimeMonitor.hpp"
16 DistributorActor::DistributorActor()
17 : mpiTag_(DEFAULT_MPI_TAG)
19 #ifdef HAVE_TPETRA_DISTRIBUTOR_TIMINGS
21 #endif // HAVE_TPETRA_DISTRIBUTOR_TIMINGS
24 DistributorActor::DistributorActor(
const DistributorActor& otherActor)
25 : mpiTag_(otherActor.mpiTag_),
26 requestsRecv_(otherActor.requestsRecv_),
27 requestsSend_(otherActor.requestsSend_)
29 #ifdef HAVE_TPETRA_DISTRIBUTOR_TIMINGS
31 #endif // HAVE_TPETRA_DISTRIBUTOR_TIMINGS
34 void DistributorActor::doWaits(
const DistributorPlan& plan) {
35 #ifdef HAVE_TPETRA_DISTRIBUTOR_TIMINGS
36 Teuchos::TimeMonitor timeMon (*timer_doWaitsRecv_);
37 #endif // HAVE_TPETRA_DISTRIBUTOR_TIMINGS
39 if (requestsRecv_.size() > 0) {
40 Teuchos::waitAll(*plan.getComm(), requestsRecv_());
44 requestsRecv_.resize(0);
47 #ifdef HAVE_TPETRA_DISTRIBUTOR_TIMINGS
48 Teuchos::TimeMonitor timeMon (*timer_doWaitsSend_);
49 #endif // HAVE_TPETRA_DISTRIBUTOR_TIMINGS
51 if (requestsSend_.size() > 0) {
52 Teuchos::waitAll(*plan.getComm(), requestsSend_());
56 requestsSend_.resize(0);
60 void DistributorActor::doWaitsRecv(
const DistributorPlan& plan) {
61 #ifdef HAVE_TPETRA_DISTRIBUTOR_TIMINGS
62 Teuchos::TimeMonitor timeMon (*timer_doWaitsRecv_);
63 #endif // HAVE_TPETRA_DISTRIBUTOR_TIMINGS
65 if (requestsRecv_.size() > 0) {
66 Teuchos::waitAll(*plan.getComm(), requestsRecv_());
70 requestsRecv_.resize(0);
74 void DistributorActor::doWaitsSend(
const DistributorPlan& plan) {
75 #ifdef HAVE_TPETRA_DISTRIBUTOR_TIMINGS
76 Teuchos::TimeMonitor timeMon (*timer_doWaitsSend_);
77 #endif // HAVE_TPETRA_DISTRIBUTOR_TIMINGS
79 if (requestsSend_.size() > 0) {
80 Teuchos::waitAll(*plan.getComm(), requestsSend_());
84 requestsSend_.resize(0);
88 bool DistributorActor::isReady()
const {
90 for (
auto& request : requestsRecv_) {
91 result &= request->isReady();
93 for (
auto& request : requestsSend_) {
94 result &= request->isReady();
99 #ifdef HAVE_TPETRA_DISTRIBUTOR_TIMINGS
100 void DistributorActor::makeTimers () {
101 timer_doWaitsRecv_ = Teuchos::TimeMonitor::getNewTimer (
102 "Tpetra::Distributor: doWaitsRecv");
104 timer_doWaitsSend_ = Teuchos::TimeMonitor::getNewTimer (
105 "Tpetra::Distributor: doWaitsSend");
107 timer_doPosts3KV_ = Teuchos::TimeMonitor::getNewTimer (
108 "Tpetra::Distributor: doPosts(3) KV");
109 timer_doPosts4KV_ = Teuchos::TimeMonitor::getNewTimer (
110 "Tpetra::Distributor: doPosts(4) KV");
112 timer_doPosts3KV_recvs_ = Teuchos::TimeMonitor::getNewTimer (
113 "Tpetra::Distributor: doPosts(3): recvs KV");
114 timer_doPosts4KV_recvs_ = Teuchos::TimeMonitor::getNewTimer (
115 "Tpetra::Distributor: doPosts(4): recvs KV");
117 timer_doPosts3KV_barrier_ = Teuchos::TimeMonitor::getNewTimer (
118 "Tpetra::Distributor: doPosts(3): barrier KV");
119 timer_doPosts4KV_barrier_ = Teuchos::TimeMonitor::getNewTimer (
120 "Tpetra::Distributor: doPosts(4): barrier KV");
122 timer_doPosts3KV_sends_ = Teuchos::TimeMonitor::getNewTimer (
123 "Tpetra::Distributor: doPosts(3): sends KV");
124 timer_doPosts4KV_sends_ = Teuchos::TimeMonitor::getNewTimer (
125 "Tpetra::Distributor: doPosts(4): sends KV");
126 timer_doPosts3KV_sends_slow_ = Teuchos::TimeMonitor::getNewTimer (
127 "Tpetra::Distributor: doPosts(3): sends KV SLOW");
128 timer_doPosts4KV_sends_slow_ = Teuchos::TimeMonitor::getNewTimer (
129 "Tpetra::Distributor: doPosts(4): sends KV SLOW");
130 timer_doPosts3KV_sends_fast_ = Teuchos::TimeMonitor::getNewTimer (
131 "Tpetra::Distributor: doPosts(3): sends KV FAST");
132 timer_doPosts4KV_sends_fast_ = Teuchos::TimeMonitor::getNewTimer (
133 "Tpetra::Distributor: doPosts(4): sends KV FAST");
135 #endif // HAVE_TPETRA_DISTRIBUTOR_TIMINGS