Skip to content

Commit

Permalink
STK: Don't access DualView's [h|d]_view directly
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Arndt <[email protected]>
  • Loading branch information
masterleinad committed Feb 14, 2025
1 parent 9c5d962 commit 62d968b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ DualViewType create_dualview(const std::string& name, unsigned size)
{
DualViewType result(name, size);

Kokkos::deep_copy(result.h_view, 0);
Kokkos::deep_copy(result.view_host(), 0);
result.template modify<typename DualViewType::host_mirror_space>();
result.template sync<typename DualViewType::execution_space>();

Expand Down
6 changes: 3 additions & 3 deletions packages/stk/stk_unit_tests/stk_mesh/ngp/UnitTestNgp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ void test_view_of_fields(const stk::mesh::BulkData& bulk,
Kokkos::parallel_for(stk::ngp::DeviceRangePolicy(0, 2),
KOKKOS_LAMBDA(const unsigned& i)
{
result.d_view(i) = fields(i).get_ordinal();
result.view_device()(i) = fields(i).get_ordinal();
});

result.modify<UnsignedDualViewType::execution_space>();
result.sync<UnsignedDualViewType::host_mirror_space>();

EXPECT_EQ(hostFields(0).get_ordinal(), result.h_view(0));
EXPECT_EQ(hostFields(1).get_ordinal(), result.h_view(1));
EXPECT_EQ(hostFields(0).get_ordinal(), result.view_host()(0));
EXPECT_EQ(hostFields(1).get_ordinal(), result.view_host()(1));

#if !defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_HIP)
for (unsigned i = 0; i < 2; ++i) {
Expand Down

0 comments on commit 62d968b

Please sign in to comment.