10 #ifndef TPETRA_DETAILS_READTRIPLES_HPP
11 #define TPETRA_DETAILS_READTRIPLES_HPP
22 #include "TpetraCore_config.h"
23 #include "Tpetra_Details_PackTriples.hpp"
24 #if KOKKOS_VERSION >= 40799
25 #include "KokkosKernels_ArithTraits.hpp"
27 #include "Kokkos_ArithTraits.hpp"
29 #include "Teuchos_MatrixMarket_generic.hpp"
30 #include "Teuchos_CommHelpers.hpp"
82 template <
class OrdinalType,
class RealType>
83 bool readComplexData(std::istream& istr,
84 OrdinalType& rowIndex,
85 OrdinalType& colIndex,
88 const std::size_t lineNumber,
89 const bool tolerant) {
90 using ::Teuchos::MatrixMarket::readRealData;
92 RealType the_realPart, the_imagPart;
93 if (!readRealData(istr, rowIndex, colIndex, the_realPart, lineNumber, tolerant)) {
97 std::ostringstream os;
98 os <<
"Failed to read pattern data and/or real value from line "
99 << lineNumber <<
" of input";
100 throw std::invalid_argument(os.str());
107 std::ostringstream os;
108 os <<
"No more data after real value on line "
109 << lineNumber <<
" of input";
110 throw std::invalid_argument(os.str());
113 istr >> the_imagPart;
118 std::ostringstream os;
119 os <<
"Failed to get imaginary value from line "
120 << lineNumber <<
" of input";
121 throw std::invalid_argument(os.str());
124 realPart = the_realPart;
125 imagPart = the_imagPart;
140 #if KOKKOS_VERSION >= 40799
141 const bool isComplex = ::KokkosKernels::ArithTraits<SC>::is_complex>
143 const bool isComplex = ::Kokkos::ArithTraits<SC>::is_complex>
167 readLine(std::function<
int(
const GO,
const GO,
const SC&)> processTriple,
168 const std::string& line,
169 const std::size_t lineNumber,
170 const bool tolerant =
false,
171 std::ostream* errStrm = NULL,
172 const bool debug =
false);
182 template <
class SC,
class GO>
205 readLine(std::function<
int(
const GO,
const GO,
const SC&)> processTriple,
206 const std::string& line,
207 const std::size_t lineNumber,
208 const bool tolerant =
false,
209 std::ostream* errStrm = NULL,
210 const bool debug =
false) {
211 using ::Teuchos::MatrixMarket::checkCommentLine;
212 #if KOKKOS_VERSION >= 40799
213 typedef typename ::KokkosKernels::ArithTraits<SC>::mag_type real_type;
215 typedef typename ::Kokkos::ArithTraits<SC>::mag_type real_type;
220 real_type realPart, imagPart;
221 std::istringstream istr(line);
227 success = readComplexData(istr, rowInd, colInd, realPart, imagPart,
228 lineNumber, tolerant);
229 }
catch (std::exception& e) {
231 if (errStrm != NULL) {
232 std::ostringstream os;
233 os <<
"readLine: readComplexData threw an exception: " << e.what()
235 *errStrm << os.str();
249 processTriple(rowInd, colInd, SC(realPart, imagPart));
250 if (errCode != 0 && errStrm != NULL) {
251 std::ostringstream os;
252 os <<
"readLine: processTriple returned " << errCode <<
" != 0."
254 *errStrm << os.str();
270 template <
class SC,
class GO>
293 readLine(std::function<
int(
const GO,
const GO,
const SC&)> processTriple,
294 const std::string& line,
295 const std::size_t lineNumber,
296 const bool tolerant =
false,
297 std::ostream* errStrm = NULL,
298 const bool debug =
false) {
300 using ::Teuchos::MatrixMarket::checkCommentLine;
301 using ::Teuchos::MatrixMarket::readRealData;
305 std::istringstream istr(line);
308 success = readRealData(istr, rowInd, colInd, val,
309 lineNumber, tolerant);
310 }
catch (std::exception& e) {
312 if (errStrm != NULL) {
313 std::ostringstream os;
314 os <<
"readLine: readRealData threw an exception: " << e.what()
316 *errStrm << os.str();
321 if (debug && errStrm != NULL) {
322 std::ostringstream os;
323 os <<
"readLine: Got entry: row=" << rowInd <<
", col=" << colInd
324 <<
", val=" << val << std::endl;
325 *errStrm << os.str();
328 const int errCode = processTriple(rowInd, colInd, val);
329 if (errCode != 0 && errStrm != NULL) {
330 std::ostringstream os;
331 os <<
"readLine: processTriple returned " << errCode <<
" != 0."
333 *errStrm << os.str();
367 template <
class SC,
class GO>
368 int readLine(std::function<
int(
const GO,
const GO,
const SC&)> processTriple,
369 const std::string& line,
370 const std::size_t lineNumber,
371 const bool tolerant =
false,
372 std::ostream* errStrm = NULL,
373 const bool debug =
false) {
375 tolerant, errStrm, debug);
408 template <
class SC,
class GO>
409 int readTriples(std::istream& inputStream,
410 std::size_t& curLineNum,
411 std::size_t& numTriplesRead,
412 std::function<
int(
const GO,
const GO,
const SC&)> processTriple,
413 const std::size_t maxNumTriplesToRead,
414 const bool tolerant =
false,
415 std::ostream* errStrm = NULL,
416 const bool debug =
false) {
419 using Teuchos::MatrixMarket::checkCommentLine;
422 if (inputStream.eof()) {
424 }
else if (inputStream.fail()) {
425 if (errStrm != NULL) {
426 *errStrm <<
"Input stream reports a failure (not the same as "
434 std::vector<size_t> badLineNumbers;
437 bool inputStreamCanStillBeRead = std::getline(inputStream, line).good();
439 while (inputStreamCanStillBeRead && numTriplesRead < maxNumTriplesToRead) {
447 const bool isCommentLine =
448 checkCommentLine(line, start, size, curLineNum, tolerant);
451 inputStreamCanStillBeRead = std::getline(inputStream, line).good();
455 const std::string theLine = line.substr(start, size);
458 const int curErrCode =
459 readLine(processTriple, theLine, curLineNum, tolerant, errStrm, debug);
460 if (curErrCode != 0) {
461 errCode = curErrCode;
462 badLineNumbers.push_back(curLineNum);
466 if (numTriplesRead < maxNumTriplesToRead) {
467 inputStreamCanStillBeRead = std::getline(inputStream, line).good();
472 if (errCode != 0 && errStrm != NULL) {
473 const size_t numBadLines = badLineNumbers.size();
474 *errStrm <<
"Encountered " << numBadLines <<
" bad line"
475 << (numBadLines != size_t(1) ?
"s" :
"")
477 for (
size_t k = 0; k < numBadLines; ++k) {
478 *errStrm << badLineNumbers[k];
479 if (k + 1 < numBadLines) {
483 *errStrm <<
"]" << endl;
485 if (!inputStream.eof() && inputStream.fail()) {
489 if (errStrm != NULL) {
490 *errStrm <<
"The input stream is not at end-of-file, "
491 "but is in a bad state."
523 template <
class SC,
class GO>
524 int readAndSendOneBatchOfTriples(std::istream& inputStream,
525 std::size_t& curLineNum,
526 std::size_t& numEntRead,
527 ::Teuchos::ArrayRCP<int>& sizeBuf,
528 ::Teuchos::ArrayRCP<char>& msgBuf,
529 std::vector<GO>& rowInds,
530 std::vector<GO>& colInds,
531 std::vector<SC>& vals,
532 const std::size_t maxNumEntPerMsg,
534 const ::Teuchos::Comm<int>& comm,
535 const bool tolerant =
false,
536 std::ostream* errStrm = NULL,
537 const bool debug =
false) {
539 using ::Teuchos::isend;
540 using ::Tpetra::Details::countPackTriples;
541 using ::Tpetra::Details::countPackTriplesCount;
542 using ::Tpetra::Details::packTriples;
543 using ::Tpetra::Details::packTriplesCount;
545 #if KOKKOS_VERSION >= 40799
546 using ::KokkosKernels::ArithTraits;
548 using ::Kokkos::ArithTraits;
552 constexpr
int sizeTag = 42;
553 constexpr
int msgTag = 43;
563 auto processTriple = [&rowInds, &colInds, &vals](
const GO rowInd,
const GO colInd,
const SC& val) {
565 rowInds.push_back(rowInd);
566 colInds.push_back(colInd);
574 errCode = readTriples<SC, GO>(inputStream, curLineNum, numEntRead,
575 processTriple, maxNumEntPerMsg, tolerant,
577 if (debug && errStrm != NULL) {
578 std::ostringstream os;
579 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
580 <<
", GO=" <<
typeid(GO).name() <<
": "
581 <<
"readAndSendOneBatchOfTriples: readTriples read "
582 << numEntRead <<
" matrix entries, and returned errCode="
583 << errCode <<
"." << std::endl;
584 *errStrm << os.str();
586 if (numEntRead != rowInds.size() ||
587 numEntRead != colInds.size() ||
588 numEntRead != vals.size()) {
589 if (errStrm != NULL) {
590 *errStrm <<
"readTriples size results are not consistent. "
591 <<
"numEntRead = " << numEntRead
592 <<
", rowInds.size() = " << rowInds.size()
593 <<
", colInds.size() = " << colInds.size()
594 <<
", and vals.size() = " << vals.size() <<
"."
608 if (numEntRead == 0 || errCode != 0) {
614 if (debug && errStrm != NULL) {
615 std::ostringstream os;
616 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
617 <<
", GO=" <<
typeid(GO).name() <<
": "
618 <<
"Post send (size=0, errCode=" << errCode <<
") "
619 <<
"to " << destRank <<
" with tag " << sizeTag << endl;
620 *errStrm << os.str();
622 send(sizeBuf.getRawPtr(), 1, destRank, sizeTag, comm);
625 const int numEnt =
static_cast<int>(numEntRead);
632 if (countSize <= 0 && errCode == 0) {
639 if (debug && errStrm != NULL) {
640 std::ostringstream os;
641 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
642 <<
", GO=" <<
typeid(GO).name() <<
": "
643 <<
"Post send (size=0, error case) to " << destRank
644 <<
" with tag " << sizeTag << endl;
645 *errStrm << os.str();
647 send(sizeBuf.getRawPtr(), 1, destRank, sizeTag, comm);
650 errCode = countPackTriples<SC, GO>(numEnt, comm, triplesSize, errStrm);
655 if (debug && errStrm != NULL) {
656 std::ostringstream os;
657 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
658 <<
", GO=" <<
typeid(GO).name() <<
": "
659 <<
"Post send (size=0, error case) to " << destRank
660 <<
" with tag " << sizeTag << endl;
661 *errStrm << os.str();
663 send(sizeBuf.getRawPtr(), 1, destRank, sizeTag, comm);
668 const int outBufSize = countSize + triplesSize;
669 sizeBuf[0] = outBufSize;
670 if (debug && errStrm != NULL) {
671 std::ostringstream os;
672 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
673 <<
", GO=" <<
typeid(GO).name() <<
": "
674 <<
"Post isend (size=" << sizeBuf[0] <<
") to " << destRank
675 <<
" with tag " << sizeTag << endl;
676 *errStrm << os.str();
678 auto sizeReq = isend<int, int>(sizeBuf, destRank, sizeTag, comm);
680 msgBuf.resize(outBufSize);
681 char* outBuf = msgBuf.getRawPtr();
685 int outBufCurPos = 0;
687 outBufCurPos, comm, errStrm);
689 errCode = packTriples<SC, GO>(rowInds.data(), colInds.data(),
690 vals.data(), numEnt, outBuf,
691 outBufSize, outBufCurPos, comm,
694 if (debug && errStrm != NULL) {
695 std::ostringstream os;
696 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
697 <<
", GO=" <<
typeid(GO).name() <<
": "
698 <<
"Post isend (packed data) to " << destRank
699 <<
" with tag " << msgTag << endl;
700 *errStrm << os.str();
702 auto msgReq = isend<int, char>(msgBuf, destRank, msgTag, comm);
708 if (debug && errStrm != NULL) {
709 std::ostringstream os;
710 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
711 <<
", GO=" <<
typeid(GO).name() <<
": "
712 <<
"Wait on isend (size)" << endl;
713 *errStrm << os.str();
716 if (debug && errStrm != NULL) {
717 std::ostringstream os;
718 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
719 <<
", GO=" <<
typeid(GO).name() <<
": "
720 <<
"Wait on isend (packed data)" << endl;
721 *errStrm << os.str();
770 template <
class SC,
class GO,
class CommRequestPtr>
771 int recvOneBatchOfTriples(std::vector<GO>& rowInds,
772 std::vector<GO>& colInds,
773 std::vector<SC>& vals,
775 ::Teuchos::ArrayRCP<int>& sizeBuf,
776 ::Teuchos::ArrayRCP<char>& msgBuf,
777 CommRequestPtr& sizeReq,
779 const ::Teuchos::Comm<int>& comm,
780 const bool tolerant =
false,
781 std::ostream* errStrm = NULL,
782 const bool debug =
false) {
783 #if KOKKOS_VERSION >= 40799
784 using ::KokkosKernels::ArithTraits;
786 using ::Kokkos::ArithTraits;
788 using ::Tpetra::Details::unpackTriples;
789 using ::Tpetra::Details::unpackTriplesCount;
794 constexpr
int msgTag = 43;
799 if (debug && errStrm != NULL) {
800 std::ostringstream os;
801 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
802 <<
", GO=" <<
typeid(GO).name() <<
": "
803 <<
"Wait on irecv (size)" << std::endl;
804 *errStrm << os.str();
807 sizeReq = CommRequestPtr(NULL);
808 const int inBufSize = sizeBuf[0];
809 if (debug && errStrm != NULL) {
810 std::ostringstream os;
811 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
812 <<
", GO=" <<
typeid(GO).name() <<
": "
813 <<
"Received size: sizeBuf[0]=" << sizeBuf[0] << std::endl;
814 *errStrm << os.str();
817 if (inBufSize == 0) {
823 msgBuf.resize(inBufSize);
824 char* inBuf = msgBuf.getRawPtr();
826 if (debug && errStrm != NULL) {
827 std::ostringstream os;
828 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
829 <<
", GO=" <<
typeid(GO).name() <<
": "
830 <<
"Post irecv (packed data) "
831 <<
"from " << srcRank
832 <<
" with tag " << msgTag << std::endl;
833 *errStrm << os.str();
835 auto msgReq = ::Teuchos::ireceive(msgBuf, srcRank, msgTag, comm);
836 if (debug && errStrm != NULL) {
837 std::ostringstream os;
838 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
839 <<
", GO=" <<
typeid(GO).name() <<
": "
840 <<
"Wait on irecv (packed data)" << std::endl;
841 *errStrm << os.str();
847 numEnt, comm, errStrm);
849 rowInds.resize(numEnt);
850 colInds.resize(numEnt);
852 errCode = unpackTriples<SC, GO>(inBuf, inBufSize, inBufCurPos,
853 rowInds.data(), colInds.data(),
854 vals.data(), numEnt, comm, errStrm);
899 template <
class SC,
class GO>
901 std::size_t& curLineNum,
902 std::size_t& totalNumEntRead,
903 std::function<
int(
const GO,
const GO,
const SC&)> processTriple,
904 const std::size_t maxNumEntPerMsg,
905 const ::Teuchos::Comm<int>& comm,
906 const bool tolerant =
false,
907 std::ostream* errStrm = NULL,
908 const bool debug =
false) {
909 #if KOKKOS_VERSION >= 40799
910 using KokkosKernels::ArithTraits;
912 using Kokkos::ArithTraits;
917 constexpr
int srcRank = 0;
920 constexpr
int sizeTag = 42;
922 const int myRank = comm.getRank();
923 const int numProcs = comm.getSize();
926 ::Teuchos::ArrayRCP<int> sizeBuf(1);
927 ::Teuchos::ArrayRCP<char> msgBuf;
931 std::vector<GO> rowInds;
932 std::vector<GO> colInds;
933 std::vector<SC> vals;
934 rowInds.reserve(maxNumEntPerMsg);
935 colInds.reserve(maxNumEntPerMsg);
936 vals.reserve(maxNumEntPerMsg);
939 if (myRank == srcRank) {
943 bool lastMessageWasLegitZero =
false;
945 !inputStream.eof() && errCode == 0;
946 destRank = (destRank + 1) % numProcs) {
947 size_t curNumEntRead = 0;
948 if (destRank == srcRank) {
952 const int readErrCode =
953 Impl::readTriples<SC, GO>(inputStream, curLineNum, curNumEntRead,
954 processTriple, maxNumEntPerMsg, tolerant,
956 if (debug && errStrm != NULL) {
957 std::ostringstream os;
958 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
959 <<
", GO=" <<
typeid(GO).name() <<
": "
960 <<
"(dest=src) readTriples returned curNumEntRead="
961 << curNumEntRead <<
", errCode=" << readErrCode << endl;
962 *errStrm << os.str();
964 errCode = (readErrCode != 0) ? readErrCode : errCode;
966 if (
false && debug && errStrm != NULL) {
967 std::ostringstream os;
968 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
969 <<
", GO=" <<
typeid(GO).name() <<
": "
970 <<
"Calling readAndSend... with destRank=" << destRank << endl;
971 *errStrm << os.str();
974 const int readAndSendErrCode =
975 Impl::readAndSendOneBatchOfTriples<SC, GO>(inputStream, curLineNum,
978 rowInds, colInds, vals,
979 maxNumEntPerMsg, destRank,
980 comm, tolerant, errStrm,
982 totalNumEntRead += curNumEntRead;
983 if (debug && errStrm != NULL) {
984 std::ostringstream os;
985 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
986 <<
", GO=" <<
typeid(GO).name() <<
": "
987 <<
"readAndSend... with destRank=" << destRank
988 <<
" returned curNumEntRead=" << curNumEntRead
989 <<
", errCode=" << readAndSendErrCode << endl;
990 *errStrm << os.str();
992 errCode = (readAndSendErrCode != 0) ? readAndSendErrCode : errCode;
993 if (readAndSendErrCode == 0 && curNumEntRead == 0) {
994 lastMessageWasLegitZero =
true;
995 if (debug && errStrm != NULL) {
996 std::ostringstream os;
997 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
998 <<
", GO=" <<
typeid(GO).name() <<
": "
999 <<
"Last send to " << destRank <<
" with tag " << sizeTag
1000 <<
" was legit zero, counts as termination" << endl;
1001 *errStrm << os.str();
1013 destRank = (destRank - 1) % numProcs;
1015 destRank = destRank + numProcs;
1018 const int startRank = lastMessageWasLegitZero ? (destRank + 1) : destRank;
1019 for (
int outRank = startRank; outRank < numProcs; ++outRank) {
1020 if (outRank != srcRank) {
1021 if (debug && errStrm != NULL) {
1022 std::ostringstream os;
1023 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
1024 <<
", GO=" <<
typeid(GO).name() <<
": "
1025 <<
"Post send (size, termination msg) to " << outRank
1026 <<
" with tag " << sizeTag <<
"(was last message legit zero? "
1027 << (lastMessageWasLegitZero ?
"true" :
"false") <<
")" << endl;
1028 *errStrm << os.str();
1031 ::Teuchos::send(sizeBuf.getRawPtr(), 1, outRank, sizeTag, comm);
1039 if (debug && errStrm != NULL) {
1040 std::ostringstream os;
1041 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
1042 <<
", GO=" <<
typeid(GO).name() <<
": "
1043 <<
"Post irecv (size) from " << srcRank
1044 <<
" with tag " << sizeTag << std::endl;
1045 *errStrm << os.str();
1047 auto sizeReq = ::Teuchos::ireceive(sizeBuf, srcRank, sizeTag, comm);
1050 const int recvErrCode =
1051 Impl::recvOneBatchOfTriples(rowInds, colInds, vals, numEnt, sizeBuf,
1052 msgBuf, sizeReq, srcRank, comm, tolerant,
1054 if (debug && errStrm != NULL) {
1055 std::ostringstream os;
1056 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
1057 <<
", GO=" <<
typeid(GO).name() <<
": "
1058 <<
"recvOneBatchOfTriples returned numEnt=" << numEnt
1059 <<
", errCode=" << recvErrCode << endl;
1060 *errStrm << os.str();
1062 errCode = (recvErrCode != 0) ? recvErrCode : errCode;
1064 if (numEnt != static_cast<int>(rowInds.size()) ||
1065 numEnt != static_cast<int>(colInds.size()) ||
1066 numEnt != static_cast<int>(vals.size())) {
1067 errCode = (errCode == 0) ? -1 : errCode;
1068 if (errStrm != NULL) {
1069 *errStrm <<
"recvOneBatchOfTriples produced inconsistent data sizes. "
1070 <<
"numEnt = " << numEnt
1071 <<
", rowInds.size() = " << rowInds.size()
1072 <<
", colInds.size() = " << colInds.size()
1073 <<
", vals.size() = " << vals.size() <<
"."
1084 for (
int k = 0; k < numEnt && errCode == 0; ++k) {
1085 const int curErrCode = processTriple(rowInds[k], colInds[k], vals[k]);
1086 errCode = (curErrCode == 0) ? errCode : curErrCode;
1091 if (debug && errStrm != NULL) {
1092 std::ostringstream os;
1093 os <<
"Proc " << comm.getRank() <<
", SC=" <<
typeid(SC).name()
1094 <<
", GO=" <<
typeid(GO).name() <<
": "
1095 <<
"Done with send/recv loop" << endl;
1096 *errStrm << os.str();
1100 using ::Teuchos::outArg;
1101 using ::Teuchos::REDUCE_BOR;
1102 using ::Teuchos::reduceAll;
1103 const int lclErrCode = errCode;
1104 reduceAll<int, int>(comm, REDUCE_BOR, lclErrCode, outArg(errCode));
1111 #endif // TPETRA_DETAILS_READTRIPLES_HPP
int packTriplesCount(const int, char[], const int, int &, const ::Teuchos::Comm< int > &, std::ostream *errStrm)
Pack the count (number) of matrix triples.
static int readLine(std::function< int(const GO, const GO, const SC &)> processTriple, const std::string &line, const std::size_t lineNumber, const bool tolerant=false, std::ostream *errStrm=NULL, const bool debug=false)
Take a line from the Matrix Market file or input stream, and process the sparse matrix entry in that ...
int readAndDealOutTriples(std::istream &inputStream, std::size_t &curLineNum, std::size_t &totalNumEntRead, std::function< int(const GO, const GO, const SC &)> processTriple, const std::size_t maxNumEntPerMsg, const ::Teuchos::Comm< int > &comm, const bool tolerant=false, std::ostream *errStrm=NULL, const bool debug=false)
On Process 0 in the given communicator, read sparse matrix entries (in chunks of at most maxNumEntPer...
Implementation of the readLine stand-alone function in this namespace (see below).
int unpackTriplesCount(const char[], const int, int &, int &, const ::Teuchos::Comm< int > &, std::ostream *errStrm)
Unpack just the count of triples from the given input buffer.
static int readLine(std::function< int(const GO, const GO, const SC &)> processTriple, const std::string &line, const std::size_t lineNumber, const bool tolerant=false, std::ostream *errStrm=NULL, const bool debug=false)
Take a line from the Matrix Market file or input stream, and process the sparse matrix entry in that ...
int countPackTriplesCount(const ::Teuchos::Comm< int > &, int &size, std::ostream *errStrm)
Compute the buffer size required by packTriples for packing the number of matrix entries ("triples")...
void start()
Start the deep_copy counter.
static int readLine(std::function< int(const GO, const GO, const SC &)> processTriple, const std::string &line, const std::size_t lineNumber, const bool tolerant=false, std::ostream *errStrm=NULL, const bool debug=false)
Take a line from the Matrix Market file or input stream, and process the sparse matrix entry in that ...