Update Kokkos library in LAMMPS to v4.0

This commit is contained in:
Stan Gerald Moore
2023-03-03 09:22:33 -07:00
parent df9bf18ed2
commit 14cb8576f4
1117 changed files with 33357 additions and 41720 deletions

View File

@ -1,46 +1,18 @@
/*
//@HEADER
// ************************************************************************
//
// Kokkos v. 3.0
// Copyright (2020) National Technology & Engineering
// Kokkos v. 4.0
// Copyright (2022) 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:
// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
// See https://kokkos.org/LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// 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
*/
#ifndef TESTVIEWSUBVIEW_HPP_
#define TESTVIEWSUBVIEW_HPP_
#include <gtest/gtest.h>
@ -164,8 +136,9 @@ struct fill_2D {
template <class Layout, class Space>
void test_auto_1d() {
using mv_type = Kokkos::View<double**, Layout, Space>;
using size_type = typename mv_type::size_type;
using mv_type = Kokkos::View<double**, Layout, Space>;
using execution_space = typename Space::execution_space;
using size_type = typename mv_type::size_type;
const double ZERO = 0.0;
const double ONE = 1.0;
@ -178,7 +151,14 @@ void test_auto_1d() {
typename mv_type::HostMirror X_h = Kokkos::create_mirror_view(X);
fill_2D<mv_type, Space> f1(X, ONE);
Kokkos::parallel_for(X.extent(0), f1);
#if (HIP_VERSION_MAJOR == 5) && (HIP_VERSION_MINOR == 3)
using Property =
Kokkos::Experimental::WorkItemProperty::ImplForceGlobalLaunch_t;
#else
using Property = Kokkos::Experimental::WorkItemProperty::None_t;
#endif
Kokkos::parallel_for(
Kokkos::RangePolicy<execution_space, Property>(0, X.extent(0)), f1);
Kokkos::fence();
Kokkos::deep_copy(X_h, X);
for (size_type j = 0; j < numCols; ++j) {
@ -188,7 +168,8 @@ void test_auto_1d() {
}
fill_2D<mv_type, Space> f2(X, 0.0);
Kokkos::parallel_for(X.extent(0), f2);
Kokkos::parallel_for(
Kokkos::RangePolicy<execution_space, Property>(0, X.extent(0)), f2);
Kokkos::fence();
Kokkos::deep_copy(X_h, X);
for (size_type j = 0; j < numCols; ++j) {
@ -198,7 +179,8 @@ void test_auto_1d() {
}
fill_2D<mv_type, Space> f3(X, TWO);
Kokkos::parallel_for(X.extent(0), f3);
Kokkos::parallel_for(
Kokkos::RangePolicy<execution_space, Property>(0, X.extent(0)), f3);
Kokkos::fence();
Kokkos::deep_copy(X_h, X);
for (size_type j = 0; j < numCols; ++j) {
@ -211,7 +193,8 @@ void test_auto_1d() {
auto X_j = Kokkos::subview(X, Kokkos::ALL, j);
fill_1D<decltype(X_j), Space> f4(X_j, ZERO);
Kokkos::parallel_for(X_j.extent(0), f4);
Kokkos::parallel_for(
Kokkos::RangePolicy<execution_space, Property>(0, X_j.extent(0)), f4);
Kokkos::fence();
Kokkos::deep_copy(X_h, X);
for (size_type i = 0; i < numRows; ++i) {
@ -221,7 +204,9 @@ void test_auto_1d() {
for (size_type jj = 0; jj < numCols; ++jj) {
auto X_jj = Kokkos::subview(X, Kokkos::ALL, jj);
fill_1D<decltype(X_jj), Space> f5(X_jj, ONE);
Kokkos::parallel_for(X_jj.extent(0), f5);
Kokkos::parallel_for(
Kokkos::RangePolicy<execution_space, Property>(0, X_jj.extent(0)),
f5);
Kokkos::fence();
Kokkos::deep_copy(X_h, X);
for (size_type i = 0; i < numRows; ++i) {