Message ID | 54A43C31.1050107@net-b.de |
---|---|
State | New |
Headers | show |
An early PING. Last year, Tobias Burnus wrote: > Looking through the stashed patches, I realized a pending > (unsubmitted) patch, showing that both a test case for CO_REDUCE was > missing and that libcaf_single didn't include co_reduce. > > This patch adds them. > > Build and regtested on x86-64-gnu-linux. > OK for the trunk? > > [Still to do for co_reduce: Checking whether any recent changes to the > coarray draft requires changes to that feature. I think there were > changes to co_reduce.] > > Tobias > > PS: For GCC 5, I really should complete the coarray support: add > LOCKING as missing F2008 feature (basic support only; currently its > pretending to always succeed), catch at compile time unsupported > features (rather than to fail at run time with wrong results) plus > adding vector support in libcaf_single.
Hi Tobias, > Looking through the stashed patches, I realized a pending (unsubmitted) > patch, showing that both a test case for CO_REDUCE was missing and that > libcaf_single didn't include co_reduce. > > This patch adds them. > > Build and regtested on x86-64-gnu-linux. > OK for the trunk? looks rather trivial to me. All the correctness checking for CO_REDUCE is already there, right? Cheers, Janus
Hi Janus, Janus Weil wrote: >> Looking through the stashed patches, I realized a pending (unsubmitted) >> patch, showing that both a test case for CO_REDUCE was missing and that >> libcaf_single didn't include co_reduce. >> >> This patch adds them. >> >> Build and regtested on x86-64-gnu-linux. >> OK for the trunk? > looks rather trivial to me. All the correctness checking for CO_REDUCE > is already there, right? Do you mean compile-time diagnostic for invalid arguments? Yes, those are at gfortran.dg/coarray_collectives_9.f90 to gfortran.dg/coarray_collectives_16.f90. For run time, this patch adds a check, albeit it is not really checkable with num_images() == 1. The multi-image library libcaf_mpi of OpenCoarrays currently only supports co_sum/min/max and co_broadcast and not yet co_reduce. Tobias
2015-01-02 17:24 GMT+01:00 Tobias Burnus <burnus@net-b.de>: >>> Looking through the stashed patches, I realized a pending (unsubmitted) >>> patch, showing that both a test case for CO_REDUCE was missing and that >>> libcaf_single didn't include co_reduce. >>> >>> This patch adds them. >>> >>> Build and regtested on x86-64-gnu-linux. >>> OK for the trunk? >> >> looks rather trivial to me. All the correctness checking for CO_REDUCE >> is already there, right? > > Do you mean compile-time diagnostic for invalid arguments? Yeah, that's what I meant. > Yes, those are at > gfortran.dg/coarray_collectives_9.f90 to > gfortran.dg/coarray_collectives_16.f90. Yes, just found those. > For run time, this patch adds a check, albeit it is not really checkable > with num_images() == 1. You mean via the STAT and ERRMSG arguments? In any case, the patch is ok from my side. Cheers, Janus
2014-12-31 Tobias Burnus <burnus@net-b.de> * caf/single.c (_gfortran_caf_co_reduce): New function. * caf/libcaf.h (_gfortran_caf_co_reduce): New prototype. 2014-12-31 Tobias Burnus <burnus@net-b.de> * gfortran.dg/coarray/collectives_4.f90: New. Index: libgfortran/caf/libcaf.h =================================================================== --- libgfortran/caf/libcaf.h (Revision 219126) +++ libgfortran/caf/libcaf.h (Arbeitskopie) @@ -110,6 +110,8 @@ void _gfortran_caf_co_broadcast (gfc_descriptor_t void _gfortran_caf_co_sum (gfc_descriptor_t *, int, int *, char *, int); void _gfortran_caf_co_min (gfc_descriptor_t *, int, int *, char *, int, int); void _gfortran_caf_co_max (gfc_descriptor_t *, int, int *, char *, int, int); +void _gfortran_caf_co_reduce (gfc_descriptor_t *, void* (*) (void *, void*), + int, int, int *, char *, int, int); void _gfortran_caf_get (caf_token_t, size_t, int, gfc_descriptor_t *, caf_vector_t *, gfc_descriptor_t *, int, int, bool); Index: libgfortran/caf/single.c =================================================================== --- libgfortran/caf/single.c (Revision 219126) +++ libgfortran/caf/single.c (Arbeitskopie) @@ -254,6 +254,21 @@ _gfortran_caf_co_max (gfc_descriptor_t *a __attrib } +void +_gfortran_caf_co_reduce (gfc_descriptor_t *a __attribute__ ((unused)), + void * (*opr) (void *, void *) + __attribute__ ((unused)), + int opr_flags __attribute__ ((unused)), + int result_image __attribute__ ((unused)), + int *stat, char *errmsg __attribute__ ((unused)), + int a_len __attribute__ ((unused)), + int errmsg_len __attribute__ ((unused))) + { + if (stat) + *stat = 0; + } + + static void assign_char4_from_char1 (size_t dst_size, size_t src_size, uint32_t *dst, unsigned char *src) Index: gcc/testsuite/gfortran.dg/coarray/collectives_4.f90 =================================================================== --- gcc/testsuite/gfortran.dg/coarray/collectives_4.f90 (Revision 0) +++ gcc/testsuite/gfortran.dg/coarray/collectives_4.f90 (Arbeitskopie) @@ -0,0 +1,24 @@ +! { dg-do run } +! +! CO_REDUCE +! +implicit none (type, external) +intrinsic :: co_reduce +integer :: stat +integer :: i4, i4_2, i + +i4 = 21 * this_image() +i4_2 = 21 +do i = 2, num_images() + i4_2 = i4_2 * 21 * i +end do +call co_reduce(i4, op_i4, stat=stat) +if (stat /= 0) call abort() +if (i4_2 /= i4) call abort() + +contains + pure integer function op_i4(a,b) + integer, value :: a, b + op_i4 = a * b + end function op_i4 +end