From ff8c44785910c9a42665e5056e7e5c31861b82d1 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 5 Apr 2023 10:36:17 -0700 Subject: [PATCH 1/2] fix cuda paths for non-default cuda locations --- cmake/thirdparty/get_legion.cmake | 5 +++++ install.py | 14 +++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) 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..4d2a1383c1 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,14 @@ def validate_path(path): ucx_dir = validate_path(ucx_dir) thrust_dir = validate_path(thrust_dir) + 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] + if verbose: print("legate_core_dir: ", legate_core_dir) print("cuda_dir: ", cuda_dir) @@ -454,7 +463,10 @@ 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}", + f"-DCMAKE_CUDA_COMPILER={cuda_compiler}", + ] if thrust_dir: cmake_flags += [f"-DThrust_ROOT={thrust_dir}"] if legion_dir: From b581d76696eb71c88a97a3fe5aa08782b9768dc5 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 5 Apr 2023 11:15:21 -0700 Subject: [PATCH 2/2] fix for case where cuda_dir is None --- install.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/install.py b/install.py index 4d2a1383c1..6cb842ee50 100755 --- a/install.py +++ b/install.py @@ -345,13 +345,16 @@ def validate_path(path): ucx_dir = validate_path(ucx_dir) thrust_dir = validate_path(thrust_dir) - 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] + 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) @@ -465,6 +468,9 @@ def validate_path(path): if cuda_dir: cmake_flags += [ f"-DCUDAToolkit_ROOT={cuda_dir}", + ] + if cuda_compiler: + cmake_flags += [ f"-DCMAKE_CUDA_COMPILER={cuda_compiler}", ] if thrust_dir: