From patchwork Fri May 27 11:57:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 54460 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 86902396E849 for ; Fri, 27 May 2022 13:26:36 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id 319A23982432 for ; Fri, 27 May 2022 11:57:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 319A23982432 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.91,255,1647331200"; d="scan'208,223";a="76433248" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 27 May 2022 03:57:52 -0800 IronPort-SDR: lLzeXdlvBnnmF8XPEW7pl0lPm6//NkyRDg4MrAHb5KuCbvC76CQlJFMM/uYo4EYkGCYCyGVUIg Ap2W3N0asjOPWGP0VB1r05iIFc7h0GvCODFXp1BSL7gqQ39rdQeVgvID8lNKplzYUeWzwQeqOh 1ztmCwCjxuLx9k5CdzzqC2KG8WxK/TNa0qurSt/nTTus99HZb8X2gqLUdZGoYDmiLTmB3Js6Kg JpQa2TcU7tvS3ganzZV6CxIo4y6TupGxsrtkyMJZF9nXkmGudrdV5IMOfplZ7GKINsSMwLABZo DmI= From: Thomas Schwinge To: Tom de Vries , Jakub Jelinek , Subject: [PING] libgomp nvptx plugin: Remove '--with-cuda-driver=[...]' etc. configuration option (was: Proposal to remove '--with-cuda-driver') In-Reply-To: <87sfpdaa5u.fsf@euler.schwinge.homeip.net> References: <1ffa4e66-af1a-4392-795a-31a8f0047c92@codesourcery.com> <87ee2bh8a4.fsf@euler.schwinge.homeip.net> <93217117-2cb5-e3de-a3d7-0faed46f4311@suse.de> <87bkwkdmr0.fsf@euler.schwinge.homeip.net> <87sfpdaa5u.fsf@euler.schwinge.homeip.net> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Fri, 27 May 2022 13:57:41 +0200 Message-ID: <877d679oi2.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tobias Burnus , Roger Sayle Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi! Ping. Grüße Thomas On 2022-05-13T14:29:01+0200, I wrote: > Hi! > > On 2022-04-29T15:48:03+0200, I wrote: >> On 2022-04-06T11:57:57+0200, Tom de Vries wrote: >>> On 4/5/22 17:14, Thomas Schwinge wrote: >>>> Regarding [...] > >>>> Now, consider doing a GCC/nvptx offloading build with >>>> '--with-cuda-driver' [...] > >>> Thanks for reminding me, I forgot about this configure option. >> >> OK, good. ;-) > > (It also wasn't documented, by the way...) > >> [...] we seem to agree that '--with-cuda-driver' is not >> very useful, and may be removed: >> >>>> Already long ago Jakub put in changes to use '--without-cuda-driver' to >>>> "Allow building GCC with PTX offloading even without CUDA being installed >>>> (gcc and nvptx-tools patches)": "Especially for distributions it is >>>> undesirable to need to have proprietary CUDA libraries and headers >>>> installed when building GCC.", and I understand GNU/Linux distributions >>>> all use that. That configuration uses the GCC-provided >>>> 'libgomp/plugin/cuda/cuda.h', 'libgomp/plugin/cuda-lib.def' to manually >>>> define the CUDA Driver ABI to use, and then 'dlopen("libcuda.so.1")'. >>>> (Similar to what the libgomp GCN (and before: HSA) plugin is doing, for >>>> example.) Quite likely that our group (at work) are the only ones to >>>> actually use '--with-cuda-driver'? >>> >>> Right, I see in my scripts that I don't use --with-cuda-driver, possibly >>> because of years-ago running into issues when changing drivers forth and >>> back. >>> >>>> My proposal now is: we remove '--with-cuda-driver' (make its use a no-op, >>>> per standard GNU Autoconf behavior), and offer '--without-cuda-driver' >>>> only. This shouldn't cause any user-visible change in behavior, so safe >>>> without a prior deprecation phase. >>> >>> I think the dlopen use-case is the most flexible, and I don't see any >>> user benefit from using --with-cuda-driver, so I don't see a problem >>> with removing --with-cuda-driver for the user. >> >> ACK, thanks. >> >>> I did wonder about keeping it available in some form, say rename to >>> --maintainer-mode-with-cuda-driver. This could be useful for debugging >>> / comparison purposes. But it would mean having to test it when making >>> relevant changes, which is maintenance burden for a feature not visible >>> to the user, so I guess that's not worth it. >>> >>> So, I'm fine with removing. >> >> Based on the point you made above, I realized that it may be beneficial >> to "keep the underlying functionality available for the developers": >> "if you develop CUDA API-level changes in the libgomp nvptx plugin, it's >> likely to be easier to just use the full CUDA toolkit 'cuda.h' and >> directly link against libcuda (so that you've got all symbols etc. >> available), and only once you know what exactly you need, update GCC's >> 'include/cuda/cuda.h' and 'libgomp/plugin/cuda-lib.def'". (See the >> thread "libgomp nvptx plugin: Split 'PLUGIN_NVPTX_DYNAMIC' into >> 'PLUGIN_NVPTX_INCLUDE_SYSTEM_CUDA_H' and 'PLUGIN_NVPTX_LINK_LIBCUDA'".) >> >> Do we agree that it's OK to remove the user-visiable '--with-cuda-driver' >> etc. options, and do not introduce any new >> '--enable-maintainer-mode-with-cuda-driver' (or similar) option, and >> instead let this functionality be available to developers only, via >> manually editing 'libgomp/plugin/Makefrag.am'? >> >> Happy to submit an illustrative patch, if that helps. > > Well, given the preparational work that I've put in in the last days, > attached now actually is the final patch: "libgomp nvptx plugin: > Remove '--with-cuda-driver=[...]' etc. configuration option". OK to > push? > > > Grüße > Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 From 68f307775254e468b0aea3209e7e34528fa92bfc Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 12 May 2022 22:46:40 +0200 Subject: [PATCH] libgomp nvptx plugin: Remove '--with-cuda-driver=[...]' etc. configuration option That means, exposing to the user only the '--without-cuda-driver' behavior: including the GCC-shipped 'include/cuda/cuda.h' (not system ), and 'dlopen'ing the CUDA Driver library (not linking it). For development purposes, the libgomp nvptx plugin developer may still manually override that, to get the previous '--with-cuda-driver' behavior. libgomp/ * plugin/Makefrag.am: Evaluate 'if PLUGIN_NVPTX_DYNAMIC' to true. * plugin/configfrag.ac (--with-cuda-driver) (--with-cuda-driver-include, --with-cuda-driver-lib) (CUDA_DRIVER_INCLUDE, CUDA_DRIVER_LIB, PLUGIN_NVPTX_CPPFLAGS) (PLUGIN_NVPTX_LDFLAGS, PLUGIN_NVPTX_LIBS, PLUGIN_NVPTX_DYNAMIC): Remove. * testsuite/libgomp-test-support.exp.in (cuda_driver_include) (cuda_driver_lib): Remove. * testsuite/lib/libgomp.exp (libgomp_init): Don't consider these. * Makefile.in: Regenerate. * configure: Likewise. * testsuite/Makefile.in: Likewise. --- libgomp/Makefile.in | 50 +++--- libgomp/configure | 143 +----------------- libgomp/plugin/Makefrag.am | 25 ++- libgomp/plugin/configfrag.ac | 90 +---------- libgomp/testsuite/Makefile.in | 5 - libgomp/testsuite/lib/libgomp.exp | 13 -- libgomp/testsuite/libgomp-test-support.exp.in | 3 - 7 files changed, 37 insertions(+), 292 deletions(-) diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in index 2ac0397a036..8f6255f2d70 100644 --- a/libgomp/Makefile.in +++ b/libgomp/Makefile.in @@ -119,18 +119,8 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ @PLUGIN_NVPTX_TRUE@am__append_1 = libgomp-plugin-nvptx.la - -# Including the GCC-shipped 'include/cuda/cuda.h' vs. system . -@PLUGIN_NVPTX_DYNAMIC_FALSE@@PLUGIN_NVPTX_TRUE@am__append_2 = -DPLUGIN_NVPTX_INCLUDE_SYSTEM_CUDA_H \ -@PLUGIN_NVPTX_DYNAMIC_FALSE@@PLUGIN_NVPTX_TRUE@ $(PLUGIN_NVPTX_CPPFLAGS) \ -@PLUGIN_NVPTX_DYNAMIC_FALSE@@PLUGIN_NVPTX_TRUE@ -DPLUGIN_NVPTX_LINK_LIBCUDA - -# 'dlopen'ing the CUDA Driver library vs. linking it. -@PLUGIN_NVPTX_DYNAMIC_TRUE@@PLUGIN_NVPTX_TRUE@am__append_3 = $(DL_LIBS) -@PLUGIN_NVPTX_DYNAMIC_FALSE@@PLUGIN_NVPTX_TRUE@am__append_4 = $(PLUGIN_NVPTX_LDFLAGS) -@PLUGIN_NVPTX_DYNAMIC_FALSE@@PLUGIN_NVPTX_TRUE@am__append_5 = $(PLUGIN_NVPTX_LIBS) -@PLUGIN_GCN_TRUE@am__append_6 = libgomp-plugin-gcn.la -@USE_FORTRAN_TRUE@am__append_7 = openacc.f90 +@PLUGIN_GCN_TRUE@am__append_2 = libgomp-plugin-gcn.la +@USE_FORTRAN_TRUE@am__append_3 = openacc.f90 subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ @@ -207,10 +197,8 @@ libgomp_plugin_gcn_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(libgomp_plugin_gcn_la_LDFLAGS) $(LDFLAGS) -o $@ @PLUGIN_GCN_TRUE@am_libgomp_plugin_gcn_la_rpath = -rpath \ @PLUGIN_GCN_TRUE@ $(toolexeclibdir) -@PLUGIN_NVPTX_DYNAMIC_TRUE@@PLUGIN_NVPTX_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) -@PLUGIN_NVPTX_DYNAMIC_FALSE@@PLUGIN_NVPTX_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_DEPENDENCIES = libgomp.la \ -@PLUGIN_NVPTX_TRUE@ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) +@PLUGIN_NVPTX_TRUE@ $(am__DEPENDENCIES_1) @PLUGIN_NVPTX_TRUE@am_libgomp_plugin_nvptx_la_OBJECTS = \ @PLUGIN_NVPTX_TRUE@ libgomp_plugin_nvptx_la-plugin-nvptx.lo libgomp_plugin_nvptx_la_OBJECTS = \ @@ -380,8 +368,6 @@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPU_COUNT = @CPU_COUNT@ -CUDA_DRIVER_INCLUDE = @CUDA_DRIVER_INCLUDE@ -CUDA_DRIVER_LIB = @CUDA_DRIVER_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -443,9 +429,6 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PLUGIN_NVPTX_CPPFLAGS = @PLUGIN_NVPTX_CPPFLAGS@ -PLUGIN_NVPTX_LDFLAGS = @PLUGIN_NVPTX_LDFLAGS@ -PLUGIN_NVPTX_LIBS = @PLUGIN_NVPTX_LIBS@ RANLIB = @RANLIB@ SECTION_LDFLAGS = @SECTION_LDFLAGS@ SED = @SED@ @@ -538,7 +521,7 @@ libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include AM_CPPFLAGS = $(addprefix -I, $(search_path)) AM_CFLAGS = $(XCFLAGS) AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS) -toolexeclib_LTLIBRARIES = libgomp.la $(am__append_1) $(am__append_6) +toolexeclib_LTLIBRARIES = libgomp.la $(am__append_1) $(am__append_2) nodist_toolexeclib_HEADERS = libgomp.spec # -Wc is only a libtool option. @@ -565,19 +548,30 @@ libgomp_la_SOURCES = alloc.c atomic.c barrier.c critical.c env.c \ oacc-parallel.c oacc-host.c oacc-init.c oacc-mem.c \ oacc-async.c oacc-plugin.c oacc-cuda.c priority_queue.c \ affinity-fmt.c teams.c allocator.c oacc-profiling.c \ - oacc-target.c $(am__append_7) + oacc-target.c $(am__append_3) # Nvidia PTX OpenACC plugin. @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_version_info = -version-info $(libtool_VERSION) @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_SOURCES = plugin/plugin-nvptx.c -@PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_CPPFLAGS = $(AM_CPPFLAGS) \ -@PLUGIN_NVPTX_TRUE@ $(am__append_2) -@PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_LDFLAGS = \ -@PLUGIN_NVPTX_TRUE@ $(libgomp_plugin_nvptx_version_info) \ -@PLUGIN_NVPTX_TRUE@ $(lt_host_flags) $(am__append_4) +@PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_CPPFLAGS = $(AM_CPPFLAGS) +@PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_LDFLAGS = $(libgomp_plugin_nvptx_version_info) \ +@PLUGIN_NVPTX_TRUE@ $(lt_host_flags) + + +# libgomp nvptx plugin developer's section. +# +# Including the GCC-shipped 'include/cuda/cuda.h' (default) vs. system : +#libgomp_plugin_nvptx_la_CPPFLAGS += -DPLUGIN_NVPTX_INCLUDE_SYSTEM_CUDA_H +#libgomp_plugin_nvptx_la_CPPFLAGS += -I[CUDA]/include +# +# 'dlopen'ing the CUDA Driver library (default): @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_LIBADD = libgomp.la \ -@PLUGIN_NVPTX_TRUE@ $(am__append_3) $(am__append_5) +@PLUGIN_NVPTX_TRUE@ $(DL_LIBS) @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_la_LIBTOOLFLAGS = --tag=disable-static +# ... vs. linking it: +#libgomp_plugin_nvptx_la_CPPFLAGS += -DPLUGIN_NVPTX_LINK_LIBCUDA +#libgomp_plugin_nvptx_la_LDFLAGS += -L[CUDA]/lib64/stubs +#libgomp_plugin_nvptx_la_LIBADD += -lcuda # AMD GCN plugin @PLUGIN_GCN_TRUE@libgomp_plugin_gcn_version_info = -version-info $(libtool_VERSION) diff --git a/libgomp/configure b/libgomp/configure index 66dface222e..89f14e441f2 100755 --- a/libgomp/configure +++ b/libgomp/configure @@ -667,19 +667,12 @@ OPT_LDFLAGS SECTION_LDFLAGS PLUGIN_GCN_FALSE PLUGIN_GCN_TRUE -PLUGIN_NVPTX_DYNAMIC_FALSE -PLUGIN_NVPTX_DYNAMIC_TRUE PLUGIN_NVPTX_FALSE PLUGIN_NVPTX_TRUE offload_additional_lib_paths offload_additional_options offload_targets offload_plugins -PLUGIN_NVPTX_LIBS -PLUGIN_NVPTX_LDFLAGS -PLUGIN_NVPTX_CPPFLAGS -CUDA_DRIVER_LIB -CUDA_DRIVER_INCLUDE DL_LIBS libtool_VERSION ac_ct_FC @@ -829,9 +822,6 @@ enable_fast_install with_gnu_ld enable_libtool_lock enable_maintainer_mode -with_cuda_driver -with_cuda_driver_include -with_cuda_driver_lib enable_linux_futex enable_tls enable_symvers @@ -1504,16 +1494,6 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-cuda-driver=PATH specify prefix directory for installed CUDA driver - package. Equivalent to - --with-cuda-driver-include=PATH/include plus - --with-cuda-driver-lib=PATH/lib - --with-cuda-driver-include=PATH - specify directory for installed CUDA driver include - files - --with-cuda-driver-lib=PATH - specify directory for the installed CUDA driver - library --with-gcc-major-version-only use only GCC major number in filesystem paths @@ -11414,7 +11394,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11417 "configure" +#line 11397 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11520,7 +11500,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11523 "configure" +#line 11503 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15158,67 +15138,8 @@ done -# Look for the CUDA driver package. -CUDA_DRIVER_INCLUDE= -CUDA_DRIVER_LIB= - - -CUDA_DRIVER_CPPFLAGS= -CUDA_DRIVER_LDFLAGS= - -# Check whether --with-cuda-driver was given. -if test "${with_cuda_driver+set}" = set; then : - withval=$with_cuda_driver; -fi - - -# Check whether --with-cuda-driver-include was given. -if test "${with_cuda_driver_include+set}" = set; then : - withval=$with_cuda_driver_include; -fi - - -# Check whether --with-cuda-driver-lib was given. -if test "${with_cuda_driver_lib+set}" = set; then : - withval=$with_cuda_driver_lib; -fi - -case "x$with_cuda_driver" in - x) ;; - xno) - CUDA_DRIVER_INCLUDE=no - CUDA_DRIVER_LIB=no - ;; - *) CUDA_DRIVER_INCLUDE=$with_cuda_driver/include - CUDA_DRIVER_LIB=$with_cuda_driver/lib - ;; -esac -if test "x$with_cuda_driver_include" != x; then - CUDA_DRIVER_INCLUDE=$with_cuda_driver_include -fi -if test "x$with_cuda_driver_lib" != x; then - CUDA_DRIVER_LIB=$with_cuda_driver_lib -fi -if test "x$CUDA_DRIVER_INCLUDE" != x \ - && test "x$CUDA_DRIVER_INCLUDE" != xno; then - CUDA_DRIVER_CPPFLAGS=-I$CUDA_DRIVER_INCLUDE -fi -if test "x$CUDA_DRIVER_LIB" != x \ - && test "x$CUDA_DRIVER_LIB" != xno; then - CUDA_DRIVER_LDFLAGS=-L$CUDA_DRIVER_LIB -fi - PLUGIN_NVPTX=0 -PLUGIN_NVPTX_CPPFLAGS= -PLUGIN_NVPTX_LDFLAGS= -PLUGIN_NVPTX_LIBS= -PLUGIN_NVPTX_DYNAMIC=0 - - - - PLUGIN_GCN=0 - # Parse '--enable-offload-targets', figure out the corresponding libgomp # plugins, and configure to find the corresponding offload compilers. # 'offload_plugins' and 'offload_targets' will be populated in the same order. @@ -15250,53 +15171,7 @@ if test x"$enable_offload_targets" != x; then ;; *) tgt_plugin=nvptx - PLUGIN_NVPTX=$tgt - if test "x$CUDA_DRIVER_LIB" != xno \ - && test "x$CUDA_DRIVER_LIB" != xno; then - PLUGIN_NVPTX_CPPFLAGS=$CUDA_DRIVER_CPPFLAGS - PLUGIN_NVPTX_LDFLAGS=$CUDA_DRIVER_LDFLAGS - PLUGIN_NVPTX_LIBS='-lcuda' - - PLUGIN_NVPTX_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$PLUGIN_NVPTX_CPPFLAGS $CPPFLAGS" - PLUGIN_NVPTX_save_LDFLAGS=$LDFLAGS - LDFLAGS="$PLUGIN_NVPTX_LDFLAGS $LDFLAGS" - PLUGIN_NVPTX_save_LIBS=$LIBS - LIBS="$PLUGIN_NVPTX_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include "cuda.h" -int -main () -{ -CUresult r = cuCtxPushCurrent (NULL); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - PLUGIN_NVPTX=1 -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CPPFLAGS=$PLUGIN_NVPTX_save_CPPFLAGS - LDFLAGS=$PLUGIN_NVPTX_save_LDFLAGS - LIBS=$PLUGIN_NVPTX_save_LIBS - fi - case $PLUGIN_NVPTX in - nvptx*) - if (test "x$CUDA_DRIVER_INCLUDE" = x \ - || test "x$CUDA_DRIVER_INCLUDE" = xno) \ - && (test "x$CUDA_DRIVER_LIB" = x \ - || test "x$CUDA_DRIVER_LIB" = xno); then - PLUGIN_NVPTX=1 - PLUGIN_NVPTX_DYNAMIC=1 - else - PLUGIN_NVPTX=0 - as_fn_error $? "CUDA driver package required for nvptx support" "$LINENO" 5 - fi - ;; - esac + PLUGIN_NVPTX=1 ;; esac ;; @@ -15362,14 +15237,6 @@ else PLUGIN_NVPTX_FALSE= fi - if test $PLUGIN_NVPTX_DYNAMIC = 1; then - PLUGIN_NVPTX_DYNAMIC_TRUE= - PLUGIN_NVPTX_DYNAMIC_FALSE='#' -else - PLUGIN_NVPTX_DYNAMIC_TRUE='#' - PLUGIN_NVPTX_DYNAMIC_FALSE= -fi - if test $PLUGIN_GCN = 1; then PLUGIN_GCN_TRUE= PLUGIN_GCN_FALSE='#' @@ -17137,10 +17004,6 @@ if test -z "${PLUGIN_NVPTX_TRUE}" && test -z "${PLUGIN_NVPTX_FALSE}"; then as_fn_error $? "conditional \"PLUGIN_NVPTX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${PLUGIN_NVPTX_DYNAMIC_TRUE}" && test -z "${PLUGIN_NVPTX_DYNAMIC_FALSE}"; then - as_fn_error $? "conditional \"PLUGIN_NVPTX_DYNAMIC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${PLUGIN_GCN_TRUE}" && test -z "${PLUGIN_GCN_FALSE}"; then as_fn_error $? "conditional \"PLUGIN_GCN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/libgomp/plugin/Makefrag.am b/libgomp/plugin/Makefrag.am index 66c8c12c1a6..5aad9ab5d8b 100644 --- a/libgomp/plugin/Makefrag.am +++ b/libgomp/plugin/Makefrag.am @@ -39,21 +39,18 @@ libgomp_plugin_nvptx_la_LDFLAGS = $(libgomp_plugin_nvptx_version_info) \ libgomp_plugin_nvptx_la_LIBADD = libgomp.la libgomp_plugin_nvptx_la_LIBTOOLFLAGS = --tag=disable-static -# Including the GCC-shipped 'include/cuda/cuda.h' vs. system . -if PLUGIN_NVPTX_DYNAMIC -else -libgomp_plugin_nvptx_la_CPPFLAGS += -DPLUGIN_NVPTX_INCLUDE_SYSTEM_CUDA_H -libgomp_plugin_nvptx_la_CPPFLAGS += $(PLUGIN_NVPTX_CPPFLAGS) -endif - -# 'dlopen'ing the CUDA Driver library vs. linking it. -if PLUGIN_NVPTX_DYNAMIC +# libgomp nvptx plugin developer's section. +# +# Including the GCC-shipped 'include/cuda/cuda.h' (default) vs. system : +#libgomp_plugin_nvptx_la_CPPFLAGS += -DPLUGIN_NVPTX_INCLUDE_SYSTEM_CUDA_H +#libgomp_plugin_nvptx_la_CPPFLAGS += -I[CUDA]/include +# +# 'dlopen'ing the CUDA Driver library (default): libgomp_plugin_nvptx_la_LIBADD += $(DL_LIBS) -else -libgomp_plugin_nvptx_la_CPPFLAGS += -DPLUGIN_NVPTX_LINK_LIBCUDA -libgomp_plugin_nvptx_la_LDFLAGS += $(PLUGIN_NVPTX_LDFLAGS) -libgomp_plugin_nvptx_la_LIBADD += $(PLUGIN_NVPTX_LIBS) -endif +# ... vs. linking it: +#libgomp_plugin_nvptx_la_CPPFLAGS += -DPLUGIN_NVPTX_LINK_LIBCUDA +#libgomp_plugin_nvptx_la_LDFLAGS += -L[CUDA]/lib64/stubs +#libgomp_plugin_nvptx_la_LIBADD += -lcuda endif if PLUGIN_GCN diff --git a/libgomp/plugin/configfrag.ac b/libgomp/plugin/configfrag.ac index 14203048bdb..ab03f94adac 100644 --- a/libgomp/plugin/configfrag.ac +++ b/libgomp/plugin/configfrag.ac @@ -40,60 +40,8 @@ AC_CHECK_HEADERS_ONCE(unistd.h) AC_CHECK_FUNCS_ONCE(secure_getenv __secure_getenv getuid geteuid getgid getegid) -# Look for the CUDA driver package. -CUDA_DRIVER_INCLUDE= -CUDA_DRIVER_LIB= -AC_SUBST(CUDA_DRIVER_INCLUDE) -AC_SUBST(CUDA_DRIVER_LIB) -CUDA_DRIVER_CPPFLAGS= -CUDA_DRIVER_LDFLAGS= -AC_ARG_WITH(cuda-driver, - [AS_HELP_STRING([--with-cuda-driver=PATH], - [specify prefix directory for installed CUDA driver package. - Equivalent to --with-cuda-driver-include=PATH/include - plus --with-cuda-driver-lib=PATH/lib])]) -AC_ARG_WITH(cuda-driver-include, - [AS_HELP_STRING([--with-cuda-driver-include=PATH], - [specify directory for installed CUDA driver include files])]) -AC_ARG_WITH(cuda-driver-lib, - [AS_HELP_STRING([--with-cuda-driver-lib=PATH], - [specify directory for the installed CUDA driver library])]) -case "x$with_cuda_driver" in - x) ;; - xno) - CUDA_DRIVER_INCLUDE=no - CUDA_DRIVER_LIB=no - ;; - *) CUDA_DRIVER_INCLUDE=$with_cuda_driver/include - CUDA_DRIVER_LIB=$with_cuda_driver/lib - ;; -esac -if test "x$with_cuda_driver_include" != x; then - CUDA_DRIVER_INCLUDE=$with_cuda_driver_include -fi -if test "x$with_cuda_driver_lib" != x; then - CUDA_DRIVER_LIB=$with_cuda_driver_lib -fi -if test "x$CUDA_DRIVER_INCLUDE" != x \ - && test "x$CUDA_DRIVER_INCLUDE" != xno; then - CUDA_DRIVER_CPPFLAGS=-I$CUDA_DRIVER_INCLUDE -fi -if test "x$CUDA_DRIVER_LIB" != x \ - && test "x$CUDA_DRIVER_LIB" != xno; then - CUDA_DRIVER_LDFLAGS=-L$CUDA_DRIVER_LIB -fi - PLUGIN_NVPTX=0 -PLUGIN_NVPTX_CPPFLAGS= -PLUGIN_NVPTX_LDFLAGS= -PLUGIN_NVPTX_LIBS= -PLUGIN_NVPTX_DYNAMIC=0 -AC_SUBST(PLUGIN_NVPTX_CPPFLAGS) -AC_SUBST(PLUGIN_NVPTX_LDFLAGS) -AC_SUBST(PLUGIN_NVPTX_LIBS) - PLUGIN_GCN=0 - # Parse '--enable-offload-targets', figure out the corresponding libgomp # plugins, and configure to find the corresponding offload compilers. # 'offload_plugins' and 'offload_targets' will be populated in the same order. @@ -125,42 +73,7 @@ if test x"$enable_offload_targets" != x; then ;; *) tgt_plugin=nvptx - PLUGIN_NVPTX=$tgt - if test "x$CUDA_DRIVER_LIB" != xno \ - && test "x$CUDA_DRIVER_LIB" != xno; then - PLUGIN_NVPTX_CPPFLAGS=$CUDA_DRIVER_CPPFLAGS - PLUGIN_NVPTX_LDFLAGS=$CUDA_DRIVER_LDFLAGS - PLUGIN_NVPTX_LIBS='-lcuda' - - PLUGIN_NVPTX_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$PLUGIN_NVPTX_CPPFLAGS $CPPFLAGS" - PLUGIN_NVPTX_save_LDFLAGS=$LDFLAGS - LDFLAGS="$PLUGIN_NVPTX_LDFLAGS $LDFLAGS" - PLUGIN_NVPTX_save_LIBS=$LIBS - LIBS="$PLUGIN_NVPTX_LIBS $LIBS" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [#include "cuda.h"], - [CUresult r = cuCtxPushCurrent (NULL);])], - [PLUGIN_NVPTX=1]) - CPPFLAGS=$PLUGIN_NVPTX_save_CPPFLAGS - LDFLAGS=$PLUGIN_NVPTX_save_LDFLAGS - LIBS=$PLUGIN_NVPTX_save_LIBS - fi - case $PLUGIN_NVPTX in - nvptx*) - if (test "x$CUDA_DRIVER_INCLUDE" = x \ - || test "x$CUDA_DRIVER_INCLUDE" = xno) \ - && (test "x$CUDA_DRIVER_LIB" = x \ - || test "x$CUDA_DRIVER_LIB" = xno); then - PLUGIN_NVPTX=1 - PLUGIN_NVPTX_DYNAMIC=1 - else - PLUGIN_NVPTX=0 - AC_MSG_ERROR([CUDA driver package required for nvptx support]) - fi - ;; - esac + PLUGIN_NVPTX=1 ;; esac ;; @@ -216,5 +129,4 @@ fi AC_DEFINE_UNQUOTED(OFFLOAD_PLUGINS, "$offload_plugins", [Define to offload plugins, separated by commas.]) AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1]) -AM_CONDITIONAL([PLUGIN_NVPTX_DYNAMIC], [test $PLUGIN_NVPTX_DYNAMIC = 1]) AM_CONDITIONAL([PLUGIN_GCN], [test $PLUGIN_GCN = 1]) diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in index 048844f0a40..7a88f0fe5c6 100644 --- a/libgomp/testsuite/Makefile.in +++ b/libgomp/testsuite/Makefile.in @@ -147,8 +147,6 @@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPU_COUNT = @CPU_COUNT@ -CUDA_DRIVER_INCLUDE = @CUDA_DRIVER_INCLUDE@ -CUDA_DRIVER_LIB = @CUDA_DRIVER_LIB@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -210,9 +208,6 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PLUGIN_NVPTX_CPPFLAGS = @PLUGIN_NVPTX_CPPFLAGS@ -PLUGIN_NVPTX_LDFLAGS = @PLUGIN_NVPTX_LDFLAGS@ -PLUGIN_NVPTX_LIBS = @PLUGIN_NVPTX_LIBS@ RANLIB = @RANLIB@ SECTION_LDFLAGS = @SECTION_LDFLAGS@ SED = @SED@ diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp index 0aaa58f19c5..11c90766704 100644 --- a/libgomp/testsuite/lib/libgomp.exp +++ b/libgomp/testsuite/lib/libgomp.exp @@ -189,19 +189,6 @@ proc libgomp_init { args } { append always_ld_library_path ":${atomic_library_path}" } } - global cuda_driver_include - global cuda_driver_lib - if { $cuda_driver_include != "" } { - # Stop gfortran from freaking out: - # Warning: Nonexistent include directory "[...]" - if {[file exists $cuda_driver_include]} { - lappend ALWAYS_CFLAGS "additional_flags=-I$cuda_driver_include" - } - } - if { $cuda_driver_lib != "" } { - lappend ALWAYS_CFLAGS "additional_flags=-L$cuda_driver_lib" - append always_ld_library_path ":$cuda_driver_lib" - } } # We use atomic operations in the testcases to validate results. diff --git a/libgomp/testsuite/libgomp-test-support.exp.in b/libgomp/testsuite/libgomp-test-support.exp.in index 3c88d1d5a62..36615b353aa 100644 --- a/libgomp/testsuite/libgomp-test-support.exp.in +++ b/libgomp/testsuite/libgomp-test-support.exp.in @@ -1,5 +1,2 @@ -set cuda_driver_include "@CUDA_DRIVER_INCLUDE@" -set cuda_driver_lib "@CUDA_DRIVER_LIB@" - set offload_plugins "@offload_plugins@" set offload_targets "@offload_targets@" -- 2.35.1