Update Kokkos library in LAMMPS to v3.7.0

This commit is contained in:
Stan Gerald Moore
2022-10-04 14:04:40 -06:00
parent dd072f7e08
commit f9f9e44f2d
653 changed files with 41432 additions and 33597 deletions

View File

@ -189,11 +189,14 @@ TEST(defaultdevicetype, chained_logical_spaces) { test_chained_spaces(); }
TEST(defaultdevicetype, access_allowed) {
test_allowed_access<fake_memory_space>();
}
// FIXME_SYCL
#if !(defined(KOKKOS_COMPILER_INTEL) && defined(KOKKOS_ENABLE_SYCL))
TEST(defaultdevicetype_DeathTest, access_forbidden) {
::testing::FLAGS_gtest_death_test_style = "threadsafe";
ASSERT_DEATH(
{ test_allowed_access<semantically_independent_logical_space>(); },
"Kokkos::View ERROR: attempt to access inaccessible memory space");
}
#endif
} // namespace Test

View File

@ -75,3 +75,79 @@ TEST(kokkosp, create_mirror_no_init) {
});
ASSERT_TRUE(success);
}
TEST(kokkosp, create_mirror_no_init_view_ctor) {
using namespace Kokkos::Test::Tools;
listen_tool_events(Config::DisableAll(), Config::EnableKernels());
Kokkos::View<int*, Kokkos::DefaultExecutionSpace> device_view("device view",
10);
Kokkos::View<int*, Kokkos::HostSpace> host_view("host view", 10);
auto success = validate_absence(
[&]() {
auto mirror_device = Kokkos::create_mirror(
Kokkos::view_alloc(Kokkos::HostSpace{},
Kokkos::WithoutInitializing),
device_view);
auto mirror_host = Kokkos::create_mirror(
Kokkos::view_alloc(Kokkos::HostSpace{}, Kokkos::WithoutInitializing,
Kokkos::DefaultExecutionSpace{}),
host_view);
auto mirror_device_view = Kokkos::create_mirror_view(
Kokkos::view_alloc(Kokkos::HostSpace{},
Kokkos::WithoutInitializing),
device_view);
auto mirror_host_view = Kokkos::create_mirror_view(
Kokkos::view_alloc(Kokkos::HostSpace{}, Kokkos::WithoutInitializing,
Kokkos::DefaultExecutionSpace{}),
host_view);
mirror_host_view = Kokkos::create_mirror_view(
Kokkos::view_alloc(Kokkos::WithoutInitializing), host_view);
},
[&](BeginParallelForEvent) {
return MatchDiagnostic{true, {"Found begin event"}};
},
[&](EndParallelForEvent) {
return MatchDiagnostic{true, {"Found end event"}};
});
ASSERT_TRUE(success);
}
TEST(kokkosp, create_mirror_view_and_copy) {
#ifdef KOKKOS_ENABLE_OPENMPTARGET // FIXME_OPENMPTARGET
if (std::is_same<Kokkos::DefaultExecutionSpace,
Kokkos::Experimental::OpenMPTarget>::value)
GTEST_SKIP() << "skipping since the OpenMPTarget has unexpected fences";
#endif
#ifdef KOKKOS_ENABLE_CUDA
if (std::is_same<Kokkos::DefaultExecutionSpace::memory_space,
Kokkos::CudaUVMSpace>::value)
GTEST_SKIP()
<< "skipping since the CudaUVMSpace requires additional fences";
#endif
using namespace Kokkos::Test::Tools;
listen_tool_events(Config::DisableAll(), Config::EnableKernels(),
Config::EnableFences());
Kokkos::View<int*, Kokkos::DefaultExecutionSpace> device_view;
Kokkos::View<int*, Kokkos::HostSpace> host_view("host view", 10);
auto success = validate_absence(
[&]() {
auto mirror_device = Kokkos::create_mirror_view_and_copy(
Kokkos::view_alloc(
Kokkos::DefaultExecutionSpace{},
typename Kokkos::DefaultExecutionSpace::memory_space{}),
host_view);
// Avoid fences for deallocation when mirror_device goes out of scope.
device_view = mirror_device;
},
[&](BeginParallelForEvent) {
return MatchDiagnostic{true, {"Found parallel_for event"}};
},
[&](BeginFenceEvent) {
return MatchDiagnostic{true, {"Found fence event"}};
});
ASSERT_TRUE(success);
}

View File

@ -1300,6 +1300,24 @@ bool validate_absence(const Lambda& lam, const Matchers... matchers) {
return true;
}
template <class Lambda, class Matcher>
bool validate_existence(const Lambda& lam, const Matcher matcher) {
// First, erase events from previous invocations
found_events.clear();
// Invoke the lambda (this will populate found_events, via tooling)
lam();
// compare the found events against the expected ones
for (const auto& event : found_events) {
MatchDiagnostic match = check_presence_of(event, matcher);
if (match.success) return true;
}
std::cout << "Test failure: Didn't encounter wanted events" << std::endl;
for (const auto& p_event : found_events)
std::cout << p_event->descriptor() << std::endl;
return false;
}
} // namespace Tools
} // namespace Test
} // namespace Kokkos