From a8ce5c4dfaa427f6dc12dbd113793bee096c80df Mon Sep 17 00:00:00 2001 From: Sam Reeve <6740307+streeve@users.noreply.github.com> Date: Tue, 23 Jul 2024 12:30:31 -0400 Subject: [PATCH] Require c++ 20 and use class lambda for force models --- .github/workflows/CI.yml | 3 +++ src/CabanaPD_ForceModels.hpp | 2 +- src/force/CabanaPD_ForceModels_PMB.hpp | 8 ++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 01f68736..4420f25f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -57,6 +57,7 @@ jobs: -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \ -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \ -DCMAKE_INSTALL_PREFIX=$HOME/kokkos \ + -DCMAKE_CXX_STANDARD=20 \ -DKokkos_ENABLE_${{ matrix.backend }}=ON \ -DKokkos_ENABLE_HWLOC=ON cmake --build build --parallel 2 @@ -148,6 +149,7 @@ jobs: run: | cmake -B build \ -DCMAKE_INSTALL_PREFIX=$HOME/kokkos \ + -DCMAKE_CXX_STANDARD=20 \ -DKokkos_ENABLE_HIP=ON \ -DKokkos_ARCH_VEGA908=ON \ -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \ @@ -230,6 +232,7 @@ jobs: run: | cmake -B build \ -DCMAKE_INSTALL_PREFIX=$HOME/kokkos \ + -DCMAKE_CXX_STANDARD=20 \ -DKokkos_ENABLE_CUDA=ON \ -DKokkos_ARCH_VOLTA72=ON \ -DKokkos_ENABLE_CUDA_LAMBDA=ON \ diff --git a/src/CabanaPD_ForceModels.hpp b/src/CabanaPD_ForceModels.hpp index 93afb9ca..a4b9c6d5 100644 --- a/src/CabanaPD_ForceModels.hpp +++ b/src/CabanaPD_ForceModels.hpp @@ -66,7 +66,7 @@ struct BaseForceModel , num_types( _delta.size() ) { max_delta = 0; - auto init_func = KOKKOS_LAMBDA( const int i, double& max ) + auto init_func = KOKKOS_CLASS_LAMBDA( const int i, double& max ) { delta( i ) = _delta[i]; if ( delta( i ) > max ) diff --git a/src/force/CabanaPD_ForceModels_PMB.hpp b/src/force/CabanaPD_ForceModels_PMB.hpp index 915fa9d0..dbb6fe0c 100644 --- a/src/force/CabanaPD_ForceModels_PMB.hpp +++ b/src/force/CabanaPD_ForceModels_PMB.hpp @@ -92,7 +92,7 @@ struct ForceModel void setParameters( const ArrayType& _K ) { // Initialize self interaction parameters. - auto init_self_func = KOKKOS_LAMBDA( const int i ) + auto init_self_func = KOKKOS_CLASS_LAMBDA( const int i ) { K( i ) = _K[i]; c( i, i ) = micromodulus( i ); @@ -103,7 +103,7 @@ struct ForceModel Kokkos::fence(); // Initialize cross-terms. - auto init_cross_func = KOKKOS_LAMBDA( const int i ) + auto init_cross_func = KOKKOS_CLASS_LAMBDA( const int i ) { for ( std::size_t j = i; j < num_types; j++ ) c( i, j ) = ( micromodulus( i ) + micromodulus( j ) ) / 2.0; @@ -218,7 +218,7 @@ struct ForceModel void setParameters( const ArrayType& _G0 ) { // Initialize self interaction parameters. - auto init_self_func = KOKKOS_LAMBDA( const int i ) + auto init_self_func = KOKKOS_CLASS_LAMBDA( const int i ) { G0( i ) = _G0[i]; s0( i, i ) = criticalStretch( i ); @@ -231,7 +231,7 @@ struct ForceModel Kokkos::fence(); // Initialize cross-terms. - auto init_cross_func = KOKKOS_LAMBDA( const int i ) + auto init_cross_func = KOKKOS_CLASS_LAMBDA( const int i ) { for ( std::size_t j = i; j < num_types; j++ ) {