Comments (2)
@awgu I thought a bit about this, the recovery math can be quite complicated in N-D scenarios, even for 2-D/3-D it seems non-trival amount of code. I'm wondering if we should do the way we do for things like device_type
, when user want to construct a device mesh from a pg, they also need to tell us a bit more about their subpg structures by passing in a mesh_tensor
in addition to device_type
, then under the hood we just do some simple validations to make sure the pg_ranks
are the same as the mesh_tensor dimension values.
The mesh tensor dim values can be easily derived similar to this https://github.com/pytorch/pytorch/blob/main/torch/distributed/device_mesh.py#L289
from pytorch.
I am not clear how to recover the mesh
tensor from the process groups in the general case. Each rank can get the ranks of the process groups passed to it, but to recover the mesh, we need to do some math.
For example, if we have mesh = torch.arange(32).view(4, 8)
, then rank 0 sees inter-node PG with ranks (0, 8, 16, 24)
and intra-node PG with ranks (0, 1, 2, 3, 4, 5, 6, 7)
. We can see that the intra-node (0, 1, 2, 3, 4, 5, 6, 7)
increments by 1 each time and use that to fill out the ranks along each element in (0, 8, 16, 24)
to get back mesh
.
Now, if we have say mesh = torch.arange(128).view(4, 4, 8)
, where the rightmost dim is excluded (e.g. 8-way TP with (4, 4)-way HSDP)), then rank 0 sees "intra-node" ranks (0, 8, 16, 24)
and "inter-node" ranks (0, 32, 64, 96)
. We can similarly see that (0, 8, 16, 24)
increments by 8 each time and use that to fill out the ranks along each element in (0, 32, 64, 96)
.
Now, how does this generalize to the user passing in N
process groups?
from pytorch.
Related Issues (20)
- "torch.geqrf" performs differently on cpu and gpu HOT 6
- "torch.matrix_exp" performs differently on cpu and gpu HOT 3
- [cudagraph] simplify usage of how cudagraph dumps debug file
- inplace parameter in dropouts should function as expected regardless of the value of training(or train) paramter
- "torch.unique" performs differently on cpu and gpu HOT 3
- The unexpected behavior of `min()` HOT 1
- The unexpected behavior of `max()` HOT 1
- "torch.orgqr" performs differently on cpu and gpu HOT 2
- Can you please intergrate the SReLU activation functions into pytorch?
- When testing the scalar version, test_torchinductor.py will fail
- OOM Message is truncated
- Third party LICENSE collection error when build wheel package
- _convert_input_to_fake doesn't work when there are no inputs
- Give`wait_tensor()` a schema that reflects its side effect HOT 3
- torch.onnx.dynamo_export nn.Bilinear's aten._trilinear HOT 1
- The significant difference between the outputs of torch.reciprocal running on cpu and gpu
- One complex number or boolean value of a 1D or more D tensor with `argmin()` and `dim=` works HOT 1
- One complex number or boolean value of a 1D or more D tensor with `argmax()` and `dim=` works HOT 1
- error: call to non-‘constexpr’ function
- using pykan i met this error. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch.