for simd/do simd constructs

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

for simd/do simd constructs

Postby jakub » Tue Apr 16, 2013 1:29 am

Shouldn't #pragma omp for simd be listed as a worksharing construct, so that the various restrictions etc. relevant to worksharing constructs?
On page 7 it only lists for, sections and single for C/C++ and do, sections, single and workshare for Fortran. E.g. the #pragma omp parallel for description clearly documents that it behaves pretty much as
#pragma omp parallel with #pragma omp for closely nested in it, but #pragma omp for simd isn't described similarly, given that it actually isn't a straightforward equivalent of #pragma omp for with #pragma omp simd inside of it.
E.g. in the description of firstprivate clause, it is required that the original list item in worksharing constructs must not be private in outer parallel. That makes sense for worksharing regions, makes sense for omp for simd, but doesn't make sense for omp simd. Or say in section 2.16, where worksharing regions are disallowed from being closely nested in whole bunch of regions, while plain simd regions likely are.

Also, what exactly means chunk-size on schedule clause of #pragma omp for simd? Is the chunk-size still measured in loop iterations (so e.g. if it is odd, we'd need to use scalar iterations), or is it measured in (implementation-defined) simd chunks instead?
Code: Select all
#pragma omp for simd schedule(static, 5) safelen(4)
for (i = 0; i < 100; i++)
  body;

Assuming the body can be vectorized with 4 iterations in simd chunk, does the above mean that the first thread should be assigned 5 simd-chunks (20 iterations), second thread again 20 iterations etc., or just not vectorize, and if schedule(static, 4)
would be used instead, that the first thread would be given the first 4 iterations (one simd-chunk), the second thread next 4 iterations, etc.?
jakub
 
Posts: 74
Joined: Fri Oct 26, 2007 3:19 am

Re: for simd/do simd constructs

Postby aduran » Thu Apr 18, 2013 12:45 pm

jakub wrote:Shouldn't #pragma omp for simd be listed as a worksharing construct, so that the various restrictions etc. relevant to worksharing constructs?


The loop simd construct inherits all the restrictions of the loop construct so it's not necessary to list it there.

jakub wrote:Assuming the body can be vectorized with 4 iterations in simd chunk, does the above mean that the first thread should be assigned 5 simd-chunks (20 iterations), second thread again 20 iterations etc., or just not vectorize, and if schedule(static, 4)
would be used instead, that the first thread would be given the first 4 iterations (one simd-chunk), the second thread next 4 iterations, etc.?


The chunksize is in terms of simd chunks.
aduran
 
Posts: 12
Joined: Wed Oct 24, 2007 8:33 am
Location: Barcelona, Spain


Return to OpenMP 4.0 Public Review Release Candidates

Who is online

Users browsing this forum: No registered users and 2 guests