C omp reduction max and min operators were included in OpenMP 3.1 standard, but I'm still looking for a widely available compiler which implements it. gcc testsuite includes Fortran but not c or c++ tests for max or min reduction. OpenMP 4.0 defines both parallel and simd capabilities for min and max reduction; apparently, Intel compilers will advertise OpenMP 4 support before these have been implemented. Other OpenMP 4 reductions are supported now in current icc.
icpc does an excellent job without omp simd reduction directive of vectorizing std::max(). Sometimes, icc can vectorize equivalent C code, possibly with the help of #pragma vector; more often, gcc can accomplish max/min vectorization. Cilk(tm) Plus includes equivalent reducers, but they seem to be less reliably optimized than gcc is with standard C source code.
The inclusion of min/max as reduction in C would be of great value for me. I have a nearest neighbor search big problem, for surface registration that is calling for that. The lack of min/max reduction force alternative implementations that look like to be suboptimal and not clear.
I beg your pardon, English is not native language and sometimes I can not express myself in the right way. I was trying to support the idea of adopting the OpenMP 3.1 min/max reduction for C and C++ , not asking for C or C++ standard modification !
I only want to use something like :
#pragma omp parallel for reduction(max : max_value)
which should be very handy for lots of programming problems.
Sergey Kostrov wrote:
>>I only want to use something like :
>>#pragma omp parallel for reduction(max : max_value)
This form is already defined by OpenMP 3.1, although I've seen it denied. OpenMP 4.0 RC2 also defines
#pragma omp parallel for simd reduction(max : max_value)
to specify explicitly that both simd and thread parallel optimizations are desired, as well as forms for simd without threaded parallelism.
I guess Intel compilers are waiting to implement reduction(max/min: ) until there is documented demand for the OpenMP 4 forms.
I've drafted a white paper on the omp simd forms already supported, as well as alternatives for those which aren't (e.g. C++ std::max(), std:max_element()....