Skip to content

Commit

Permalink
Simplify array input templates for neighbor lists;
Browse files Browse the repository at this point in the history
Update min Kokkos to 4.4 to do so
  • Loading branch information
streeve committed Feb 5, 2025
1 parent 50a9d16 commit 603dc2f
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 117 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
cxx: ['g++', 'clang++']
backend: ['OPENMP', 'SERIAL']
cmake_build_type: ['Debug', 'Release']
kokkos_ver: ['4.1.00']
kokkos_ver: ['4.4.01']
bounds_check: ['OFF']
arborx: ['OFF']
heffte: ['OFF' ]
Expand All @@ -42,7 +42,7 @@ jobs:
cxx: 'g++'
backend: 'THREADS'
cmake_build_type: 'Debug'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'OFF'
heffte: 'OFF'
hypre: 'OFF'
Expand All @@ -52,7 +52,7 @@ jobs:
cxx: 'icpx'
backend: 'OPENMP'
cmake_build_type: 'Release'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'OFF'
heffte: 'OFF'
hypre: 'OFF'
Expand All @@ -61,7 +61,7 @@ jobs:
cxx: 'icpx'
backend: 'OPENMP'
cmake_build_type: 'Debug'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'OFF'
heffte: 'OFF'
hypre: 'OFF'
Expand All @@ -70,7 +70,7 @@ jobs:
cxx: 'icpx'
backend: 'SERIAL'
cmake_build_type: 'Release'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'OFF'
heffte: 'OFF'
hypre: 'OFF'
Expand All @@ -79,7 +79,7 @@ jobs:
cxx: 'icpx'
backend: 'SERIAL'
cmake_build_type: 'Debug'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'OFF'
heffte: 'OFF'
hypre: 'OFF'
Expand All @@ -88,7 +88,7 @@ jobs:
cxx: 'icpx'
backend: 'SERIAL'
cmake_build_type: 'Debug'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'OFF'
heffte: 'MKL'
hypre: 'OFF'
Expand All @@ -98,7 +98,7 @@ jobs:
cxx: 'g++'
backend: 'OPENMP'
cmake_build_type: 'Release'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'OFF'
heffte: 'OFF'
hypre: 'OFF'
Expand All @@ -109,7 +109,7 @@ jobs:
cxx: 'clang++'
backend: 'OPENMP'
cmake_build_type: 'Release'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'OFF'
heffte: 'OFF'
hypre: 'OFF'
Expand All @@ -118,7 +118,7 @@ jobs:
cxx: 'g++'
cmake_build_type: 'Release'
backend: 'OPENMP'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'OFF'
heffte: 'OFF'
hypre: 'OFF'
Expand All @@ -127,7 +127,7 @@ jobs:
cxx: 'clang++'
backend: 'OPENMP'
cmake_build_type: 'Release'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'OFF'
heffte: 'OFF'
hypre: 'OFF'
Expand All @@ -137,7 +137,7 @@ jobs:
cxx: 'g++'
cmake_build_type: 'Release'
backend: 'OPENMP'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'OFF'
heffte: 'OFF'
hypre: 'OFF'
Expand All @@ -146,7 +146,7 @@ jobs:
cxx: 'clang++'
backend: 'OPENMP'
cmake_build_type: 'Release'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'OFF'
heffte: 'OFF'
hypre: 'OFF'
Expand All @@ -155,7 +155,7 @@ jobs:
cxx: 'g++'
backend: 'OPENMP'
cmake_build_type: 'Debug'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'ArborX'
heffte: 'OFF'
hypre: 'OFF'
Expand All @@ -164,7 +164,7 @@ jobs:
cxx: 'g++'
backend: 'OPENMP'
cmake_build_type: 'Release'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'ArborX'
heffte: 'OFF'
hypre: 'OFF'
Expand All @@ -173,7 +173,7 @@ jobs:
cxx: 'g++'
backend: 'OPENMP'
cmake_build_type: 'Release'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'OFF'
heffte: 'FFTW'
hypre: 'OFF'
Expand All @@ -182,7 +182,7 @@ jobs:
cxx: 'g++'
backend: 'OPENMP'
cmake_build_type: 'Release'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'OFF'
heffte: 'OFF'
hypre: 'OFF'
Expand All @@ -192,7 +192,7 @@ jobs:
cxx: 'g++'
backend: 'OPENMP'
cmake_build_type: 'Debug'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'OFF'
heffte: 'OFF'
hypre: 'HYPRE'
Expand All @@ -201,7 +201,7 @@ jobs:
cxx: 'g++'
backend: 'OPENMP'
cmake_build_type: 'Debug'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'OFF'
heffte: 'OFF'
hypre: 'OFF'
Expand All @@ -211,7 +211,7 @@ jobs:
cxx: 'g++'
backend: 'OPENMP'
cmake_build_type: 'Debug'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'OFF'
heffte: 'OFF'
hypre: 'OFF'
Expand All @@ -221,7 +221,7 @@ jobs:
cxx: 'g++'
backend: 'OPENMP'
cmake_build_type: 'Debug'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'ArborX'
heffte: 'FFTW'
hypre: 'HYPRE'
Expand All @@ -234,7 +234,7 @@ jobs:
cxx: 'g++'
backend: 'OPENMP'
cmake_build_type: 'Debug'
kokkos_ver: '4.1.00'
kokkos_ver: '4.4.01'
arborx: 'ArborX'
heffte: 'FFTW'
hypre: 'HYPRE'
Expand Down Expand Up @@ -484,7 +484,7 @@ jobs:
matrix:
cxx: ['hipcc']
cmake_build_type: ['Debug']
kokkos_ver: ['4.2.00']
kokkos_ver: ['4.4.01']
runs-on: ubuntu-20.04
container: ghcr.io/ecp-copa/ci-containers/rocm:latest
steps:
Expand Down Expand Up @@ -568,7 +568,7 @@ jobs:
matrix:
cxx: ['nvcc']
cmake_build_type: ['Release']
kokkos_ver: ['4.1.00']
kokkos_ver: ['4.4.01']
runs-on: ubuntu-20.04
container: ghcr.io/ecp-copa/ci-containers/cuda:12.2.0
steps:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Dependencies
#------------------------------------------------------------------------------#
# find kokkos
find_package(Kokkos 4.1 REQUIRED)
find_package(Kokkos 4.4 REQUIRED)

# set supported kokkos devices
set(CABANA_SUPPORTED_DEVICES SERIAL THREADS OPENMP CUDA HIP SYCL OPENMPTARGET)
Expand Down
92 changes: 39 additions & 53 deletions core/src/Cabana_LinkedCellList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,12 @@ class LinkedCellList
\param grid_min Grid minimum value in each direction.
\param grid_max Grid maximum value in each direction.
*/
template <class PositionType,
template <class, std::size_t, class...> class ArrayType,
class... Args>
template <class PositionType, template <class, std::size_t> class ArrayType>
LinkedCellList(
PositionType positions,
const ArrayType<Scalar, num_space_dim, Args...> grid_delta,
const ArrayType<Scalar, num_space_dim, Args...> grid_min,
const ArrayType<Scalar, num_space_dim, Args...> grid_max,
const ArrayType<Scalar, num_space_dim> grid_delta,
const ArrayType<Scalar, num_space_dim> grid_min,
const ArrayType<Scalar, num_space_dim> grid_max,
typename std::enable_if<( is_slice<PositionType>::value ||
Kokkos::is_view<PositionType>::value ),
int>::type* = 0 )
Expand Down Expand Up @@ -208,14 +206,12 @@ class LinkedCellList
\param grid_min Grid minimum value in each direction.
\param grid_max Grid maximum value in each direction.
*/
template <class PositionType,
template <class, std::size_t, class...> class ArrayType,
class... Args>
template <class PositionType, template <class, std::size_t> class ArrayType>
LinkedCellList(
PositionType positions, const std::size_t begin, const std::size_t end,
const ArrayType<Scalar, num_space_dim, Args...> grid_delta,
const ArrayType<Scalar, num_space_dim, Args...> grid_min,
const ArrayType<Scalar, num_space_dim, Args...> grid_max,
const ArrayType<Scalar, num_space_dim> grid_delta,
const ArrayType<Scalar, num_space_dim> grid_min,
const ArrayType<Scalar, num_space_dim> grid_max,
typename std::enable_if<( is_slice<PositionType>::value ||
Kokkos::is_view<PositionType>::value ),
int>::type* = 0 )
Expand All @@ -241,14 +237,12 @@ class LinkedCellList
\param neighborhood_radius Radius for neighbors.
\param cell_size_ratio Ratio of the cell size to the neighborhood size.
*/
template <class PositionType,
template <class, std::size_t, class...> class ArrayType,
class... Args>
template <class PositionType, template <class, std::size_t> class ArrayType>
LinkedCellList(
PositionType positions,
const ArrayType<Scalar, num_space_dim, Args...> grid_delta,
const ArrayType<Scalar, num_space_dim, Args...> grid_min,
const ArrayType<Scalar, num_space_dim, Args...> grid_max,
const ArrayType<Scalar, num_space_dim> grid_delta,
const ArrayType<Scalar, num_space_dim> grid_min,
const ArrayType<Scalar, num_space_dim> grid_max,
const Scalar neighborhood_radius, const Scalar cell_size_ratio = 1,
typename std::enable_if<( is_slice<PositionType>::value ||
Kokkos::is_view<PositionType>::value ),
Expand Down Expand Up @@ -283,14 +277,12 @@ class LinkedCellList
\param neighborhood_radius Radius for neighbors.
\param cell_size_ratio Ratio of the cell size to the neighborhood size.
*/
template <class PositionType,
template <class, std::size_t, class...> class ArrayType,
class... Args>
template <class PositionType, template <class, std::size_t> class ArrayType>
LinkedCellList(
PositionType positions, const std::size_t begin, const std::size_t end,
const ArrayType<Scalar, num_space_dim, Args...> grid_delta,
const ArrayType<Scalar, num_space_dim, Args...> grid_min,
const ArrayType<Scalar, num_space_dim, Args...> grid_max,
const ArrayType<Scalar, num_space_dim> grid_delta,
const ArrayType<Scalar, num_space_dim> grid_min,
const ArrayType<Scalar, num_space_dim> grid_max,
const Scalar neighborhood_radius, const Scalar cell_size_ratio = 1,
typename std::enable_if<( is_slice<PositionType>::value ||
Kokkos::is_view<PositionType>::value ),
Expand Down Expand Up @@ -895,14 +887,12 @@ class LinkedCellList
\brief Creation function for linked cell list.
\return LinkedCellList.
*/
template <class PositionType,
template <class, std::size_t, class...> class ArrayType,
class... Args, class Scalar, std::size_t NumSpaceDim>
auto createLinkedCellList(
PositionType positions,
const ArrayType<Scalar, NumSpaceDim, Args...> grid_delta,
const ArrayType<Scalar, NumSpaceDim, Args...> grid_min,
const ArrayType<Scalar, NumSpaceDim, Args...> grid_max )
template <class PositionType, template <class, std::size_t> class ArrayType,
class Scalar, std::size_t NumSpaceDim>
auto createLinkedCellList( PositionType positions,
const ArrayType<Scalar, NumSpaceDim> grid_delta,
const ArrayType<Scalar, NumSpaceDim> grid_min,
const ArrayType<Scalar, NumSpaceDim> grid_max )
{
using memory_space = typename PositionType::memory_space;
using scalar_type = typename PositionType::value_type;
Expand All @@ -914,14 +904,13 @@ auto createLinkedCellList(
\brief Creation function for linked cell list with partial range.
\return LinkedCellList.
*/
template <class PositionType,
template <class, std::size_t, class...> class ArrayType,
class... Args, class Scalar, std::size_t NumSpaceDim>
auto createLinkedCellList(
PositionType positions, const std::size_t begin, const std::size_t end,
const ArrayType<Scalar, NumSpaceDim, Args...> grid_delta,
const ArrayType<Scalar, NumSpaceDim, Args...> grid_min,
const ArrayType<Scalar, NumSpaceDim, Args...> grid_max )
template <class PositionType, template <class, std::size_t> class ArrayType,
class Scalar, std::size_t NumSpaceDim>
auto createLinkedCellList( PositionType positions, const std::size_t begin,
const std::size_t end,
const ArrayType<Scalar, NumSpaceDim> grid_delta,
const ArrayType<Scalar, NumSpaceDim> grid_min,
const ArrayType<Scalar, NumSpaceDim> grid_max )
{
using memory_space = typename PositionType::memory_space;
using scalar_type = typename PositionType::value_type;
Expand All @@ -934,14 +923,12 @@ auto createLinkedCellList(
cell ratio.
\return LinkedCellList.
*/
template <class PositionType,
template <class, std::size_t, class...> class ArrayType,
class... Args, class Scalar, std::size_t NumSpaceDim>
template <class PositionType, template <class, std::size_t> class ArrayType,
class Scalar, std::size_t NumSpaceDim>
auto createLinkedCellList(
PositionType positions,
const ArrayType<Scalar, NumSpaceDim, Args...> grid_delta,
const ArrayType<Scalar, NumSpaceDim, Args...> grid_min,
const ArrayType<Scalar, NumSpaceDim, Args...> grid_max,
PositionType positions, const ArrayType<Scalar, NumSpaceDim> grid_delta,
const ArrayType<Scalar, NumSpaceDim> grid_min,
const ArrayType<Scalar, NumSpaceDim> grid_max,
const typename PositionType::value_type neighborhood_radius,
const typename PositionType::value_type cell_size_ratio = 1.0 )
{
Expand All @@ -957,14 +944,13 @@ auto createLinkedCellList(
cutoff radius and/or cell ratio.
\return LinkedCellList.
*/
template <class PositionType,
template <class, std::size_t, class...> class ArrayType,
class... Args, class Scalar, std::size_t NumSpaceDim>
template <class PositionType, template <class, std::size_t> class ArrayType,
class Scalar, std::size_t NumSpaceDim>
auto createLinkedCellList(
PositionType positions, const std::size_t begin, const std::size_t end,
const ArrayType<Scalar, NumSpaceDim, Args...> grid_delta,
const ArrayType<Scalar, NumSpaceDim, Args...> grid_min,
const ArrayType<Scalar, NumSpaceDim, Args...> grid_max,
const ArrayType<Scalar, NumSpaceDim> grid_delta,
const ArrayType<Scalar, NumSpaceDim> grid_min,
const ArrayType<Scalar, NumSpaceDim> grid_max,
const typename PositionType::value_type neighborhood_radius,
const typename PositionType::value_type cell_size_ratio = 1.0 )
{
Expand Down
Loading

0 comments on commit 603dc2f

Please sign in to comment.