Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

Derived type with coarray component

$
0
0

Dear all, 

I am facing with a SIGSEGV that is "terrible" because I cannot reproduce always, sometimes occurs sometimes not and in any case the results are not as expected even when the SIGSEGV occurs. 

In the following there is the complete test that I am playing with 

module classes
  implicit none
  private
  public :: wrapped_coarray

  type :: wrapped_point
    integer, allocatable :: point(:)
    contains
      procedure :: add => wrapped_point_add
  end type wrapped_point

  type :: wrapped_coarray
    type(wrapped_point), allocatable :: caf(:)[:]
  end type wrapped_coarray

  contains

    subroutine wrapped_point_add(self, to_add)
      class(wrapped_point), intent(inout) :: self
      integer,              intent(in)    :: to_add
      integer, allocatable                :: point(:)
      integer                             :: points_number

      if (allocated(self%point)) then
        points_number = size(self%point, dim=1)
        allocate(point(1:points_number+1))
        point(1:points_number) = self%point
        point(points_number+1) = to_add
        call move_alloc(from=point, to=self%point)
      else
        allocate(self%point(1))
        point(1) = to_add
      end if
    end subroutine wrapped_point_add
end module classes

program test
  use classes
  implicit none

  type(wrapped_coarray) :: foo
  allocate(foo%caf(99)[*])
  call foo%caf(32)%add(this_image())
  print*, foo%caf(32)%point
end program test

Essentially, I have a "wrapped" coarray member, namely "caf", that is, in turn, a wrapper of an allocatable integer array, namely "point". 

The very kind Michael Siehl has already pointed me to a good paper of Aleksandar Donev, see http://caf.rice.edu/documentation/Aleksandar-Donev-Coarray-Rationale-N17... 

To my understanding the above test should be conforming: 

1. "foo" is a scalar non allocatable; 
2. the "caf" member is allocated, thus an implicit synchronization should happen; by the way, adding an explicit "sync all" after the allocation does not produce any changes. 

Currently, I am sticking on only Intel Fortran 17.0.1. 

I compile the test with 

ifort -coarray -debug -check -warn -traceback -standard-semantics test.f90 

To speedup my test, I on-the-fly modify my shell envs with: 

export FOR_COARRAY_NUM_IMAGES=2 

The SIGSEV (when occurs), generates the following output 

---log 
a.out 
forrtl: severe (174): SIGSEGV, segmentation fault occurred 
In coarray image 1 
Image              PC                Routine            Line        Source 
a.out              000000000047ECB1  Unknown               Unknown  Unknown 
a.out              000000000047CDEB  Unknown               Unknown  Unknown 
a.out              000000000042DCF4  Unknown               Unknown  Unknown 
a.out              000000000042DB06  Unknown               Unknown  Unknown 
a.out              0000000000407359  Unknown               Unknown  Unknown 
a.out              000000000040A926  Unknown               Unknown  Unknown 
libpthread-2.24.s  00002B073ED40080  Unknown               Unknown  Unknown 
a.out              00000000004051AB  MAIN__                     43  test.f90 
a.out              0000000000403D2E  Unknown               Unknown  Unknown 
libc-2.24.so       00002B073F170291  __libc_start_main     Unknown  Unknown 
a.out              0000000000403C2A  Unknown               Unknown  Unknown 

application called MPI_Abort(comm=0x84000004, 3) - process 0 
forrtl: severe (174): SIGSEGV, segmentation fault occurred 
In coarray image 2 
Image              PC                Routine            Line        Source 
a.out              000000000047ECB1  Unknown               Unknown  Unknown 
a.out              000000000047CDEB  Unknown               Unknown  Unknown 
a.out              000000000042DCF4  Unknown               Unknown  Unknown 
a.out              000000000042DB06  Unknown               Unknown  Unknown 
a.out              0000000000407359  Unknown               Unknown  Unknown 
a.out              000000000040A926  Unknown               Unknown  Unknown 
libpthread-2.24.s  00002B9DA38EC080  Unknown               Unknown  Unknown 
a.out              00000000004051AB  MAIN__                     43  test.f90 
a.out              0000000000403D2E  Unknown               Unknown  Unknown 
libc-2.24.so       00002B9DA3D1C291  __libc_start_main     Unknown  Unknown 
a.out              0000000000403C2A  Unknown               Unknown  Unknown 

application called MPI_Abort(comm=0x84000002, 3) - process 1 
---end log 

When the SIGSEV does not occur no output is produced, namely the line 44 is not executed (I think). The SIGSEV occurs un the calling of "add" procedure, even if the procedure does not contain nothing (all commented). 

Can you tell me: 
1. is the test standard conforming? 
2. if it is, does Intel v 17.0.1 support such a coarray components? 

Thank you in advance for any help! 

My best regards. 

Zone: 

Thread Topic: 

Question

Viewing all articles
Browse latest Browse all 2583

Trending Articles



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