diff --git a/cmake/thirdparty/get_legion.cmake b/cmake/thirdparty/get_legion.cmake index 71ce33fb1e..7a0ee42d33 100644 --- a/cmake/thirdparty/get_legion.cmake +++ b/cmake/thirdparty/get_legion.cmake @@ -173,6 +173,7 @@ function(find_or_configure_legion) message(VERBOSE "legate.core: Legion git_branch: ${git_branch}") message(VERBOSE "legate.core: Legion exclude_from_all: ${exclude_from_all}") + set(ENV{CUDA_BIN_PATH} "${CUDAToolkit_LIBRARY_ROOT}") rapids_cpm_find(Legion ${version} ${FIND_PKG_ARGS} CPM_ARGS ${legion_cpm_git_args} @@ -200,6 +201,10 @@ function(find_or_configure_legion) ) endif() + if (NOT CUDA_TOOLKIT_ROOT_DIR STREQUAL CUDAToolkit_LIBRARY_ROOT) + message(FATAL_ERROR "Legion CUDA root ${CUDA_TOOLKIT_ROOT_DIR} differs from Legate's CUDA root ${CUDAToolkit_LIBRARY_ROOT}") + endif() + set(Legion_USE_CUDA ${Legion_USE_CUDA} PARENT_SCOPE) set(Legion_USE_OpenMP ${Legion_USE_OpenMP} PARENT_SCOPE) set(Legion_USE_Python ${Legion_USE_Python} PARENT_SCOPE) diff --git a/install.py b/install.py index 25bf4e7992..6cb842ee50 100755 --- a/install.py +++ b/install.py @@ -23,6 +23,7 @@ import subprocess import sys from distutils import sysconfig +from pathlib import Path # Flush output on newlines sys.stdout.reconfigure(line_buffering=True) @@ -344,6 +345,17 @@ def validate_path(path): ucx_dir = validate_path(ucx_dir) thrust_dir = validate_path(thrust_dir) + if cuda_dir is not None: + nvcc_matches = list(Path(cuda_dir).rglob("nvcc")) + if len(nvcc_matches) == 0: + sys.exit(f"No valid nvcc found in root {cuda_dir}") + elif len(nvcc_matches) > 1: + sys.exit(f"Multiple nvcc found in root {cuda_dir}: {nvcc_matches}") + + cuda_compiler = nvcc_matches[0] + else: + cuda_compiler = None + if verbose: print("legate_core_dir: ", legate_core_dir) print("cuda_dir: ", cuda_dir) @@ -454,7 +466,13 @@ def validate_path(path): if conduit: cmake_flags += [f"-DGASNet_CONDUIT={conduit}"] if cuda_dir: - cmake_flags += [f"-DCUDAToolkit_ROOT={cuda_dir}"] + cmake_flags += [ + f"-DCUDAToolkit_ROOT={cuda_dir}", + ] + if cuda_compiler: + cmake_flags += [ + f"-DCMAKE_CUDA_COMPILER={cuda_compiler}", + ] if thrust_dir: cmake_flags += [f"-DThrust_ROOT={thrust_dir}"] if legion_dir: