From 01d0a5c4a210617fb47b9aa85a79eeccd715fa5f Mon Sep 17 00:00:00 2001 From: Tim Mattox Date: Sat, 18 Feb 2017 01:38:55 -0500 Subject: [PATCH] BUGFIX: use Kokkos::atomic_fetch_max() to avoid a race on new_maxneighs --- src/KOKKOS/npair_kokkos.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/KOKKOS/npair_kokkos.cpp b/src/KOKKOS/npair_kokkos.cpp index c750918695..5bfa147def 100644 --- a/src/KOKKOS/npair_kokkos.cpp +++ b/src/KOKKOS/npair_kokkos.cpp @@ -422,10 +422,10 @@ void NeighborKokkosExecute:: neigh_list.d_numneigh(i) = n; - if(n >= neigh_list.maxneighs) { + if(n > neigh_list.maxneighs) { resize() = 1; - if(n >= new_maxneighs()) new_maxneighs() = n; + if(n > new_maxneighs()) Kokkos::atomic_fetch_max(&new_maxneighs(),n); } neigh_list.d_ilist(i) = i; @@ -632,10 +632,10 @@ void NeighborKokkosExecute::build_ItemCuda(typename Kokkos::TeamPoli neigh_list.d_ilist(i) = i; } - if(n >= neigh_list.maxneighs) { + if(n > neigh_list.maxneighs) { resize() = 1; - if(n >= new_maxneighs()) new_maxneighs() = n; + if(n > new_maxneighs()) Kokkos::atomic_fetch_max(&new_maxneighs(),n); } } } @@ -755,10 +755,10 @@ void NeighborKokkosExecute:: neigh_list.d_numneigh(i) = n; - if(n >= neigh_list.maxneighs) { + if(n > neigh_list.maxneighs) { resize() = 1; - if(n >= new_maxneighs()) new_maxneighs() = n; + if(n > new_maxneighs()) Kokkos::atomic_fetch_max(&new_maxneighs(),n); } neigh_list.d_ilist(i) = i; }