[Omp] slow performance

Jose Luis Gordillo Ruiz jlgr at super.unam.mx
Thu Dec 16 17:59:05 PST 2004


>
>
> #pragma omp parallel private (jj,kk,x, sum)
> 	  {
>
> 	      id = omp_get_thread_num();
>
> 	      for (jj=id;jj<3; jj=jj+omp_threads )
>
> ...
>
> are equivalent to "omp parallel for"
>
   but works "efficiently" only if you have 4 or less threads

> >>Also be careful with accumulating your result. The statement
> >>
> >>	pi += sum;
> >>
> >>needds an "atomic" pragma. Or better still, specify pi as "accumulate"
> >>in your omp pragma.
>
>
> Yes, I should do that. But for this testing program, I simply igonore it at
> this  moment.
>

  that pi could be another source of slow performance, because cache
  effects.


  regards,
  José Luis Gordillo
  Departamento de Supercómputo - UNAM





More information about the Omp mailing list