43#ifdef HAVE_TEUCHOS_MPI
47#ifdef HAVE_TEUCHOSCORE_CXX11
53#ifdef HAVE_TEUCHOS_MPI
56std::string getMpiErrorString (
const int errCode) {
59 char errString [MPI_MAX_ERROR_STRING+1];
60 int errStringLen = MPI_MAX_ERROR_STRING;
61 (void) MPI_Error_string (errCode, errString, &errStringLen);
66 if (errString[errStringLen-1] !=
'\0') {
67 errString[errStringLen] =
'\0';
69 return std::string (errString);
87 const EReductionType reductType,
92#ifdef HAVE_TEUCHOS_MPI
93 using Teuchos::Details::MpiTypeTraits;
98 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
99 if (mpiComm == NULL) {
102 if (serialComm == NULL) {
105#ifdef HAVE_TEUCHOSCORE_CXX11
106 std::unique_ptr<ValueTypeReductionOp<int, T> >
108 std::auto_ptr<ValueTypeReductionOp<int, T> >
111 reduceAll (comm, *reductOp, count, sendBuffer, globalReducts);
114 std::copy (sendBuffer, sendBuffer + count, globalReducts);
117 MPI_Op rawMpiOp = ::Teuchos::Details::getMpiOpForEReductionType (reductType);
118 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
120 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
122 int err = MPI_SUCCESS;
123 if (sendBuffer == globalReducts) {
127 err = MPI_Allreduce (MPI_IN_PLACE, globalReducts,
128 count, rawMpiType, rawMpiOp, rawMpiComm);
131 err = MPI_Allreduce (
const_cast<T*
> (sendBuffer), globalReducts,
132 count, rawMpiType, rawMpiOp, rawMpiComm);
137 "MPI_Allreduce failed with the following error: "
138 << ::Teuchos::Details::getMpiErrorString (err));
142 std::copy (sendBuffer, sendBuffer + count, globalReducts);
156gatherImpl (
const T sendBuf[],
163#ifdef HAVE_TEUCHOS_MPI
164 using Teuchos::Details::MpiTypeTraits;
169 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
170 if (mpiComm == NULL) {
173 if (serialComm == NULL) {
176 gather<int, T> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
179 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
182 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
184 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
185 const int err = MPI_Gather (
const_cast<T*
> (sendBuf), sendCount, rawMpiType,
186 recvBuf, recvCount, rawMpiType,
191 "MPI_Gather failed with the following error: "
192 << ::Teuchos::Details::getMpiErrorString (err));
196 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
210scatterImpl (
const T sendBuf[],
217#ifdef HAVE_TEUCHOS_MPI
218 using Teuchos::Details::MpiTypeTraits;
223 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
224 if (mpiComm == NULL) {
227 if (serialComm == NULL) {
233 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
236 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
238 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
240 MPI_Scatter (
const_cast<T*
> (sendBuf), sendCount, rawMpiType,
241 recvBuf, recvCount, rawMpiType,
244 (err != MPI_SUCCESS, std::runtime_error,
245 "MPI_Scatter failed with the following error: "
246 << ::Teuchos::Details::getMpiErrorString (err));
251 std::copy (sendBuf, sendBuf + sendCount, recvBuf);
265reduceImpl (
const T sendBuf[],
268 const EReductionType reductType,
272#ifdef HAVE_TEUCHOS_MPI
273 using Teuchos::Details::MpiTypeTraits;
278 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
279 if (mpiComm == NULL) {
282 if (serialComm == NULL) {
288 std::copy (sendBuf, sendBuf + count, recvBuf);
291 MPI_Op rawMpiOp = ::Teuchos::Details::getMpiOpForEReductionType (reductType);
292 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
294 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
295 const int err = MPI_Reduce (
const_cast<T*
> (sendBuf), recvBuf, count,
296 rawMpiType, rawMpiOp, root, rawMpiComm);
298 (err != MPI_SUCCESS, std::runtime_error,
"MPI_Reduce failed with the "
299 "following error: " << ::Teuchos::Details::getMpiErrorString (err));
303 std::copy (sendBuf, sendBuf + count, recvBuf);
317gathervImpl (
const T sendBuf[],
320 const int recvCounts[],
325#ifdef HAVE_TEUCHOS_MPI
326 using Teuchos::Details::MpiTypeTraits;
331 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
332 if (mpiComm == NULL) {
335 if (serialComm == NULL) {
338 gatherv<int, T> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
342 recvCounts[0] > sendCount, std::invalid_argument,
343 "Teuchos::gatherv: If the input communicator contains only one "
344 "process, then you cannot receive more entries than you send. "
345 "You aim to receive " << recvCounts[0] <<
" entries, but to send "
346 << sendCount <<
" entries.");
350 std::copy (sendBuf, sendBuf + recvCounts[0], recvBuf + displs[0]);
353 MPI_Comm rawMpiComm = * (mpiComm->getRawMpiComm ());
355 MPI_Datatype rawMpiType = MpiTypeTraits<T>::getType (t);
356 const int err = MPI_Gatherv (
const_cast<T*
> (sendBuf),
360 const_cast<int*
> (recvCounts),
361 const_cast<int*
> (displs),
368 "MPI_Gatherv failed with the following error: "
369 << ::Teuchos::Details::getMpiErrorString (err));
374 recvCounts[0] > sendCount, std::invalid_argument,
375 "Teuchos::gatherv: If the input communicator contains only one "
376 "process, then you cannot receive more entries than you send. "
377 "You aim to receive " << recvCounts[0] <<
" entries, but to send "
378 << sendCount <<
" entries.");
382 std::copy (sendBuf, sendBuf + recvCounts[0], recvBuf + displs[0]);
391template<
typename Packet>
395 const int sourceRank)
399 <<
"> ( value type )"
402 charRecvBuffer (recvBuffer.size (), recvBuffer.getRawPtr ());
404 comm.ireceive (charRecvBuffer.getCharBufferView (), sourceRank);
411template<
typename Packet>
414 const int sourceRank,
420 <<
"> ( value type )"
423 charRecvBuffer (recvBuffer.size (), recvBuffer.getRawPtr ());
425 comm.ireceive (charRecvBuffer.getCharBufferView (), sourceRank, tag);
446 const int sourceRank)
448#ifdef HAVE_TEUCHOS_MPI
449 using Teuchos::Details::MpiTypeTraits;
454 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
455 if (mpiComm == NULL) {
458 if (serialComm == NULL) {
461 return ireceiveGeneral<T> (comm, recvBuffer, sourceRank);
467 "ireceiveImpl: Not implemented for a serial communicator.");
471 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
473 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
474 T* rawRecvBuf = recvBuffer.getRawPtr ();
475 const int count =
as<int> (recvBuffer.size ());
476 const int tag = mpiComm->getTag ();
477 MPI_Request rawRequest = MPI_REQUEST_NULL;
478 const int err = MPI_Irecv (rawRecvBuf, count, rawType, sourceRank, tag,
479 rawComm, &rawRequest);
481 err != MPI_SUCCESS, std::runtime_error,
482 "MPI_Irecv failed with the following error: "
483 << ::Teuchos::Details::getMpiErrorString (err));
494 "ireceiveImpl: Not implemented for a serial communicator.");
513 const int sourceRank,
517#ifdef HAVE_TEUCHOS_MPI
518 using Teuchos::Details::MpiTypeTraits;
523 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
524 if (mpiComm == NULL) {
527 if (serialComm == NULL) {
530 return ireceiveGeneral<T> (recvBuffer, sourceRank, tag, comm);
536 "ireceiveImpl: Not implemented for a serial communicator.");
540 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
542 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
543 T* rawRecvBuf = recvBuffer.getRawPtr ();
544 const int count =
as<int> (recvBuffer.size ());
545 MPI_Request rawRequest = MPI_REQUEST_NULL;
546 const int err = MPI_Irecv (rawRecvBuf, count, rawType, sourceRank, tag,
547 rawComm, &rawRequest);
549 err != MPI_SUCCESS, std::runtime_error,
550 "MPI_Irecv failed with the following error: "
551 << ::Teuchos::Details::getMpiErrorString (err));
562 "ireceiveImpl: Not implemented for a serial communicator.");
577 const T sendBuffer[],
583 comm.send (charSendBuffer.getBytes (),
584 charSendBuffer.getCharBuffer (),
592sendGeneral (
const T sendBuffer[],
601 comm.send (charSendBuffer.getBytes (),
602 charSendBuffer.getCharBuffer (),
622 const T sendBuffer[],
625#ifdef HAVE_TEUCHOS_MPI
626 using Teuchos::Details::MpiTypeTraits;
631 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
632 if (mpiComm == NULL) {
635 if (serialComm == NULL) {
638 sendGeneral<T> (comm, count, sendBuffer, destRank);
644 "sendImpl: Not implemented for a serial communicator.");
648 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
650 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
651 T* rawBuf =
const_cast<T*
> (sendBuffer);
652 const int tag = mpiComm->getTag ();
653 const int err = MPI_Send (rawBuf, count, rawType, destRank, tag, rawComm);
657 "MPI_Send failed with the following error: "
658 << ::Teuchos::Details::getMpiErrorString (err));
664 "sendImpl: Not implemented for a serial communicator.");
672sendImpl (
const T sendBuffer[],
678#ifdef HAVE_TEUCHOS_MPI
679 using Teuchos::Details::MpiTypeTraits;
684 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
685 if (mpiComm == NULL) {
688 if (serialComm == NULL) {
691 sendGeneral<T> (sendBuffer, count, destRank, tag, comm);
697 "sendImpl: Not implemented for a serial communicator.");
701 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
703 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
704 T* rawBuf =
const_cast<T*
> (sendBuffer);
705 const int err = MPI_Send (rawBuf, count, rawType, destRank, tag, rawComm);
709 "MPI_Send failed with the following error: "
710 << ::Teuchos::Details::getMpiErrorString (err));
716 "sendImpl: Not implemented for a serial communicator.");
734 charSendBuffer (sendBuffer.size (), sendBuffer.getRawPtr ());
736 comm.isend (charSendBuffer.getCharBufferView (), destRank);
757 charSendBuffer (sendBuffer.size (), sendBuffer.getRawPtr ());
759 comm.isend (charSendBuffer.getCharBufferView (), destRank, tag);
773#ifdef HAVE_TEUCHOS_MPI
774 using Teuchos::Details::MpiTypeTraits;
779 const MpiComm<int>* mpiComm =
dynamic_cast<const MpiComm<int>*
> (&comm);
780 if (mpiComm == NULL) {
783 if (serialComm == NULL) {
786 return isendGeneral<T> (sendBuffer, destRank, tag, comm);
790 true, std::logic_error,
791 "isendImpl: Not implemented for a serial communicator.");
795 MPI_Comm rawComm = * (mpiComm->getRawMpiComm ());
797 MPI_Datatype rawType = MpiTypeTraits<T>::getType (t);
801 T* rawSendBuf =
const_cast<T*
> (sendBuffer.getRawPtr ());
802 const int count =
as<int> (sendBuffer.size ());
803 MPI_Request rawRequest = MPI_REQUEST_NULL;
804 const int err = MPI_Isend (rawSendBuf, count, rawType, destRank, tag,
805 rawComm, &rawRequest);
809 "MPI_Isend failed with the following error: "
810 << ::Teuchos::Details::getMpiErrorString (err));
820 "isendImpl: Not implemented for a serial communicator.");
837#ifdef HAVE_TEUCHOS_COMPLEX
842 const EReductionType reductType,
844 const std::complex<double> sendBuffer[],
845 std::complex<double> globalReducts[])
848 "Teuchos::reduceAll<int, std::complex<double> > (" << count <<
", "
851 reduceAllImpl<std::complex<double> > (comm, reductType, count, sendBuffer, globalReducts);
858 const int sourceRank)
861 return ireceiveImpl<std::complex<double> > (comm, recvBuffer, sourceRank);
867 const int sourceRank,
872 return ireceiveImpl<std::complex<double> > (recvBuffer, sourceRank, tag, comm);
879 const std::complex<double> sendBuffer[],
882 sendImpl<std::complex<double> > (comm, count, sendBuffer, destRank);
893 sendImpl<std::complex<double> > (sendBuffer, count, destRank, tag, comm);
898isend (
const ArrayRCP<
const std::complex<double> >& sendBuffer,
903 return isendImpl<std::complex<double> > (sendBuffer, destRank, tag, comm);
910 const EReductionType reductType,
912 const std::complex<float> sendBuffer[],
913 std::complex<float> globalReducts[])
916 "Teuchos::reduceAll<int, std::complex<float> > (" << count <<
", "
919 reduceAllImpl<std::complex<float> > (comm, reductType, count, sendBuffer, globalReducts);
926 const int sourceRank)
929 return ireceiveImpl<std::complex<float> > (comm, recvBuffer, sourceRank);
935 const int sourceRank,
940 return ireceiveImpl<std::complex<float> > (recvBuffer, sourceRank, tag, comm);
947 const std::complex<float> sendBuffer[],
950 return sendImpl<std::complex<float> > (comm, count, sendBuffer, destRank);
961 return sendImpl<std::complex<float> > (sendBuffer, count, destRank, tag, comm);
966isend (
const ArrayRCP<
const std::complex<float> >& sendBuffer,
971 return isendImpl<std::complex<float> > (sendBuffer, destRank, tag, comm);
981 const EReductionType reductType,
983 const double sendBuffer[],
984 double globalReducts[])
987 "Teuchos::reduceAll<int, double> (" << count <<
", "
990 reduceAllImpl<double> (comm, reductType, count, sendBuffer, globalReducts);
996 const ArrayRCP<double>& recvBuffer,
997 const int sourceRank)
1000 return ireceiveImpl<double> (comm, recvBuffer, sourceRank);
1006 const int sourceRank,
1011 return ireceiveImpl<double> (recvBuffer, sourceRank, tag, comm);
1018 const double sendBuffer[],
1021 return sendImpl<double> (comm, count, sendBuffer, destRank);
1032 return sendImpl<double> (sendBuffer, count, destRank, tag, comm);
1042 return isendImpl<double> (sendBuffer, destRank, tag, comm);
1049 const EReductionType reductType,
1051 const float sendBuffer[],
1052 float globalReducts[])
1055 "Teuchos::reduceAll<int, float> (" << count <<
", "
1058 reduceAllImpl<float> (comm, reductType, count, sendBuffer, globalReducts);
1064 const ArrayRCP<float>& recvBuffer,
1065 const int sourceRank)
1068 return ireceiveImpl<float> (comm, recvBuffer, sourceRank);
1074 const int sourceRank,
1079 return ireceiveImpl<float> (recvBuffer, sourceRank, tag, comm);
1086 const float sendBuffer[],
1089 return sendImpl<float> (comm, count, sendBuffer, destRank);
1100 return sendImpl<float> (sendBuffer, count, destRank, tag, comm);
1110 return isendImpl<float> (sendBuffer, destRank, tag, comm);
1118 const int sendCount,
1119 long long recvBuf[],
1120 const int recvCount,
1124 gatherImpl<long long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1130 const int sendCount,
1131 long long recvBuf[],
1132 const int recvCounts[],
1137 gathervImpl<long long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1143 const EReductionType reductType,
1145 const long long sendBuffer[],
1146 long long globalReducts[])
1149 "Teuchos::reduceAll<int, long long> (" << count <<
", "
1152 reduceAllImpl<long long> (comm, reductType, count, sendBuffer, globalReducts);
1158 const ArrayRCP<long long>& recvBuffer,
1159 const int sourceRank)
1162 return ireceiveImpl<long long> (comm, recvBuffer, sourceRank);
1168 const int sourceRank,
1173 return ireceiveImpl<long long> (recvBuffer, sourceRank, tag, comm);
1180 const long long sendBuffer[],
1183 return sendImpl<long long> (comm, count, sendBuffer, destRank);
1194 return sendImpl<long long> (sendBuffer, count, destRank, tag, comm);
1204 return isendImpl<long long> (sendBuffer, destRank, tag, comm);
1211 const int sendCount,
1212 unsigned long long recvBuf[],
1213 const int recvCount,
1217 gatherImpl<unsigned long long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1223 const int sendCount,
1224 unsigned long long recvBuf[],
1225 const int recvCounts[],
1230 gathervImpl<unsigned long long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1236 const EReductionType reductType,
1238 const unsigned long long sendBuffer[],
1239 unsigned long long globalReducts[])
1242 "Teuchos::reduceAll<int, unsigned long long> (" << count <<
", "
1245 reduceAllImpl<unsigned long long> (comm, reductType, count, sendBuffer, globalReducts);
1251 const ArrayRCP<unsigned long long>& recvBuffer,
1252 const int sourceRank)
1255 return ireceiveImpl<unsigned long long> (comm, recvBuffer, sourceRank);
1261 const int sourceRank,
1266 return ireceiveImpl<unsigned long long> (recvBuffer, sourceRank, tag, comm);
1273 const unsigned long long sendBuffer[],
1276 return sendImpl<unsigned long long> (comm, count, sendBuffer, destRank);
1287 return sendImpl<unsigned long long> (sendBuffer, count, destRank, tag, comm);
1297 return isendImpl<unsigned long long> (sendBuffer, destRank, tag, comm);
1305 const int sendCount,
1307 const int recvCount,
1311 gatherImpl<long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1317 const int sendCount,
1319 const int recvCounts[],
1324 gathervImpl<long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1330 const EReductionType reductType,
1332 const long sendBuffer[],
1333 long globalReducts[])
1336 "Teuchos::reduceAll<int, long> (" << count <<
", "
1339 reduceAllImpl<long> (comm, reductType, count, sendBuffer, globalReducts);
1345 const ArrayRCP<long>& recvBuffer,
1346 const int sourceRank)
1349 return ireceiveImpl<long> (comm, recvBuffer, sourceRank);
1355 const int sourceRank,
1360 return ireceiveImpl<long> (recvBuffer, sourceRank, tag, comm);
1367 const long sendBuffer[],
1370 return sendImpl<long> (comm, count, sendBuffer, destRank);
1381 return sendImpl<long> (sendBuffer, count, destRank, tag, comm);
1391 return isendImpl<long> (sendBuffer, destRank, tag, comm);
1399 const int sendCount,
1400 unsigned long recvBuf[],
1401 const int recvCount,
1405 gatherImpl<unsigned long> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1411 const int sendCount,
1412 unsigned long recvBuf[],
1413 const int recvCounts[],
1418 gathervImpl<unsigned long> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1424 const EReductionType reductType,
1426 const unsigned long sendBuffer[],
1427 unsigned long globalReducts[])
1430 "Teuchos::reduceAll<int, unsigned long> (" << count <<
", "
1433 reduceAllImpl<unsigned long> (comm, reductType, count, sendBuffer, globalReducts);
1439 const ArrayRCP<unsigned long>& recvBuffer,
1440 const int sourceRank)
1443 return ireceiveImpl<unsigned long> (comm, recvBuffer, sourceRank);
1449 const int sourceRank,
1454 return ireceiveImpl<unsigned long> (recvBuffer, sourceRank, tag, comm);
1461 const unsigned long sendBuffer[],
1464 return sendImpl<unsigned long> (comm, count, sendBuffer, destRank);
1475 return sendImpl<unsigned long> (sendBuffer, count, destRank, tag, comm);
1485 return isendImpl<unsigned long> (sendBuffer, destRank, tag, comm);
1492 const int sendCount,
1494 const int recvCount,
1498 gatherImpl<int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1504 const int sendCount,
1506 const int recvCounts[],
1511 gathervImpl<int> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1517 const int sendCount,
1519 const int recvCount,
1523 scatterImpl<int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1531 const EReductionType reductType,
1536 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1538 reduceImpl<int> (sendBuf, recvBuf, count, reductType, root, comm);
1545 const EReductionType reductType,
1550 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1552 reduceImpl<long> (sendBuf, recvBuf, count, reductType, root, comm);
1558 unsigned long recvBuf[],
1560 const EReductionType reductType,
1565 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1567 reduceImpl<unsigned long> (sendBuf, recvBuf, count, reductType, root, comm);
1573 unsigned long long recvBuf[],
1575 const EReductionType reductType,
1580 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1582 reduceImpl<unsigned long long> (sendBuf, recvBuf, count, reductType, root, comm);
1590 const EReductionType reductType,
1595 (
"Teuchos::reduce<int, int> (" << count <<
", " <<
toString (reductType)
1597 reduceImpl<double> (sendBuf, recvBuf, count, reductType, root, comm);
1602 const EReductionType reductType,
1604 const int sendBuffer[],
1605 int globalReducts[])
1608 "Teuchos::reduceAll<int, int> (" << count <<
", "
1611 reduceAllImpl<int> (comm, reductType, count, sendBuffer, globalReducts);
1617 const ArrayRCP<int>& recvBuffer,
1618 const int sourceRank)
1621 return ireceiveImpl<int> (comm, recvBuffer, sourceRank);
1627 const int sourceRank,
1632 return ireceiveImpl<int> (recvBuffer, sourceRank, tag, comm);
1639 const int sendBuffer[],
1642 return sendImpl<int> (comm, count, sendBuffer, destRank);
1653 return sendImpl<int> (sendBuffer, count, destRank, tag, comm);
1663 return isendImpl<int> (sendBuffer, destRank, tag, comm);
1670 const int sendCount,
1671 unsigned int recvBuf[],
1672 const int recvCount,
1676 gatherImpl<unsigned int> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1682 const int sendCount,
1683 unsigned int recvBuf[],
1684 const int recvCounts[],
1689 gathervImpl<unsigned int> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1695 const EReductionType reductType,
1697 const unsigned int sendBuffer[],
1698 unsigned int globalReducts[])
1701 "Teuchos::reduceAll<int, unsigned int> (" << count <<
", "
1704 reduceAllImpl<unsigned int> (comm, reductType, count, sendBuffer, globalReducts);
1710 const ArrayRCP<unsigned int>& recvBuffer,
1711 const int sourceRank)
1714 return ireceiveImpl<unsigned int> (comm, recvBuffer, sourceRank);
1720 const int sourceRank,
1725 return ireceiveImpl<unsigned int> (recvBuffer, sourceRank, tag, comm);
1732 const unsigned int sendBuffer[],
1735 return sendImpl<unsigned int> (comm, count, sendBuffer, destRank);
1746 return sendImpl<unsigned int> (sendBuffer, count, destRank, tag, comm);
1756 return isendImpl<unsigned int> (sendBuffer, destRank, tag, comm);
1764 const int sendCount,
1766 const int recvCount,
1770 gatherImpl<short> (sendBuf, sendCount, recvBuf, recvCount, root, comm);
1776 const int sendCount,
1778 const int recvCounts[],
1783 gathervImpl<short> (sendBuf, sendCount, recvBuf, recvCounts, displs, root, comm);
1789 const EReductionType reductType,
1791 const short sendBuffer[],
1792 short globalReducts[])
1795 "Teuchos::reduceAll<int, short> (" << count <<
", "
1798 reduceAllImpl<short> (comm, reductType, count, sendBuffer, globalReducts);
1804 const ArrayRCP<short>& recvBuffer,
1805 const int sourceRank)
1808 return ireceiveImpl<short> (comm, recvBuffer, sourceRank);
1814 const int sourceRank,
1819 return ireceiveImpl<short> (recvBuffer, sourceRank, tag, comm);
1826 const short sendBuffer[],
1829 return sendImpl<short> (comm, count, sendBuffer, destRank);
1840 return sendImpl<short> (sendBuffer, count, destRank, tag, comm);
1850 return isendImpl<short> (sendBuffer, destRank, tag, comm);
1866 const EReductionType reductType,
1868 const char sendBuffer[],
1869 char globalReducts[])
1872 "Teuchos::reduceAll<int, char> (" << count <<
", "
1875 reduceAllImpl<char> (comm, reductType, count, sendBuffer, globalReducts);
#define TEUCHOS_COMM_TIME_MONITOR(FUNCNAME)
Declaration of Teuchos::Details::MpiTypeTraits (only if building with MPI)
Smart reference counting pointer class for automatic garbage collection.
Reference-counted smart pointer for managing arrays.
ArrayRCP< T2 > arcp_reinterpret_cast(const ArrayRCP< T1 > &p1)
Reinterpret cast of underlying ArrayRCP type from T1* to T2*.
void set_extra_data(const T1 &extra_data, const std::string &name, const Ptr< ArrayRCP< T2 > > &p, EPrePostDestruction destroy_when=POST_DESTROY, bool force_unique=true)
Set extra data associated with a ArrayRCP object.
ArrayRCP< T2 > arcp_const_cast(const ArrayRCP< T1 > &p1)
Const cast of underlying ArrayRCP type from const T* to T*.
Abstract interface for distributed-memory communication.
void reduce(const Packet sendBuf[], Packet recvBuf[], const Ordinal count, const EReductionType reductType, const Ordinal root, const Comm< Ordinal > &comm)
Wrapper for MPI_Reduce; reduction to one process, using a built-in reduction operator selected by enu...
void gather(const Packet sendBuf[], const Ordinal sendCount, Packet recvBuf[], const Ordinal recvCount, const int root, const Comm< Ordinal > &comm)
Gather values from each process to the root process.
void gatherv(const Packet sendBuf[], const Ordinal sendCount, Packet recvBuf[], const Ordinal recvCounts[], const Ordinal displs[], const int root, const Comm< Ordinal > &comm)
Gather arrays of possibly different lengths from each process to the root process.
void reduceAll(const Comm< Ordinal > &comm, const ValueTypeReductionOp< Ordinal, Packet > &reductOp, const Ordinal count, const Packet sendBuffer[], Packet globalReducts[])
Wrapper for MPI_Allreduce that takes a custom reduction operator.
Encapsulate how an array of const objects with value sematics is serialized into a const char[] array...
MPI implementation of CommRequest<int>.
Ptr< T > inOutArg(T &arg)
create a non-persisting (required or optional) input/output argument for a function call.
Smart reference counting pointer class for automatic garbage collection.
RCP< T2 > rcp_implicit_cast(const RCP< T1 > &p1)
Implicit cast of underlying RCP type from T1* to T2*.
Concrete serial communicator subclass.
static std::string name()
Encapsulate how an array of non-const objects with value sematics is serialized into a char[] array.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
void gather< int, long long >(const long long sendBuf[], const int sendCount, long long recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
void send< int, unsigned long long >(const Comm< int > &comm, const int count, const unsigned long long sendBuffer[], const int destRank)
void reduceAll< int, unsigned int >(const Comm< int > &comm, const EReductionType reductType, const int count, const unsigned int sendBuffer[], unsigned int globalReducts[])
RCP< Teuchos::CommRequest< int > > ireceive< int, double >(const Comm< int > &comm, const ArrayRCP< double > &recvBuffer, const int sourceRank)
TypeTo as(const TypeFrom &t)
Convert from one value type to another.
void gather< int, unsigned long >(const unsigned long sendBuf[], const int sendCount, unsigned long recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
void gatherv< int, unsigned long >(const unsigned long sendBuf[], const int sendCount, unsigned long recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
void gather< int, int >(const int sendBuf[], const int sendCount, int recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
void send< int, double >(const Comm< int > &comm, const int count, const double sendBuffer[], const int destRank)
void gather< int, unsigned int >(const unsigned int sendBuf[], const int sendCount, unsigned int recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
void send< int, float >(const Comm< int > &comm, const int count, const float sendBuffer[], const int destRank)
void reduceAll< int, unsigned long >(const Comm< int > &comm, const EReductionType reductType, const int count, const unsigned long sendBuffer[], unsigned long globalReducts[])
void reduceAll< int, long long >(const Comm< int > &comm, const EReductionType reductType, const int count, const long long sendBuffer[], long long globalReducts[])
void reduceAll< int, double >(const Comm< int > &comm, const EReductionType reductType, const int count, const double sendBuffer[], double globalReducts[])
RCP< Teuchos::CommRequest< int > > isend(const ArrayRCP< const double > &sendBuffer, const int destRank, const int tag, const Comm< int > &comm)
void send< int, unsigned int >(const Comm< int > &comm, const int count, const unsigned int sendBuffer[], const int destRank)
void reduce< int, int >(const int sendBuf[], int recvBuf[], const int count, const EReductionType reductType, const int root, const Comm< int > &comm)
RCP< Teuchos::CommRequest< int > > ireceive< int, unsigned int >(const Comm< int > &comm, const ArrayRCP< unsigned int > &recvBuffer, const int sourceRank)
TEUCHOSCOMM_LIB_DLL_EXPORT void scatter(const int sendBuf[], const int sendCount, int recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
void reduce< int, long >(const long sendBuf[], long recvBuf[], const int count, const EReductionType reductType, const int root, const Comm< int > &comm)
void reduceAll< int, unsigned long long >(const Comm< int > &comm, const EReductionType reductType, const int count, const unsigned long long sendBuffer[], unsigned long long globalReducts[])
RCP< CommRequest< Ordinal > > ireceive(const ArrayRCP< Packet > &recvBuffer, const int sourceRank, const int tag, const Comm< Ordinal > &comm)
Variant of ireceive that takes a tag argument (and restores the correct order of arguments).
void reduceAll< int, long >(const Comm< int > &comm, const EReductionType reductType, const int count, const long sendBuffer[], long globalReducts[])
void send< int, long >(const Comm< int > &comm, const int count, const long sendBuffer[], const int destRank)
void reduceAll< int, float >(const Comm< int > &comm, const EReductionType reductType, const int count, const float sendBuffer[], float globalReducts[])
RCP< Teuchos::CommRequest< int > > ireceive< int, unsigned long >(const Comm< int > &comm, const ArrayRCP< unsigned long > &recvBuffer, const int sourceRank)
RCP< Teuchos::CommRequest< int > > ireceive< int, long >(const Comm< int > &comm, const ArrayRCP< long > &recvBuffer, const int sourceRank)
void reduce< int, unsigned long >(const unsigned long sendBuf[], unsigned long recvBuf[], const int count, const EReductionType reductType, const int root, const Comm< int > &comm)
void reduceAll< int, int >(const Comm< int > &comm, const EReductionType reductType, const int count, const int sendBuffer[], int globalReducts[])
RCP< Teuchos::CommRequest< int > > ireceive< int, unsigned long long >(const Comm< int > &comm, const ArrayRCP< unsigned long long > &recvBuffer, const int sourceRank)
void gatherv< int, long >(const long sendBuf[], const int sendCount, long recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
void reduceAll< int, short >(const Comm< int > &comm, const EReductionType reductType, const int count, const short sendBuffer[], short globalReducts[])
void reduce< int, double >(const double sendBuf[], double recvBuf[], const int count, const EReductionType reductType, const int root, const Comm< int > &comm)
std::string toString(const HashSet< Key > &h)
void gatherv< int, unsigned long long >(const unsigned long long sendBuf[], const int sendCount, unsigned long long recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
void gather< int, unsigned long long >(const unsigned long long sendBuf[], const int sendCount, unsigned long long recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
void gatherv< int, long long >(const long long sendBuf[], const int sendCount, long long recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
void reduce< int, unsigned long long >(const unsigned long long sendBuf[], unsigned long long recvBuf[], const int count, const EReductionType reductType, const int root, const Comm< int > &comm)
void gather< int, short >(const short sendBuf[], const int sendCount, short recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
void gather< int, long >(const long sendBuf[], const int sendCount, long recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
RCP< Teuchos::CommRequest< int > > ireceive< int, short >(const Comm< int > &comm, const ArrayRCP< short > &recvBuffer, const int sourceRank)
void send< int, unsigned long >(const Comm< int > &comm, const int count, const unsigned long sendBuffer[], const int destRank)
ValueTypeReductionOp< Ordinal, Packet > * createOp(const EReductionType reductType)
void scatter< int, int >(const int sendBuf[], const int sendCount, int recvBuf[], const int recvCount, const int root, const Comm< int > &comm)
void send< int, int >(const Comm< int > &comm, const int count, const int sendBuffer[], const int destRank)
void send< int, short >(const Comm< int > &comm, const int count, const short sendBuffer[], const int destRank)
RCP< Teuchos::CommRequest< int > > ireceive< int, long long >(const Comm< int > &comm, const ArrayRCP< long long > &recvBuffer, const int sourceRank)
void send(const Packet sendBuffer[], const Ordinal count, const int destRank, const int tag, const Comm< Ordinal > &comm)
Variant of send() that takes a tag (and restores the correct order of arguments).
RCP< Teuchos::CommRequest< int > > ireceive< int, float >(const Comm< int > &comm, const ArrayRCP< float > &recvBuffer, const int sourceRank)
void send< int, long long >(const Comm< int > &comm, const int count, const long long sendBuffer[], const int destRank)
void gatherv< int, short >(const short sendBuf[], const int sendCount, short recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
void gatherv< int, unsigned int >(const unsigned int sendBuf[], const int sendCount, unsigned int recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)
RCP< Teuchos::CommRequest< int > > ireceive< int, int >(const Comm< int > &comm, const ArrayRCP< int > &recvBuffer, const int sourceRank)
void gatherv< int, int >(const int sendBuf[], const int sendCount, int recvBuf[], const int recvCounts[], const int displs[], const int root, const Comm< int > &comm)