explain example fig.5.28 - dynamic schedule

Use this forum to discuss the book: Using OpenMP - Portable Shared Memory Parallel Programming, by Barbara Chapman, Gabriele Jost and Ruud van der Pas Read the viewtopic.php?f=8&t=465 for book info and to download the examples. Post your feedback about the book and examples to this forum

explain example fig.5.28 - dynamic schedule

Postby fjhr » Wed Mar 25, 2015 8:53 am

Hello , I am checking the example of fig 5.28 from the book.

Code: Select all
#pragma omp parallel
{
    /* preload data to be used in first iteration of the i-loop */
    #pragma omp single
    {ReadFromFile(0,...);}

    for (i=0; i<N; i++) {

    /* preload data for next iteration of the i-loop */

    #pragma omp single nowait
    {ReadFromFile(i+1...);}

    #pragma omp for schedule(dynamic)
    for (j=0; j<ProcessingNum; j++)
        ProcessChunkOfData(); /* here is the work */
   
    /* there is a barrier at the end of this loop */
   
    #pragma omp single nowait
    {WriteResultsToFile(i);}

    } /* threads immediately move on to next iteration of i-loop */
} /* one parallel region encloses all the work */


I couldn't understand how the processing of data works ( ProcessChunkOfData() ) in parallel.

First , 1 thread reads from file .
Then,we have 1 thread to read from next file and 1 thread write to next file while all the others process data.
But the writting tales place after processing the data ( ok with this).

But then, how the ProcessChunkOfData works right in parallel?It processes which data?On which file?


Can someone elaborate on this?

Thanks!
fjhr
 
Posts: 14
Joined: Thu Jul 03, 2014 12:37 am

Re: explain example fig.5.28 - dynamic schedule

Postby fjhr » Thu Apr 02, 2015 12:05 am

Hello ,

Someone about this please?

Thanks!
fjhr
 
Posts: 14
Joined: Thu Jul 03, 2014 12:37 am


Return to Using OpenMP - The Book and Examples

Who is online

Users browsing this forum: No registered users and 1 guest