Multithreading Big loop containing several loops inside

jimdempseyatthecove
Total Points:
34,867
Status Points:
34,867
Black Belt
October 9, 2008 6:23 AM PDT
Rate
 
#6 Reply to #4


>>I added the commands and i see that all processors are working but the program is much slower. How can i detect bootlenick.

This is symptomatic of the inner OpenMP do loop running serially. Place the "!$OMP DO ..." (or "C$OMP DO ..." at the left margine.

Should this not improve matters then try

!$omp parallel do private(i,j)
do i=nx1+1,nx2-2
do j=ny1+2,ny2-2

     “stuff1”
enddo
enddo
!$omp end parallel do

 

!$omp parallel do private(i,j)
do i=nx1+2,nx2-2
do j=ny1+1,ny2-2

     “stuff2”
enddo
enddo
!$omp end parallel do

Note, the above is not inside an !$OMP PARALLEL region

The purpose of coding the first way was to permit the threads finishing the STUFF1 loop first to begin processing the STUFF2 loop prior to the remaining threads working on STUFF1 loop finishing.

If this too does not improve the performance then the code in STUFF1 and STUFF2 are likely memory copy statements as opposed to computational statements.

Jim Dempsey



Intel Software Network Forums Statistics

8290 users have contributed to 31237 threads and 99114 posts to date.
In the past 24 hours, we have 8 new thread(s) 19 new posts(s), and 25 new user(s).

In the past 3 days, the most popular thread for everyone has been comparison cilk++, openmp, pthreads first results The most posts were made to Pipeline buffer between stages? The post with the most views is Very amusing...  Escalated as

Please welcome our newest member zq.x