From patchwork Wed Nov 6 19:42:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 289002 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 406052C00A8 for ; Thu, 7 Nov 2013 07:05:38 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; q=dns; s=default; b=Zv5uigT847UYIJ4y yJNddugcIdigGkJsIAkyPnL9iC14BJg+HiO1U3x20xIVLVsZEIf6vaE5hhQMgfLI RgxLi5XBYRJKXGvOURb19ogXfaOisIAT1HvXjkP3rz0xUL7OFeRDJfkCs4DgkWXe XmIr5h9QeF+szolhSdZsQtAmJPE= 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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=default; bh=M42+ntqSWyBIHJuuoHuvb8 rgdwE=; b=bNCd7NN3LtRXwW8M2F8u4RVwirFLs/zO/Ku/VkpFuXCmFLp7y+WFlO MOIPxDjX95R/gL1tXPbCUfXx7f6iSZ6dnbfqduAvNSyC8yVvXGTe/4ovQPkLxKjg E34939kDR1gmszuc/AlUlP6HNKy7tCx45n6vDbTDgC0f5JiTmXp+0= Received: (qmail 10383 invoked by alias); 6 Nov 2013 20:05:28 -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 10374 invoked by uid 89); 6 Nov 2013 20:05:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=AWL, BAYES_60, RDNS_NONE, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: eggs.gnu.org Received: from Unknown (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 06 Nov 2013 20:04:38 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ve8zx-0005oN-GW for gcc-patches@gcc.gnu.org; Wed, 06 Nov 2013 14:42:50 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:60281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve8zx-0005o3-4J for gcc-patches@gcc.gnu.org; Wed, 06 Nov 2013 14:42:41 -0500 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1Ve8zv-0000Tp-ES from Thomas_Schwinge@mentor.com for gcc-patches@gcc.gnu.org; Wed, 06 Nov 2013 11:42:39 -0800 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 6 Nov 2013 11:42:39 -0800 Received: from build5-lucid-cs (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.2.247.3; Wed, 6 Nov 2013 11:42:37 -0800 Received: by build5-lucid-cs (Postfix, from userid 49978) id 99778321830; Wed, 6 Nov 2013 11:42:37 -0800 (PST) From: To: CC: Thomas Schwinge Subject: [gomp4 4/9] OpenACC: The runtime library will be implemented in libgomp, too. Date: Wed, 6 Nov 2013 20:42:18 +0100 Message-ID: <1383766943-8863-4-git-send-email-thomas@codesourcery.com> In-Reply-To: <1383766943-8863-3-git-send-email-thomas@codesourcery.com> References: <878ux1jp2s.fsf@schwinge.name> <1383766943-8863-1-git-send-email-thomas@codesourcery.com> <1383766943-8863-2-git-send-email-thomas@codesourcery.com> <1383766943-8863-3-git-send-email-thomas@codesourcery.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 From: Thomas Schwinge gcc/ * gcc.c (LINK_COMMAND_SPEC, GOMP_SELF_SPECS): For -fopenacc, link to libgomp and its dependencies. * config/arc/arc.h (LINK_COMMAND_SPEC): Likewise. * config/darwin.h (LINK_COMMAND_SPEC_A): Likewise. * config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise. * config/ia64/hpux.h (LIB_SPEC): Likewise. * config/pa/pa-hpux11.h (LIB_SPEC): Likewise. * config/pa/pa64-hpux.h (LIB_SPEC): Likewise. * doc/invoke.texi (-fopenacc): Update. libgomp/ * libgomp.map (OACC_2.0): New symbol version. * libgomp.spec.in: Update comment. * configure.ac: Likewise. * configure: Regenerate. * Makefile.am (nodist_libsubinclude_HEADERS): Add openacc.h. (nodist_finclude_HEADERS): Add openacc_lib.h, openacc.f90, openacc.mod, and openacc_kinds.mod. (openacc_kinds.mod): New target. (%.mod): New target, generalized from omp_lib.mod. * Makefile.in: Regenerate. * openacc.f90: New file. * openacc.h: Likewise. * openacc_lib.h: Likewise. * testsuite/libgomp.oacc-c++/c++.exp: Likewise. * testsuite/libgomp.oacc-c/c.exp: Likewise. * testsuite/libgomp.oacc-c/lib-1.c: Likewise. * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise. * testsuite/libgomp.oacc-fortran/lib-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-2.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-3.f: Likewise. --- gcc/config/arc/arc.h | 2 +- gcc/config/darwin.h | 2 +- gcc/config/i386/mingw32.h | 2 +- gcc/config/ia64/hpux.h | 2 +- gcc/config/pa/pa-hpux11.h | 2 +- gcc/config/pa/pa64-hpux.h | 12 ++-- gcc/doc/invoke.texi | 4 +- gcc/gcc.c | 7 ++- libgomp/Makefile.am | 9 ++- libgomp/Makefile.in | 10 +++- libgomp/configure | 2 +- libgomp/configure.ac | 2 +- libgomp/libgomp.map | 3 + libgomp/libgomp.spec.in | 2 +- libgomp/openacc.f90 | 37 ++++++++++++ libgomp/openacc.h | 45 ++++++++++++++ libgomp/openacc_lib.h | 26 ++++++++ libgomp/testsuite/libgomp.oacc-c++/c++.exp | 66 +++++++++++++++++++++ libgomp/testsuite/libgomp.oacc-c/c.exp | 36 +++++++++++ libgomp/testsuite/libgomp.oacc-c/lib-1.c | 7 +++ libgomp/testsuite/libgomp.oacc-fortran/fortran.exp | 69 ++++++++++++++++++++++ libgomp/testsuite/libgomp.oacc-fortran/lib-1.f90 | 3 + libgomp/testsuite/libgomp.oacc-fortran/lib-2.f | 3 + libgomp/testsuite/libgomp.oacc-fortran/lib-3.f | 3 + 24 files changed, 332 insertions(+), 24 deletions(-) create mode 100644 libgomp/openacc.f90 create mode 100644 libgomp/openacc.h create mode 100644 libgomp/openacc_lib.h create mode 100644 libgomp/testsuite/libgomp.oacc-c++/c++.exp create mode 100644 libgomp/testsuite/libgomp.oacc-c/c.exp create mode 100644 libgomp/testsuite/libgomp.oacc-c/lib-1.c create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/fortran.exp create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/lib-1.f90 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/lib-2.f create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/lib-3.f diff --git gcc/config/arc/arc.h gcc/config/arc/arc.h index 637f7b6..14fc717 100644 --- gcc/config/arc/arc.h +++ gcc/config/arc/arc.h @@ -174,7 +174,7 @@ along with GCC; see the file COPYING3. If not see %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\ %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\ %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\ - %{fopenmp:%:include(libgomp.spec)%(link_gomp)} %(mflib)\ + %{fopenacc|fopenmp:%:include(libgomp.spec)%(link_gomp)} %(mflib)\ %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\ %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\ %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}" diff --git gcc/config/darwin.h gcc/config/darwin.h index 596c9ef..735b6b9 100644 --- gcc/config/darwin.h +++ gcc/config/darwin.h @@ -176,7 +176,7 @@ extern GTY(()) int darwin_ms_struct; %{o*}%{!o:-o a.out} \ %{!nostdlib:%{!nostartfiles:%S}} \ %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \ - %{fopenmp|ftree-parallelize-loops=*: \ + %{fopenacc|fopenmp|ftree-parallelize-loops=*: \ %{static|static-libgcc|static-libstdc++|static-libgfortran: libgomp.a%s; : -lgomp } } \ %{fgnu-tm: \ %{static|static-libgcc|static-libstdc++|static-libgfortran: libitm.a%s; : -litm } } \ diff --git gcc/config/i386/mingw32.h gcc/config/i386/mingw32.h index 1ac5544..6f5c3a4 100644 --- gcc/config/i386/mingw32.h +++ gcc/config/i386/mingw32.h @@ -198,7 +198,7 @@ do { \ /* mingw32 uses the -mthreads option to enable thread support. */ #undef GOMP_SELF_SPECS -#define GOMP_SELF_SPECS "%{fopenmp|ftree-parallelize-loops=*: " \ +#define GOMP_SELF_SPECS "%{fopenacc|fopenmp|ftree-parallelize-loops=*: " \ "-mthreads -pthread}" #undef GTM_SELF_SPECS #define GTM_SELF_SPECS "%{fgnu-tm:-mthreads -pthread}" diff --git gcc/config/ia64/hpux.h gcc/config/ia64/hpux.h index ca592e4..e0158ba 100644 --- gcc/config/ia64/hpux.h +++ gcc/config/ia64/hpux.h @@ -92,7 +92,7 @@ do { \ #undef LIB_SPEC #define LIB_SPEC \ "%{!shared: \ - %{mt|pthread:%{fopenmp:-lrt} -lpthread} \ + %{mt|pthread:%{fopenacc|fopenmp:-lrt} -lpthread} \ %{p:%{!mlp64:-L/usr/lib/hpux32/libp} \ %{mlp64:-L/usr/lib/hpux64/libp} -lprof} \ %{pg:%{!mlp64:-L/usr/lib/hpux32/libp} \ diff --git gcc/config/pa/pa-hpux11.h gcc/config/pa/pa-hpux11.h index c217398..0676d74 100644 --- gcc/config/pa/pa-hpux11.h +++ gcc/config/pa/pa-hpux11.h @@ -120,7 +120,7 @@ along with GCC; see the file COPYING3. If not see #undef LIB_SPEC #define LIB_SPEC \ "%{!shared:\ - %{fopenmp:%{static:-a archive_shared} -lrt %{static:-a archive}}\ + %{fopenacc|fopenmp:%{static:-a archive_shared} -lrt %{static:-a archive}}\ %{mt|pthread:-lpthread} -lc\ %{static:%{!nolibdld:-a archive_shared -ldld -a archive -lc}\ %{!mt:%{!pthread:-a shared -lc -a archive}}}}\ diff --git gcc/config/pa/pa64-hpux.h gcc/config/pa/pa64-hpux.h index a3e21d3..fdccf51 100644 --- gcc/config/pa/pa64-hpux.h +++ gcc/config/pa/pa64-hpux.h @@ -58,19 +58,19 @@ along with GCC; see the file COPYING3. If not see #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GNU_LD) #define LIB_SPEC \ "%{!shared:\ - %{!p:%{!pg:%{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ + %{!p:%{!pg:%{fopenacc|fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ %{mt|pthread:-lpthread} -lc\ %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\ %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\ %{p:%{!pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\ -lprof %{static:-a archive}\ - %{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ + %{fopenacc|fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ %{mt|pthread:-lpthread} -lc\ %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\ %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\ %{pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\ -lgprof %{static:-a archive}\ - %{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ + %{fopenacc|fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ %{mt|pthread:-lpthread} -lc\ %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\ %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\ @@ -78,19 +78,19 @@ along with GCC; see the file COPYING3. If not see #else #define LIB_SPEC \ "%{!shared:\ - %{!p:%{!pg:%{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ + %{!p:%{!pg:%{fopenacc|fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ %{mt|pthread:-lpthread} -lc\ %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\ %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\ %{p:%{!pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\ -lprof %{static:-a archive}\ - %{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ + %{fopenacc|fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ %{mt|pthread:-lpthread} -lc\ %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\ %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\ %{pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\ -lgprof %{static:-a archive}\ - %{fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ + %{fopenacc|fopenmp:%{static:-a shared} -lrt %{static:-a archive}}\ %{mt|pthread:-lpthread} -lc\ %{static:%{!nolibdld:-a shared -ldld -a archive -lc}\ %{!mt:%{!pthread:-a shared -lc -a archive}}}}}\ diff --git gcc/doc/invoke.texi gcc/doc/invoke.texi index e393139..af8973a 100644 --- gcc/doc/invoke.texi +++ gcc/doc/invoke.texi @@ -1838,7 +1838,9 @@ freestanding and hosted environments. Enable handling of OpenACC. When @option{-fopenacc} is specified, the compiler generates accelerated code according to the OpenACC Application -Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. +Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option +implies @option{-pthread}, and thus is only supported on targets that +have support for @option{-pthread}. @item -fopenmp @opindex fopenmp diff --git gcc/gcc.c gcc/gcc.c index 2298249..fdc0db5 100644 --- gcc/gcc.c +++ gcc/gcc.c @@ -765,7 +765,7 @@ proper position among the other output files. */ %X %{o*} %{e*} %{N} %{n} %{r}\ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \ %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\ - %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\ + %{fopenacc|fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\ %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\ %(mflib) " STACK_SPLIT_SPEC "\ %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \ @@ -921,10 +921,11 @@ static const char *const multilib_defaults_raw[] = MULTILIB_DEFAULTS; #define DRIVER_SELF_SPECS "" #endif -/* Adding -fopenmp should imply pthreads. This is particularly important +/* Linking to libgomp implies pthreads. This is particularly important for targets that use different start files and suchlike. */ #ifndef GOMP_SELF_SPECS -#define GOMP_SELF_SPECS "%{fopenmp|ftree-parallelize-loops=*: -pthread}" +#define GOMP_SELF_SPECS "%{fopenacc|fopenmp|ftree-parallelize-loops=*: " \ + "-pthread}" #endif /* Likewise for -fgnu-tm. */ diff --git libgomp/Makefile.am libgomp/Makefile.am index 427415e..0b5c097 100644 --- libgomp/Makefile.am +++ libgomp/Makefile.am @@ -63,9 +63,10 @@ libgomp_la_SOURCES = alloc.c barrier.c critical.c env.c error.c iter.c \ time.c fortran.c affinity.c target.c nodist_noinst_HEADERS = libgomp_f.h -nodist_libsubinclude_HEADERS = omp.h +nodist_libsubinclude_HEADERS = omp.h openacc.h if USE_FORTRAN -nodist_finclude_HEADERS = omp_lib.h omp_lib.f90 omp_lib.mod omp_lib_kinds.mod +nodist_finclude_HEADERS = omp_lib.h omp_lib.f90 omp_lib.mod omp_lib_kinds.mod \ + openacc_lib.h openacc.f90 openacc.mod openacc_kinds.mod endif LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) @@ -75,7 +76,9 @@ LINK = $(LIBTOOL) --tag CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ omp_lib_kinds.mod: omp_lib.mod : -omp_lib.mod: omp_lib.f90 +openacc_kinds.mod: openacc.mod + : +%.mod: %.f90 $(FC) $(FCFLAGS) -fsyntax-only $< fortran.lo: libgomp_f.h fortran.o: libgomp_f.h diff --git libgomp/Makefile.in libgomp/Makefile.in index 5cd666f..9ee1bec 100644 --- libgomp/Makefile.in +++ libgomp/Makefile.in @@ -320,8 +320,10 @@ libgomp_la_SOURCES = alloc.c barrier.c critical.c env.c error.c iter.c \ time.c fortran.c affinity.c target.c nodist_noinst_HEADERS = libgomp_f.h -nodist_libsubinclude_HEADERS = omp.h -@USE_FORTRAN_TRUE@nodist_finclude_HEADERS = omp_lib.h omp_lib.f90 omp_lib.mod omp_lib_kinds.mod +nodist_libsubinclude_HEADERS = omp.h openacc.h +@USE_FORTRAN_TRUE@nodist_finclude_HEADERS = omp_lib.h omp_lib.f90 omp_lib.mod omp_lib_kinds.mod \ +@USE_FORTRAN_TRUE@ openacc_lib.h openacc.f90 openacc.mod openacc_kinds.mod + LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) LINK = $(LIBTOOL) --tag CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LTLDFLAGS) -o $@ @@ -1085,7 +1087,9 @@ vpath % $(strip $(search_path)) omp_lib_kinds.mod: omp_lib.mod : -omp_lib.mod: omp_lib.f90 +openacc_kinds.mod: openacc.mod + : +%.mod: %.f90 $(FC) $(FCFLAGS) -fsyntax-only $< fortran.lo: libgomp_f.h fortran.o: libgomp_f.h diff --git libgomp/configure libgomp/configure index e754eff..704f22a 100755 --- libgomp/configure +++ libgomp/configure @@ -16217,7 +16217,7 @@ else fi # Set up the set of libraries that we need to link against for libgomp. -# Note that the GOMP_SELF_SPEC in gcc.c will force -pthread for -fopenmp, +# Note that the GOMP_SELF_SPEC in gcc.c may force -pthread, # which will force linkage against -lpthread (or equivalent for the system). # That's not 100% ideal, but about the best we can do easily. if test $enable_shared = yes; then diff --git libgomp/configure.ac libgomp/configure.ac index 67f28ed..da06426 100644 --- libgomp/configure.ac +++ libgomp/configure.ac @@ -283,7 +283,7 @@ else fi # Set up the set of libraries that we need to link against for libgomp. -# Note that the GOMP_SELF_SPEC in gcc.c will force -pthread for -fopenmp, +# Note that the GOMP_SELF_SPEC in gcc.c may force -pthread, # which will force linkage against -lpthread (or equivalent for the system). # That's not 100% ideal, but about the best we can do easily. if test $enable_shared = yes; then diff --git libgomp/libgomp.map libgomp/libgomp.map index b102fd8..4f87d00 100644 --- libgomp/libgomp.map +++ libgomp/libgomp.map @@ -227,3 +227,6 @@ GOMP_4.0 { GOMP_target_update; GOMP_teams; } GOMP_3.0; + +OACC_2.0 { +}; diff --git libgomp/libgomp.spec.in libgomp/libgomp.spec.in index b7319f3..5651603 100644 --- libgomp/libgomp.spec.in +++ libgomp/libgomp.spec.in @@ -1,3 +1,3 @@ # This spec file is read by gcc when linking. It is used to specify the -# standard libraries we need in order to link with -fopenmp. +# standard libraries we need in order to link with libgomp. *link_gomp: @link_gomp@ diff --git libgomp/openacc.f90 libgomp/openacc.f90 new file mode 100644 index 0000000..55b79c2 --- /dev/null +++ libgomp/openacc.f90 @@ -0,0 +1,37 @@ +! OpenACC Runtime Library Definitions. + +! Copyright (C) 2013 Free Software Foundation, Inc. + +! Contributed by Thomas Schwinge . + +! This file is part of the GNU OpenMP Library (libgomp). + +! Libgomp is free software; you can redistribute it and/or modify it +! under the terms of the GNU General Public License as published by +! the Free Software Foundation; either version 3, or (at your option) +! any later version. + +! Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY +! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +! FOR A PARTICULAR PURPOSE. See the GNU General Public License for +! more details. + +! Under Section 7 of GPL version 3, you are granted additional +! permissions described in the GCC Runtime Library Exception, version +! 3.1, as published by the Free Software Foundation. + +! You should have received a copy of the GNU General Public License and +! a copy of the GCC Runtime Library Exception along with this program; +! see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +! . + +module openacc_kinds + implicit none + +end module openacc_kinds + +module openacc + use openacc_kinds + implicit none + +end module openacc diff --git libgomp/openacc.h libgomp/openacc.h new file mode 100644 index 0000000..a6f7ec94 --- /dev/null +++ libgomp/openacc.h @@ -0,0 +1,45 @@ +/* OpenACC Runtime Library Declarations + + Copyright (C) 2013 Free Software Foundation, Inc. + + Contributed by Thomas Schwinge . + + This file is part of the GNU OpenMP Library (libgomp). + + Libgomp is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + +#ifndef _OPENACC_H +#define _OPENACC_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +# define __GOACC_NOTHROW throw () +#else +# define __GOACC_NOTHROW __attribute__ ((__nothrow__)) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _OPENACC_H */ diff --git libgomp/openacc_lib.h libgomp/openacc_lib.h new file mode 100644 index 0000000..b2cb679 --- /dev/null +++ libgomp/openacc_lib.h @@ -0,0 +1,26 @@ +! OpenACC Runtime Library Definitions. -*- mode: fortran -*- + +! Copyright (C) 2013 Free Software Foundation, Inc. + +! Contributed by Thomas Schwinge . + +! This file is part of the GNU OpenMP Library (libgomp). + +! Libgomp is free software; you can redistribute it and/or modify it +! under the terms of the GNU General Public License as published by +! the Free Software Foundation; either version 3, or (at your option) +! any later version. + +! Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY +! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +! FOR A PARTICULAR PURPOSE. See the GNU General Public License for +! more details. + +! Under Section 7 of GPL version 3, you are granted additional +! permissions described in the GCC Runtime Library Exception, version +! 3.1, as published by the Free Software Foundation. + +! You should have received a copy of the GNU General Public License and +! a copy of the GCC Runtime Library Exception along with this program; +! see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +! . diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp new file mode 100644 index 0000000..4c0a3e3 --- /dev/null +++ libgomp/testsuite/libgomp.oacc-c++/c++.exp @@ -0,0 +1,66 @@ +# This whole file adapted from libgomp.c++/c++.exp. + +load_lib libgomp-dg.exp +load_gcc_lib gcc-dg.exp + +global shlib_ext + +set shlib_ext [get_shlib_extension] +set lang_link_flags "-lstdc++" +set lang_test_file_found 0 +set lang_library_path "../libstdc++-v3/src/.libs" + +# Initialize dg. +dg-init + +# Turn on OpenACC. +lappend ALWAYS_CFLAGS "additional_flags=-fopenacc" + +set blddir [lookfor_file [get_multilibs] libgomp] + + +if { $blddir != "" } { + # Look for a static libstdc++ first. + if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] { + set lang_test_file "${lang_library_path}/libstdc++.a" + set lang_test_file_found 1 + # We may have a shared only build, so look for a shared libstdc++. + } elseif [file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] { + set lang_test_file "${lang_library_path}/libstdc++.${shlib_ext}" + set lang_test_file_found 1 + } else { + puts "No libstdc++ library found, will not execute c++ tests" + } +} elseif { [info exists GXX_UNDER_TEST] } { + set lang_test_file_found 1 + # Needs to exist for libgomp.exp. + set lang_test_file "" +} else { + puts "GXX_UNDER_TEST not defined, will not execute c++ tests" +} + +if { $lang_test_file_found } { + # Gather a list of all tests. + set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]] + + if { $blddir != "" } { + set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}" + } else { + set ld_library_path "$always_ld_library_path" + } + append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] + set_ld_library_path_env_vars + + set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags" + if { [file exists $flags_file] } { + set libstdcxx_includes [exec sh $flags_file --build-includes] + } else { + set libstdcxx_includes "" + } + + # Main loop. + dg-runtest $tests "" $libstdcxx_includes +} + +# All done. +dg-finish diff --git libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp new file mode 100644 index 0000000..8307ecd --- /dev/null +++ libgomp/testsuite/libgomp.oacc-c/c.exp @@ -0,0 +1,36 @@ +# This whole file adapted from libgomp.c/c.exp. + +if [info exists lang_library_path] then { + unset lang_library_path + unset lang_link_flags +} +if [info exists lang_test_file] then { + unset lang_test_file +} + +load_lib libgomp-dg.exp +load_gcc_lib gcc-dg.exp + +# If a testcase doesn't have special options, use these. +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS "-O2" +} + +# Initialize dg. +dg-init + +# Turn on OpenACC. +lappend ALWAYS_CFLAGS "additional_flags=-fopenacc" + +# Gather a list of all tests. +set tests [lsort [find $srcdir/$subdir *.c]] + +set ld_library_path $always_ld_library_path +append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] +set_ld_library_path_env_vars + +# Main loop. +dg-runtest $tests "" $DEFAULT_CFLAGS + +# All done. +dg-finish diff --git libgomp/testsuite/libgomp.oacc-c/lib-1.c libgomp/testsuite/libgomp.oacc-c/lib-1.c new file mode 100644 index 0000000..8ad1b19 --- /dev/null +++ libgomp/testsuite/libgomp.oacc-c/lib-1.c @@ -0,0 +1,7 @@ +#include + +int +main (void) +{ + return 0; +} diff --git libgomp/testsuite/libgomp.oacc-fortran/fortran.exp libgomp/testsuite/libgomp.oacc-fortran/fortran.exp new file mode 100644 index 0000000..4070df5 --- /dev/null +++ libgomp/testsuite/libgomp.oacc-fortran/fortran.exp @@ -0,0 +1,69 @@ +# This whole file adapted from libgomp.fortran/fortran.exp. + +load_lib libgomp-dg.exp +load_gcc_lib gcc-dg.exp +load_gcc_lib gfortran-dg.exp + +global shlib_ext +global ALWAYS_CFLAGS + +set shlib_ext [get_shlib_extension] +set lang_library_path "../libgfortran/.libs" +set lang_link_flags "-lgfortran" +set lang_test_file_found 0 +set quadmath_library_path "../libquadmath/.libs" + + +# Initialize dg. +dg-init + +# Turn on OpenACC. +lappend ALWAYS_CFLAGS "additional_flags=-fopenacc" + +if { $blddir != "" } { + lappend ALWAYS_CFLAGS "additional_flags=-fintrinsic-modules-path=${blddir}" + # Look for a static libgfortran first. + if [file exists "${blddir}/${lang_library_path}/libgfortran.a"] { + set lang_test_file "${lang_library_path}/libgfortran.a" + set lang_test_file_found 1 + # We may have a shared only build, so look for a shared libgfortran. + } elseif [file exists "${blddir}/${lang_library_path}/libgfortran.${shlib_ext}"] { + set lang_test_file "${lang_library_path}/libgfortran.${shlib_ext}" + set lang_test_file_found 1 + } else { + puts "No libgfortran library found, will not execute fortran tests" + } +} elseif [info exists GFORTRAN_UNDER_TEST] { + set lang_test_file_found 1 + # Needs to exist for libgomp.exp. + set lang_test_file "" +} else { + puts "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests" +} + +if { $lang_test_file_found } { + # Gather a list of all tests. + set tests [lsort [find $srcdir/$subdir *.\[fF\]{,90,95,03,08}]] + + if { $blddir != "" } { + if { [file exists "${blddir}/${quadmath_library_path}/libquadmath.a"] + || [file exists "${blddir}/${quadmath_library_path}/libquadmath.${shlib_ext}"] } { + lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/${quadmath_library_path}/" + # Allow for spec subsitution. + lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/${quadmath_library_path}/" + set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}:${blddir}/${quadmath_library_path}" + } else { + set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}" + } + } else { + set ld_library_path "$always_ld_library_path" + } + append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] + set_ld_library_path_env_vars + + # Main loop. + gfortran-dg-runtest $tests "" +} + +# All done. +dg-finish diff --git libgomp/testsuite/libgomp.oacc-fortran/lib-1.f90 libgomp/testsuite/libgomp.oacc-fortran/lib-1.f90 new file mode 100644 index 0000000..124aa87 --- /dev/null +++ libgomp/testsuite/libgomp.oacc-fortran/lib-1.f90 @@ -0,0 +1,3 @@ +use openacc + +end diff --git libgomp/testsuite/libgomp.oacc-fortran/lib-2.f libgomp/testsuite/libgomp.oacc-fortran/lib-2.f new file mode 100644 index 0000000..64beb9e --- /dev/null +++ libgomp/testsuite/libgomp.oacc-fortran/lib-2.f @@ -0,0 +1,3 @@ + USE OPENACC + + END diff --git libgomp/testsuite/libgomp.oacc-fortran/lib-3.f libgomp/testsuite/libgomp.oacc-fortran/lib-3.f new file mode 100644 index 0000000..3f9940b --- /dev/null +++ libgomp/testsuite/libgomp.oacc-fortran/lib-3.f @@ -0,0 +1,3 @@ + INCLUDE "openacc_lib.h" + + END