Nesting restriction

Forum for the public review of the OpenMP 4.0 API Release Candidates. (Read Only)
Forum rules
This forum is now closed.
Locked
jakub
Posts: 74
Joined: Fri Oct 26, 2007 3:19 am

Nesting restriction

Post by jakub »

2.16 disallows any OpenMP constructs in simd region. For most of the constructs it is logical, but I wonder if/why that includes also the #pragma omp declare simd construct.
While it is a construct, not a directive, it doesn't result in any code generated at that point, and especially in #pragma omp simd might be useful.
Consider

Code: Select all

int a[1024], b[1024];
void foo ()
{
  int i;
#pragma omp simd safelen (8)
  for (i = 0; i < 1024; i++)
    {
    #pragma omp declare simd simdlen (8) linear (b)
      extern int bar (int, int b);
      a[i] = bar (a[i], i) + b[i];
    }
One would be forced to prototype bar before the simd loop or at global scope etc. instead, while that is what will usually happen anyway, any reason to enforce it?

jakub
Posts: 74
Joined: Fri Oct 26, 2007 3:19 am

Re: Nesting restriction

Post by jakub »

Similarly, in #pragma omp declare simd description (2.8.2) the restrictions say that the execution of the body can't result in execution of an OpenMP construct. Does this preclude

Code: Select all

#pragma omp declare simd
int foo (int x, int y)
{
  #pragma omp declare simd
  extern int bar (int x, int y);
  return x + bar (x, y) + y;
}
? Given that #pragma omp declare simd is just a declarative construct, there is nothing to execute. Unless the elemental function itself is considered an OpenMP construct.

Locked