Order of execution in Reduction Operation in OpenMP
Is there a way to know the order of execution for a reduction operator in OpenMP? In other words, I would like to know how the threads execute reduction operation- is it left to right? What happens when there are numbers that are not power of 2? I think you'll find that OpenMP will only reduce on associative operations, such as + and * (or addition and multiplication if you prefer) which means that it can proceed oblivious to the order of evaluation of the component parts of the reduction expression across threads. I strongly suggest that you proceed in the same way when using OpenMP, trying