Skip to content

Commit

Permalink
Weed out verbose output from dynamic_view container unit test (kokk…
Browse files Browse the repository at this point in the history
…os#6173)

* Fix print message issue in TestDynamicView.

* Check memory spaces.

---------

Co-authored-by: Rahulkumar Gayatri <rgayatri@lbl.gov>
  • Loading branch information
Rahulkumar Gayatri and Rahulkumar Gayatri committed Jun 6, 2023
1 parent e2a7f08 commit 789b62c
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions containers/unit_tests/TestDynamicView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,19 +274,13 @@ struct TestDynamicView {
// swapped in the deep_copy implementation.
// Once that's fixed, both deep_copy's will fail at runtime because the
// destination execution space cannot access the source memory space.
try {
Kokkos::deep_copy(host_view, device_dynamic_view);
} catch (std::runtime_error const& error) {
std::string msg = error.what();
std::cerr << "Copy from on-device DynamicView to on-host View failed:\n"
<< msg << std::endl;
}
try {
Kokkos::deep_copy(device_dynamic_view, host_view);
} catch (std::runtime_error const& error) {
std::string msg = error.what();
std::cerr << "Copy from on-host View to on-device DynamicView failed:\n"
<< msg << std::endl;
// Check if the memory spaces are different before testing the deep_copy.
if (!Kokkos::SpaceAccessibility<Kokkos::HostSpace,
memory_space>::accessible) {
ASSERT_THROW(Kokkos::deep_copy(host_view, device_dynamic_view),
std::runtime_error);
ASSERT_THROW(Kokkos::deep_copy(device_dynamic_view, host_view),
std::runtime_error);
}
}
}
Expand Down

0 comments on commit 789b62c

Please sign in to comment.