diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-01-17 10:44:17 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-01-17 10:44:17 +0100 |
commit | 2393d337e7c5ff258b1ad167025b9e4d5f518533 (patch) | |
tree | eaf913e6c721a84f592e444c942b624bbb14fe06 /libgomp/configure | |
parent | 3c36aa6ba2be894d4092a6ce8129d39ef846c964 (diff) | |
download | gcc-2393d337e7c5ff258b1ad167025b9e4d5f518533.zip gcc-2393d337e7c5ff258b1ad167025b9e4d5f518533.tar.gz gcc-2393d337e7c5ff258b1ad167025b9e4d5f518533.tar.bz2 |
configfrag.ac: For --without-cuda-driver don't initialize CUDA_DRIVER_INCLUDE nor CUDA_DRIVER_LIB.
* plugin/configfrag.ac: For --without-cuda-driver don't initialize
CUDA_DRIVER_INCLUDE nor CUDA_DRIVER_LIB. If both
CUDA_DRIVER_INCLUDE and CUDA_DRIVER_LIB are empty and linking small
cuda program fails, define PLUGIN_NVPTX_DYNAMIC to 1 and use
plugin/include/cuda as include dir and -ldl instead of -lcuda as
library to link ptx plugin against.
* plugin/plugin-nvptx.c: Include dlfcn.h if PLUGIN_NVPTX_DYNAMIC.
(CUDA_CALLS): Define.
(cuda_lib, cuda_lib_inited): New variables.
(init_cuda_lib): New function.
(CUDA_CALL_PREFIX): Define.
(CUDA_CALL_ERET, CUDA_CALL_ASSERT): Use CUDA_CALL_PREFIX.
(CUDA_CALL): Use FN instead of (FN).
(CUDA_CALL_NOCHECK): Define.
(cuda_error, fini_streams_for_device, select_stream_for_async,
nvptx_attach_host_thread_to_device, nvptx_open_device, link_ptx,
event_gc, nvptx_exec, nvptx_async_test, nvptx_async_test_all,
nvptx_wait_all, nvptx_set_clocktick, GOMP_OFFLOAD_unload_image,
nvptx_stacks_alloc, nvptx_stacks_free, GOMP_OFFLOAD_run): Use
CUDA_CALL_NOCHECK.
(nvptx_init): Call init_cuda_lib, if it fails, return false. Use
CUDA_CALL_NOCHECK.
(nvptx_get_num_devices): Call init_cuda_lib, if it fails, return 0.
Use CUDA_CALL_NOCHECK.
* plugin/cuda/cuda.h: New file.
* config.h.in: Regenerated.
* configure: Regenerated.
From-SVN: r244522
Diffstat (limited to 'libgomp/configure')
-rwxr-xr-x | libgomp/configure | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/libgomp/configure b/libgomp/configure index 6a4b3b2..b7e9f40 100755 --- a/libgomp/configure +++ b/libgomp/configure @@ -15299,10 +15299,12 @@ if test "${with_cuda_driver_lib+set}" = set; then : withval=$with_cuda_driver_lib; fi -if test "x$with_cuda_driver" != x; then - CUDA_DRIVER_INCLUDE=$with_cuda_driver/include - CUDA_DRIVER_LIB=$with_cuda_driver/lib -fi +case "x$with_cuda_driver" in + x | xno) ;; + *) 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 @@ -15320,6 +15322,7 @@ PLUGIN_NVPTX=0 PLUGIN_NVPTX_CPPFLAGS= PLUGIN_NVPTX_LDFLAGS= PLUGIN_NVPTX_LIBS= +PLUGIN_NVPTX_DYNAMIC=0 @@ -15426,9 +15429,17 @@ rm -f core conftest.err conftest.$ac_objext \ LIBS=$PLUGIN_NVPTX_save_LIBS case $PLUGIN_NVPTX in nvptx*) - PLUGIN_NVPTX=0 - as_fn_error "CUDA driver package required for nvptx support" "$LINENO" 5 - ;; + if test "x$CUDA_DRIVER_INCLUDE" = x \ + && test "x$CUDA_DRIVER_LIB" = x; then + PLUGIN_NVPTX=1 + PLUGIN_NVPTX_CPPFLAGS='-I$(srcdir)/plugin/cuda' + PLUGIN_NVPTX_LIBS='-ldl' + PLUGIN_NVPTX_DYNAMIC=1 + else + PLUGIN_NVPTX=0 + as_fn_error "CUDA driver package required for nvptx support" "$LINENO" 5 + fi + ;; esac ;; hsa*) @@ -15513,6 +15524,11 @@ cat >>confdefs.h <<_ACEOF #define PLUGIN_NVPTX $PLUGIN_NVPTX _ACEOF + +cat >>confdefs.h <<_ACEOF +#define PLUGIN_NVPTX_DYNAMIC $PLUGIN_NVPTX_DYNAMIC +_ACEOF + if test $PLUGIN_HSA = 1; then PLUGIN_HSA_TRUE= PLUGIN_HSA_FALSE='#' |