Some interesting new OpenMP functions in OpenMP 4.5, including the potentially useful reduction on arrays for C and C++ now (this was previously supported for Fortran only).
You can now perform summations of arrays using the reduction clause with OpenMP 4.5.
Reductions can be done on variables using syntax such as:
So each thread gets its own copy of total_sum, and at the end of the parallel for region, all the local copies of total_sum are summed up to get the grand total.
Suppose you have an array where you want to summation of each array element (not the entire array). Previously, you would have to implement this manually.
Whereas now in OpenMP 4.5 you can do
I compiled this with GCC 6.2. You can see which common compiler versions support the OpenMP 4.5 features here: http://www.openmp.org/resources/openmp-compilers/