Skip to content
Open
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: 1 addition & 1 deletion py/torch_tensorrt/_Device.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def _from_torch_device(cls, torch_dev: torch.device) -> Device:

@classmethod
def _current_device(cls) -> Device:
dev_id = torch.cuda.current_device()
dev_id = torch.cuda.current_device() if torch.cuda.is_available() else 0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

return cls(gpu_id=dev_id)

@staticmethod
Expand Down
6 changes: 6 additions & 0 deletions py/torch_tensorrt/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,24 @@ def is_tensorrt_version_supported(min_version: str) -> bool:


def is_tegra_platform() -> bool:
if not torch.cuda.is_available():
return False
if torch.cuda.get_device_capability() in [(8, 7), (7, 2)]:
return True
return False


def is_orin() -> bool:
if not torch.cuda.is_available():
return False
if torch.cuda.get_device_capability() in [(8, 7)]:
return True
return False


def is_thor() -> bool:
if not torch.cuda.is_available():
return False
if torch.cuda.get_device_capability() in [(11, 0)]:
return True
return False
Expand Down
2 changes: 2 additions & 0 deletions py/torch_tensorrt/dynamo/_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,6 @@


def default_device() -> Device:
if not torch.cuda.is_available():
return Device(gpu_id=0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it gpu_id=0 instead of cpu?

return Device(gpu_id=torch.cuda.current_device())
Loading