Skip to content

Commit

Permalink
Fix a couple more occurences
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Arndt <[email protected]>
  • Loading branch information
masterleinad committed Feb 5, 2025
1 parent 9a658f6 commit 35332f6
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,12 @@ int main (int argc, char* argv[]) {
// DualView<double**> for now, rather than a View<double*>.
Kokkos::DualView<double**, Kokkos::LayoutLeft> b_lcl ("b", numLclRows, 1);
b_lcl.modify<Kokkos::DualView<double**, Kokkos::LayoutLeft>::t_dev::execution_space> ();
Kokkos::deep_copy (Kokkos::subview (b_lcl.d_view, Kokkos::ALL (), 0), forcingTerm);
Kokkos::deep_copy (Kokkos::subview (b_lcl.view_device(), Kokkos::ALL (), 0), forcingTerm);
Tpetra::Vector<> b (A.getRangeMap (), b_lcl);

Kokkos::DualView<double**, Kokkos::LayoutLeft> x_lcl ("b", numLclRows, 1);
x_lcl.modify<Kokkos::DualView<double**, Kokkos::LayoutLeft>::t_dev::execution_space> ();
Kokkos::deep_copy (Kokkos::subview (x_lcl.d_view, Kokkos::ALL (), 0), temperature);
Kokkos::deep_copy (Kokkos::subview (x_lcl.view_device(), Kokkos::ALL (), 0), temperature);
Tpetra::Vector<> x (A.getDomainMap (), x_lcl);

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,12 @@ int main (int argc, char* argv[]) {
// DualView<double**> for now, rather than a View<double*>.
Kokkos::DualView<double**, Kokkos::LayoutLeft, device_type> b_lcl ("b", numLclRows, 1);
b_lcl.modify_device ();
Kokkos::deep_copy (Kokkos::subview (b_lcl.d_view, Kokkos::ALL (), 0), forcingTerm);
Kokkos::deep_copy (Kokkos::subview (b_lcl.view_device(), Kokkos::ALL (), 0), forcingTerm);
Tpetra::Vector<> b (A.getRangeMap (), b_lcl);

Kokkos::DualView<double**, Kokkos::LayoutLeft, device_type> x_lcl ("b", numLclRows, 1);
x_lcl.modify_device ();
Kokkos::deep_copy (Kokkos::subview (x_lcl.d_view, Kokkos::ALL (), 0), temperature);
Kokkos::deep_copy (Kokkos::subview (x_lcl.view_device(), Kokkos::ALL (), 0), temperature);
Tpetra::Vector<> x (A.getDomainMap (), x_lcl);

const int numIters = solve (x, A, b, dx); // solve the linear system
Expand All @@ -374,7 +374,7 @@ int main (int argc, char* argv[]) {
// means that we have to make a deep copy back into the
// 'temperature' output array.
x_lcl.sync_device ();
Kokkos::deep_copy (temperature, Kokkos::subview (b_lcl.d_view, Kokkos::ALL (), 0));
Kokkos::deep_copy (temperature, Kokkos::subview (b_lcl.view_device(), Kokkos::ALL (), 0));

// Correct the solution for the nonhomogenous Dirichlet boundary
// conditions.
Expand Down
16 changes: 8 additions & 8 deletions packages/tpetra/core/inout/Tpetra_Details_CooMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1221,13 +1221,13 @@ class CooMatrix : public ::Tpetra::DistObject<char, LO, GO, NT> {
numPacketsPerLID_tmp.modify_host ();
}
// Fill numPacketsPerLID with zeros.
Kokkos::deep_copy (numPacketsPerLID.h_view, static_cast<size_t> (0));
Kokkos::deep_copy (numPacketsPerLID.view_host(), static_cast<size_t> (0));
return;
}

const size_t numExports = exportLIDs.extent (0);
if (numExports == 0) {
Details::reallocDualViewIfNeeded (exports, 0, exports.h_view.label ());
Details::reallocDualViewIfNeeded (exports, 0, exports.view_host().label ());
return; // nothing to send
}
RCP<const Comm<int> > comm = src->getMap ().is_null () ?
Expand Down Expand Up @@ -1264,7 +1264,7 @@ class CooMatrix : public ::Tpetra::DistObject<char, LO, GO, NT> {
if (gblRow == ::Tpetra::Details::OrdinalTraits<GO>::invalid ()) {
// Mark the error later; just count for now.
++numInvalidRowInds;
numPacketsPerLID.h_view[k] = 0;
numPacketsPerLID.view_host()[k] = 0;
continue;
}

Expand All @@ -1276,7 +1276,7 @@ class CooMatrix : public ::Tpetra::DistObject<char, LO, GO, NT> {
if (errCode != 0) {
std::ostream& err = this->markLocalErrorAndGetStream ();
err << prefix << errStrm.str () << endl;
numPacketsPerLID.h_view[k] = 0;
numPacketsPerLID.view_host()[k] = 0;
continue;
}

Expand All @@ -1294,11 +1294,11 @@ class CooMatrix : public ::Tpetra::DistObject<char, LO, GO, NT> {
// leave the output arguments in a rational state, we zero out
// all remaining entries of numPacketsPerLID before returning.
for (size_t k2 = k; k2 < numExports; ++k2) {
numPacketsPerLID.h_view[k2] = 0;
numPacketsPerLID.view_host()[k2] = 0;
}
return;
}
numPacketsPerLID.h_view[k] = static_cast<size_t> (numPackets);
numPacketsPerLID.view_host()[k] = static_cast<size_t> (numPackets);
totalNumPackets = static_cast<int> (newTotalNumPackets);
}

Expand Down Expand Up @@ -1352,9 +1352,9 @@ class CooMatrix : public ::Tpetra::DistObject<char, LO, GO, NT> {
std::vector<SC> vals;

int outBufCurPos = 0;
packet_type* outBuf = exports.h_view.data ();
packet_type* outBuf = exports.view_host().data ();
for (size_t k = 0; k < numExports; ++k) {
const LO lclRow = exportLIDs.h_view[k];
const LO lclRow = exportLIDs.view_host()[k];
// We're packing the source object's data, so we need to use the
// source object's Map to convert from local to global indices.
const GO gblRow = src->map_->getGlobalElement (lclRow);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ castAwayConstDualView (const Kokkos::DualView<const ValueType*, DeviceType>& inp
typedef typename input_dual_view_type::t_host::non_const_type out_host_view_type;

out_dev_view_type output_view_dev
(const_cast<ValueType*> (input_dv.d_view.data ()),
input_dv.d_view.extent (0));
(const_cast<ValueType*> (input_dv.view_device().data ()),
input_dv.view_device().extent (0));
out_host_view_type output_view_host
(const_cast<ValueType*> (input_dv.h_view.data ()),
input_dv.h_view.extent (0));
(const_cast<ValueType*> (input_dv.view_host().data ()),
input_dv.view_host().extent (0));

Kokkos::DualView<ValueType*, DeviceType> output_dv(output_view_dev,output_view_host);
if(input_dv.need_sync_host()) output_dv.modify_device();
Expand Down
4 changes: 2 additions & 2 deletions packages/tpetra/core/src/Tpetra_Details_packCrsGraph_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ packCrsGraph (const CrsGraph<LO, GO, NT>& sourceGraph,
/// \param exports [in/out] Output pack buffer; resized if needed.
///
/// \param numPacketsPerLID [out] On output,
/// numPacketsPerLID.d_view[k] is the number of bytes packed for row
/// exportLIDs.d_view[k] of the local graph.
/// numPacketsPerLID.view_device()[k] is the number of bytes packed for row
/// exportLIDs.view_device()[k] of the local graph.
///
/// \param exportLIDs [in] Local indices of the rows to pack.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ packCrsMatrix (const CrsMatrix<ST, LO, GO, NT>& sourceMatrix,
/// \param exports [in/out] Output pack buffer; resized if needed.
///
/// \param numPacketsPerLID [out] On output,
/// numPacketsPerLID.d_view[k] is the number of bytes packed for row
/// exportLIDs.d_view[k] of the local matrix.
/// numPacketsPerLID.view_device()[k] is the number of bytes packed for row
/// exportLIDs.view_device()[k] of the local matrix.
///
/// \param exportLIDs [in] Local indices of the rows to pack.
///
Expand Down
48 changes: 24 additions & 24 deletions packages/tpetra/core/test/MultiVector/MV_reduce_strided.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,21 +248,21 @@ TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL( MultiVector, reduce_strided, Scalar, LocalOrd
pair_type (0, numCols));
TEST_ASSERT( LO (Z4_dv.extent (0) == lclNumRows ) );
TEST_ASSERT( LO (Z4_dv.extent (1) == numCols ) );
TEST_ASSERT( LO (Z4_dv.d_view.extent (0) == lclNumRows ) );
TEST_ASSERT( LO (Z4_dv.d_view.extent (1) == numCols ) );
TEST_ASSERT( LO (Z4_dv.h_view.extent (0) == lclNumRows ) );
TEST_ASSERT( LO (Z4_dv.h_view.extent (1) == numCols ) );
TEST_ASSERT( LO (Z4_dv.view_device().extent (0) == lclNumRows ) );
TEST_ASSERT( LO (Z4_dv.view_device().extent (1) == numCols ) );
TEST_ASSERT( LO (Z4_dv.view_host().extent (0) == lclNumRows ) );
TEST_ASSERT( LO (Z4_dv.view_host().extent (1) == numCols ) );
// Kokkos could in theory insert padding in the row dimension.
TEST_ASSERT( size_t (Z4_dv.d_view.stride (1)) >= Z4_stride );
TEST_ASSERT( size_t (Z4_dv.h_view.stride (1)) >= Z4_stride );
TEST_ASSERT( size_t (Z4_dv.view_device().stride (1)) >= Z4_stride );
TEST_ASSERT( size_t (Z4_dv.view_host().stride (1)) >= Z4_stride );

MV Z4 (lclMap, Z4_dv, Z4_dv_extra);
TEST_ASSERT( Z4_dv.d_view.data () == Z4.getLocalViewDevice(Tpetra::Access::ReadOnly).data () );
TEST_ASSERT( Z4_dv.h_view.data () == Z4.getLocalViewHost(Tpetra::Access::ReadOnly).data () );
TEST_ASSERT( Z4_dv.view_device().data () == Z4.getLocalViewDevice(Tpetra::Access::ReadOnly).data () );
TEST_ASSERT( Z4_dv.view_host().data () == Z4.getLocalViewHost(Tpetra::Access::ReadOnly).data () );
TEST_ASSERT( Z4.isConstantStride () );
if (Z4.isConstantStride ()) {
TEST_ASSERT( size_t (Z4_dv.d_view.stride (1)) == Z4.getStride () );
TEST_ASSERT( size_t (Z4_dv.h_view.stride (1)) == Z4.getStride () );
TEST_ASSERT( size_t (Z4_dv.view_device().stride (1)) == Z4.getStride () );
TEST_ASSERT( size_t (Z4_dv.view_host().stride (1)) == Z4.getStride () );
// Kokkos could in theory insert padding in the row dimension.
TEST_ASSERT( Z4.getStride () >= Z4_stride );
}
Expand All @@ -279,13 +279,13 @@ TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL( MultiVector, reduce_strided, Scalar, LocalOrd
auto Z4_j_h_lcl = Kokkos::subview (Z4_j_h_lcl_2d, Kokkos::ALL (), 0);
Z4_h_raw = Z4_j_h_lcl.data();

TEST_ASSERT( Z4_j_h_lcl.data () == Z4_dv_j.h_view.data () );
if (Z4_j_h_lcl.data () != Z4_dv_j.h_view.data ()) {
TEST_ASSERT( Z4_j_h_lcl.data () == Z4_dv_j.view_host().data () );
if (Z4_j_h_lcl.data () != Z4_dv_j.view_host().data ()) {
out << "Z4_j_h_lcl.data() = " << Z4_j_h_lcl.data ()
<< ", Z4_dv_j.h_view.data() = " << Z4_dv_j.h_view.data ()
<< ", Z4_dv_j.view_host().data() = " << Z4_dv_j.view_host().data ()
<< endl;
}
TEST_ASSERT( Z4_j_h_lcl.extent (0) == Z4_dv_j.h_view.extent (0) );
TEST_ASSERT( Z4_j_h_lcl.extent (0) == Z4_dv_j.view_host().extent (0) );
}

{
Expand All @@ -294,18 +294,18 @@ TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL( MultiVector, reduce_strided, Scalar, LocalOrd
auto Z4_j_d_lcl = Kokkos::subview (Z4_j_d_lcl_2d, Kokkos::ALL (), 0);
Z4_d_raw = Z4_j_d_lcl.data();

TEST_ASSERT( Z4_j_d_lcl.data () == Z4_dv_j.d_view.data () );
if (Z4_j_d_lcl.data () != Z4_dv_j.d_view.data ()) {
TEST_ASSERT( Z4_j_d_lcl.data () == Z4_dv_j.view_device().data () );
if (Z4_j_d_lcl.data () != Z4_dv_j.view_device().data ()) {
out << "Z4_j_d_lcl.data() = " << Z4_j_d_lcl.data ()
<< ", Z4_dv_j.d_view.data() = " << Z4_dv_j.d_view.data ()
<< ", Z4_dv_j.view_device().data() = " << Z4_dv_j.view_device().data ()
<< endl;
}
TEST_ASSERT( Z4_j_d_lcl.extent (0) == Z4_dv_j.d_view.extent (0) );
TEST_ASSERT( Z4_j_d_lcl.extent (0) == Z4_dv_j.view_device().extent (0) );
}

if (j == 0) {
TEST_ASSERT( Z4_h_raw == Z4_dv.h_view.data () );
TEST_ASSERT( Z4_d_raw == Z4_dv.d_view.data () );
TEST_ASSERT( Z4_h_raw == Z4_dv.view_host().data () );
TEST_ASSERT( Z4_d_raw == Z4_dv.view_device().data () );
}
}

Expand All @@ -328,8 +328,8 @@ TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL( MultiVector, reduce_strided, Scalar, LocalOrd
TEST_ASSERT( LO (Z5_dv.extent (0) == lclNumRows ) );
TEST_ASSERT( LO (Z5_dv.extent (1) == numCols ) );
// Kokkos could in theory insert padding in the row dimension.
TEST_ASSERT( size_t (Z5_dv.d_view.stride (1)) >= Z5_stride );
TEST_ASSERT( size_t (Z5_dv.h_view.stride (1)) >= Z5_stride );
TEST_ASSERT( size_t (Z5_dv.view_device().stride (1)) >= Z5_stride );
TEST_ASSERT( size_t (Z5_dv.view_host().stride (1)) >= Z5_stride );

MV Z5 (lclMap, Z5_dv);
Tpetra::deep_copy (Z5, Z0);
Expand All @@ -353,8 +353,8 @@ TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL( MultiVector, reduce_strided, Scalar, LocalOrd
TEST_ASSERT( LO (Z6_dv.extent (0) == lclNumRows ) );
TEST_ASSERT( LO (Z6_dv.extent (1) == numCols ) );
// Kokkos could in theory insert padding in the row dimension.
TEST_ASSERT( size_t (Z6_dv.d_view.stride (1)) >= Z6_stride );
TEST_ASSERT( size_t (Z6_dv.h_view.stride (1)) >= Z6_stride );
TEST_ASSERT( size_t (Z6_dv.view_device().stride (1)) >= Z6_stride );
TEST_ASSERT( size_t (Z6_dv.view_host().stride (1)) >= Z6_stride );

MV Z6 (lclMap, Z6_dv, Z6_dv_extra);
Tpetra::deep_copy (Z6, Z0);
Expand Down

0 comments on commit 35332f6

Please sign in to comment.