Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Coarray Confusion

$
0
0

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)

 


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>