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

Coarray Confusion

IanH
Honored Contributor III
493 Views

From a thread on c.l.f., two coarray related oddities.  As should be painfully evident from the thread, I am never really sure which end of a coarray is supposed to be pointing up, so take this all with a grain of salt.

I expect the following to show the value of the component taken from image two (i.e. 66), assuming the coindexed polymorphic object is permitted.

  program main
    implicit none
    type foo
      integer :: bar = 99
    end type
    class(foo), allocatable :: foobar[:]
    class(foo), allocatable :: some_local_object
    allocate(foo::foobar
  • ) if (this_image()==2) foobar%bar=66 sync all if (this_image()==1) then allocate(some_local_object, source=foobar[2]) print *,"some_local_object%bar = ", & some_local_object%bar end if end program
  •  

    >ifort /check:all /warn:all /standard-semantics /Qcoarray "2015-09-04 poly-coarray.f90" && "2015-09-04 poly-coarray.exe"
    
    Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0 Build 20150815
    Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.
    
    Microsoft (R) Incremental Linker Version 10.00.40219.01
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    "-out:2015-09-04 poly-coarray.exe"
    -subsystem:console
    "2015-09-04 poly-coarray.obj"
     some_local_object%bar =  99

     

    This example gives an ice due to the sourced allocation statement on line ~31.

    program p3
      implicit none
      
      type, abstract :: r
      end type r
      
      type, extends(r) :: ra
        integer :: icomp
      end type ra
      
      type r_collection
        class(r), allocatable :: item
      end type r_collection
      
      type :: out_type
        type(ra) :: a
      end type out_type
      
      type(out_type) :: out
  • integer :: image ! Image index out%a = ra(1) sync all if (this_image() == 1) then block type (r_collection) :: results(num_images()) do image = 1, num_images() allocate(results(image)%item, source=out[image]%a) end do end block end if end program p3
  •  

    >ifort /check:all /warn:all /standard-semantics /Qcoarray "2015-09-04 poly-coarray3.f90" && "2015-09-04 poly-coarray3.ex
    e"
    Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0 Build 20150815
    Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.
    
    fortcom: Fatal: There has been an internal compiler error (C0000005).
    compilation aborted for 2015-09-04 poly-coarray3.f90 (code 1)

     

    0 Kudos
    1 Reply
    Kevin_D_Intel
    Employee
    493 Views

    Thank you for the simplified reproducers. I do not know if the coindexed polymorphic object is permitted but I submitted both these to Development and will let you know what I hear back.

    (Internal tracking id: DPD200375999 - Internal compiler error for coarray sourced allocation)
    (Internal tracking id: DPD200376001 - Unexpected result for coindexed polymorphic object with sourced allocation)

    0 Kudos
    Reply