Skip to content

Commit

Permalink
Merge 'trilinos/Trilinos:trilinos/develop' (155e45e) into 'EM-Plasma/…
Browse files Browse the repository at this point in the history
…Trilinos:develop' (f215687).

* trilinos/develop:
  Tpetra:  Enable deprecated code warnings for capabilities changed during UVM-requirement removal (trilinos#10014)
  Ifpack2: Bump up tolerance in Chebyshev unit test
  • Loading branch information
EMPIRE Jenkins committed Dec 20, 2021
2 parents f215687 + 155e45e commit f576669
Show file tree
Hide file tree
Showing 18 changed files with 215 additions and 112 deletions.
25 changes: 15 additions & 10 deletions packages/ifpack2/src/Ifpack2_RILUK_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,16 +941,21 @@ void RILUK<MatrixType>::compute ()

using row_map_type = typename crs_matrix_type::local_matrix_device_type::row_map_type;

row_map_type L_rowmap = L_->getLocalMatrixDevice().graph.row_map;
auto L_entries = L_->getLocalMatrixDevice().graph.entries;
auto L_values = L_->getLocalValuesView();
row_map_type U_rowmap = U_->getLocalMatrixDevice().graph.row_map;
auto U_entries = U_->getLocalMatrixDevice().graph.entries;
auto U_values = U_->getLocalValuesView();

KokkosSparse::Experimental::spiluk_numeric( KernelHandle_.getRawPtr(), LevelOfFill_,
A_local_rowmap_, A_local_entries_, A_local_values_,
L_rowmap, L_entries, L_values, U_rowmap, U_entries, U_values );
{
auto lclL = L_->getLocalMatrixDevice();
row_map_type L_rowmap = lclL.graph.row_map;
auto L_entries = lclL.graph.entries;
auto L_values = L_->getLocalValuesView();

auto lclU = U_->getLocalMatrixDevice();
row_map_type U_rowmap = lclU.graph.row_map;
auto U_entries = lclU.graph.entries;
auto U_values = U_->getLocalValuesView();

KokkosSparse::Experimental::spiluk_numeric( KernelHandle_.getRawPtr(), LevelOfFill_,
A_local_rowmap_, A_local_entries_, A_local_values_,
L_rowmap, L_entries, L_values, U_rowmap, U_entries, U_values );
}

L_->fillComplete (L_->getColMap (), A_local_->getRangeMap ());
U_->fillComplete (A_local_->getDomainMap (), U_->getRowMap ());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,14 @@ TEUCHOS_UNIT_TEST_TEMPLATE_3_DECL(Ifpack2Chebyshev, Test0, Scalar, LocalOrdinal,
prec.setParameters(params);
prec.compute();

TEST_FLOATING_EQUALITY(prec.getLambdaMaxForApply(),expectedLambdaMax,2e-2);
TEST_FLOATING_EQUALITY(prec.getLambdaMaxForApply(),expectedLambdaMax,4.5e-2);

params.set("eigen-analysis: type", "cg");
params.set("chebyshev: eigenvalue max iterations",10);
prec.setParameters(params);
prec.compute();

TEST_FLOATING_EQUALITY(prec.getLambdaMaxForApply(),expectedLambdaMax,2e-2);
TEST_FLOATING_EQUALITY(prec.getLambdaMaxForApply(),expectedLambdaMax,4.5e-2);
}

#define UNIT_TEST_GROUP_SC_LO_GO(Scalar,LocalOrdinal,GlobalOrdinal) \
Expand Down
36 changes: 21 additions & 15 deletions packages/tpetra/core/src/Tpetra_BlockMultiVector_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,21 +457,21 @@ class BlockMultiVector :
/// it, by calling the modify() method with the appropriate
/// template parameter.
template<class TargetMemorySpace>
//TPETRA_DEPRECATED
TPETRA_DEPRECATED
void sync () {
mv_.template sync<typename TargetMemorySpace::memory_space> ();
mv_.view_.getOriginalDualView().template sync<typename TargetMemorySpace::memory_space> ();
}

/// \brief Update data to the host
//TPETRA_DEPRECATED
TPETRA_DEPRECATED
void sync_host() {
mv_.sync_host();
mv_.view_.getOriginalDualView().sync_host ();
}

/// \brief Update data to the device
//TPETRA_DEPRECATED
TPETRA_DEPRECATED
void sync_device() {
mv_.sync_device();
mv_.view_.getOriginalDualView().sync_device ();
}

#endif // TPETRA_ENABLE_DEPRECATED_CODE
Expand Down Expand Up @@ -500,21 +500,21 @@ class BlockMultiVector :
/// object's memory space, then mark the device's data as modified.
/// Otherwise, mark the host's data as modified.
template<class TargetMemorySpace>
//TPETRA_DEPRECATED
TPETRA_DEPRECATED
void modify () {
mv_.template modify<typename TargetMemorySpace::memory_space> ();
mv_.view_.getOriginalDualView().template modify<typename TargetMemorySpace::memory_space> ();
}

/// \brief Mark data as modified on the host
//TPETRA_DEPRECATED
TPETRA_DEPRECATED
void modify_host() {
mv_.modify_host();
mv_.view_.getOriginalDualView().modify_host ();
}

/// \brief Mark data as modified on the device
//TPETRA_DEPRECATED
TPETRA_DEPRECATED
void modify_device() {
mv_.modify_device();
mv_.view_.getOriginalDualView().modify_device ();
}

#endif // TPETRA_ENABLE_DEPRECATED_CODE
Expand Down Expand Up @@ -588,7 +588,7 @@ class BlockMultiVector :
/// \return true if successful, else false. This method will
/// <i>not</i> succeed if the given local index of the mesh point
/// is invalid on the calling process.
// TPETRA_DEPRECATED
TPETRA_DEPRECATED
bool getLocalRowView (const LO localRowIndex, const LO colIndex, Scalar*& vals);

/// \brief Get a writeable view of the entries at the given mesh
Expand All @@ -601,7 +601,7 @@ class BlockMultiVector :
/// \return true if successful, else false. This method will
/// <i>not</i> succeed if the given global index of the mesh point
/// is invalid on the calling process.
// TPETRA_DEPRECATED
TPETRA_DEPRECATED
bool getGlobalRowView (const GO globalRowIndex, const LO colIndex, Scalar*& vals);

/// \brief Get a host view of the degrees of freedom at the given
Expand All @@ -612,7 +612,7 @@ class BlockMultiVector :
/// future. If you insist not to use \c auto, then please use the
/// \c little_vec_type typedef to deduce the correct return type;
/// don't try to hard-code the return type yourself.
//TPETRA_DEPRECATED
TPETRA_DEPRECATED
little_host_vec_type getLocalBlock (const LO localRowIndex, const LO colIndex);

#endif // TPETRA_ENABLE_DEPRECATED_CODE
Expand Down Expand Up @@ -702,14 +702,20 @@ class BlockMultiVector :
/// index in the mesh Map.
bool isValidLocalMeshIndex (const LO meshLocalIndex) const;

#ifdef TPETRA_ENABLE_DEPRECATED_CODE
// Allow BlockVector to access meshMap_
protected:
#else
private:
#endif // TPETRA_ENABLE_DEPRECATED_CODE
/// \brief Mesh Map given to constructor.
///
/// This is stored by value, not as a Teuchos::RCP, because the
/// latter is not thread-safe. I would like GID->LID lookups to be
/// thread-safe.
map_type meshMap_;

private:
//! The point Map (describing the distribution of degrees of freedom).
map_type pointMap_;

Expand Down
6 changes: 3 additions & 3 deletions packages/tpetra/core/src/Tpetra_BlockMultiVector_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,8 @@ sumIntoGlobalValues (const GO globalRowIndex,
#ifdef TPETRA_ENABLE_DEPRECATED_CODE

template<class Scalar, class LO, class GO, class Node>
TPETRA_DEPRECATED
bool
// TPETRA_DEPRECATED
BlockMultiVector<Scalar, LO, GO, Node>::
getLocalRowView (const LO localRowIndex, const LO colIndex, Scalar*& vals)
{
Expand All @@ -416,8 +416,8 @@ getLocalRowView (const LO localRowIndex, const LO colIndex, Scalar*& vals)
}

template<class Scalar, class LO, class GO, class Node>
TPETRA_DEPRECATED
bool
// TPETRA_DEPRECATED
BlockMultiVector<Scalar, LO, GO, Node>::
getGlobalRowView (const GO globalRowIndex, const LO colIndex, Scalar*& vals)
{
Expand All @@ -432,8 +432,8 @@ getGlobalRowView (const GO globalRowIndex, const LO colIndex, Scalar*& vals)
}

template<class Scalar, class LO, class GO, class Node>
TPETRA_DEPRECATED
typename BlockMultiVector<Scalar, LO, GO, Node>::little_host_vec_type
// TPETRA_DEPRECATED
BlockMultiVector<Scalar, LO, GO, Node>::
getLocalBlock (const LO localRowIndex,
const LO colIndex)
Expand Down
2 changes: 1 addition & 1 deletion packages/tpetra/core/src/Tpetra_BlockVector_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class BlockVector : public BlockMultiVector<Scalar, LO, GO, Node> {
/// porting strategy to move from "classic" Tpetra to the Kokkos
/// refactor version.
#ifdef TPETRA_ENABLE_DEPRECATED_CODE
//TPETRA_DEPRECATED
TPETRA_DEPRECATED
little_host_vec_type getLocalBlock (const LO localRowIndex);
#endif
const_little_host_vec_type getLocalBlockHost (const LO localRowIndex,
Expand Down
23 changes: 18 additions & 5 deletions packages/tpetra/core/src/Tpetra_BlockVector_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,24 +146,37 @@ namespace Tpetra {

#ifdef TPETRA_ENABLE_DEPRECATED_CODE
template<class Scalar, class LO, class GO, class Node>
TPETRA_DEPRECATED
bool
// TPETRA_DEPRECATED
BlockVector<Scalar, LO, GO, Node>::
getLocalRowView (const LO localRowIndex, Scalar*& vals) {
return ((base_type*) this)->getLocalRowView (localRowIndex, 0, vals);
if (! this->meshMap_.isNodeLocalElement (localRowIndex)) {
return false;
} else {
auto X_ij = getLocalBlockHost (localRowIndex, Access::ReadWrite);
vals = reinterpret_cast<Scalar*> (X_ij.data ());
return true;
}
}

template<class Scalar, class LO, class GO, class Node>
TPETRA_DEPRECATED
bool
// TPETRA_DEPRECATED
BlockVector<Scalar, LO, GO, Node>::
getGlobalRowView (const GO globalRowIndex, Scalar*& vals) {
return ((base_type*) this)->getGlobalRowView (globalRowIndex, 0, vals);
const LO localRowIndex = this->meshMap_.getLocalElement (globalRowIndex);
if (localRowIndex == Teuchos::OrdinalTraits<LO>::invalid ()) {
return false;
} else {
auto X_ij = getLocalBlockHost (localRowIndex, Access::ReadWrite);
vals = reinterpret_cast<Scalar*> (X_ij.data ());
return true;
}
}

template<class Scalar, class LO, class GO, class Node>
TPETRA_DEPRECATED
typename BlockVector<Scalar, LO, GO, Node>::little_host_vec_type
// TPETRA_DEPRECATED
BlockVector<Scalar, LO, GO, Node>::
getLocalBlock (const LO localRowIndex)
{
Expand Down
48 changes: 32 additions & 16 deletions packages/tpetra/core/src/Tpetra_CrsGraph_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,7 @@ namespace Tpetra {
nonconst_global_inds_host_view_type &gblColInds,
size_t& numColInds) const override;
#ifdef TPETRA_ENABLE_DEPRECATED_CODE
TPETRA_DEPRECATED
void
getGlobalRowCopy (global_ordinal_type gblRow,
const Teuchos::ArrayView<global_ordinal_type>& gblColInds,
Expand All @@ -1164,6 +1165,7 @@ namespace Tpetra {
nonconst_local_inds_host_view_type &gblColInds,
size_t& numColInds) const override;
#ifdef TPETRA_ENABLE_DEPRECATED_CODE
TPETRA_DEPRECATED
void
getLocalRowCopy (local_ordinal_type lclRow,
const Teuchos::ArrayView<local_ordinal_type>& lclColInds,
Expand All @@ -1181,6 +1183,7 @@ namespace Tpetra {
///
/// \pre <tt>! isLocallyIndexed()</tt>
/// \post <tt>gblColInds.size() == getNumEntriesInGlobalRow(gblRow)</tt>
TPETRA_DEPRECATED
void
getGlobalRowView (const global_ordinal_type gblRow,
Teuchos::ArrayView<const global_ordinal_type>& gblColInds) const override;
Expand Down Expand Up @@ -1217,6 +1220,7 @@ namespace Tpetra {
///
/// \pre <tt>! isGloballyIndexed()</tt>
/// \post <tt>lclColInds.size() == getNumEntriesInLocalRow(lclRow)</tt>
TPETRA_DEPRECATED
void
getLocalRowView (const local_ordinal_type lclRow,
Teuchos::ArrayView<const local_ordinal_type>& lclColInds) const override;
Expand Down Expand Up @@ -1434,6 +1438,7 @@ namespace Tpetra {
void
getLocalDiagOffsets (Teuchos::ArrayRCP<size_t>& offsets) const;

#ifdef TPETRA_ENABLE_DEPRECATED_CODE
/// \brief Get an upper bound on the number of entries that can be
/// stored in each row.
///
Expand All @@ -1456,11 +1461,12 @@ namespace Tpetra {
/// it only tells us whether boundForAllLocalRows has a meaningful
/// value on output. We don't necessarily check whether all
/// entries of boundPerLocalRow are the same.
//TPETRA_DEPRECATED
TPETRA_DEPRECATED
void
getNumEntriesPerLocalRowUpperBound (Teuchos::ArrayRCP<const size_t>& boundPerLocalRow,
size_t& boundForAllLocalRows,
bool& boundSameForAllLocalRows) const;
#endif

/// \brief Set the graph's data directly, using 1-D storage.
///
Expand Down Expand Up @@ -2180,7 +2186,11 @@ namespace Tpetra {
/// \brief Get a const, locally indexed view of the
/// locally owned row myRow, such that rowinfo =
/// getRowInfo(myRow).
// Replaced by getLocalIndsViewHost
/// Replaced by getLocalIndsViewHost
///
/// Deprecated but protected;
/// not emitting warnings prevents Tpetra from emitting deprecation warnings
/// TPETRA_DEPRECATED
Teuchos::ArrayView<const local_ordinal_type>
getLocalView (const RowInfo& rowinfo) const;
#endif
Expand All @@ -2191,7 +2201,11 @@ namespace Tpetra {
/// \brief Get a const, nonowned, globally indexed view of the
/// locally owned row myRow, such that rowinfo =
/// getRowInfo(myRow).
// Replaced by getGlobalIndsViewHost
/// Replaced by getGlobalIndsViewHost
///
/// Deprecated but protected;
/// not emitting warnings prevents Tpetra from emitting deprecation warnings
/// TPETRA_DEPRECATED
Teuchos::ArrayView<const global_ordinal_type>
getGlobalView (const RowInfo& rowinfo) const;
#endif
Expand All @@ -2206,7 +2220,7 @@ namespace Tpetra {
/// This is only a valid representation of the local graph if the
/// (global) graph is fill complete.
#ifdef TPETRA_ENABLE_DEPRECATED_CODE
// TPETRA_DEPRECATED
TPETRA_DEPRECATED
local_graph_device_type getLocalGraph () const;
#endif
local_graph_device_type getLocalGraphDevice () const;
Expand Down Expand Up @@ -2304,13 +2318,13 @@ namespace Tpetra {
rowPtrsPacked_dev_ = dview;
rowPtrsPacked_host_ =
Kokkos::create_mirror_view_and_copy(
typename row_ptrs_device_view_type::host_mirror_space(),
dview);
typename row_ptrs_device_view_type::host_mirror_space(),
dview);
}

//TODO: Make private -- matrix shouldn't access directly the guts of graph

/// \brief Local ordinals of colum indices for all rows
/// UVM REMOVAL: Device view takes place of k_lclInds1D_
/// \brief Local ordinals of column indices for all rows
/// Valid when isLocallyIndexed is true
/// If OptimizedStorage, storage is PACKED after fillComplete
/// If not OptimizedStorate, storage is UNPACKED after fillComplete;
Expand All @@ -2321,12 +2335,11 @@ namespace Tpetra {
///
/// - The calling process has a nonzero number of entries
/// - The graph is locally indexed

// TODO: Make private -- matrix shouldn't access directly
///
/// UVM Removal Note: Device view takes place of k_lclInds1D_
local_inds_wdv_type lclIndsUnpacked_wdv;

/// \brief Local ordinals of colum indices for all rows
/// UVM REMOVAL: Device view takes place of lclGraph_.entries
/// \brief Local ordinals of column indices for all rows
/// Valid when isLocallyIndexed is true
/// Built during fillComplete or non-fillComplete constructors
/// Storage is PACKED after fillComplete
Expand All @@ -2337,15 +2350,21 @@ namespace Tpetra {
///
/// - The calling process has a nonzero number of entries
/// - The graph is locally indexed
///
/// UVM Removal Note: Device view takes place of lclGraph_.entries
mutable local_inds_wdv_type lclIndsPacked_wdv;

//TODO: Make private -- matrix shouldn't access directly the guts of graph

/// \brief Global ordinals of column indices for all rows
/// \brief Global ordinals of column indices for all rows
/// UVM REMOVAL: Device view takes place of k_gblInds1D_
///
/// This is allocated only if
///
/// - The calling process has a nonzero number of entries
/// - The graph is globally indexed
///
/// UVM Removal Note: Device view takes place of k_gblInds1D_

// TODO: Make private -- matrix shouldn't access directly
global_inds_wdv_type gblInds_wdv;
Expand Down Expand Up @@ -2426,9 +2445,6 @@ namespace Tpetra {
//! \name Graph data structures (packed and unpacked storage).
//@{

//! Type of the k_gblInds1D_ array of global column indices.
typedef Kokkos::View<global_ordinal_type*, device_type> t_GlobalOrdinal_1D;

/// \brief Row offsets for "1-D" storage.
///
/// This is only allocated if "1-D" storage is active. In that
Expand Down
Loading

0 comments on commit f576669

Please sign in to comment.