Open rouson opened 6 years ago
Is the only (known) thing stopping this the lack of >2D array puts (and maybe gets?) support in opencoarrays + gcc7? There probably aren't that many places in which that is used... we could try just making them loop through 2D arrays. It wouldn't be as efficient, but at least it would run.
Yes but I think the problem is even more severe: >1D arrays don't work. Nonetheless, I can imagine a couple of workarounds that I haven't a chance to test:
Ouch, yes moving entirely to 1D arrays is not ideal... As long as all the coarray transfers are single threaded, it would be easy enough to make the actual coarrays be module variables instead of derived type components just by storing the coarray in the model that implements the derived type. It's not pretty, but it should be pretty quick and easy to implement with very little performance penalty and no major remapping of the code structure.
Sadly, even doing that might more effort than it will take to just fix opencoarrays, but I don't know how to do the latter.
I think @scrasmussen is likely to work on a fix for this so that's good news.
Here's a relevant example of pointer rank remapping:
$ cat pointer-rank-remap.f90
program main
implicit none
integer, parameter :: n=2
type foo
integer :: array2D(n,n)=reshape([0,1,2,3],[n,n])
integer, pointer :: array1D(:)=>null()
integer, pointer :: array3D(:,:,:)=>null()
end type
type(foo), target :: bar
print *,"shape(array2D), array2D: ",shape(bar%array2D)," ",bar%array2D
bar%array1D(1:size(bar%array2D)) => bar%array2D
print *,"shape(array1D), array1D: ",shape(bar%array1D)," ",bar%array1D
bar%array3D(1:size(bar%array2D,1),1:size(bar%array2D,2),1:1) => bar%array2D
print *,"shape(array3D), array3D: ",shape(bar%array3D), bar%array3D
end program
$ gfortran pointer-rank-remap.f90
$ ./a.out
shape(array2D), array2D: 2 2 0 1 2 3
shape(array1D), array1D: 4 0 1 2 3
shape(array3D), array3D: 2 2 1 0 1 2 3
rouson@localhost:~/Desktop$ gfortran --version
GNU Fortran (Homebrew GCC 7.2.0) 7.2.0
@rouson Yes, that unit tests bug we had discussed has disappeared for me so I've started working on issue #511 which will be related to this
@afanfa
@gutmann and I are thinking this is another good near-term focus.