Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26758 Discussions

Unexpected coarray behavior with array section

Jerry_Greenough
Beginner
137 Views

I have a coarray of local size 5 (called AXC) and I am updating the object in the local memory of image #1 in two different ways (primarily to test my understanding ..or otherwise .. of coarrays). Firstly I do an array section update without explicitly referring to the coarray index 1

AXC(2:4)  = AXC(1:3)[2]

and subsequently I do an array section update by using the square brackets with co-index 1.

AXC(2:4)[1]  = AXC(1:3)[2]

In the latter case the local array in image #1 is updated with unexpected values. Ignoring efficiency issues, shouldn't the snippets above produce the same result when executed in image 1 ? Here's the entire code. I'm using Parallel Studio XE 2017 Update 5 Version 17.0.0053.14​.

PROGRAM ArraySectionTest

IMPLICIT NONE

REAL AXC(5)
  • REAL AA(5) AXC(1:5) = REAL(THIS_IMAGE()) SYNC ALL IF(THIS_IMAGE()==1) THEN AXC(2:4) = AXC(1:3)[2] AA = AXC(1:5)[1] END IF ! AA contains [1, 2, 2, 2, 1] which is what was expected. IF(THIS_IMAGE()==1) THEN WRITE(*,*) AA END IF IF(THIS_IMAGE()==1) THEN AXC(2:4)[1] = AXC(1:3)[2] AA = AXC(1:5)[1] END IF ! AA contains [1, 2, *, *, 1] where * is an unusual number. IF(THIS_IMAGE()==1) THEN WRITE(*,*) AA END IF END PROGRAM ArraySectionTest
  •  

     

     

     

     

     

     

     

     

    0 Kudos
    5 Replies
    Steve_Lionel
    Black Belt Retired Employee
    137 Views

    I tried your program with 18.0.1 and got the correct (and same) answers in both WRITEs. I know that in the past Intel Fortran's treatment of "same image" coindexed variables wasn't quite right in that they didn't always match the local variables, but maybe that has been fixed.

    Jerry_Greenough
    Beginner
    137 Views

    Many thanks for taking a look. I'll upgrade to v18 to see if it helps.

    Steve Lionel (Ret.) wrote:

    I tried your program with 18.0.1 and got the correct (and same) answers in both WRITEs. I know that in the past Intel Fortran's treatment of "same image" coindexed variables wasn't quite right in that they didn't always match the local variables, but maybe that has been fixed.

    Jerry_Greenough
    Beginner
    137 Views

    Unfortunately the upgrade to 18.0.1.156 did not address the problem. 

    I also upgraded the Intel MPI stuff to Intel(R) MPI Library for Windows* OS, Version 2018 Update 1 Build 20171011.

    One more observation: if I use the following instead of the array section then I could get [1, 2, 2, 2, 1] as expected.

    IF(THIS_IMAGE()==1) THEN  
        !AXC(2:4)[1]  = AXC(1:3)[2]
        AXC(2)[1]  = AXC(1)[2]
        AXC(3)[1]  = AXC(2)[2]
        AXC(4)[1]  = AXC(3)[2]
        AA = AXC(1:5)[1] 
    END IF
    Steve_Lionel
    Black Belt Retired Employee
    137 Views

    I suggest then that you submit a report through the Intel Online Service Center. I could not reproduce the problem.

    Jerry_Greenough
    Beginner
    137 Views

    This has now been fixed in Version 2018 Update 2. Thanks to all concerned.

    Reply