Where is the mistake?

General OpenMP discussion

Where is the mistake?

Postby Dadits » Fri Jul 25, 2008 11:38 pm

Hi guys,

I'm having a code that should compute LU decomposition. I observed that the calculation of U cannot be parallelized but for L we can have some paralelization there..The problem is the the code paralelized takes longer than the code executed without paralelization!!! Where am i wrong? Thank you

SUBROUTINE decLU(A,n,nmax)
integer n,i,j,k,nmax,CHUNK,TID
parameter(chunk=10)
real A(nmax,nmax)
real sumP(n),sum


do j=1,n
do i=1,j
sum=A(i,j)
do k=1,i-1
sum=sum-A(i,k)*A(k,j)
enddo
A(i,j)=sum
enddo
!$OMP PARALLEL SHARED(sumP,A) PRIVATE(i)
!$OMP DO SCHEDULE(DYNAMIC,CHUNK)
do i=j+1,n
sumP(i)=A(i,j)
do k=1,j-1
sumP(i)=sumP(i)-A(i,k)*A(k,j)
enddo
A(i,j)=sumP(i)/A(j,j)

enddo
!$OMP END DO NOWAIT
!$OMP END PARALLEL
enddo

return
END
Dadits
 

Re: Where is the mistake?

Postby ejd » Wed Aug 13, 2008 11:12 pm

It would be nice to know more about what you are trying to do. Hardware? Compiler? Size of arrays (values of n and nmax)? Without more information it is hard to tell what is going on.

Just because something can be parallelized doesn't mean that it should be. You may have done nothing wrong other than trying to parallelize a loop that shouldn't be parallelized.
ejd
 
Posts: 1025
Joined: Wed Jan 16, 2008 7:21 am


Return to Using OpenMP

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 5 guests

cron