Skip to content

Commit 7fc23e5

Browse files
committed
Make Kokkos code compatible with C++20
The Kokkos code has two problems when it comes to C++20 compatibility. Firstly, the current version simply does not work in C++20 mode; compilation requires Kokkos 4.3.1 or later. There are also some warnings that prevent compilation. This commit fixes these issues by updating to Kokkos 4.3.1 and by adding some hacks to fix the compiler warnings.
1 parent 25d868a commit 7fc23e5

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

device/kokkos/src/seeding/spacepoint_binning.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ spacepoint_binning::output_type spacepoint_binning::operator()(
4646
const unsigned int num_threads = 32 * 8;
4747
const unsigned int num_blocks = (sp_size + num_threads - 1) / num_threads;
4848

49+
// Hack to avoid warnings thrown by C++20
50+
seedfinder_config config = m_config;
51+
auto axes = m_axes;
52+
4953
Kokkos::parallel_for(
5054
"count_grid_capacities", team_policy(num_blocks, Kokkos::AUTO),
5155
KOKKOS_LAMBDA(const member_type& team_member) {
@@ -55,7 +59,7 @@ spacepoint_binning::output_type spacepoint_binning::operator()(
5559
device::count_grid_capacities(
5660
team_member.league_rank() * team_member.team_size() +
5761
thr,
58-
m_config, m_axes.first, m_axes.second, spacepoints_view,
62+
config, axes.first, axes.second, spacepoints_view,
5963
grid_capacities_view);
6064
});
6165
});
@@ -84,12 +88,12 @@ spacepoint_binning::output_type spacepoint_binning::operator()(
8488
device::populate_grid(
8589
team_member.league_rank() * team_member.team_size() +
8690
thr,
87-
m_config, spacepoints_view, grid_view);
91+
config, spacepoints_view, grid_view);
8892
});
8993
});
9094

9195
// Return the freshly filled buffer.
9296
return grid_buffer;
9397
}
9498

95-
} // namespace traccc::kokkos
99+
} // namespace traccc::kokkos

extern/kokkos/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ message( STATUS "Building Kokkos as part of the TRACCC project" )
1818

1919
# Declare where to get Kokkos from.
2020
set( TRACCC_KOKKOS_SOURCE
21-
"URL;https://github.com/kokkos/kokkos/archive/refs/tags/3.7.00.tar.gz;URL_MD5;84991eca9f066383abe119a5bc7a11c4"
21+
"URL;https://github.com/kokkos/kokkos/archive/refs/tags/4.3.01.tar.gz;URL_MD5;243de871b3dc2cf3990c1c404032df83"
2222
CACHE STRING "Source for Kokkos, when built as part of this project" )
2323
mark_as_advanced( TRACCC_KOKKOS_SOURCE )
2424
FetchContent_Declare( Kokkos ${TRACCC_KOKKOS_SOURCE} )
2525

2626
# Default options for the Kokkos build.
2727
set( Kokkos_ENABLE_SERIAL TRUE CACHE BOOL
2828
"Enable the serial backend of Kokkos" )
29+
set( BUILD_SHARED_LIBS TRUE CACHE BOOL
30+
"Enable building of shared libs in Kokkos" )
2931

3032
# Get it into the current directory.
3133
FetchContent_MakeAvailable( Kokkos )

0 commit comments

Comments
 (0)