Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ config.mk
.vscode
_cmake_test_compile
!cmake/versions.json
legate.core.code-workspace

3 changes: 2 additions & 1 deletion legate/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
#
from __future__ import annotations

from ..rc import check_legion, parse_command_args
from ..rc import check_legion
from ..util.args import parse_library_command_args

check_legion()

Expand Down
5 changes: 2 additions & 3 deletions legate/core/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@

from legion_top import add_cleanup_item, top_level

from legate.rc import ArgSpec, Argument, parse_command_args

from ..util.args import ArgSpec, Argument, parse_library_command_args
from . import ffi # Make sure we only have one ffi instance
from . import (
Fence,
Expand Down Expand Up @@ -855,7 +854,7 @@ def __init__(self, core_library: CoreLib) -> None:
focus on implementing their domain logic.
"""

self._args = parse_command_args("legate", ARGS)
self._args = parse_library_command_args("legate", ARGS)

try:
self._legion_context = top_level.context[0]
Expand Down
1 change: 0 additions & 1 deletion legate/driver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@
from .driver import Driver
from .launcher import Launcher
from .main import main
from .system import System
2 changes: 1 addition & 1 deletion legate/driver/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser

from ..util.types import LauncherType
from . import defaults
from .types import LauncherType

__all__ = ("parser",)

Expand Down
6 changes: 3 additions & 3 deletions legate/driver/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

from typing import TYPE_CHECKING

from .ui import warn
from ..util.ui import warn

if TYPE_CHECKING:
from ..util.system import System
from ..util.types import CommandPart
from .config import Config
from .launcher import Launcher
from .system import System
from .types import CommandPart

__all__ = ("CMD_PARTS",)

Expand Down
10 changes: 7 additions & 3 deletions legate/driver/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
from pathlib import Path
from typing import Any

from ..util.types import (
ArgList,
DataclassMixin,
LauncherType,
object_to_dataclass,
)
from ..util.ui import warn
from .args import parser
from .types import ArgList, DataclassMixin, LauncherType
from .ui import warn
from .util import object_to_dataclass

__all__ = ("Config",)

Expand Down
62 changes: 57 additions & 5 deletions legate/driver/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,22 @@
#
from __future__ import annotations

from shlex import quote
from subprocess import run
from textwrap import indent
from typing import TYPE_CHECKING

from ..util.system import System
from ..util.ui import kvtable, rule, section, value, warn
from .command import CMD_PARTS
from .config import Config
from .launcher import Launcher
from .logs import process_logs
from .system import System
from .types import Command, EnvDict
from .ui import warn
from .util import print_verbose

__all__ = ("Driver",)
if TYPE_CHECKING:
from ..util.types import Command, EnvDict

__all__ = ("Driver", "print_verbose")

_DARWIN_GDB_WARN = """\
You must start the debugging session with the following command,
Expand Down Expand Up @@ -113,3 +117,51 @@ def _darwin_gdb_warn(self) -> None:
)
)
)


def print_verbose(
system: System,
driver: Driver | None = None,
) -> None:
"""Print system and driver configuration values.

Parameters
----------
system : System
A System instance to obtain Legate and Legion paths from

driver : Driver or None, optional
If not None, a Driver instance to obtain command invocation and
environment from (default: None)

Returns
-------
None

"""

print(f"\n{rule('Legion Python Configuration')}")

print(section("\nLegate paths:"))
print(indent(str(system.legate_paths), prefix=" "))

print(section("\nLegion paths:"))
print(indent(str(system.legion_paths), prefix=" "))

if driver:
print(section("\nCommand:"))
cmd = " ".join(quote(t) for t in driver.cmd)
print(f" {value(cmd)}")

if keys := sorted(driver.custom_env_vars):
print(section("\nCustomized Environment:"))
print(
indent(
kvtable(driver.env, delim="=", align=False, keys=keys),
prefix=" ",
)
)

print(f"\n{rule()}")

print(flush=True)
13 changes: 8 additions & 5 deletions legate/driver/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@
import os
import sys
from pathlib import Path
from typing import TYPE_CHECKING

from .config import Config
from .system import System
from .types import Command, EnvDict, LauncherType
from .ui import warn
from .util import read_c_define
from ..util.fs import read_c_define
from ..util.ui import warn

if TYPE_CHECKING:
from ..util.system import System
from ..util.types import Command, EnvDict, LauncherType
from .config import Config

__all__ = ("Launcher",)

Expand Down
14 changes: 8 additions & 6 deletions legate/driver/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
from contextlib import contextmanager
from shlex import quote
from subprocess import run
from typing import Iterator
from typing import TYPE_CHECKING, Iterator

from .config import Config
from .launcher import Launcher
from .system import System
from .types import Command
from .ui import warn
from ..util.ui import warn

if TYPE_CHECKING:
from ..util.system import System
from ..util.types import Command
from .config import Config
from .launcher import Launcher

__all__ = (
"DebuggingHandler",
Expand Down
7 changes: 4 additions & 3 deletions legate/driver/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ def main(argv: list[str]) -> int:
int, a process return code

"""
from . import Config, Driver, System
from .ui import error
from .util import print_verbose
from ..util.system import System
from ..util.ui import error
from . import Config, Driver
from .driver import print_verbose

try:
config = Config(argv)
Expand Down
Loading