From e2a78cbed63ef3cfed2a018ce911dbc86bd46ca2 Mon Sep 17 00:00:00 2001 From: Joe Todd Date: Fri, 2 Jul 2021 13:25:19 +0100 Subject: [PATCH] SYCL team_reduce to mimic cuda __syncthreads_count This fixes a suspected out of bounds error later on in the kernel. --- src/KOKKOS/npair_kokkos.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/KOKKOS/npair_kokkos.cpp b/src/KOKKOS/npair_kokkos.cpp index 7d6a39abe5..1110aef4a6 100644 --- a/src/KOKKOS/npair_kokkos.cpp +++ b/src/KOKKOS/npair_kokkos.cpp @@ -610,7 +610,9 @@ void NeighborKokkosExecute::build_ItemGPU(typename Kokkos::TeamPolic if (test) return; #else - dev.team_barrier(); + int not_done = (i >= 0 && i <= nlocal); + dev.team_reduce(Kokkos::Max(not_done)); + if(not_done == 0) return; #endif if (i >= 0 && i < nlocal) { @@ -1053,13 +1055,14 @@ void NeighborKokkosExecute::build_ItemSizeGPU(typename Kokkos::TeamP other_x[MY_II + 4 * atoms_per_bin] = radi; } other_id[MY_II] = i; - // FIXME_SYCL #ifndef KOKKOS_ENABLE_SYCL int test = (__syncthreads_count(i >= 0 && i <= nlocal) == 0); if (test) return; #else - dev.team_barrier(); + int not_done = (i >= 0 && i <= nlocal); + dev.team_reduce(Kokkos::Max(not_done)); + if(not_done == 0) return; #endif if (i >= 0 && i < nlocal) {