adding a 5D version of reduce #263
francois-rincon
started this conversation in
General
Replies: 2 comments
-
(it does compile, I think it works too but who knows :) ) |
Beta Was this translation helpful? Give feedback.
0 replies
-
YEs, this can (should!) be added to Idefix as well. Feel free to propose a PR with the modifications in |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hello, I had to add a 5D version of idefix_reduce on my patou fork of idefix, just as we did last year for the idefix_for loops.
I think that this could clash with idefix when I try to merge in the future (or break compatibility), so I suggest that the loop be absorbed into idefix itself as it is a very benign piece of code.
// 5D loop
template <typename Function, typename Reducer>
inline void idefix_reduce(const std::string & NAME,
const int NB, const int NE,
const int NPRIMEB, const int NPRIMEE,
const int KB, const int KE,
const int JB, const int JE,
const int IB, const int IE,
Function function,
Reducer redFunction) {
// We only implement MDRange reductions here since the other implementations are too
// complicated to be implemented for any reduction operator on any class
#ifdef DEBUG
idfx::pushRegion("idefix_reduce("+NAME+")");
#endif
Kokkos::parallel_reduce(NAME,
Kokkos::MDRangePolicy<Kokkos::Rank<5,Kokkos::Iterate::Right, Kokkos::Iterate::Right>>
({NB,NPRIMEB,KB,JB,IB},{NE,NPRIMEE,KE,JE,IE}), function, redFunction);
}
Beta Was this translation helpful? Give feedback.
All reactions