Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advice on sharding for data parallelism #566

Open
DBraun opened this issue Aug 24, 2024 · 1 comment
Open

Advice on sharding for data parallelism #566

DBraun opened this issue Aug 24, 2024 · 1 comment

Comments

@DBraun
Copy link

DBraun commented Aug 24, 2024

I'm using code similar to the 8-way batch data parallelism example here: https://jax.readthedocs.io/en/latest/notebooks/Distributed_arrays_and_automatic_parallelization.html#way-batch-data-parallelism

mesh = Mesh(mesh_utils.create_device_mesh((8,)), 'batch')
sharding = NamedSharding(mesh, P('batch'))
replicated_sharding = NamedSharding(mesh, P())
batch = jax.device_put(batch, sharding)

So I think if batch is shaped (B, H, W, C) like an image, then if B is a multiple of 8, then the data is nicely distributed among the 8 devices. Is Grain able to prepare a batch like this? I haven't been able to figure it out from looking at the ShardOptions.

@DBraun
Copy link
Author

DBraun commented Nov 13, 2024

Is there a solution with ShardByJaxProcess?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant