Skip to content

DRAFT: Add suggested fixes for known build errors #599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: branch-24.03
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 50 additions & 3 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,32 @@
import shutil
import subprocess
import sys
from typing import Callable, Optional, Tuple

# Flush output on newlines
sys.stdout.reconfigure(line_buffering=True)


class bcolors:
OKGREEN = "\033[92m"
WARNING = "\033[93m"
FAIL = "\033[91m"
ENDC = "\033[0m"


CUDA_PATH_ERROR_RE = (
r"The\s+following\s+variables\s+are\s+used\s+in\s+this\s+project,\s+but"
r"\s+they\s+are\s+set\s+to\s+NOTFOUND.\s+Please\s+set\s+them\s+or\s+make"
r"\s+sure\s+they\s+are\s+set\s+and\s+tested\s+correctly\s+in\s+the\s+CMake"
r"\s+files:\s+CUDA_CUDA_LIBRARY\s+\(ADVANCED"
)

CUDA_PATH_ERROR_MESSAGE = """
The most likely error is Legion's FindCUDA failing to find the CUDA libraries.
This can usually be fixed by setting CUDA_PATH in the environment.
For most systems, this will be CUDA_PATH=/usr/local/cuda/lib64/stubs.
"""

os_name = platform.system()

if os_name == "Linux":
Expand Down Expand Up @@ -76,10 +98,21 @@ def __call__(self, parser, namespace, values, option_string):
setattr(namespace, self.dest, not option_string.startswith("--no"))


def execute_command(args, verbose, **kwargs):
def execute_command(
args, verbose, suggested_fixes: Optional[Tuple[Callable]] = None, **kwargs
):
if verbose:
print('Executing: "', " ".join(args), '" with ', kwargs)
subprocess.check_call(args, **kwargs)
try:
output = subprocess.check_output(
args, stderr=subprocess.STDOUT, **kwargs
).decode("utf-8")
for fix in suggested_fixes:
fix(output)
except subprocess.CalledProcessError as e:
for fix in suggested_fixes:
fix(e.output.decode("utf-8"))
raise


def scikit_build_cmake_build_dir(skbuild_dir):
Expand Down Expand Up @@ -120,6 +153,14 @@ def was_previously_built_with_different_build_isolation(
return False


def check_cuda_paths_error(output):
import re

match = re.compile(CUDA_PATH_ERROR_RE).search(output)
if match:
print(bcolors.FAIL + CUDA_PATH_ERROR_MESSAGE + bcolors.ENDC)


def install_cunumeric(
arch,
build_isolation,
Expand Down Expand Up @@ -359,7 +400,13 @@ def validate_path(path):
}
)

execute_command(pip_install_cmd, verbose, cwd=cunumeric_dir, env=cmd_env)
execute_command(
pip_install_cmd,
verbose,
cwd=cunumeric_dir,
env=cmd_env,
suggested_fixes=(check_cuda_paths_error,),
)


def driver():
Expand Down