This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: gomp slowness


On 19 October 2007 02:45, tim prince wrote:

> skaller wrote:
>> On Thu, 2007-10-18 at 06:00 -0700, Tim Prince wrote:
>> 
>>> skaller wrote:
>>> 
>> 
>> 
>>> I don't know of any OpenMP compiler which would correct the nesting of
>>> parallel loops in your LU.  I have assumed that OpenMP doesn't allow
>>> such optimization; you have to get it right yourself.
>>> 
>> 
>> Can you explain? This code was taken from a *tutorial* on OpenMP:
>> 
>> http://kallipolis.com/openmp/2.html
>> 
>> 
> Did they show your version somewhere as an example of what not to do?
> In the page you referenced, they appear to have the correct loop nesting.

  Huh?

http://kallipolis.com/openmp/2.html
Or, if you are really lazy, you can download LU_mp.c.

    47:     /* Here we update A by subtracting the appropriate values from row
    48:        and column.  Note that these adjustments to A can be done in
    49:        any order */
    50: #pragma omp parallel for shared(A, row, col) 
    51:     for (i = k+1; i<SIZE; i++) {
    52:       for (j = k+1; j<SIZE; j++) {
    53:         A[i][j] = A[i][j] - row[i] * col[j];
    54:       }
    55:     }

Now instead of a parallel

http://gcc.gnu.org/ml/gcc/2007-10/msg00230.html


    /* Here we update A by subtracting the appropriate values from row
       and column.  Note that these adjustments to A can be done in
       any order */
#pragma omp parallel for shared(A, row, col)
    for (i = k+1; i<SIZE; i++) {
      for (j = k+1; j<SIZE; j++) {
	A[i][j] = A[i][j] - row[i] * col[j];
      }
    }
  }


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]