Skip to content

Commit db10da9

Browse files
authored
Merge pull request #4257 from jsquyres/pr/moar-hwloc-cuda-cleanup
hwloc2a/configure.m4: be more careful in with_cuda->enable_cuda
2 parents e28cc8c + 2ec2a32 commit db10da9

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

opal/mca/hwloc/hwloc2a/configure.m4

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,36 @@ AC_DEFUN([MCA_opal_hwloc_hwloc2a_CONFIG],[
124124

125125
# Per https://github.com/open-mpi/ompi/issues/4219, if
126126
# --without-cuda was specified, be sure to disable it in hwloc,
127-
# too. Note that hwloc uses --disable-cuda, so just set
128-
# enable_cuda=$with_cuda to get the same value that was passed in
129-
# via the top-level --with-cuda CLI option.
130-
enable_cuda=$with_cuda
131-
132-
# Disable NVML support if CUDA support is not built
133-
AS_IF([test "$opal_check_cuda_happy" != "yes"],
134-
[enable_nvml=no])
127+
# too. Note that hwloc uses --disable-cuda (i.e., a yes or no
128+
# value), whereas we use --with-cuda here in Open MPI (i.e., a
129+
# yes, no, or path value). Need to translate appropriately.
130+
#
131+
# Set enable_cuda to yes if:
132+
#
133+
# 1. --with-cuda was specified (i.e., a human specifically asked
134+
# for it)
135+
# 2. --with-cuda=blah was specified (i.e., a human specifically
136+
# asked for it)
137+
# 3. --with-cuda was not specified, but Open MPI is building CUDA
138+
# support
139+
#
140+
# Set enable_cuda to no in all other cases. This logic could be
141+
# compressed into a smaller set of if tests, but for readability /
142+
# clarity, I left it expanded.
143+
AC_MSG_CHECKING([for hwloc --enable-cuda value])
144+
enable_cuda=no
145+
AS_IF([test "$with_cuda" = "yes"],
146+
[enable_cuda=yes],
147+
[AS_IF([test -n "$with_cuda" && test "$with_cuda" != "no"],
148+
[enable_cuda=yes],
149+
[AS_IF([test "$opal_check_cuda_happy" = "yes"],
150+
[enable_cuda=yes])
151+
])
152+
])
153+
AC_MSG_RESULT(["$enable_cuda"])
154+
155+
# Open MPI currently does not use hwloc's NVML support
156+
enable_nvml=no
135157

136158
# hwloc checks for compiler visibility, and its needs to do
137159
# this without "picky" flags.

0 commit comments

Comments
 (0)