Re: Poor performance with OpenMP



On Jan 13, 2:45 pm, gmail-unlp <ftine...@xxxxxxxxx> wrote:
Just in case: there is an openmp forum athttp://www.openmp.org/forum/
about "Using OpenMP" where you can also ask, but I'm sure many of us
here are interested too.

Thanks.


About the question: right now, I think you are partially measuring the
difference in making (plus threading/parallel processing).

     C = MATMUL(A,B)
vs.
     do j = 1,N
         C(j,:) = MATMUL(A,B(j,:))
     end do

Just to see something "interesting" you could time ex2 without -
fopenmp when compiling (it compiles, but does not use OpenMP) or run
with export OMP_NUM_THREADS=1.

Indeed. When I do as you suggest, the two programs have basically the
same runtime. The single-threaded is still faster, but only by about 1
second out of ~18.

Lesson: Parallel processing might be worse if it forces you to use a
poorer algorithm. In this instance, I guess that the for loop might
prevent the compiler from doing some optimizations, like making sure
you access memory sequentially maybe.


A side question: how are you measuring runtime?

I'm using the Unix "time" command and I'm reporting the total wall
clock time spent by the user.

Daniel.
.



Relevant Pages

  • Re: Poor performance with OpenMP
    ... about "Using OpenMP" where you can also ask, but I'm sure many of us ... fopenmp when compiling or run ... poorer algorithm. ... code that does this 3 outer over blocks, 3 inner blocks to illustrate ...
    (comp.lang.fortran)
  • Re: Poor performance with OpenMP
    ... about "Using OpenMP" where you can also ask, but I'm sure many of us ... fopenmp when compiling or run ... I think it would be very educational if someone could give us a piece of code that does this 3 outer over blocks, 3 inner blocks to illustrate the results actually using OMP. ...
    (comp.lang.fortran)
  • Re: Poor performance with OpenMP
    ... about "Using OpenMP" where you can also ask, but I'm sure many of us ... fopenmp when compiling or run ... Note that you have removed locality properties from your algorithm not only by going from mat*mat to a mat*vec, ... Note that an efficient MATMUL implementation would ...
    (comp.lang.fortran)
  • OpenMP in MATLAB under Windows
    ... Did anybody get OpenMP to work in MATLAB under Windows? ... am talking about compiling it in MATLAB environment or ... optionally MS Visual Studio (where OpenMP actually works by ...
    (comp.soft-sys.matlab)
  • Re: Parallel programming with FORALL?
    ... I just tested hello-world with OpenMP: ... program helloMP ...     use omp_lib ... (I've seen a bunch of other tutorials, but I think they are more like ...
    (comp.lang.fortran)