From patchwork Wed Dec 31 18:10:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 424820 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id CFC451400B7 for ; Thu, 1 Jan 2015 05:11:18 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=l82sLBpgl232jjDhQl6Z/94oTxQ2hPfUO2Rh/+/fpZUNMO yQEwXs1SiqcxqnNjH9Z1RO6FwtM0aO/JmBtIYkBQPmiIbbx22kqvwUfuX3VXMRSo vxVlEyfzgYlnDZJ/MhtDyGM9zmD4lPUoNHRnwwqs2hGLOF+wM1JPM5LQU0G40= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=pB8hTdqpw0cxnAp88Y3ZU5vCbkA=; b=ZsL2X3hXn5ToLfAwfO55 z4YTTyBnc1LP5+AnpyaJP+xYjQOTw+rYeaUFsOfxUa7YUV5weAo9JZtqBuk7jPLS KULAt5PYQbYK4JgZoEL1P/bnux9ySx/vzWgBqW1q0Qd5farIAlO9TGBvbSbT0Q7y M8t648GOMDudcezPCiW6fK4= Received: (qmail 28573 invoked by alias); 31 Dec 2014 18:11:09 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 28548 invoked by uid 89); 31 Dec 2014 18:11:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: outpost5.zedat.fu-berlin.de Received: from outpost5.zedat.fu-berlin.de (HELO outpost5.zedat.fu-berlin.de) (130.133.4.89) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 31 Dec 2014 18:11:07 +0000 Received: from relay1.zedat.fu-berlin.de ([130.133.4.67]) by outpost.zedat.fu-berlin.de (Exim 4.82) with esmtp (envelope-from ) id <1Y6Njc-001t86-7r>; Wed, 31 Dec 2014 19:11:04 +0100 Received: from squeeze64.physik.fu-berlin.de ([160.45.66.239] helo=tux.net-b.de) by relay1.zedat.fu-berlin.de (Exim 4.82) with esmtp (envelope-from ) id <1Y6NjZ-0004wx-M1>; Wed, 31 Dec 2014 19:11:04 +0100 Message-ID: <54A43C31.1050107@net-b.de> Date: Wed, 31 Dec 2014 19:10:57 +0100 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: gcc-patches , gfortran Subject: [Patch, Fortran] add co_reduce to libcaf_single 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. 2014-12-31 Tobias Burnus * caf/single.c (_gfortran_caf_co_reduce): New function. * caf/libcaf.h (_gfortran_caf_co_reduce): New prototype. 2014-12-31 Tobias Burnus * 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