Skip to content

Commit

Permalink
Introduce multi-node SPMD initialization for Neuron
Browse files Browse the repository at this point in the history
  • Loading branch information
rpsilva-aws committed Sep 20, 2024
1 parent d0ea5cc commit fd39924
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions torch_xla/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ def use_spmd(auto: Optional[bool] = False):
torch_xla._XLAC._xla_set_auto_sharding()
os.environ["XLA_AUTO_SPMD"] = "1"

if os.environ[xenv.PJRT_DEVICE] == 'NEURON':
# In case of Neuron, retrigger the PJRT initialization if possible.
try:
from torch_neuronx.initialization import initialize
initialize()
except ImportError:
pass


def is_spmd():
"""Returns if SPMD is set for execution."""
Expand Down

0 comments on commit fd39924

Please sign in to comment.