Skip to content

Commit a166ad7

Browse files
authored
Merge pull request #12378 from nsarka/nsarka/cuda-aware-ompi-find-libs-automatically
Find libcuda.so automatically if --with-cuda-lib is not passed
2 parents 4847e41 + cad3d9a commit a166ad7

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) 2> /dev/null)],
63+
[with_cuda_libdir=$(dirname $(find /usr/local/cuda -name libcuda.so) 2> /dev/null)])
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)