mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-23 19:03:59 +08:00
[libgomp, nvptx, --without-cuda-driver] Don't use system cuda driver
Using libgomp configure option --with-cuda-driver=<dir> we can indicate what cuda driver to use to build the libgomp nvptx plugin. Without such an option, the system cuda driver is used, if available. If not availabe, a dlopen interface is used instead. However, when we use --without-cuda-driver (or the equivalent --with-cuda-driver=no) the system cuda driver is still used if available. This patch fixes that, making sure that --without-cuda-driver selects the dlopen interface. Build on x86_64 with nvptx accelerator and tested libgomp testsuite, with and without option --without-cuda-driver. 2018-08-04 Tom de Vries <tdevries@suse.de> * plugin/configfrag.ac: For --without-cuda-driver, set CUDA_DRIVER_INCLUDE and CUDA_DRIVER_LIB to no. Handle CUDA_DRIVER_INCLUDE == no and CUDA_DRIVER_LIB == no. * configure: Regenerate. From-SVN: r263310
This commit is contained in:
parent
11fc901348
commit
099400909e
@ -1,3 +1,10 @@
|
||||
2018-08-04 Tom de Vries <tdevries@suse.de>
|
||||
|
||||
* plugin/configfrag.ac: For --without-cuda-driver, set
|
||||
CUDA_DRIVER_INCLUDE and CUDA_DRIVER_LIB to no. Handle
|
||||
CUDA_DRIVER_INCLUDE == no and CUDA_DRIVER_LIB == no.
|
||||
* configure: Regenerate.
|
||||
|
||||
2018-08-02 Tom de Vries <tdevries@suse.de>
|
||||
|
||||
PR target/86660
|
||||
|
47
libgomp/configure
vendored
47
libgomp/configure
vendored
@ -15302,7 +15302,11 @@ if test "${with_cuda_driver_lib+set}" = set; then :
|
||||
fi
|
||||
|
||||
case "x$with_cuda_driver" in
|
||||
x | xno) ;;
|
||||
x) ;;
|
||||
xno)
|
||||
CUDA_DRIVER_INCLUDE=no
|
||||
CUDA_DRIVER_LIB=no
|
||||
;;
|
||||
*) CUDA_DRIVER_INCLUDE=$with_cuda_driver/include
|
||||
CUDA_DRIVER_LIB=$with_cuda_driver/lib
|
||||
;;
|
||||
@ -15313,10 +15317,12 @@ 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; then
|
||||
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; then
|
||||
if test "x$CUDA_DRIVER_LIB" != x \
|
||||
&& test "x$CUDA_DRIVER_LIB" != xno; then
|
||||
CUDA_DRIVER_LDFLAGS=-L$CUDA_DRIVER_LIB
|
||||
fi
|
||||
|
||||
@ -15400,17 +15406,19 @@ if test x"$enable_offload_targets" != x; then
|
||||
nvptx*)
|
||||
tgt_name=nvptx
|
||||
PLUGIN_NVPTX=$tgt
|
||||
PLUGIN_NVPTX_CPPFLAGS=$CUDA_DRIVER_CPPFLAGS
|
||||
PLUGIN_NVPTX_LDFLAGS=$CUDA_DRIVER_LDFLAGS
|
||||
PLUGIN_NVPTX_LIBS='-lcuda'
|
||||
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
|
||||
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
|
||||
@ -15426,13 +15434,16 @@ if ac_fn_c_try_link "$LINENO"; then :
|
||||
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
|
||||
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_LIB" = x; then
|
||||
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_CPPFLAGS='-I$(srcdir)/plugin/cuda'
|
||||
PLUGIN_NVPTX_LIBS='-ldl'
|
||||
|
@ -59,7 +59,11 @@ 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) ;;
|
||||
x) ;;
|
||||
xno)
|
||||
CUDA_DRIVER_INCLUDE=no
|
||||
CUDA_DRIVER_LIB=no
|
||||
;;
|
||||
*) CUDA_DRIVER_INCLUDE=$with_cuda_driver/include
|
||||
CUDA_DRIVER_LIB=$with_cuda_driver/lib
|
||||
;;
|
||||
@ -70,10 +74,12 @@ 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; then
|
||||
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; then
|
||||
if test "x$CUDA_DRIVER_LIB" != x \
|
||||
&& test "x$CUDA_DRIVER_LIB" != xno; then
|
||||
CUDA_DRIVER_LDFLAGS=-L$CUDA_DRIVER_LIB
|
||||
fi
|
||||
|
||||
@ -150,28 +156,33 @@ if test x"$enable_offload_targets" != x; then
|
||||
nvptx*)
|
||||
tgt_name=nvptx
|
||||
PLUGIN_NVPTX=$tgt
|
||||
PLUGIN_NVPTX_CPPFLAGS=$CUDA_DRIVER_CPPFLAGS
|
||||
PLUGIN_NVPTX_LDFLAGS=$CUDA_DRIVER_LDFLAGS
|
||||
PLUGIN_NVPTX_LIBS='-lcuda'
|
||||
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
|
||||
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_LIB" = x; then
|
||||
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_CPPFLAGS='-I$(srcdir)/plugin/cuda'
|
||||
PLUGIN_NVPTX_LIBS='-ldl'
|
||||
|
Loading…
Reference in New Issue
Block a user