Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
41 Views

wrong broadcast behavior in derived coarray object

Here is the code:

program main
	implicit none
	type gfs
		integer :: i
		integer :: Gc(1,1)
	end type
	integer :: ica
	type(gfs) :: self
  • self%Gc=this_image() sync all if(this_image()==1) then do ica=2,num_images() self[ica]%Gc=self%Gc enddo endif sync all write(*,*)this_image(),"->Gc",self%Gc(1,1) end program
  • compiled with Intel(R) 64, Version 18.0.1.163 Build 20171018 and run for example with four coarray images gives results like:

               1 ->Gc           1
               3 ->Gc           3
               4 ->Gc           4
               2 ->Gc           2
    

    But what I expect is:

               1 ->Gc           1
               3 ->Gc           1
               4 ->Gc           1
               2 ->Gc           1
    

    remove integer :: i in derived type or broadcast element by element (i.e. change to self[ica]%Gc(1,1)=self%Gc(1,1)) seems solve the problem. Any idea about this?

    BTW, this there any performance cost to broadcast element by element for large array?

    0 Kudos
    6 Replies
    Highlighted
    Valued Contributor III
    41 Views

    Looks like another bug in the

    Looks like another bug in the compiler, a pernicious one since it involves erroneous run-time result.  Report this at Intel OSC if you can.

    0 Kudos
    Highlighted
    Valued Contributor III
    41 Views

    Quote:Zuodong Y. wrote:

    Zuodong Y. wrote:

    .. BTW, this there any performance cost to broadcast element by element for large array?

    I'm not sure how one can reliably measure performance under the circumstances.

    If the whole array is to be broadcast, I think the intrinsic CO_BROADCAST will be as good as it gets for a given processor in terms of performance.  It will add to better readability of the code as well:

       integer, save :: a(3)
  • integer :: i character(len=*), parameter :: fmtg = "(g0,t15,g0)" if ( this_image() == 1 ) then a = [ 1, 2, 3 ] else a = 0 end if sync all call co_broadcast( a, source_image=1 ) if ( this_image() == 1 ) then print fmtg, "Image #", "a(1)" do i = 1, num_images() print fmtg, i, a(1) end do end if end
  • C:\Temp>ifort /standard-semantics /warn:all /stand:f18 /Qcoarray:shared /Qcoarray-num-images=8 p.f90
    Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.1.216 Build 20200306
    Copyright (C) 1985-2020 Intel Corporation.  All rights reserved.
    
    Microsoft (R) Incremental Linker Version 14.25.28612.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    -out:p.exe
    -subsystem:console
    p.obj
    
    C:\Temp>p.exe
    Image #       a(1)
    1             1
    2             1
    3             1
    4             1
    5             1
    6             1
    7             1
    8             1
    
    C:\Temp>

     

    0 Kudos
    Highlighted
    Beginner
    41 Views

    Thanks for comment. I believe

    Thanks for comment. I believe CO_BROADCAST feature only available in ifort 19.1 and I remember have other issue to move to new version of ifort.

    FortranFan wrote:

    Quote:

    Zuodong Y. wrote:

     

    .. BTW, this there any performance cost to broadcast element by element for large array?

     

     

    I'm not sure how one can reliably measure performance under the circumstances.

    If the whole array is to be broadcast, I think the intrinsic CO_BROADCAST will be as good as it gets for a given processor in terms of performance.  It will add to better readability of the code as well:

       integer, save :: a(3)
  • integer :: i character(len=*), parameter :: fmtg = "(g0,t15,g0)" if ( this_image() == 1 ) then a = [ 1, 2, 3 ] else a = 0 end if sync all call co_broadcast( a, source_image=1 ) if ( this_image() == 1 ) then print fmtg, "Image #", "a(1)" do i = 1, num_images() print fmtg, i, a(1) end do end if end
  • C:\Temp>ifort /standard-semantics /warn:all /stand:f18 /Qcoarray:shared /Qcoarray-num-images=8 p.f90
    Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.1.216 Build 20200306
    Copyright (C) 1985-2020 Intel Corporation.  All rights reserved.
    
    Microsoft (R) Incremental Linker Version 14.25.28612.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    -out:p.exe
    -subsystem:console
    p.obj
    
    C:\Temp>p.exe
    Image #       a(1)
    1             1
    2             1
    3             1
    4             1
    5             1
    6             1
    7             1
    8             1
    
    C:\Temp>

     

    0 Kudos
    Highlighted
    Moderator
    41 Views

    I filed a bug (moth) report

    I filed a bug (moth) report for the original posting, CMPLRIL0-32769. 

    0 Kudos
    Beginner
    41 Views

    Thanks for helping me file

    Thanks for helping me file the bug (moth).

    Barbara P (Intel) wrote:

    I filed a bug (moth) report for the original posting, CMPLRIL0-32769. 

    0 Kudos
    Highlighted
    Moderator
    25 Views

    Re:wrong broadcast behavior in derived coarray object

    This problem is fixed in PSXE 2020 update 2 (Fortran 19.1.2) that was released last week. Please check it out!



    0 Kudos