[Omp] A speed test in small memory

Eugene Loh Eugene.Loh at Sun.COM
Wed Apr 4 14:58:48 PDT 2007


Brad Bell wrote:

> In order to determine how much speed up is possible with OpenMP,

"The sky's the limit."  "Your mileage may vary."

> I created a test case that uses very little memory. It appears that 
> the improvement, with increasing the number of processors, drops off 
> when there are more than four processors (see the results below). Is 
> this to be expected from OpenMP in general, or is there a way to get 
> continued improvement with more than four processors (perhaps using a 
> different system or different algorithm) ?

Better should be possible.

I'm much more comfortable with Fortran than C++.  Here's my Fortran version:

  call sub( 1)
  call sub( 2)
  call sub( 4)
  call sub( 8)
  call sub(12)
  call sub(16)
  call sub(24)
  call sub(32)
  call sub(40)
end



subroutine sub(nthr)
  use omp_lib
  real(8) total, t, t1
  save t1

  total = 0
  t = omp_get_wtime()
  do j = 1, 10
    !$omp parallel do reduction(+:total) num_threads(nthr)
    do i = 1, 40 * 1000000
      total = total + 1.d0 / i
    end do
  end do
  t = omp_get_wtime() - t

  if ( nthr == 1 ) t1 = t
  write(6,'(f15.8,i4,f8.1)') total, nthr, t1 / t

end

Then, I run with

% f90 -fast -xopenmp a.f90
% ./a.out
   180.81605689   1     1.0
   180.81605689   2     2.0
   180.81605689   4     4.0
   180.81605689   8     8.0
   180.81605689  12    11.8
   180.81605689  16    15.4
   180.81605689  24    22.8
   180.81605689  32    29.7
   180.81605689  40    35.7

This is with Sun Studio compilers and a Sun F6900 server (48-way).  
Scalability is 36x at 40 threads.


More information about the Omp mailing list