Skip to content

Commit

Permalink
tpetra: Deprecating getNodeNumElements in favor of getLocalNumElements
Browse files Browse the repository at this point in the history
  • Loading branch information
kddevin committed Feb 14, 2022
1 parent 6b1eb4c commit 646a650
Show file tree
Hide file tree
Showing 104 changed files with 483 additions and 477 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ main (int argc, char *argv[])
RCP<const map_type> map =
rcp (new map_type (numGblIndices, indexBase, comm));

const size_t numMyElements = map->getNodeNumElements ();
const size_t numMyElements = map->getLocalNumElements ();

// If you like, you may get the list of global indices that the
// calling process owns. This is unnecessary if you don't mind
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ createMatrix (const Teuchos::RCP<const typename CrsMatrixType::map_type>& map)
const scalar_type negOne = static_cast<scalar_type> (-1.0);

const GST numGlobalIndices = map->getGlobalNumElements ();
// const size_t numMyElements = map->getNodeNumElements ();
// const size_t numMyElements = map->getLocalNumElements ();

// The list of global elements owned by this MPI process.
ArrayView<const GO> myGlobalElements = map->getNodeElementList ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class MyOp : public Tpetra::Operator<> {
//
// Get the local number of rows
//
local_ordinal_type nlocal = opMap_->getNodeNumElements ();
local_ordinal_type nlocal = opMap_->getLocalNumElements ();

//
// Define the distribution that you need for the matvec. When you
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ getLclRowsToTest(const export_type& exporter)
{
Teuchos::ArrayView<const LO> incomingRows = exporter.getRemoteLIDs();
const map_type& tgtMap = *(exporter.getTargetMap());
const LO tgtLclNumRows = LO(tgtMap.getNodeNumElements());
const LO tgtLclNumRows = LO(tgtMap.getLocalNumElements());

using device_type = crs_matrix_type::device_type;
using Kokkos::view_alloc;
Expand Down Expand Up @@ -558,13 +558,13 @@ void benchmark(const RCP<const Teuchos::Comm<int>>& comm,
std::unique_ptr<GO[]> colGids(new GO[numColsToFill]);
std::iota(colGids.get(), colGids.get()+numColsToFill,
domainMap->getIndexBase());
const LO tgtLclNumRows = LO(tgtRowMap->getNodeNumElements());
const LO tgtLclNumRows = LO(tgtRowMap->getLocalNumElements());
for(LO lclRow = 0; lclRow < tgtLclNumRows; ++lclRow) {
const GO gblRow = tgtRowMap->getGlobalElement(lclRow);
tgtGraph->insertGlobalIndices(gblRow, numColsToFill,
colGids.get());
}
const LO srcLclNumRows = LO(srcRowMap->getNodeNumElements());
const LO srcLclNumRows = LO(srcRowMap->getLocalNumElements());
for(LO lclRow = 0; lclRow < srcLclNumRows; ++lclRow) {
const GO gblRow = srcRowMap->getGlobalElement(lclRow);
srcGraph->insertGlobalIndices(gblRow, numColsToFill,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ getTpetraCrsMatrix (Teuchos::FancyOStream& out,
// columns, or asking the column Map for the number of entries,
// won't give the correct number of columns in the graph.
// const GO gblNumCols = graph->getDomainMap ()->getGlobalNumElements ();
const LO lclNumRows = meshRowMap.getNodeNumElements ();
const LO lclNumRows = meshRowMap.getLocalNumElements ();

RCP<matrix_type> A = rcp (new matrix_type (graph));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ localApplyBlockNoTrans (Tpetra::BlockCrsMatrix<Scalar, LO, GO, Node>& A,
const IST zero = KAT::zero ();
const IST one = KAT::one ();
const LO numLocalMeshRows =
static_cast<LO> (G.getRowMap ()->getNodeNumElements ());
static_cast<LO> (G.getRowMap ()->getLocalNumElements ());
const LO numVecs = static_cast<LO> (X.getNumVectors ());
const LO blockSize = A.getBlockSize ();

Expand Down Expand Up @@ -175,7 +175,7 @@ compareLocalMatVec (Teuchos::FancyOStream& out,
"X_mv and Y_mv must have the same number of columns.");

const auto G = A.getCrsGraph ();
const size_t lclNumMeshRows = G.getRowMap ()->getNodeNumElements ();
const size_t lclNumMeshRows = G.getRowMap ()->getLocalNumElements ();
const LO blockSize = A.getBlockSize ();
const size_t maxNumTermsInRowSum =
static_cast<size_t> (G.getNodeMaxNumRowEntries ()) *
Expand Down Expand Up @@ -522,7 +522,7 @@ getTpetraBlockCrsMatrix (Teuchos::FancyOStream& out,
// columns, or asking the column Map for the number of entries,
// won't give the correct number of columns in the graph.
// const GO gblNumCols = graph->getDomainMap ()->getGlobalNumElements ();
const LO lclNumRows = meshRowMap.getNodeNumElements ();
const LO lclNumRows = meshRowMap.getLocalNumElements ();
const LO blkSize = opts.blockSize;

RCP<matrix_type> A = rcp (new matrix_type (*graph, blkSize));
Expand Down
10 changes: 5 additions & 5 deletions packages/tpetra/core/ext/TpetraExt_MatrixMatrix_Cuda.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void KernelWrappers<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosCuda
KokkosSparse::SPGEMMAlgorithm alg_enum = KokkosSparse::StringToSPGEMMAlgorithm(myalg);

// Merge the B and Bimport matrices
const KCRS Bmerged = Tpetra::MMdetails::merge_matrices(Aview,Bview,Acol2Brow,Acol2Irow,Bcol2Ccol,Icol2Ccol,C.getColMap()->getNodeNumElements());
const KCRS Bmerged = Tpetra::MMdetails::merge_matrices(Aview,Bview,Acol2Brow,Acol2Irow,Bcol2Ccol,Icol2Ccol,C.getColMap()->getLocalNumElements());

#ifdef HAVE_TPETRA_MMM_TIMINGS
MM = Teuchos::null; MM = rcp(new TimeMonitor (*TimeMonitor::getNewTimer(prefix_mmm + std::string("MMM Newmatrix CudaCore"))));
Expand Down Expand Up @@ -325,7 +325,7 @@ void KernelWrappers<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosCuda
// Sizes
RCP<const map_type> Ccolmap = C.getColMap();
size_t m = Aview.origMatrix->getNodeNumRows();
size_t n = Ccolmap->getNodeNumElements();
size_t n = Ccolmap->getLocalNumElements();

// Grab the Kokkos::SparseCrsMatrices & inner stuff
const KCRS & Amat = Aview.origMatrix->getLocalMatrixHost();
Expand Down Expand Up @@ -555,7 +555,7 @@ void KernelWrappers2<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosCud
// Sizes
RCP<const map_type> Ccolmap = C.getColMap();
size_t m = Aview.origMatrix->getNodeNumRows();
size_t n = Ccolmap->getNodeNumElements();
size_t n = Ccolmap->getLocalNumElements();

// Grab the Kokkos::SparseCrsMatrices & inner stuff
const KCRS & Amat = Aview.origMatrix->getLocalMatrixHost();
Expand Down Expand Up @@ -700,7 +700,7 @@ void KernelWrappers2<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosCud
auto rowMap = Aview.origMatrix->getRowMap();
Tpetra::Vector<Scalar> diags(rowMap);
Aview.origMatrix->getLocalDiagCopy(diags);
size_t diagLength = rowMap->getNodeNumElements();
size_t diagLength = rowMap->getLocalNumElements();
Teuchos::Array<Scalar> diagonal(diagLength);
diags.get1dCopy(diagonal());

Expand Down Expand Up @@ -738,7 +738,7 @@ void KernelWrappers2<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosCud
}

// Merge the B and Bimport matrices
const matrix_t Bmerged = Tpetra::MMdetails::merge_matrices(Aview,Bview,Acol2Brow,Acol2Irow,Bcol2Ccol,Icol2Ccol,C.getColMap()->getNodeNumElements());
const matrix_t Bmerged = Tpetra::MMdetails::merge_matrices(Aview,Bview,Acol2Brow,Acol2Irow,Bcol2Ccol,Icol2Ccol,C.getColMap()->getLocalNumElements());

// Get the properties and arrays of input matrices
const matrix_t & Amat = Aview.origMatrix->getLocalMatrixDevice();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void mult_A_B_newmatrix_LowThreadGustavsonKernel(CrsMatrixStruct<Scalar, LocalOr
// Sizes
RCP<const map_type> Ccolmap = C.getColMap();
size_t m = Aview.origMatrix->getNodeNumRows();
size_t n = Ccolmap->getNodeNumElements();
size_t n = Ccolmap->getLocalNumElements();
size_t Cest_nnz_per_row = 2*C_estimate_nnz_per_row(*Aview.origMatrix,*Bview.origMatrix);

// Get my node / thread info (right from openmp or parameter list)
Expand Down Expand Up @@ -372,7 +372,7 @@ void mult_A_B_reuse_LowThreadGustavsonKernel(CrsMatrixStruct<Scalar, LocalOrdina
// Sizes
RCP<const map_type> Ccolmap = C.getColMap();
size_t m = Aview.origMatrix->getNodeNumRows();
size_t n = Ccolmap->getNodeNumElements();
size_t n = Ccolmap->getLocalNumElements();

// Get my node / thread info (right from openmp or parameter list)
size_t thread_max = Kokkos::Compat::KokkosOpenMPWrapperNode::execution_space::concurrency();
Expand Down Expand Up @@ -538,7 +538,7 @@ void jacobi_A_B_newmatrix_LowThreadGustavsonKernel(Scalar omega,
// Sizes
RCP<const map_type> Ccolmap = C.getColMap();
size_t m = Aview.origMatrix->getNodeNumRows();
size_t n = Ccolmap->getNodeNumElements();
size_t n = Ccolmap->getLocalNumElements();
size_t Cest_nnz_per_row = 2*C_estimate_nnz_per_row(*Aview.origMatrix,*Bview.origMatrix);

// Get my node / thread info (right from openmp)
Expand Down Expand Up @@ -781,7 +781,7 @@ void jacobi_A_B_reuse_LowThreadGustavsonKernel(Scalar omega,
// Sizes
RCP<const map_type> Ccolmap = C.getColMap();
size_t m = Aview.origMatrix->getNodeNumRows();
size_t n = Ccolmap->getNodeNumElements();
size_t n = Ccolmap->getLocalNumElements();

// Get my node / thread info (right from openmp or parameter list)
size_t thread_max = Kokkos::Compat::KokkosOpenMPWrapperNode::execution_space::concurrency();
Expand Down Expand Up @@ -1072,7 +1072,7 @@ static inline void mult_R_A_P_newmatrix_LowThreadGustavsonKernel(CrsMatrixStruct
// Sizes
RCP<const map_type> Accolmap = Ac.getColMap();
size_t m = Rview.origMatrix->getNodeNumRows();
size_t n = Accolmap->getNodeNumElements();
size_t n = Accolmap->getLocalNumElements();

// Get raw Kokkos matrices, and the raw CSR views
const KCRS & Rmat = Rview.origMatrix->getLocalMatrixDevice();
Expand Down Expand Up @@ -1336,7 +1336,7 @@ static inline void mult_R_A_P_reuse_LowThreadGustavsonKernel(CrsMatrixStruct<Sca
// Sizes
RCP<const map_type> Accolmap = Ac.getColMap();
size_t m = Rview.origMatrix->getNodeNumRows();
size_t n = Accolmap->getNodeNumElements();
size_t n = Accolmap->getLocalNumElements();

// Get raw Kokkos matrices, and the raw CSR views
const KCRS & Rmat = Rview.origMatrix->getLocalMatrixDevice();
Expand Down
10 changes: 5 additions & 5 deletions packages/tpetra/core/ext/TpetraExt_MatrixMatrix_HIP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void KernelWrappers<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosHIPW
KokkosSparse::SPGEMMAlgorithm alg_enum = KokkosSparse::StringToSPGEMMAlgorithm(myalg);

// Merge the B and Bimport matrices
const KCRS Bmerged = Tpetra::MMdetails::merge_matrices(Aview,Bview,Acol2Brow,Acol2Irow,Bcol2Ccol,Icol2Ccol,C.getColMap()->getNodeNumElements());
const KCRS Bmerged = Tpetra::MMdetails::merge_matrices(Aview,Bview,Acol2Brow,Acol2Irow,Bcol2Ccol,Icol2Ccol,C.getColMap()->getLocalNumElements());

#ifdef HAVE_TPETRA_MMM_TIMINGS
MM = Teuchos::null; MM = rcp(new TimeMonitor (*TimeMonitor::getNewTimer(prefix_mmm + std::string("MMM Newmatrix HIPCore"))));
Expand Down Expand Up @@ -321,7 +321,7 @@ void KernelWrappers<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosHIPW
// Sizes
RCP<const map_type> Ccolmap = C.getColMap();
size_t m = Aview.origMatrix->getNodeNumRows();
size_t n = Ccolmap->getNodeNumElements();
size_t n = Ccolmap->getLocalNumElements();

// Grab the Kokkos::SparseCrsMatrices & inner stuff
const KCRS & Amat = Aview.origMatrix->getLocalMatrixHost();
Expand Down Expand Up @@ -548,7 +548,7 @@ void KernelWrappers2<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosHIP
// Sizes
RCP<const map_type> Ccolmap = C.getColMap();
size_t m = Aview.origMatrix->getNodeNumRows();
size_t n = Ccolmap->getNodeNumElements();
size_t n = Ccolmap->getLocalNumElements();

// Grab the Kokkos::SparseCrsMatrices & inner stuff
const KCRS & Amat = Aview.origMatrix->getLocalMatrixHost();
Expand Down Expand Up @@ -693,7 +693,7 @@ void KernelWrappers2<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosHIP
auto rowMap = Aview.origMatrix->getRowMap();
Tpetra::Vector<Scalar> diags(rowMap);
Aview.origMatrix->getLocalDiagCopy(diags);
size_t diagLength = rowMap->getNodeNumElements();
size_t diagLength = rowMap->getLocalNumElements();
Teuchos::Array<Scalar> diagonal(diagLength);
diags.get1dCopy(diagonal());

Expand Down Expand Up @@ -731,7 +731,7 @@ void KernelWrappers2<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosHIP
}

// Merge the B and Bimport matrices
const matrix_t Bmerged = Tpetra::MMdetails::merge_matrices(Aview,Bview,Acol2Brow,Acol2Irow,Bcol2Ccol,Icol2Ccol,C.getColMap()->getNodeNumElements());
const matrix_t Bmerged = Tpetra::MMdetails::merge_matrices(Aview,Bview,Acol2Brow,Acol2Irow,Bcol2Ccol,Icol2Ccol,C.getColMap()->getLocalNumElements());

// Get the properties and arrays of input matrices
const matrix_t & Amat = Aview.origMatrix->getLocalMatrixDevice();
Expand Down
6 changes: 3 additions & 3 deletions packages/tpetra/core/ext/TpetraExt_MatrixMatrix_OpenMP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ void KernelWrappers<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosOpen
KokkosSparse::SPGEMMAlgorithm alg_enum = KokkosSparse::StringToSPGEMMAlgorithm(myalg);

// Merge the B and Bimport matrices
const KCRS Bmerged = Tpetra::MMdetails::merge_matrices(Aview,Bview,Acol2Brow,Acol2Irow,Bcol2Ccol,Icol2Ccol,C.getColMap()->getNodeNumElements());
const KCRS Bmerged = Tpetra::MMdetails::merge_matrices(Aview,Bview,Acol2Brow,Acol2Irow,Bcol2Ccol,Icol2Ccol,C.getColMap()->getLocalNumElements());

#ifdef HAVE_TPETRA_MMM_TIMINGS
MM = Teuchos::null; MM = rcp(new TimeMonitor (*TimeMonitor::getNewTimer(prefix_mmm + std::string("MMM Newmatrix OpenMPCore"))));
Expand Down Expand Up @@ -530,7 +530,7 @@ void KernelWrappers2<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosOpe
auto rowMap = Aview.origMatrix->getRowMap();
Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode> diags(rowMap);
Aview.origMatrix->getLocalDiagCopy(diags);
size_t diagLength = rowMap->getNodeNumElements();
size_t diagLength = rowMap->getLocalNumElements();
Teuchos::Array<Scalar> diagonal(diagLength);
diags.get1dCopy(diagonal());

Expand Down Expand Up @@ -568,7 +568,7 @@ void KernelWrappers2<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosOpe
}

// Merge the B and Bimport matrices
const matrix_t Bmerged = Tpetra::MMdetails::merge_matrices(Aview,Bview,Acol2Brow,Acol2Irow,Bcol2Ccol,Icol2Ccol,C.getColMap()->getNodeNumElements());
const matrix_t Bmerged = Tpetra::MMdetails::merge_matrices(Aview,Bview,Acol2Brow,Acol2Irow,Bcol2Ccol,Icol2Ccol,C.getColMap()->getLocalNumElements());

// Get the properties and arrays of input matrices
const matrix_t & Amat = Aview.origMatrix->getLocalMatrixDevice();
Expand Down
10 changes: 5 additions & 5 deletions packages/tpetra/core/ext/TpetraExt_MatrixMatrix_SYCL.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void KernelWrappers<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosSYCL
KokkosSparse::SPGEMMAlgorithm alg_enum = KokkosSparse::StringToSPGEMMAlgorithm(myalg);

// Merge the B and Bimport matrices
const KCRS Bmerged = Tpetra::MMdetails::merge_matrices(Aview,Bview,Acol2Brow,Acol2Irow,Bcol2Ccol,Icol2Ccol,C.getColMap()->getNodeNumElements());
const KCRS Bmerged = Tpetra::MMdetails::merge_matrices(Aview,Bview,Acol2Brow,Acol2Irow,Bcol2Ccol,Icol2Ccol,C.getColMap()->getLocalNumElements());

#ifdef HAVE_TPETRA_MMM_TIMINGS
MM = Teuchos::null; MM = rcp(new TimeMonitor (*TimeMonitor::getNewTimer(prefix_mmm + std::string("MMM Newmatrix SYCLCore"))));
Expand Down Expand Up @@ -328,7 +328,7 @@ void KernelWrappers<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosSYCL
// Sizes
RCP<const map_type> Ccolmap = C.getColMap();
size_t m = Aview.origMatrix->getNodeNumRows();
size_t n = Ccolmap->getNodeNumElements();
size_t n = Ccolmap->getLocalNumElements();

// Grab the Kokkos::SparseCrsMatrices & inner stuff
const KCRS & Amat = Aview.origMatrix->getLocalMatrixHost();
Expand Down Expand Up @@ -558,7 +558,7 @@ void KernelWrappers2<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosSYC
// Sizes
RCP<const map_type> Ccolmap = C.getColMap();
size_t m = Aview.origMatrix->getNodeNumRows();
size_t n = Ccolmap->getNodeNumElements();
size_t n = Ccolmap->getLocalNumElements();

// Grab the Kokkos::SparseCrsMatrices & inner stuff
const KCRS & Amat = Aview.origMatrix->getLocalMatrixHost();
Expand Down Expand Up @@ -703,7 +703,7 @@ void KernelWrappers2<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosSYC
auto rowMap = Aview.origMatrix->getRowMap();
Tpetra::Vector<Scalar> diags(rowMap);
Aview.origMatrix->getLocalDiagCopy(diags);
size_t diagLength = rowMap->getNodeNumElements();
size_t diagLength = rowMap->getLocalNumElements();
Teuchos::Array<Scalar> diagonal(diagLength);
diags.get1dCopy(diagonal());

Expand Down Expand Up @@ -741,7 +741,7 @@ void KernelWrappers2<Scalar,LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosSYC
}

// Merge the B and Bimport matrices
const matrix_t Bmerged = Tpetra::MMdetails::merge_matrices(Aview,Bview,Acol2Brow,Acol2Irow,Bcol2Ccol,Icol2Ccol,C.getColMap()->getNodeNumElements());
const matrix_t Bmerged = Tpetra::MMdetails::merge_matrices(Aview,Bview,Acol2Brow,Acol2Irow,Bcol2Ccol,Icol2Ccol,C.getColMap()->getLocalNumElements());

// Get the properties and arrays of input matrices
const matrix_t & Amat = Aview.origMatrix->getLocalMatrixDevice();
Expand Down
Loading

0 comments on commit 646a650

Please sign in to comment.