[Users] OpenMP is making it slower?

Scott Hawley scott.hawley at belmont.edu
Tue May 17 12:00:40 CDT 2011


No doubt someone will ask for the code itself.  The relevant part is given below.  ( In old-school Fortran77)
Specifically, the 'problem' I'm noticing is that the "% done" messages appear with less frequency and with lesser increment per wall clock time with OMP_NUM_THREADS > 1 than for OMP_NUM_THREADS = 1.       The cpus get used alot more --- 'top' shows up to 2000% cpu usage for 24 threads --- but the wallclock time doesn't decrease at all.

Also note that whether I use the long OMP directive shown (with the 'shared' declarations and schedule, etc) and the 'END PARALLEL DO' at the end,  or if I just use a simple '!$OMP PARALLEL DO' and *nothing else*,   the execution time is *identical*.

Thanks again!
-Scott

                     chunk = 8
         do k = 1, nz 
            write(msg,*)'[1F      setbkgrnd:   ' //
     &              'nz = ',nz,',   % done = ',int(k*1.0d2/nz),'  '
            call writemessage(msg)
       
!$OMP PARALLEL DO SHARED(mask,agxx,agxy,agxz,agyy,agyz,agzz,
!$OMP&   aKxx,aKxy,aKxz,aKyy,aKyz,aKzz,ax,ay,az), 
!$OMP& SCHEDULE(STATIC,chunk) PRIVATE(j) 
            do j = 1, ny
               do i = 1, nx

c                 if (ltrace) then 
c                     write(msg,*) '---------------'
c                     call writemessage(msg)
c                 endif
                 
                  if (mask(i,j,k) .ne. m_ex .and.
     &                (ibonly .eq. 0 .or. 
     &                 mask(i,j,k) .eq. m_ib)) then

                   x = ax(i)
                   y = ay(j)
                   z = az(k)

c the following two include files just perform many pointwise calc's
                   include 'gd.inc'
                   include 'kd.inc'

                     agxx(i,j,k) = gxx
                     agxy(i,j,k) = gxy
                     agxz(i,j,k) = gxz
                     agyy(i,j,k) = gyy
                     agyz(i,j,k) = gyz
                     agzz(i,j,k) = gzz
            
                     aKxx(i,j,k) = Kxx
                     aKxy(i,j,k) = Kxy
                     aKxz(i,j,k) = Kxz
                     aKyy(i,j,k) = Kyy
                     aKyz(i,j,k) = Kyz
                     aKzz(i,j,k) = Kzz


                 else if (mask(i,j,k) .eq. m_ex) then
c                   Excised points
                     agxx(i,j,k) = exval
                     agxy(i,j,k) = exval
                     agxz(i,j,k) = exval
                     agyy(i,j,k) = exval
                     agyz(i,j,k) = exval
                     agzz(i,j,k) = exval
   
                     aKxx(i,j,k) = exval
                     aKxy(i,j,k) = exval
                     aKxz(i,j,k) = exval
                     aKyy(i,j,k) = exval
                     aKyz(i,j,k) = exval
                     aKzz(i,j,k) = exval
                 endif

               enddo
            enddo
!$OMP END PARALLEL DO 
         enddo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.einsteintoolkit.org/pipermail/users/attachments/20110517/5bfaff6e/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 535 bytes
Desc: This is a digitally signed message part
Url : http://lists.einsteintoolkit.org/pipermail/users/attachments/20110517/5bfaff6e/attachment.bin 


More information about the Users mailing list