Nesting restriction

Forum for the public review of the OpenMP 4.0 API Release Candidates. (Read Only)
Forum rules
This forum is now closed.

Nesting restriction

Postby jakub » Tue Apr 30, 2013 4:50 am

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

Postby jakub » Tue Apr 30, 2013 7:56 am

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.
jakub
 
Posts: 74
Joined: Fri Oct 26, 2007 3:19 am


Return to OpenMP 4.0 Public Review Release Candidates

Who is online

Users browsing this forum: No registered users and 2 guests

cron