[Patch] Fortran: invoke.texi - link to OpenCoarrays.org + mention libcaf_single
I noticed that gfortran's coarray support did not link to the http://www.opencoarrays.org/ As that library is needed to support parallelization, it makes sense to have the link. Motivated by someone claiming at ISC-HPC that GCC only supports a single image. And also motivated by Damian's presentation, which showed that gfortran's coarrays could successfully run the ICAR atmospheric model with 25,600 processes (OpenCoarrays with OpenSHMEM backend), which definitely is more than one image :-) I think mentioning the existing libcaf_single is still useful, even though it is only of limited use (except that it does ship with GCC and permits to do some testings. Especially, it is used by GCC's testsuite). OK for mainline? Tobias Fortran: invoke.texi - link to OpenCoarrays.org + mention libcaf_single gcc/fortran/ChangeLog: * invoke.texi (fcoarray): Link to OpenCoarrays.org; mention libcaf_single. gcc/fortran/invoke.texi | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index 40e8e4a7cdd..78a2910b8d8 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -1753,7 +1753,10 @@ Single-image mode, i.e. @code{num_images()} is always one. @item @samp{lib} Library-based coarray parallelization; a suitable GNU Fortran coarray -library needs to be linked. +library needs to be linked such as @url{http://opencoarrays.org}. +Alternatively, GCC's @code{libcaf_single} library can be linked, +albeit it only supports a single image. + @end table
[Patch] Fortran: Fix SHAPE for zero-size arrays
That is for https://gcc.gnu.org/PR115150 – a GCC 12/13/14/15 regression, caused when switching from a libgomp call to inline code and missing the corner case of zero-size arrays ... OK for mainline + all affected branches? Tobias Fortran: Fix SHAPE for zero-size arrays PR fortran/115150 gcc/fortran/ChangeLog: * trans-intrinsic.cc (gfc_conv_intrinsic_bound): Fix SHAPE for zero-size arrays gcc/testsuite/ChangeLog: * gfortran.dg/shape_12.f90: New test. gcc/fortran/trans-intrinsic.cc | 4 ++- gcc/testsuite/gfortran.dg/shape_12.f90 | 51 ++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/trans-intrinsic.cc b/gcc/fortran/trans-intrinsic.cc index 80dc3426ab0..912c1000e18 100644 --- a/gcc/fortran/trans-intrinsic.cc +++ b/gcc/fortran/trans-intrinsic.cc @@ -3090,7 +3090,9 @@ gfc_conv_intrinsic_bound (gfc_se * se, gfc_expr * expr, enum gfc_isym_id op) lbound, gfc_index_one_node); } else if (op == GFC_ISYM_SHAPE) - se->expr = size; + se->expr = fold_build2_loc (input_location, MAX_EXPR, +gfc_array_index_type, size, +gfc_index_zero_node); else gcc_unreachable (); diff --git a/gcc/testsuite/gfortran.dg/shape_12.f90 b/gcc/testsuite/gfortran.dg/shape_12.f90 new file mode 100644 index 000..e672e1ff9f9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/shape_12.f90 @@ -0,0 +1,51 @@ +! { dg-do run } +! +! PR fortran/115150 +! +! Check that SHAPE handles zero-sized arrays correctly +! +implicit none +call one +call two + +contains + +subroutine one + real,allocatable :: A(:),B(:,:) + allocate(a(3:0), b(5:1, 2:5)) + + if (any (shape(a) /= [0])) stop 1 + if (any (shape(b) /= [0, 4])) stop 2 + if (size(a) /= 0) stop 3 + if (size(b) /= 0) stop 4 + if (any (lbound(a) /= [1])) stop 5 + if (any (lbound(b) /= [1, 2])) stop 6 + if (any (ubound(a) /= [0])) stop 5 + if (any (ubound(b) /= [0,5])) stop 6 +end + +subroutine two +integer :: x1(10), x2(10,10) +call f(x1, x2, -3) +end + +subroutine f(y1, y2, n) + integer, value :: n + integer :: y1(1:n) + integer :: y2(1:n,4,2:*) + call g(y1, y2) +end + +subroutine g(z1, z2) + integer :: z1(..), z2(..) + + if (any (shape(z1) /= [0])) stop 1 + if (any (shape(z2) /= [0, 4, -1])) stop 2 + if (size(z1) /= 0) stop 3 + if (size(z2) /= 0) stop 4 + if (any (lbound(z1) /= [1])) stop 5 + if (any (lbound(z2) /= [1, 1, 1])) stop 6 + if (any (ubound(z1) /= [0])) stop 5 + if (any (ubound(z2) /= [0, 4, -1])) stop 6 +end +end
Re: [Patch] Fortran: Fix SHAPE for zero-size arrays
Hi Tobias, > That is for https://gcc.gnu.org/PR115150 – a GCC 12/13/14/15 regression, > caused when switching from a libgomp call to inline code and missing the > corner case of zero-size arrays … OK to push, thanks. FX
Re: [Patch] Fortran: invoke.texi - link to OpenCoarrays.org + mention libcaf_single
Hi Tobias, > OK for mainline? Seems reasonable, OK to push in 48 hours unless someone has suggestions related to wording. FX
Re: [Patch] Fortran: invoke.texi - link to OpenCoarrays.org + mention libcaf_single
On 5/19/24 02:01, Tobias Burnus wrote: I noticed that gfortran's coarray support did not link to the http://www.opencoarrays.org/ > [snip] diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index 40e8e4a7cdd..78a2910b8d8 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -1753,7 +1753,10 @@ Single-image mode, i.e. @code{num_images()} is always one. @item @samp{lib} Library-based coarray parallelization; a suitable GNU Fortran coarray -library needs to be linked. +library needs to be linked such as @url{http://opencoarrays.org}. This would read better as library such as @url{http://opencoarrays.org} needs to be linked. +Alternatively, GCC's @code{libcaf_single} library can be linked, +albeit it only supports a single image. + @end table OK with that tweak. -Sandra