Skip to content

Commit d0b8dad

Browse files
committed
Simplify array input templates for neighbor lists;
Update min Kokkos to 4.4 to do so
1 parent 2713478 commit d0b8dad

File tree

5 files changed

+92
-116
lines changed

5 files changed

+92
-116
lines changed

.github/workflows/CI.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
cxx: ['g++', 'clang++']
2828
backend: ['OPENMP', 'SERIAL']
2929
cmake_build_type: ['Debug', 'Release']
30-
kokkos_ver: ['4.1.00']
30+
kokkos_ver: ['4.4.01']
3131
bounds_check: ['OFF']
3232
arborx: ['OFF']
3333
heffte: ['OFF' ]
@@ -42,7 +42,7 @@ jobs:
4242
cxx: 'g++'
4343
backend: 'THREADS'
4444
cmake_build_type: 'Debug'
45-
kokkos_ver: '4.1.00'
45+
kokkos_ver: '4.4.01'
4646
arborx: 'OFF'
4747
heffte: 'OFF'
4848
hypre: 'OFF'
@@ -52,7 +52,7 @@ jobs:
5252
cxx: 'icpx'
5353
backend: 'OPENMP'
5454
cmake_build_type: 'Release'
55-
kokkos_ver: '4.1.00'
55+
kokkos_ver: '4.4.01'
5656
arborx: 'OFF'
5757
heffte: 'OFF'
5858
hypre: 'OFF'
@@ -61,7 +61,7 @@ jobs:
6161
cxx: 'icpx'
6262
backend: 'OPENMP'
6363
cmake_build_type: 'Debug'
64-
kokkos_ver: '4.1.00'
64+
kokkos_ver: '4.4.01'
6565
arborx: 'OFF'
6666
heffte: 'OFF'
6767
hypre: 'OFF'
@@ -70,7 +70,7 @@ jobs:
7070
cxx: 'icpx'
7171
backend: 'SERIAL'
7272
cmake_build_type: 'Release'
73-
kokkos_ver: '4.1.00'
73+
kokkos_ver: '4.4.01'
7474
arborx: 'OFF'
7575
heffte: 'OFF'
7676
hypre: 'OFF'
@@ -79,7 +79,7 @@ jobs:
7979
cxx: 'icpx'
8080
backend: 'SERIAL'
8181
cmake_build_type: 'Debug'
82-
kokkos_ver: '4.1.00'
82+
kokkos_ver: '4.4.01'
8383
arborx: 'OFF'
8484
heffte: 'OFF'
8585
hypre: 'OFF'
@@ -88,7 +88,7 @@ jobs:
8888
cxx: 'icpx'
8989
backend: 'SERIAL'
9090
cmake_build_type: 'Debug'
91-
kokkos_ver: '4.1.00'
91+
kokkos_ver: '4.4.01'
9292
arborx: 'OFF'
9393
heffte: 'MKL'
9494
hypre: 'OFF'
@@ -98,7 +98,7 @@ jobs:
9898
cxx: 'g++'
9999
backend: 'OPENMP'
100100
cmake_build_type: 'Release'
101-
kokkos_ver: '4.1.00'
101+
kokkos_ver: '4.4.01'
102102
arborx: 'OFF'
103103
heffte: 'OFF'
104104
hypre: 'OFF'
@@ -109,7 +109,7 @@ jobs:
109109
cxx: 'clang++'
110110
backend: 'OPENMP'
111111
cmake_build_type: 'Release'
112-
kokkos_ver: '4.1.00'
112+
kokkos_ver: '4.4.01'
113113
arborx: 'OFF'
114114
heffte: 'OFF'
115115
hypre: 'OFF'
@@ -118,7 +118,7 @@ jobs:
118118
cxx: 'g++'
119119
cmake_build_type: 'Release'
120120
backend: 'OPENMP'
121-
kokkos_ver: '4.1.00'
121+
kokkos_ver: '4.4.01'
122122
arborx: 'OFF'
123123
heffte: 'OFF'
124124
hypre: 'OFF'
@@ -127,7 +127,7 @@ jobs:
127127
cxx: 'clang++'
128128
backend: 'OPENMP'
129129
cmake_build_type: 'Release'
130-
kokkos_ver: '4.1.00'
130+
kokkos_ver: '4.4.01'
131131
arborx: 'OFF'
132132
heffte: 'OFF'
133133
hypre: 'OFF'
@@ -137,7 +137,7 @@ jobs:
137137
cxx: 'g++'
138138
cmake_build_type: 'Release'
139139
backend: 'OPENMP'
140-
kokkos_ver: '4.1.00'
140+
kokkos_ver: '4.4.01'
141141
arborx: 'OFF'
142142
heffte: 'OFF'
143143
hypre: 'OFF'
@@ -146,7 +146,7 @@ jobs:
146146
cxx: 'clang++'
147147
backend: 'OPENMP'
148148
cmake_build_type: 'Release'
149-
kokkos_ver: '4.1.00'
149+
kokkos_ver: '4.4.01'
150150
arborx: 'OFF'
151151
heffte: 'OFF'
152152
hypre: 'OFF'
@@ -155,7 +155,7 @@ jobs:
155155
cxx: 'g++'
156156
backend: 'OPENMP'
157157
cmake_build_type: 'Debug'
158-
kokkos_ver: '4.1.00'
158+
kokkos_ver: '4.4.01'
159159
arborx: 'ArborX'
160160
heffte: 'OFF'
161161
hypre: 'OFF'
@@ -164,7 +164,7 @@ jobs:
164164
cxx: 'g++'
165165
backend: 'OPENMP'
166166
cmake_build_type: 'Release'
167-
kokkos_ver: '4.1.00'
167+
kokkos_ver: '4.4.01'
168168
arborx: 'ArborX'
169169
heffte: 'OFF'
170170
hypre: 'OFF'
@@ -173,7 +173,7 @@ jobs:
173173
cxx: 'g++'
174174
backend: 'OPENMP'
175175
cmake_build_type: 'Release'
176-
kokkos_ver: '4.1.00'
176+
kokkos_ver: '4.4.01'
177177
arborx: 'OFF'
178178
heffte: 'FFTW'
179179
hypre: 'OFF'
@@ -182,7 +182,7 @@ jobs:
182182
cxx: 'g++'
183183
backend: 'OPENMP'
184184
cmake_build_type: 'Release'
185-
kokkos_ver: '4.1.00'
185+
kokkos_ver: '4.4.01'
186186
arborx: 'OFF'
187187
heffte: 'OFF'
188188
hypre: 'OFF'
@@ -192,7 +192,7 @@ jobs:
192192
cxx: 'g++'
193193
backend: 'OPENMP'
194194
cmake_build_type: 'Debug'
195-
kokkos_ver: '4.1.00'
195+
kokkos_ver: '4.4.01'
196196
arborx: 'OFF'
197197
heffte: 'OFF'
198198
hypre: 'HYPRE'
@@ -201,7 +201,7 @@ jobs:
201201
cxx: 'g++'
202202
backend: 'OPENMP'
203203
cmake_build_type: 'Debug'
204-
kokkos_ver: '4.1.00'
204+
kokkos_ver: '4.4.01'
205205
arborx: 'OFF'
206206
heffte: 'OFF'
207207
hypre: 'OFF'
@@ -211,7 +211,7 @@ jobs:
211211
cxx: 'g++'
212212
backend: 'OPENMP'
213213
cmake_build_type: 'Debug'
214-
kokkos_ver: '4.1.00'
214+
kokkos_ver: '4.4.01'
215215
arborx: 'OFF'
216216
heffte: 'OFF'
217217
hypre: 'OFF'
@@ -221,7 +221,7 @@ jobs:
221221
cxx: 'g++'
222222
backend: 'OPENMP'
223223
cmake_build_type: 'Debug'
224-
kokkos_ver: '4.1.00'
224+
kokkos_ver: '4.4.01'
225225
arborx: 'ArborX'
226226
heffte: 'FFTW'
227227
hypre: 'HYPRE'
@@ -234,7 +234,7 @@ jobs:
234234
cxx: 'g++'
235235
backend: 'OPENMP'
236236
cmake_build_type: 'Debug'
237-
kokkos_ver: '4.1.00'
237+
kokkos_ver: '4.4.01'
238238
arborx: 'ArborX'
239239
heffte: 'FFTW'
240240
hypre: 'HYPRE'
@@ -568,7 +568,7 @@ jobs:
568568
matrix:
569569
cxx: ['nvcc']
570570
cmake_build_type: ['Release']
571-
kokkos_ver: ['4.1.00']
571+
kokkos_ver: ['4.4.01']
572572
runs-on: ubuntu-20.04
573573
container: ghcr.io/ecp-copa/ci-containers/cuda:12.2.0
574574
steps:

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
3939
# Dependencies
4040
#------------------------------------------------------------------------------#
4141
# find kokkos
42-
find_package(Kokkos 4.1 REQUIRED)
42+
find_package(Kokkos 4.4 REQUIRED)
4343

4444
# set supported kokkos devices
4545
set(CABANA_SUPPORTED_DEVICES SERIAL THREADS OPENMP CUDA HIP SYCL OPENMPTARGET)

core/src/Cabana_LinkedCellList.hpp

Lines changed: 39 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,12 @@ class LinkedCellList
170170
\param grid_min Grid minimum value in each direction.
171171
\param grid_max Grid maximum value in each direction.
172172
*/
173-
template <class PositionType,
174-
template <class, std::size_t, class...> class ArrayType,
175-
class... Args>
173+
template <class PositionType, template <class, std::size_t> class ArrayType>
176174
LinkedCellList(
177175
PositionType positions,
178-
const ArrayType<Scalar, num_space_dim, Args...> grid_delta,
179-
const ArrayType<Scalar, num_space_dim, Args...> grid_min,
180-
const ArrayType<Scalar, num_space_dim, Args...> grid_max,
176+
const ArrayType<Scalar, num_space_dim> grid_delta,
177+
const ArrayType<Scalar, num_space_dim> grid_min,
178+
const ArrayType<Scalar, num_space_dim> grid_max,
181179
typename std::enable_if<( is_slice<PositionType>::value ||
182180
Kokkos::is_view<PositionType>::value ),
183181
int>::type* = 0 )
@@ -208,14 +206,12 @@ class LinkedCellList
208206
\param grid_min Grid minimum value in each direction.
209207
\param grid_max Grid maximum value in each direction.
210208
*/
211-
template <class PositionType,
212-
template <class, std::size_t, class...> class ArrayType,
213-
class... Args>
209+
template <class PositionType, template <class, std::size_t> class ArrayType>
214210
LinkedCellList(
215211
PositionType positions, const std::size_t begin, const std::size_t end,
216-
const ArrayType<Scalar, num_space_dim, Args...> grid_delta,
217-
const ArrayType<Scalar, num_space_dim, Args...> grid_min,
218-
const ArrayType<Scalar, num_space_dim, Args...> grid_max,
212+
const ArrayType<Scalar, num_space_dim> grid_delta,
213+
const ArrayType<Scalar, num_space_dim> grid_min,
214+
const ArrayType<Scalar, num_space_dim> grid_max,
219215
typename std::enable_if<( is_slice<PositionType>::value ||
220216
Kokkos::is_view<PositionType>::value ),
221217
int>::type* = 0 )
@@ -241,14 +237,12 @@ class LinkedCellList
241237
\param neighborhood_radius Radius for neighbors.
242238
\param cell_size_ratio Ratio of the cell size to the neighborhood size.
243239
*/
244-
template <class PositionType,
245-
template <class, std::size_t, class...> class ArrayType,
246-
class... Args>
240+
template <class PositionType, template <class, std::size_t> class ArrayType>
247241
LinkedCellList(
248242
PositionType positions,
249-
const ArrayType<Scalar, num_space_dim, Args...> grid_delta,
250-
const ArrayType<Scalar, num_space_dim, Args...> grid_min,
251-
const ArrayType<Scalar, num_space_dim, Args...> grid_max,
243+
const ArrayType<Scalar, num_space_dim> grid_delta,
244+
const ArrayType<Scalar, num_space_dim> grid_min,
245+
const ArrayType<Scalar, num_space_dim> grid_max,
252246
const Scalar neighborhood_radius, const Scalar cell_size_ratio = 1,
253247
typename std::enable_if<( is_slice<PositionType>::value ||
254248
Kokkos::is_view<PositionType>::value ),
@@ -283,14 +277,12 @@ class LinkedCellList
283277
\param neighborhood_radius Radius for neighbors.
284278
\param cell_size_ratio Ratio of the cell size to the neighborhood size.
285279
*/
286-
template <class PositionType,
287-
template <class, std::size_t, class...> class ArrayType,
288-
class... Args>
280+
template <class PositionType, template <class, std::size_t> class ArrayType>
289281
LinkedCellList(
290282
PositionType positions, const std::size_t begin, const std::size_t end,
291-
const ArrayType<Scalar, num_space_dim, Args...> grid_delta,
292-
const ArrayType<Scalar, num_space_dim, Args...> grid_min,
293-
const ArrayType<Scalar, num_space_dim, Args...> grid_max,
283+
const ArrayType<Scalar, num_space_dim> grid_delta,
284+
const ArrayType<Scalar, num_space_dim> grid_min,
285+
const ArrayType<Scalar, num_space_dim> grid_max,
294286
const Scalar neighborhood_radius, const Scalar cell_size_ratio = 1,
295287
typename std::enable_if<( is_slice<PositionType>::value ||
296288
Kokkos::is_view<PositionType>::value ),
@@ -895,14 +887,12 @@ class LinkedCellList
895887
\brief Creation function for linked cell list.
896888
\return LinkedCellList.
897889
*/
898-
template <class PositionType,
899-
template <class, std::size_t, class...> class ArrayType,
900-
class... Args, class Scalar, std::size_t NumSpaceDim>
901-
auto createLinkedCellList(
902-
PositionType positions,
903-
const ArrayType<Scalar, NumSpaceDim, Args...> grid_delta,
904-
const ArrayType<Scalar, NumSpaceDim, Args...> grid_min,
905-
const ArrayType<Scalar, NumSpaceDim, Args...> grid_max )
890+
template <class PositionType, template <class, std::size_t> class ArrayType,
891+
class Scalar, std::size_t NumSpaceDim>
892+
auto createLinkedCellList( PositionType positions,
893+
const ArrayType<Scalar, NumSpaceDim> grid_delta,
894+
const ArrayType<Scalar, NumSpaceDim> grid_min,
895+
const ArrayType<Scalar, NumSpaceDim> grid_max )
906896
{
907897
using memory_space = typename PositionType::memory_space;
908898
using scalar_type = typename PositionType::value_type;
@@ -915,14 +905,13 @@ auto createLinkedCellList(
915905
\brief Creation function for linked cell list with partial range.
916906
\return LinkedCellList.
917907
*/
918-
template <class PositionType,
919-
template <class, std::size_t, class...> class ArrayType,
920-
class... Args, class Scalar, std::size_t NumSpaceDim>
921-
auto createLinkedCellList(
922-
PositionType positions, const std::size_t begin, const std::size_t end,
923-
const ArrayType<Scalar, NumSpaceDim, Args...> grid_delta,
924-
const ArrayType<Scalar, NumSpaceDim, Args...> grid_min,
925-
const ArrayType<Scalar, NumSpaceDim, Args...> grid_max )
908+
template <class PositionType, template <class, std::size_t> class ArrayType,
909+
class Scalar, std::size_t NumSpaceDim>
910+
auto createLinkedCellList( PositionType positions, const std::size_t begin,
911+
const std::size_t end,
912+
const ArrayType<Scalar, NumSpaceDim> grid_delta,
913+
const ArrayType<Scalar, NumSpaceDim> grid_min,
914+
const ArrayType<Scalar, NumSpaceDim> grid_max )
926915
{
927916
using memory_space = typename PositionType::memory_space;
928917
using scalar_type = typename PositionType::value_type;
@@ -936,14 +925,12 @@ auto createLinkedCellList(
936925
cell ratio.
937926
\return LinkedCellList.
938927
*/
939-
template <class PositionType,
940-
template <class, std::size_t, class...> class ArrayType,
941-
class... Args, class Scalar, std::size_t NumSpaceDim>
928+
template <class PositionType, template <class, std::size_t> class ArrayType,
929+
class Scalar, std::size_t NumSpaceDim>
942930
auto createLinkedCellList(
943-
PositionType positions,
944-
const ArrayType<Scalar, NumSpaceDim, Args...> grid_delta,
945-
const ArrayType<Scalar, NumSpaceDim, Args...> grid_min,
946-
const ArrayType<Scalar, NumSpaceDim, Args...> grid_max,
931+
PositionType positions, const ArrayType<Scalar, NumSpaceDim> grid_delta,
932+
const ArrayType<Scalar, NumSpaceDim> grid_min,
933+
const ArrayType<Scalar, NumSpaceDim> grid_max,
947934
const typename PositionType::value_type neighborhood_radius,
948935
const typename PositionType::value_type cell_size_ratio = 1.0 )
949936
{
@@ -960,14 +947,13 @@ auto createLinkedCellList(
960947
cutoff radius and/or cell ratio.
961948
\return LinkedCellList.
962949
*/
963-
template <class PositionType,
964-
template <class, std::size_t, class...> class ArrayType,
965-
class... Args, class Scalar, std::size_t NumSpaceDim>
950+
template <class PositionType, template <class, std::size_t> class ArrayType,
951+
class Scalar, std::size_t NumSpaceDim>
966952
auto createLinkedCellList(
967953
PositionType positions, const std::size_t begin, const std::size_t end,
968-
const ArrayType<Scalar, NumSpaceDim, Args...> grid_delta,
969-
const ArrayType<Scalar, NumSpaceDim, Args...> grid_min,
970-
const ArrayType<Scalar, NumSpaceDim, Args...> grid_max,
954+
const ArrayType<Scalar, NumSpaceDim> grid_delta,
955+
const ArrayType<Scalar, NumSpaceDim> grid_min,
956+
const ArrayType<Scalar, NumSpaceDim> grid_max,
971957
const typename PositionType::value_type neighborhood_radius,
972958
const typename PositionType::value_type cell_size_ratio = 1.0 )
973959
{

0 commit comments

Comments
 (0)