-
-
Notifications
You must be signed in to change notification settings - Fork 55
Closed
Description
Avg response time |
---|
A future pull request will add a unit test that exposes this bug in a more complete way than the small reproducer below.
Defect/Bug Report
When compiled with GCC 6.4, 7.3, and 8.0.1, OpenCoarrays returns the incorrect shape of a coindexed variable even in single-image execution.
- OpenCoarrays Version:
2.0.0-rc1-14-g3af39fa
- Fortran Compiler: GCC 6.4.0, 7.3.0, 8.0.1
- C compiler used for building lib: GCC 6.4.0, 7.3.0, 8.0.1
- Installation method:
install.sh
- Output of
uname -a
:Linux sourcery-VirtualBox 4.13.0-16-generic #19-Ubuntu SMP Wed Oct 11 18:35:14 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
- MPI library being used: MPICH 3.2
- Machine architecture and number of physical cores: 2.7 GHz Intel Core i7, 4 cores
- Version of CMake: 3.10.0
Observed Behavior
$ cat wrong-coarray-shape.f90
program main
implicit none
type foo
logical, allocatable :: x(:,:)[:]
end type
type(foo) :: bar
allocate(bar%x(2,1)[*])
print *,shape(bar%x) , shape(bar%x(:,:)[1])
end program
$ caf wrong-coarray-shape.f90
$ cafrun -n 1 ./a.out
2 1 2 0
Expected Behavior
$ cafrun -n 1 ./a.out
2 1 2 1
Steps to Reproduce
To reproduce this problem, the shape
argument must
- Be a coarray component of a derived type variable,
- Have a rank greater than 1, and
- Have a first dimension with an extent greater than 1.
This appears to be an OpenCoarrays bug and is unrelated to the compiler's shape
intrinsic function. Any reference to a coindexed variable yields an array with incorrect extents. For example, if an array that meets the above criteria is assigned to a non-coarray allocatable array, the latter array acquires the wrong shape through automatic (re)allocation.
Activity
rouson commentedon Mar 9, 2018
@gutmann I'm tagging you so you'll get updates on this issue. Notice that this issue occurs with all versions tested, including 6.4.0. Either the error creeped in after 6.3.0 or we luckily circumvented it or we had an undetected, silent failure.
rouson commentedon May 3, 2018
@scrasmussen The send-get/alloc_comp_multidim_shape.F90 unit test provides a more comprehensive test of the feature required to close this issue.
scrasmussen commentedon May 7, 2018
Just an update on where I am, I think
shape
isn't working because there's an issue with the array indexing,get_data
inmpi_caf.c
is probably fetching the wrong memory (seems to just be slightly off). Withshape
and indexing in the following example, it worked withbar%x
but breaks withbar%x(:,:)[i]
. In the example I tried to show the three different behaviors I was getting, non-deterministic numbers returned from indexing, seg fault, and infinite printing; all which point to array indexing going out of bounds, probably off by one.@vehre were you seeing any strange array indexing behavior with your fixes?
Anyway I'll work on the indexing but wanted to give an update because this bug might pop up in other issues.
OpenCoarrays Version: 3d485ea
Fortran Compiler: GCC with
gcc-8-branch
version:8.1.1 20180507
MPI library being used: MPICH 3.3b1
Compiled and ran the following program with
zbeekman commentedon May 7, 2018
@scrasmussen are you building using OpenCoarrays from 3d485ea or from 7d6d24f ? Master will not work with GCC >= 8 (at least not until we merge Andre's PR, but we need to clean it up to work with GFortran 7.1 - 7.3 first.
scrasmussen commentedon May 8, 2018
@zbeekman yeah sorry about the misleading info, I'm using the 3d485ea commit, I just put the wrong one in my previous message
rouson commentedon Jun 5, 2018
This [alloc_comp_multidim_shape] test now passes with a patched GCC 8.1.0. Wow! Great work, @scrasmussen. I'm closing this issue.
@gutmann This fixes one issue that was blocking Coarray ICAR, but my tests with a patched GCC 8.1.0 lead to a runtime error in the OpenCoarrays
send_by_ref
function so we should attempt to isolate the remaining issue. I'll tag you when I reopen a related issue that I just closed. There have been a number of improvements tosend_by_ref
lately so hopefully the issue is not too difficult to find and fix.17 remaining items