Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: support nested allocatable derived-type array components inside derived-type coarrays #700

Closed
rouson opened this issue Feb 11, 2020 · 2 comments · Fixed by #714
Closed
Assignees

Comments

@rouson
Copy link
Member

rouson commented Feb 11, 2020

The transcript below demonstrates the runtime error message that the OpenCoarrays function libcaf_mpi::caf_get_by_ref() produces in a simple scenario wherein a derived-type coarray has an allocatable, derived-type array component. A cumbersome workaround is to flatten such coarray data structures so that the components of derived type coarrays are intrinsic types. Even with this workaround, a source allocation will fail. A workaround for the lack of source allocation is to use mold allocation followed by element-by-element copying of the component array.

The following are the results of compiling the code below with the gfortran versions cited in bold:

  • 8.3.0: the final allocation generates the runtime error message below.
  • 9.2.0: the allocation completes without error but the subsequent component access generates a segmentation fault - invalid memory reference.
  • 10.0.0: same as 8.3.0.
$ cat opencoarrays-missing-feature.f90 
  implicit none

  type package
    integer, allocatable :: surface_fluxes(:)
  end type

  type outbox
    type(package), allocatable :: block_surfaces(:)
  end type

  type(outbox), save :: halo[*]

  integer, parameter :: source_image = 1
  integer, parameter :: message(1)=[99]

  if (this_image() == source_image) then
    allocate(halo%block_surfaces(1))
    allocate(halo%block_surfaces(1)%surface_fluxes, source = message)
  end if

  sync all

  if (this_image() /= source_image) then
    allocate(halo%block_surfaces(1))
    allocate(halo%block_surfaces(1)%surface_fluxes, mold = halo[source_image]%block_surfaces(1)%surface_fluxes)
    halo%block_surfaces(1)%surface_fluxes(1) = halo[source_image]%block_surfaces(1)%surface_fluxes(1)
  end if

end
$ caf opencoarrays-missing-feature.f90 

$ cafrun -n 2 ./a.out
Fortran runtime error on image 2: libcaf_mpi::caf_get_by_ref(): two or more array part references are not supported.

Error: Command:
   `/usr/local/Cellar/mpich-3.2-gnu-8.3.0/bin/mpiexec -n 2 ./a.out`
failed to run.
@rouson
Copy link
Member Author

rouson commented Feb 11, 2020

Adding a link to the 76-line example that motivated this issue. It seg faults without producing the useful error message above, but captures more detail from the relevant class hierarchy in the ultimate application (Morfeus).

@rouson
Copy link
Member Author

rouson commented Feb 11, 2020

@neok-m4700 I'm adding the "help wanted" label to this issue. Thanks for your great contribution to fixing issue #511. The example in this issue is one step closer to what we want to do and the link to the 76-line example in my earlier comment is even closer to what the full application does. If you have any interest in looking this, let us know. As it stands, any OpenCoarrays contributor is at least several weeks away from working on it so any community contributions are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants