Nvfortran: openacc wrong implicit reduction detection

Hello,
I am using openacc with nvfortran. In one of my loops it detects a wrong implicit reduction.
That means the compiler wants to generate an implicit reduction, that should not be there.
Is there any way to turn off implicit reductions somehow for a certain loop, so one can tell the compiler not to generate it ?!

Here is a small example:

program test
real surface(100,3)
real tensor(100,3,3)
real f(3)
integer i,j,n

surface=1.0
tensor=1.0

!$acc kernels create(f) present(default)
!$acc loop independent private(f)
do inode=1,100
forall (idim=1:3) f(idim) = sum(tensor(inode,idim,:)*surface(inode,:))
enddo
!$acc end loop
!$acc end kernels
end program test

compile option:
nvfortran -Minfo=accel -acc=gpu -gpu=cc80,nomanaged openacc_reduction.f90
compiler version 24.5

In this case it will generate an impilcit reduction on the “tensor” array
==> Generating implicit reduction(+:tensor$r)

Without the “forall” statement it does not work either (just using e.g. idim=1).
Seems that the compiler has problems with the modern fortran “sum” statement in combination with the
implicit “:” loops.

In a different loop I also found now, that is also produces a wrong implicit reduction, using the fortran function
DOT_PRODUCT(surface(inode,:),surface(inode,:))
so , those modern fortran functions seem to be a problem for the compiler

But I still wondered if one can force the compiler not to generate an implicit reduction, when it is wrongly detected (probably something to fix in the compiler as well)

Thanks, Frank

Hi Frank,

Both the SUM and DOT_PRODUCT intrinsics get inlined into the device kernel and implicit reduction is applied to allow them to be parallelized, if necessary. This is by design and correct.

Is there an issue that it’s causing?

-Mat

Thanks for the answer,
I am a bit irretated by
Generating implicit reduction(+:tensor$r)

It sounded to me, that it tries to make a reduction on the “tensor” variable itself.

Frank