12 #ifdef USE_ARRAY_REPLICATION
21 #if defined(USE_ARRAY_REPLICATION) && defined(USE_OMP)
22 return omp_get_thread_num();
31 #ifdef USE_ARRAY_REPLICATION
34 Kokkos::atomic_add(addr, val);
42 #ifdef USE_ARRAY_REPLICATION
43 int n_threads = view.extent(0);
44 int size_per_thread = view.size()/n_threads;
46 auto thread_0_ptr = view.data();
47 auto thread_i_ptr = view.data();
49 for(
int i = 1; i<n_threads; i++){
50 thread_i_ptr += size_per_thread;
51 Kokkos::parallel_for(
"reduce_replicated_array", Kokkos::RangePolicy<HostExSpace>( 0, size_per_thread), KOKKOS_LAMBDA(
const int idx){
52 thread_0_ptr[
idx] += thread_i_ptr[
idx];
KOKKOS_INLINE_FUNCTION int get_thread()
Definition: access_add.hpp:20
idx
Definition: diag_f0_df_port1.hpp:32
KOKKOS_INLINE_FUNCTION void access_add(T *addr, T val)
Definition: access_add.hpp:30
ScatterType
Definition: access_add.hpp:7
void reduce_replicated_array(T &view)
Definition: access_add.hpp:41
constexpr ScatterType SCATTER_TYPE_GLOBAL
Definition: access_add.hpp:15
void parallel_for(const std::string name, int n_ptl, Function func, Option option, HostAoSoA aosoa_h, DeviceAoSoA aosoa_d)
Definition: streamed_parallel_for.hpp:252