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

coarray compiler does not conform to standard

hpcsoftwaremail_csi_
211 Views
See the following in the Standard:
NOTE 12.30
Each invocation of a procedure with a nonallocatable coarray dummy
argument establishes a dummy coarray for the image with its own bounds
and cobounds. During this execution of the procedure, this image may use
its own bounds and cobounds to access the coarray corresponding to the
ultimate argument on any other image. For example, consider

INTERFACE
SUBROUTINE SUB(X,N)
INTEGER :: N
REAL :: X(N,N)[N,*]
END SUBROUTINE SUB
END INTERFACE
...
REAL :: A(1000)[:]
...
CALL SUB(A,10)

During execution of this invocation of SUB, the executing image has
access through the syntax X(1,2)[3,4] to A(11) on the image with image
index 33.
-------------------------
Consider this program:
> program HelloWorld1
> implicit none
>
> interface
> subroutine sub(me,x,p)
> integer,intent(in) :: me,p
> real,intent(in) :: x[p,*]
> end subroutine sub
> end interface
>
> integer :: me0
>
>
> integer,parameter :: p=4
>
> real :: x[0:*]
> real :: y[0:1,0:*]
>
> write(*,"('image indices for y',2i5)") this_image(y)
>
> me0 = this_image(x,1)
>
> call sub(me0,x,p)
>
> end program HelloWorld1
>
> subroutine sub(me,x,p)
> integer,intent(in) :: me,p
> real,intent(in) :: x[p,*]
> integer :: i
>
> do i=1,num_images()
> if(this_image() == i) then
> write(*,"('Image index outside: ',i5,' Image index inside: ',2i16)") me, this_image(x)
> end if
> end do
> sync all
> end subroutine sub
>
> CSI-andy> !ifort
> ifort -coarray helloWorld1.F90
> helloWorld1.F90(22): error #8397: The corank of the actual argument must be the same as that of the dummy argument.
> call sub(me0,x,p)
> ---------------^
> compilation aborted for helloWorld1.F90 (code 1)
>
> If I change the interface so that x has rank one
>
> interface
> subroutine sub(me,x,p)
> integer,intent(in) :: me,p
> real,intent(in) :: x

  • > end subroutine sub
    > end interface
    >
    > Intel lets me compile, but gives the wrong values for this_image(x) in the subroutine.
  • 0 Kudos
    3 Replies
    Steven_L_Intel1
    Employee
    211 Views
    Thanks - we'll take a look at this.
    0 Kudos
    Steven_L_Intel1
    Employee
    211 Views
    The compile error was fixed in Composer XE 2011 Update 1. However, the erroneous return from THIS_IMAGE is still a problem. I have filed issue DPD200167271 for that.
    0 Kudos
    Steven_L_Intel1
    Employee
    211 Views
    The bad result error was fixed in Update 6.
    0 Kudos
    Reply