22 #ifndef __kokkosAlgorithms_hpp__
23 #define __kokkosAlgorithms_hpp__
31 template<
typename Type,
typename ExecutionSpace>
35 using policy = Kokkos::RangePolicy<
37 Kokkos::IndexType<int32> >;
39 Kokkos::parallel_reduce(
"count",
42 if(
equal(first[i],val)) updateVal++;
51 template<
typename Type,
typename ExecutionSpace>
56 using policy = Kokkos::RangePolicy<
58 Kokkos::IndexType<int32> >;
64 first[i] = firstVal+i;
69 template<
typename Type,
typename indexType,
typename ExecutionSpace>
71 void fillSelected(Type* first,
const indexType* indices,
const int32 numElems,
const Type val)
73 using policy = Kokkos::RangePolicy<
75 Kokkos::IndexType<int32> >;
80 first[indices[i]]= val;
85 template<
typename Type,
typename indexType,
typename ExecutionSpace>
87 void fillSelected(Type* first,
const indexType* indices,
const Type* vals,
const int32 numElems)
89 using policy = Kokkos::RangePolicy<
91 Kokkos::IndexType<int32> >;
97 first[indices[i]]= vals[i];
102 template<
typename Type,
typename ExecutionSpace>
106 using policy = Kokkos::RangePolicy<
108 Kokkos::IndexType<int32> >;
111 Kokkos::parallel_reduce(
115 if(maxUpdate<first[i]) maxUpdate = first[i];
117 Kokkos::Max<Type>(maxElement));
122 template<
typename Type,
typename ExecutionSpace>
126 using policy = Kokkos::RangePolicy<
128 Kokkos::IndexType<int32> >;
131 Kokkos::parallel_reduce(
135 if(first[i] < minUpdate) minUpdate = first[i];
137 Kokkos::Min<Type>(minElement));
147 template<
typename Type,
typename DestType,
typename ExecutionSpace>
150 using policy = Kokkos::RangePolicy<
152 Kokkos::IndexType<int32> >;
154 Kokkos::parallel_scan(
159 const int32 val = first[i];
161 dFirst[i] = valToUpdate;
166 template<
typename Type,
typename DestType,
typename ExecutionSpace>
169 using policy = Kokkos::RangePolicy<
171 Kokkos::IndexType<int32> >;
173 Kokkos::parallel_scan(
178 const int32 val = first[i];
181 dFirst[i] = valToUpdate;
188 #endif //__kokkosAlgorithms_hpp__