Skip to content

Commit

Permalink
Part 1: Introduce multi-node SPMD support for Neuron (#8204) (#8224)
Browse files Browse the repository at this point in the history
Co-authored-by: Rui <[email protected]>
  • Loading branch information
jeffhataws and rpsilva-aws authored Oct 7, 2024
1 parent ee0f159 commit fbede65
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions torch_xla/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,15 @@ def use_spmd(auto: Optional[bool] = False):
torch_xla._XLAC._xla_set_auto_sharding()
os.environ["XLA_AUTO_SPMD"] = "1"

if device_type() == 'NEURON':
# In case of Neuron, reset the initialization environment to accommodate SPMD.
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 fbede65

Please sign in to comment.