Skip to content

Commit 5204853

Browse files
committed
Find libcuda.so automatically if --with-cuda-lib is not passed.
Finding CUDA libraries without having to specify both --with-cuda and --with-cuda-lib was requested in github issue #12264 Signed-off-by: Nick Sarkauskas <[email protected]>
1 parent aa2e117 commit 5204853

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

config/opal_check_cuda.m4

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,18 @@ AC_ARG_WITH([cuda],
5050
[AS_HELP_STRING([--with-cuda(=DIR)],
5151
[Build cuda support, optionally adding DIR/include])])
5252
AC_MSG_CHECKING([if --with-cuda is set])
53+
54+
# Search for libcuda.so in $with_cuda if the user didn't pass --with-cuda-libdir
55+
# Otherwise check for cuda in the default path, /usr/local/cuda. If the default
56+
# path doesn't exist, set with_cuda_libdir to empty.
5357
AC_ARG_WITH([cuda-libdir],
5458
[AS_HELP_STRING([--with-cuda-libdir=DIR],
55-
[Search for CUDA libraries in DIR])])
59+
[Search for CUDA libraries in DIR])],
60+
[],
61+
[AS_IF([test -d "$with_cuda"],
62+
[with_cuda_libdir=$(dirname $(find $with_cuda -name libcuda.so))],
63+
[with_cuda_libdir=$(dirname $(find /usr/local/cuda -name libcuda.so))])
64+
])
5665
5766
# Note that CUDA support is off by default. To turn it on, the user has to
5867
# request it. The user can just ask for --with-cuda and it that case we

0 commit comments

Comments
 (0)