Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28457 Discussions

Reduction routines in Intel Fortran 2020 beta do not work for real coarrays

Arjen_Markus
Honored Contributor I
235 Views

Hello,

while experimenting with the reduction routines in Intel Fortran 2020 beta I ran into a problem with real coarrays. For integer coarrays it works fine (unless you leave out the target image - that results in an error about image 0). For real coarrays the result is simply the value on the target image it seems. Here is my sample program:

! chk_coarrays_reduction.f90 --
!     Check: does the compiler support reduction operations with coarrays
!
program chk_coarrays_reduction
    implicit none

    real, dimension(10), codimension
  • :: rvalue integer, dimension(10), codimension
  • :: value integer :: i if ( this_image() == 1 ) then write( *, '(a)' ) 'Using co-reduction routines for integer values: ' endif ! ! Fill the integer coarray ! value = [ (this_image() * i, i = 1,size(value)) ] sync all call co_sum( value(1), 1 ) if ( this_image() == 1 ) then write( *, '(a,10i5)' ) 'Cosum: ', value(1) endif call co_max( value(2), 1 ) if ( this_image() == 1 ) then write( *, '(a,10i5)' ) 'Comax: ', value(2) endif call co_min( value(3), 1 ) if ( this_image() == 1 ) then write( *, '(a,10i5)' ) 'Comin: ', value(3) endif ! ! Fill the real coarray ! rvalue = [ (this_image() * 0.1, i = 1,size(value)) ] sync all if ( this_image() == 1 ) then write( *, '(a)' ) 'Using co-reduction routines for real values: ' endif call co_sum( rvalue(1), 1 ) if ( this_image() == 1 ) then write( *, '(a,f10.5)' ) 'Cosum: ', rvalue(1) endif call co_max( rvalue(2), 1 ) if ( this_image() == 1 ) then write( *, '(a,f10.5)' ) 'Comax: ', rvalue(2) endif call co_min( rvalue(3), 1 ) if ( this_image() == 1 ) then write( *, '(a,f10.5)' ) 'Comin: ', rvalue(3) endif end program chk_coarrays_reduction
  • And here is the output I got:

    Using co-reduction routines for integer values: 
    Cosum:    36
    Comax:    16
    Comin:     3
    Using co-reduction routines for real values: 
    Cosum:    0.10000
    Comax:    0.10000
    Comin:    0.10000
    

    As you can see all real values are the same, whereas you would expect 3.6, 0.8 and 0.1. The integer values are conform the expectation.

    0 Kudos
    0 Replies
    Reply