Update Kokkos library in LAMMPS to v3.7.0
This commit is contained in:
@ -61,8 +61,7 @@ __global__ void offset(int* p) {
|
||||
TEST(hip, raw_hip_interop) {
|
||||
int* p;
|
||||
KOKKOS_IMPL_HIP_SAFE_CALL(hipMalloc(&p, sizeof(int) * 100));
|
||||
Kokkos::InitArguments arguments{-1, -1, -1, false};
|
||||
Kokkos::initialize(arguments);
|
||||
Kokkos::initialize();
|
||||
|
||||
Kokkos::View<int*, Kokkos::MemoryTraits<Kokkos::Unmanaged>> v(p, 100);
|
||||
Kokkos::deep_copy(v, 5);
|
||||
|
||||
@ -52,8 +52,7 @@ namespace Test {
|
||||
TEST(hip, raw_hip_streams) {
|
||||
hipStream_t stream;
|
||||
KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamCreate(&stream));
|
||||
Kokkos::InitArguments arguments{-1, -1, -1, false};
|
||||
Kokkos::initialize(arguments);
|
||||
Kokkos::initialize();
|
||||
int* p;
|
||||
KOKKOS_IMPL_HIP_SAFE_CALL(hipMalloc(&p, sizeof(int) * 100));
|
||||
using MemorySpace = typename TEST_EXECSPACE::memory_space;
|
||||
|
||||
@ -0,0 +1,86 @@
|
||||
|
||||
/*
|
||||
//@HEADER
|
||||
// ************************************************************************
|
||||
//
|
||||
// Kokkos v. 3.0
|
||||
// Copyright (2020) National Technology & Engineering
|
||||
// Solutions of Sandia, LLC (NTESS).
|
||||
//
|
||||
// Under the terms of Contract DE-NA0003525 with NTESS,
|
||||
// the U.S. Government retains certain rights in this software.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the Corporation nor the names of the
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Questions? Contact Christian R. Trott (crtrott@sandia.gov)
|
||||
//
|
||||
// ************************************************************************
|
||||
//@HEADER
|
||||
*/
|
||||
|
||||
#include <Kokkos_Core.hpp>
|
||||
#include <TestHIP_Category.hpp>
|
||||
|
||||
namespace {
|
||||
|
||||
template <class HIPMemoryContainer>
|
||||
bool checkMemoryCoarseGrainedness(HIPMemoryContainer const& container) {
|
||||
auto size = container.size();
|
||||
auto allocationSize = HIPMemoryContainer::required_allocation_size(size);
|
||||
hipMemRangeCoherencyMode memInfo;
|
||||
|
||||
KOKKOS_IMPL_HIP_SAFE_CALL(hipMemRangeGetAttribute(
|
||||
&memInfo, sizeof(hipMemRangeCoherencyMode),
|
||||
hipMemRangeAttributeCoherencyMode, container.data(), allocationSize));
|
||||
|
||||
return (hipMemRangeCoherencyModeCoarseGrain == memInfo);
|
||||
}
|
||||
|
||||
#define KOKKOS_TEST_MEMORY_COARSEGRAINEDNESS(MEMORY_SPACE, DATATYPE, SIZE) \
|
||||
{ \
|
||||
Kokkos::View<DATATYPE*, MEMORY_SPACE> view(#MEMORY_SPACE, SIZE); \
|
||||
ASSERT_TRUE(view.is_allocated()) \
|
||||
<< "View in " << #MEMORY_SPACE << " with size " << SIZE \
|
||||
<< " was not allocated. This prevents checks of the grainedness."; \
|
||||
ASSERT_TRUE(checkMemoryCoarseGrainedness(view)) \
|
||||
<< "The memory in views in " << #MEMORY_SPACE \
|
||||
<< " is not coarse-grained. Kokkos relies on all user facing memory " \
|
||||
"being coarse-grained."; \
|
||||
}
|
||||
|
||||
TEST(hip, memory_requirements) {
|
||||
// we want all user-facing memory in hip to be coarse grained. As of
|
||||
// today(07.01.22) the documentation is not reliable/correct, we test the
|
||||
// memory on the device and host
|
||||
KOKKOS_TEST_MEMORY_COARSEGRAINEDNESS(Kokkos::Experimental::HIPSpace, int, 10);
|
||||
KOKKOS_TEST_MEMORY_COARSEGRAINEDNESS(Kokkos::Experimental::HIPHostPinnedSpace,
|
||||
int, 10);
|
||||
KOKKOS_TEST_MEMORY_COARSEGRAINEDNESS(Kokkos::Experimental::HIPManagedSpace,
|
||||
int, 10);
|
||||
}
|
||||
} // namespace
|
||||
@ -60,8 +60,11 @@ __global__ void start_intra_block_scan()
|
||||
__syncthreads();
|
||||
|
||||
DummyFunctor f;
|
||||
Kokkos::Impl::hip_intra_block_reduce_scan<true, DummyFunctor, void>(f,
|
||||
values);
|
||||
typename Kokkos::Impl::FunctorAnalysis<
|
||||
Kokkos::Impl::FunctorPatternInterface::SCAN,
|
||||
Kokkos::RangePolicy<Kokkos::Experimental::HIP>, DummyFunctor>::Reducer
|
||||
reducer(&f);
|
||||
Kokkos::Impl::hip_intra_block_reduce_scan<true>(reducer, values);
|
||||
|
||||
__syncthreads();
|
||||
if (values[i] != ((i + 2) * (i + 1)) / 2) {
|
||||
|
||||
@ -75,6 +75,16 @@ TEST(hip, space_access) {
|
||||
Kokkos::HostSpace, Kokkos::Experimental::HIPSpace>::accessible,
|
||||
"");
|
||||
|
||||
static_assert(
|
||||
!Kokkos::Impl::MemorySpaceAccess<
|
||||
Kokkos::HostSpace, Kokkos::Experimental::HIPManagedSpace>::assignable,
|
||||
"");
|
||||
|
||||
static_assert(
|
||||
Kokkos::Impl::MemorySpaceAccess<
|
||||
Kokkos::HostSpace, Kokkos::Experimental::HIPManagedSpace>::accessible,
|
||||
"");
|
||||
|
||||
//--------------------------------------
|
||||
|
||||
static_assert(Kokkos::Impl::MemorySpaceAccess<
|
||||
@ -100,6 +110,16 @@ TEST(hip, space_access) {
|
||||
Kokkos::HostSpace>::accessible,
|
||||
"");
|
||||
|
||||
static_assert(Kokkos::Impl::MemorySpaceAccess<
|
||||
Kokkos::Experimental::HIPSpace,
|
||||
Kokkos::Experimental::HIPManagedSpace>::assignable,
|
||||
"");
|
||||
|
||||
static_assert(Kokkos::Impl::MemorySpaceAccess<
|
||||
Kokkos::Experimental::HIPSpace,
|
||||
Kokkos::Experimental::HIPManagedSpace>::accessible,
|
||||
"");
|
||||
|
||||
//--------------------------------------
|
||||
|
||||
static_assert(Kokkos::Impl::MemorySpaceAccess<
|
||||
@ -127,6 +147,53 @@ TEST(hip, space_access) {
|
||||
Kokkos::Experimental::HIPSpace>::accessible,
|
||||
"");
|
||||
|
||||
static_assert(!Kokkos::Impl::MemorySpaceAccess<
|
||||
Kokkos::Experimental::HIPHostPinnedSpace,
|
||||
Kokkos::Experimental::HIPManagedSpace>::assignable,
|
||||
"");
|
||||
|
||||
static_assert(Kokkos::Impl::MemorySpaceAccess<
|
||||
Kokkos::Experimental::HIPHostPinnedSpace,
|
||||
Kokkos::Experimental::HIPManagedSpace>::accessible,
|
||||
"");
|
||||
|
||||
//--------------------------------------
|
||||
|
||||
static_assert(Kokkos::Impl::MemorySpaceAccess<
|
||||
Kokkos::Experimental::HIPManagedSpace,
|
||||
Kokkos::Experimental::HIPManagedSpace>::assignable,
|
||||
"");
|
||||
|
||||
static_assert(
|
||||
!Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HIPManagedSpace,
|
||||
Kokkos::HostSpace>::assignable,
|
||||
"");
|
||||
|
||||
static_assert(
|
||||
!Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HIPManagedSpace,
|
||||
Kokkos::HostSpace>::accessible,
|
||||
"");
|
||||
|
||||
static_assert(!Kokkos::Impl::MemorySpaceAccess<
|
||||
Kokkos::Experimental::HIPManagedSpace,
|
||||
Kokkos::Experimental::HIPSpace>::assignable,
|
||||
"");
|
||||
|
||||
static_assert(Kokkos::Impl::MemorySpaceAccess<
|
||||
Kokkos::Experimental::HIPManagedSpace,
|
||||
Kokkos::Experimental::HIPSpace>::accessible,
|
||||
"");
|
||||
|
||||
static_assert(!Kokkos::Impl::MemorySpaceAccess<
|
||||
Kokkos::Experimental::HIPManagedSpace,
|
||||
Kokkos::Experimental::HIPHostPinnedSpace>::assignable,
|
||||
"");
|
||||
|
||||
static_assert(Kokkos::Impl::MemorySpaceAccess<
|
||||
Kokkos::Experimental::HIPManagedSpace,
|
||||
Kokkos::Experimental::HIPHostPinnedSpace>::accessible,
|
||||
"");
|
||||
|
||||
//--------------------------------------
|
||||
|
||||
static_assert(!Kokkos::SpaceAccessibility<Kokkos::Experimental::HIP,
|
||||
@ -143,6 +210,11 @@ TEST(hip, space_access) {
|
||||
Kokkos::Experimental::HIPHostPinnedSpace>::accessible,
|
||||
"");
|
||||
|
||||
static_assert(Kokkos::SpaceAccessibility<
|
||||
Kokkos::Experimental::HIP,
|
||||
Kokkos::Experimental::HIPManagedSpace>::accessible,
|
||||
"");
|
||||
|
||||
static_assert(
|
||||
!Kokkos::SpaceAccessibility<Kokkos::HostSpace,
|
||||
Kokkos::Experimental::HIPSpace>::accessible,
|
||||
@ -153,6 +225,11 @@ TEST(hip, space_access) {
|
||||
Kokkos::Experimental::HIPHostPinnedSpace>::accessible,
|
||||
"");
|
||||
|
||||
static_assert(
|
||||
Kokkos::SpaceAccessibility<
|
||||
Kokkos::HostSpace, Kokkos::Experimental::HIPManagedSpace>::accessible,
|
||||
"");
|
||||
|
||||
static_assert(
|
||||
std::is_same<
|
||||
Kokkos::Impl::HostMirror<Kokkos::Experimental::HIPSpace>::Space,
|
||||
@ -165,6 +242,14 @@ TEST(hip, space_access) {
|
||||
Kokkos::Experimental::HIPHostPinnedSpace>::value,
|
||||
"");
|
||||
|
||||
static_assert(
|
||||
std::is_same<
|
||||
Kokkos::Impl::HostMirror<
|
||||
Kokkos::Experimental::HIPManagedSpace>::Space,
|
||||
Kokkos::Device<Kokkos::HostSpace::execution_space,
|
||||
Kokkos::Experimental::HIPManagedSpace>>::value,
|
||||
"");
|
||||
|
||||
static_assert(Kokkos::SpaceAccessibility<
|
||||
Kokkos::Impl::HostMirror<Kokkos::Experimental::HIP>::Space,
|
||||
Kokkos::HostSpace>::accessible,
|
||||
@ -181,6 +266,12 @@ TEST(hip, space_access) {
|
||||
Kokkos::Experimental::HIPHostPinnedSpace>::Space,
|
||||
Kokkos::HostSpace>::accessible,
|
||||
"");
|
||||
|
||||
static_assert(Kokkos::SpaceAccessibility<
|
||||
Kokkos::Impl::HostMirror<
|
||||
Kokkos::Experimental::HIPManagedSpace>::Space,
|
||||
Kokkos::HostSpace>::accessible,
|
||||
"");
|
||||
}
|
||||
|
||||
template <class MemSpace, class ExecSpace>
|
||||
@ -227,6 +318,11 @@ TEST(hip, impl_view_accessible) {
|
||||
Kokkos::Experimental::HIP>::run();
|
||||
TestViewHIPAccessible<Kokkos::Experimental::HIPHostPinnedSpace,
|
||||
Kokkos::HostSpace::execution_space>::run();
|
||||
|
||||
TestViewHIPAccessible<Kokkos::Experimental::HIPManagedSpace,
|
||||
Kokkos::HostSpace::execution_space>::run();
|
||||
TestViewHIPAccessible<Kokkos::Experimental::HIPManagedSpace,
|
||||
Kokkos::Experimental::HIP>::run();
|
||||
}
|
||||
|
||||
} // namespace Test
|
||||
|
||||
Reference in New Issue
Block a user