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

Jakub Jelinek jakub@redhat.com
Fri Oct 14 23:08:00 GMT 2005


On Fri, Oct 14, 2005 at 02:11:47PM -0700, Richard Henderson wrote:
> 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?

Ok, will rework with HONOR_INFINITIES (TYPE_MODE (type)) then, ok?

> > 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.

So you prefer a langhook, or extend OMP_CLAUSE_REDUCTION, so that
FE would already attach both the initialization and merging code
to the clause and omplower pass would just insert that into
the stmt list and gimplify?

> > 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
> -----

Allocatables are explicitely forbidden in reduction list by the OpenMP
standard.

	Jakub



More information about the Fortran mailing list