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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Changed :func:`~isaaclab.app.launch_simulation` to warn when it runs on the CPU because ``--device`` was not
given on macOS.
3 changes: 3 additions & 0 deletions source/isaaclab/isaaclab/app/sim_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,9 @@ def launch_simulation(

# Resolve the device before any launcher or physics init: --device, else this rank's GPU, else the config's.
_resolve_distributed_device(args)
if sys.platform == "darwin" and args.get("device") == "cpu" and not args.get("device_explicit", False):
# the --device default on macOS, which has no CUDA
logger.warning("No --device given; using 'cpu' because macOS has no CUDA.")
if sim_cfg is not None:
args["device"] = args.get("device") or sim_cfg.device
# Decide the visualizers once, into the SimulationCfg.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Changed the ``--device`` default to ``cpu`` on macOS, which has no CUDA, so commands run without passing
``--device cpu``. Other platforms still default to ``cuda:0``.
12 changes: 8 additions & 4 deletions source/isaaclab_physx/isaaclab_physx/app/kit_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def _sanitize_sys_argv_for_kit(argv: list[str]) -> list[str]:
class _StoreAndMarkExplicit(argparse.Action):
"""Store the value and set ``<dest>_explicit``, for options whose default must stay a real value.

``--device`` defaults to ``"cuda:0"`` because scripts read ``args_cli.device`` before launch, yet XR
needs to know whether it was passed (see :meth:`KitLauncher._resolve_device_settings`).
``--device`` defaults to ``"cuda:0"`` (``"cpu"`` on macOS) because scripts read ``args_cli.device`` before
launch, yet XR needs to know whether it was passed (see :meth:`KitLauncher._resolve_device_settings`).
"""

def __call__(self, parser, namespace, values, option_string=None):
Expand Down Expand Up @@ -358,8 +358,12 @@ def add_launcher_args(parser: argparse.ArgumentParser) -> None:
"--device",
type=str,
action=_StoreAndMarkExplicit,
default="cuda:0",
help='The device to run the simulation on. Can be "cpu", "cuda", "cuda:N", where N is the device ID',
# macOS has no CUDA; checked without importing torch, which must load after Kit
default="cpu" if sys.platform == "darwin" else "cuda:0",
help=(
'The device to run the simulation on. Can be "cpu", "cuda", "cuda:N", where N is the device ID.'
' Defaults to "cuda:0", or "cpu" on macOS.'
),
)
arg_group.add_argument(
"--visualizer",
Expand Down
Loading