Skip to content
Merged
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
12 changes: 12 additions & 0 deletions torch_xla/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ def _summarize_fn_tracker():
os.remove(_tmp_fname)


def _aws_ec2_inf_trn_init():
try:
from torch_neuronx import xla
except ImportError:
return
else:
xla.init()


def _setup_tpu_vm_library_path() -> bool:
"""Returns true if $TPU_LIBRARY is set or can be inferred.

Expand Down Expand Up @@ -110,6 +119,9 @@ def _setup_tpu_vm_library_path() -> bool:

_found_libtpu = _setup_tpu_vm_library_path()

# Setup Neuron library for AWS EC2 inf/trn instances.
_aws_ec2_inf_trn_init()


def _prepare_to_exit():
_XLAC._prepare_to_exit()
Expand Down