OpenACC reduction for complex variables in FORTRAN

Is there any plans to provide support for OpenACC reduction on complex variables in loops? Currently if I try to parallelise a loop like this:

!$acc parallel reduction(+:total) create(i) copy(total)
!$acc loop
do i=1,10
total = total + data(i)
end do
!$acc end parallel

Where total and data declared as follows:

complex, dimension(10) :: data
complex :: total

I get these compiler errors:

[adrianj@kepler1 CASTEP-CUBLAS]$ pgf90 -acc -Minfo=accel -o test test.f90
/tmp/pgacckiObEm-bALDn.gpu(27): error: expression must have class type

/tmp/pgacckiObEm-bALDn.gpu(28): error: expression must have class type

/tmp/pgacckiObEm-bALDn.gpu(35): error: expression must have class type

/tmp/pgacckiObEm-bALDn.gpu(36): error: expression must have class type

/tmp/pgacckiObEm-bALDn.gpu(43): error: a value of type “signed char *” cannot be assigned to an entity of type “signed char”

/tmp/pgacckiObEm-bALDn.gpu(72): error: no operator “=” matches these operands
operand types are: dcmplx2 = signed char

/tmp/pgacckiObEm-bALDn.gpu(80): error: no operator “+” matches these operands
operand types are: dcmplx2 + signed char

/tmp/pgacckiObEm-bALDn.gpu(86): error: a value of type “signed char *” cannot be assigned to an entity of type “dcmplx2 *”

/tmp/pgacckiObEm-bALDn.gpu(87): error: no suitable conversion function from “dcmplx2” to “signed char” exists

/tmp/pgacckiObEm-bALDn.gpu(106): error: no operator “+” matches these operands
operand types are: dcmplx2 + dcmplx2

/tmp/pgacckiObEm-bALDn.gpu(113): error: no operator “+” matches these operands
operand types are: dcmplx2 + dcmplx2

/tmp/pgacckiObEm-bALDn.gpu(116): error: no operator “+” matches these operands
operand types are: dcmplx2 + dcmplx2

/tmp/pgacckiObEm-bALDn.gpu(119): error: no operator “+” matches these operands
operand types are: dcmplx2 + dcmplx2

/tmp/pgacckiObEm-bALDn.gpu(122): error: no operator “+” matches these operands
operand types are: dcmplx2 + dcmplx2

/tmp/pgacckiObEm-bALDn.gpu(125): error: no operator “+” matches these operands
operand types are: dcmplx2 + dcmplx2

/tmp/pgacckiObEm-bALDn.gpu(128): error: no operator “+” matches these operands
operand types are: dcmplx2 + dcmplx2

/tmp/pgacckiObEm-bALDn.gpu(129): error: no operator “+” matches these operands
operand types are: dcmplx2 + dcmplx2

17 errors detected in the compilation of “/tmp/pgnvdGjObG989VOht.nv0”.
PGF90-W-0155-Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code (test.f90: 23)
test:
23, Generating present_or_create(i)
Generating present_or_copy(total)
Accelerator kernel generated
26, !$acc loop gang ! blockidx%x
23, Generating present_or_copyin(data(:))
Generating NVIDIA code
26, Scalar last value needed after loop for ‘total’ at line 33
Accelerator restriction: scalar variable live-out from loop: total
0 inform, 1 warnings, 0 severes, 0 fatal for test

And if I try to run the produced executable it seg faults.

I can get round this by reducing the real and imaginary parts to separate real variables and combining again after the loop but this is not a very nice solution.

thanks

Is there any plans to provide support for OpenACC reduction on complex variables in loops?

I talked with our Compiler Engineering Manger about this. Support for complex reductions is currently planned for mid-2014. Apologies that it’s so far out, but it was determined to be lower in priority than other items.

  • Mat

Hi,
do you know if the use of reduction on complex data type is now possible? I read that it was expected for the 14.7 version, but I can not find any information about it in the release notes…

Best Regards,

Enrico

Hi Enrico,

It looks like this work was just completed a few weeks ago so will be in available in the 15.1 release (assuming it passes QA). It includes the case where a complex variable is used in an OpenACC reduction clause. However, the compiler will not automatically be able to recognize complex reductions.

  • Mat