No speedup in Fortran subroutine

General OpenMP discussion

No speedup in Fortran subroutine

Postby anand » Wed Jan 09, 2008 11:31 pm

Hi all,

I know the following is spawning 8 threads (I have 2 quad-core processors), and I've tried setting nx, ny so big that the call takes 15 seconds, but I'm not getting any speedup over the serial version. I've tried using a large, prespecified chunk size and schedule(dynamic). Is there anything wrong with the code, or is the problem elsewhere?

Code: Select all
      SUBROUTINE testomp(C,nx,ny)

      INTEGER nx,ny,i,j
      DOUBLE PRECISION C(nx,ny)
     
!$OMP PARALLEL SHARED(C,nx,ny) PRIVATE(i,j)

!$OMP DO SCHEDULE(STATIC)
        do i=1,nx
          do j=1,ny
            C(i,j) = dexp(-C(i,j)**2)
          enddo
        enddo
!$OMP END DO NOWAIT

!$OMP END PARALLEL       

      return
      END


Thanks,
Anand Patil
anand
 
Posts: 1
Joined: Wed Jan 09, 2008 11:22 pm

Re: No speedup in Fortran subroutine

Postby lfm » Tue Jan 15, 2008 9:01 am

The code looks correct at first glance, but there isn't much work. Further, the loop order is very bad for memory bandwidth, since the inner loop accesses non-contiguous elements of the C array. So, you probaby don't have enough memory bandwidth to see speedup.
lfm
 
Posts: 135
Joined: Sun Oct 21, 2007 4:58 pm
Location: OpenMP ARB


Return to Using OpenMP

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot], Yahoo [Bot] and 10 guests