From patchwork Mon Oct 12 12:52:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 529092 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 3246214016A for ; Mon, 12 Oct 2015 23:53:29 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=S+I2g5WN; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=XoxhZwxagGvWgtXQ5 7eUUV5hCn1eLjLFgYbFN86awd4/qiIOAaN06Eh3noF+dhbDRnl58NUuSlWSDl4G4 yVFwnRhoC42MoXH60toLjSUOQs1aV9YF1IOIsmQoEMaZQajSLIEk4YuPZLKyJBc0 y279jeLaxDnUTB8LOw6NB4I270= 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=WFmYz7KLlOI+B8Jk/Yr5WRN LRAg=; b=S+I2g5WNNOG/zpb9zCjG0Kz3xd/zL088s/etOyIvjoedy1Chdb5b9CJ lgG/Iiex7D9MP3vudU610w8ml16bum8EyYHCkqpfn8eqpZIrrozy/vfM1xBNbIaf I1tY77oiKhN3iFWSaYfP4TVM2HoodNYBFWqHyRwEJhMR54K9mS48= Received: (qmail 52889 invoked by alias); 12 Oct 2015 12:53:22 -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 52874 invoked by uid 89); 12 Oct 2015 12:53:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 12 Oct 2015 12:53:20 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43781) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ZlcbN-0004aH-S6 for gcc-patches@gnu.org; Mon, 12 Oct 2015 08:53:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZlcbJ-0000hT-9Y for gcc-patches@gnu.org; Mon, 12 Oct 2015 08:53:17 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:43731) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlcbJ-0000cV-3J for gcc-patches@gnu.org; Mon, 12 Oct 2015 08:53:13 -0400 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Zlcb6-00072s-Js from Tom_deVries@mentor.com for gcc-patches@gnu.org; Mon, 12 Oct 2015 05:53:00 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Mon, 12 Oct 2015 13:52:59 +0100 Subject: Re: [gomp4, committed] Add goacc/kernels-acc-on-device.c To: Thomas Schwinge References: <5618ED1D.60906@mentor.com> <874mhwmkf0.fsf@kepler.schwinge.homeip.net> CC: "gcc-patches@gnu.org" From: Tom de Vries Message-ID: <561BACFD.6030001@mentor.com> Date: Mon, 12 Oct 2015 14:52:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <874mhwmkf0.fsf@kepler.schwinge.homeip.net> X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 On 12/10/15 12:49, Thomas Schwinge wrote: > Hi Tom! > > On Sat, 10 Oct 2015 12:49:01 +0200, Tom de Vries wrote: >> >--- /dev/null >> >+++ b/gcc/testsuite/c-c++-common/goacc/kernels-acc-on-device.c >> >@@ -0,0 +1,39 @@ >> >+/* { dg-additional-options "-O2" } */ >> >+ >> >+#include Hi Thomas, > That doesn't work (at least in build-tree testing), as gcc/testsuite/ is > not set up to look for header files in [target]/libgomp/: > > [...]/source-gcc/gcc/testsuite/c-c++-common/goacc/kernels-acc-on-device.c:3:21: fatal error: openacc.h: No such file or directory > compilation terminated. > compiler exited with status 1 > Ah, I see. I was doing 'make' followed by 'make install', and then build-tree testing. The build-tree testing seems to pick up the header file from the install directory. So for me test passed. >> >+ >> >+#define N 32 >> >+ >> >+void >> >+foo (float *a, float *b) >> >+{ >> >+ float exp; >> >+ int i; >> >+ int n; >> >+ >> >+#pragma acc kernels copyin(a[0:N]) copyout(b[0:N]) >> >+ { >> >+ int ii; >> >+ >> >+ for (ii = 0; ii < N; ii++) >> >+ { >> >+ if (acc_on_device (acc_device_host)) > Your two options are: if that's applicable/sufficient for what you intend > to test here, use __builtin_acc_on_device with a hard-coded acc_device_*, > or duplicate part of as done for example in > gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c. > Went with second option, committed as attached. Thanks, - Tom Remove openacc.h include from goacc/kernels-acc-on-device.c 2015-10-12 Tom de Vries * c-c++-common/goacc/kernels-acc-on-device.c: Remove openacc.h include. (enum acc_device_t, acc_on_device): Declare. (foo): Remove unused vars. Use acc_device_X. --- .../c-c++-common/goacc/kernels-acc-on-device.c | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-acc-on-device.c b/gcc/testsuite/c-c++-common/goacc/kernels-acc-on-device.c index e9e93c7..784c66a 100644 --- a/gcc/testsuite/c-c++-common/goacc/kernels-acc-on-device.c +++ b/gcc/testsuite/c-c++-common/goacc/kernels-acc-on-device.c @@ -1,23 +1,36 @@ /* { dg-additional-options "-O2" } */ -#include +#if __cplusplus +extern "C" { +#endif + +#if __cplusplus >= 201103 +# define __GOACC_NOTHROW noexcept +#elif __cplusplus +# define __GOACC_NOTHROW throw () +#else /* Not C++ */ +# define __GOACC_NOTHROW __attribute__ ((__nothrow__)) +#endif + +typedef enum acc_device_t { acc_device_X = 123 } acc_device_t; +int acc_on_device (int) __GOACC_NOTHROW; + +#if __cplusplus +} +#endif #define N 32 void foo (float *a, float *b) { - float exp; - int i; - int n; - #pragma acc kernels copyin(a[0:N]) copyout(b[0:N]) { int ii; for (ii = 0; ii < N; ii++) { - if (acc_on_device (acc_device_host)) + if (acc_on_device (acc_device_X)) b[ii] = a[ii] + 1; else b[ii] = a[ii]; @@ -30,7 +43,7 @@ foo (float *a, float *b) for (ii = 0; ii < N; ii++) { - if (acc_on_device (acc_device_host)) + if (acc_on_device (acc_device_X)) b[ii] = a[ii] + 2; else b[ii] = a[ii]; -- 1.9.1