[Openmp-dev] KMP Work sharing for dynamic loop

Alexandre Eichenberger alexe at us.ibm.com
Mon May 12 12:46:05 PDT 2014



I have a question with respect to the code pattern generated for dynamic
loops by Clang. Given this input program:

   #pragma omp for schedule(dynamic, 2)
   for(int i=0; i<16; i++)
     // code a

the code pattern seems to be:

   // init
   kmpc_dispatch_ini(..., schedule=dyn, lb=0, ub=15, step=1, chunk=2);

   // work
   while (kmpc_dispatch_next( ..., &last, &lb, &ub, &stride)) { // next
     for(int j=lb, j<ub; j++) {
       // code a
     }
     kmpc_dispatch_fini(...);
   }

   // barrier
   kmpc_cancel_barrier(...)

Namely, there seems to be one "fini" call for each "next" call. I assumed
initially only one "fini" before the barrier to indicate the end of all
chunks of work... but this does not appear to be the case.

Also, the stride passed back by "next" does not seems to be used.

And Clang appears to generate only normalized loop (i.e. lb = 0 and
increment = 1)...

Could you please confirm that my current understanding is correct?

Thanks

Alexandre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20140512/b0ace7db/attachment.html>


More information about the Openmp-dev mailing list