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


Postby mimi » Tue Apr 24, 2012 9:39 am

hello, i am trying to make one exercise where there is one 2D array and the elements of each column depend only by those from the previous column. i tried to make the elements of each column to make their calculations parallel but i dont know if this is true. here is my code

#pragma omp parallel for

can somebody tell me if its true or if their is a better way to write it?

Re: array

Postby ruud » Wed Apr 25, 2012 8:55 pm

Hi Mimi,

Could you perhaps give us some more detail?

In particular, what the code within the loop looks like. Also, since this is in C, you really want to change the order of the loops to access the array along the rows first, not the columns. This will make the code run much faster serially and also improve scalability of the parallel version. On top of that there is less overhead because it'll make the parallel for-loop the outermost loop.

Whether this can be done though depends on what is computed within the loop nest.


Re: array

Postby visio » Wed May 02, 2012 11:38 pm

you should try this. Thing that you have to change, i am writing in red color
#pragma omp parallel for
Posts: 1
Joined: Wed May 02, 2012 11:34 pm

Return to Using OpenMP - The Book and Examples

Who is online

Users browsing this forum: No registered users and 1 guest