[gomp] Handle array reductions plus various fortran reduction handling fixes

Richard Henderson rth@redhat.com
Fri Oct 14 21:23:00 GMT 2005


On Fri, Oct 14, 2005 at 04:53:21PM -0400, Jakub Jelinek wrote:
> I actually coded there real_max (...) first.  But Inf is bigger than
> FLT_MAX, so it wouldn't actually print the right result if
> all threads set the inner x to Inf.

I suppose.  I'm also thinking of -ffast-math things, for which
+inf would trap on alpha, but flt_max wouldn't.  Perhaps we do
different things based on -ffinite-math-only?

> I believe all arrays Fortran FE creates are one-dimensional.

This is a known bug in the fortran front end, which affects 
debugging among other things.  At some point I assume it'll
be fixed.  Likewise with the min element always being zero
instead of matching the source dimensions.

> As you can only put variable names into the reduction list, not
> say a(5:7), I can't think of a way how you could get something that
> wouldn't be a one-dimensional array

Can you do it with allocatables?

-----
  real, allocatable :: a(:,:,:)
  allocate (a(5,5,5))
!$ omp sections reduction(+:a)
!$ omp end sections
  deallocate(a)
  end
-----

> (though I hope C/C++ FEs reject arrays in reduction clause ...

I don't yet, but certainly I should.


r~



More information about the Fortran mailing list