Skip to content

Commit

Permalink
Amesos2: update Tpetra getNode* names to getLocal*
Browse files Browse the repository at this point in the history
Attempts to address issue trilinos#10247
Related to trilinos#10189
  • Loading branch information
ndellingwood committed Feb 25, 2022
1 parent c110f92 commit fedb22f
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions packages/amesos2/src/Amesos2_EpetraMultiVecAdapter_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void MultiVecAdapter<Epetra_MultiVector>::get1dCopy(
const size_t num_vecs = getGlobalNumVectors();

#ifdef HAVE_AMESOS2_DEBUG
const size_t requested_vector_length = distribution_map->getNodeNumElements();
const size_t requested_vector_length = distribution_map->getLocalNumElements();
TEUCHOS_TEST_FOR_EXCEPTION( lda < requested_vector_length,
std::invalid_argument,
"Given stride is not large enough for local vector length" );
Expand Down Expand Up @@ -270,7 +270,7 @@ void MultiVecAdapter<Epetra_MultiVector>::get1dCopy_kokkos_view_host(
const size_t num_vecs = getGlobalNumVectors();

#ifdef HAVE_AMESOS2_DEBUG
const size_t requested_vector_length = distribution_map->getNodeNumElements();
const size_t requested_vector_length = distribution_map->getLocalNumElements();
TEUCHOS_TEST_FOR_EXCEPTION( lda < requested_vector_length,
std::invalid_argument,
"Given stride is not large enough for local vector length" );
Expand All @@ -279,7 +279,7 @@ void MultiVecAdapter<Epetra_MultiVector>::get1dCopy_kokkos_view_host(
// First make a host view
host_view = Kokkos::View<scalar_t**, Kokkos::LayoutLeft, Kokkos::HostSpace>(
Kokkos::ViewAllocateWithoutInitializing("get1dCopy_kokkos_view"),
distribution_map->getNodeNumElements(), num_vecs);
distribution_map->getLocalNumElements(), num_vecs);

// Optimization for ROOTED and single MPI process
if ( num_vecs == 1 && this->mv_->Comm().MyPID() == 0 && this->mv_->Comm().NumProc() == 1 ) {
Expand Down Expand Up @@ -320,7 +320,7 @@ MultiVecAdapter<Epetra_MultiVector>::get1dViewNonConst(bool local)

// // localize();
// // /* Use the global element list returned by
// // * mv_->getMap()->getNodeElementList() to get a subCopy of mv_ which we
// // * mv_->getMap()->getLocalElementList() to get a subCopy of mv_ which we
// // * assign to l_l_mv_, then return get1dViewNonConst() of l_l_mv_
// // */
// // l_l_mv_ = Teuchos::null;
Expand Down
10 changes: 5 additions & 5 deletions packages/amesos2/src/Amesos2_MatrixAdapter_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,14 @@ namespace Amesos2 {
size_t
MatrixAdapter<Matrix>::getLocalNumRows() const
{
return row_map_->getNodeNumElements(); // TODO: verify
return row_map_->getLocalNumElements(); // TODO: verify
}

template < class Matrix >
size_t
MatrixAdapter<Matrix>::getLocalNumCols() const
{
return col_map_->getNodeNumElements();
return col_map_->getLocalNumElements();
}

template < class Matrix >
Expand Down Expand Up @@ -422,7 +422,7 @@ namespace Amesos2 {
// compatibility, but things are working fine now.

RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rmap = get_mat->getRowMap();
ArrayView<const global_ordinal_t> node_elements = rmap->getNodeElementList();
ArrayView<const global_ordinal_t> node_elements = rmap->getLocalElementList();
if( node_elements.size() == 0 ) return; // no more contribution

typename ArrayView<const global_ordinal_t>::iterator row_it, row_end;
Expand Down Expand Up @@ -509,7 +509,7 @@ namespace Amesos2 {
// compatibility, but things are working fine now.

RCP<const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > rmap = get_mat->getRowMap();
ArrayView<const global_ordinal_t> node_elements = rmap->getNodeElementList();
ArrayView<const global_ordinal_t> node_elements = rmap->getLocalElementList();
//if( node_elements.size() == 0 ) return; // no more contribution
typename ArrayView<const global_ordinal_t>::iterator row_it, row_end;
row_end = node_elements.end();
Expand Down Expand Up @@ -788,7 +788,7 @@ namespace Amesos2 {
RCP<const Tpetra::Map<scalar_t,local_ordinal_t,global_ordinal_t> > cmap = get_mat->getColMap();
TEUCHOS_ASSERT( *colmap == *cmap );

ArrayView<global_ordinal_t> node_elements = cmap->getNodeElementList();
ArrayView<global_ordinal_t> node_elements = cmap->getLocalElementList();
if( node_elements.size() == 0 ) return; // no more contribution

typename ArrayView<global_ordinal_t>::iterator col_it, col_end;
Expand Down
2 changes: 1 addition & 1 deletion packages/amesos2/src/Amesos2_STRUMPACK_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ namespace Amesos2 {
#ifdef HAVE_MPI
// local_len_rhs is how many of the multivector rows belong to
// this processor
const size_t local_len_rhs = strumpack_rowmap_->getNodeNumElements();
const size_t local_len_rhs = strumpack_rowmap_->getLocalNumElements();
const global_size_type nrhs = X->getGlobalNumVectors();

// make sure our multivector storage is sized appropriately
Expand Down
2 changes: 1 addition & 1 deletion packages/amesos2/src/Amesos2_Superludist_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ namespace Amesos2 {

// local_len_rhs is how many of the multivector rows belong to
// this processor in the SuperLU_DIST processor grid.
const size_t local_len_rhs = superlu_rowmap_->getNodeNumElements();
const size_t local_len_rhs = superlu_rowmap_->getLocalNumElements();
const global_size_type nrhs = X->getGlobalNumVectors();
const global_ordinal_type first_global_row_b = superlu_rowmap_->getMinGlobalIndex();

Expand Down
10 changes: 5 additions & 5 deletions packages/amesos2/src/Amesos2_TpetraMultiVecAdapter_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ namespace Amesos2 {
"Amesos2::MultiVecAdapter::get1dCopy: this->getMap() returns null.");

#ifdef HAVE_AMESOS2_DEBUG
const size_t requested_vector_length = distribution_map->getNodeNumElements ();
const size_t requested_vector_length = distribution_map->getLocalNumElements ();
TEUCHOS_TEST_FOR_EXCEPTION(
lda < requested_vector_length, std::invalid_argument,
"Amesos2::MultiVecAdapter::get1dCopy: On process " <<
Expand Down Expand Up @@ -248,7 +248,7 @@ namespace Amesos2 {
"Amesos2::MultiVecAdapter::get1dCopy_kokkos_view: this->getMap() returns null.");

#ifdef HAVE_AMESOS2_DEBUG
const size_t requested_vector_length = distribution_map->getNodeNumElements ();
const size_t requested_vector_length = distribution_map->getLocalNumElements ();
TEUCHOS_TEST_FOR_EXCEPTION(
lda < requested_vector_length, std::invalid_argument,
"Amesos2::MultiVecAdapter::get1dCopy_kokkos_view: On process " <<
Expand Down Expand Up @@ -338,12 +338,12 @@ namespace Amesos2 {
// if( local ){
// this->localize();
// /* Use the global element list returned by
// * mv_->getMap()->getNodeElementList() to get a subCopy of mv_ which we
// * mv_->getMap()->getLocalElementList() to get a subCopy of mv_ which we
// * assign to l_l_mv_, then return get1dViewNonConst() of l_l_mv_
// */
// if(l_l_mv_.is_null() ){
// Teuchos::ArrayView<const GlobalOrdinal> nodeElements_go
// = mv_->getMap()->getNodeElementList();
// = mv_->getMap()->getLocalElementList();
// Teuchos::Array<size_t> nodeElements_st(nodeElements_go.size());

// // Convert the node element to a list of size_t type objects
Expand All @@ -362,7 +362,7 @@ namespace Amesos2 {
// // made to the global structure that are not reflected in the local
// // view.
// Teuchos::ArrayView<const GlobalOrdinal> nodeElements_go
// = mv_->getMap()->getNodeElementList();
// = mv_->getMap()->getLocalElementList();
// Teuchos::Array<size_t> nodeElements_st(nodeElements_go.size());

// // Convert the node element to a list of size_t type objects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ namespace Amesos2 {
Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>,
DerivedMat>::getLocalNNZ_impl() const
{
return this->mat_->getNodeNumEntries();
return this->mat_->getLocalNumEntries();
}

template <typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node, class DerivedMat>
Expand Down
2 changes: 1 addition & 1 deletion packages/amesos2/src/Amesos2_Util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ namespace Amesos2 {
using Teuchos::as;

Teuchos::Array<GO> elements_tmp;
elements_tmp = map.getNodeElementList();
elements_tmp = map.getLocalElementList();
int num_my_elements = elements_tmp.size();
Teuchos::Array<int> my_global_elements(num_my_elements);
for (int i = 0; i < num_my_elements; ++i){
Expand Down
2 changes: 1 addition & 1 deletion packages/amesos2/test/solvers/SolverFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ namespace {
const SC minusOne = static_cast<SC> (-1.0);
RCP<MAT> A (new MAT (rowMap, maxNumEntPerRow));

if (rowMap->getNodeNumElements () != 0) {
if (rowMap->getLocalNumElements () != 0) {
for (LO lclRow = rowMap->getMinLocalIndex ();
lclRow <= rowMap->getMaxLocalIndex (); ++lclRow) {
const GO gblRow = rowMap->getGlobalElement(lclRow);
Expand Down
4 changes: 2 additions & 2 deletions packages/amesos2/test/tklu_simple/tklu_simple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) {

// Get update list and number of local equations from newly created map.

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

if( numMyElements != numGlobalElements )
if (numProc != 1) {
Expand All @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) {
return -1;
}

Teuchos::ArrayView<const Ordinal> myGlobalElements = map->getNodeElementList();
Teuchos::ArrayView<const Ordinal> myGlobalElements = map->getLocalElementList();

// klu_symbolic *Symbolic ;
// klu_numeric *Numeric ;
Expand Down

0 comments on commit fedb22f

Please sign in to comment.