reduction with array section, lower bound 0

Comments and discussion of the 4.1 OpenMP Draft specifications. Comment period ends September 30, 2015. See to download the specifications. (Read Only)
Forum rules
The OpenMP Forums are now closed to new posts. Please visit Stack Overflow if you are in need of help:
Posts: 73
Joined: Mon Jul 27, 2015 4:50 pm

reduction with array section, lower bound 0

Post by fewl9012 »

Reduction clause, page 203:14
"If a list item is an array section, its lower bound must be zero."
Are Fortran array sections allowed? Must the Fortran lower bound be zero?

Posts: 12
Joined: Tue Jul 14, 2015 9:35 am

Re: reduction with array section, lower bound 0

Post by Spreis »

0 for lower bound of a section is strange requirement overall: it precludes reductions into single array elements and distribution of reduction array among threads by non-overlapping sections for SIMD processing. Something like code below:

Code: Select all

#pragma omp parallel for shared(array) schedule(static, chunk_size)  // entire array is shared
for(int i = 0; i < N; i++) {
int threadnum = omp_get_thread_num();
#pragma omp simd reduction(+:array[threadnum*chunk_size:chunk_size])  // reduce own portion of array 
for (int j = 0; j < N; j++)
    array[i] += b[i]*c[j];
Is there any rationale for this requirement?