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 19, 2024
1 parent d0ea5cc commit 92be233
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 @@ -252,6 +252,14 @@ def use_spmd(auto: Optional[bool] = False):
if auto:
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.initializer import initialize
initialize()
except ImportError:
pass


def is_spmd():
Expand Down

0 comments on commit 92be233

Please sign in to comment.