Closed miladm closed 2 months ago
We are supposed to use xr.global_ordinal()
and xr.world_size()
. I will update the http documentation today.
The reasoning for lifting fundamental functionality higher in our API is covered in #6399. torch_xla.core.xla_model
is needlessly verbose.
At this point, one import already gets you access to nearly all basic APIs you actually need to write PyTorch/XLA:
import torch_xla as xla
# Examples
xla.sync()
xla.device()
xla.runtime.world_size()
xla.runtime.global_ordinal()
xla.launch()
The only thing better than having ergonomic APIs is being an invisible backend of upstream PyTorch. For distributed APIs such as rank and world size, the best option is to implement torch.distributed
and just use their APIs (dist.rank
, dist.world_size()
) in 90% of cases, but there is still work to be done there.
Unify the path of get_ordinal
, world_size
in https://github.com/pytorch/xla/pull/7753.
📚 Usability / API / Documentation
Calling
get_ordinal
andworld_size
(1) are inconsistent in the use of their underlying library (2) are being migrated fromxla_model
toruntime
.(1) the two API must come from the same underlying package /
import
(2) there must be a compelling reason why we want to change the user code fromxla_model
torun_time
. Is the reason is compelling, we need a RFC for it. (3) most importantly, we need a proposal to upstream these APIscc @will-cromar