ray icon indicating copy to clipboard operation
ray copied to clipboard

[Collective] Ray Collective Doc Declarative Style Doesn't work

Open OrenLeung opened this issue 2 years ago • 3 comments

Description

Ray Collective Doc Declarative Style Doesn't work

Suggestion

update docs from the removed declare_collective_group to the create_collective_group

example of proper usage https://github.com/ray-project/ray/blob/7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065/python/ray/util/collective/examples/nccl_allreduce_example_declare_collective_group.py#L7-L33

Error Trace:

Traceback (most recent call last):
  File "$PATH/ray_collective.py", line 48, in <module>
    collective.declare_collective_group(workers, **_options)
AttributeError: module 'ray.util.collective' has no attribute 'declare_collective_group'. Did you mean: 'create_collective_group'?
import ray
import ray.util.collective as collective

import cupy as cp


@ray.remote(num_gpus=1)
class Worker:
   def __init__(self):
       self.send = cp.ones((4, ), dtype=cp.float32)
       self.recv = cp.zeros((4, ), dtype=cp.float32)

   def setup(self, world_size, rank):
       collective.init_collective_group(world_size, rank, "nccl", "default")
       return True

   def compute(self):
       collective.allreduce(self.send, "default")
       return self.send

   def destroy(self):
       collective.destroy_group()

num_workers = 2
workers = []
init_rets = []

# declarative
for i in range(num_workers):
   w = Worker.remote()
   workers.append(w)
_options = {
   "group_name": "177",
   "world_size": 2,
   "ranks": [0, 1],
   "backend": "nccl"
}
collective.declare_collective_group(workers, **_options)
results = ray.get([w.compute.remote() for w in workers])

Link

https://docs.ray.io/en/latest/ray-more-libs/ray-collective.html

OrenLeung avatar Sep 13 '22 16:09 OrenLeung

Hi, I'm a bot from the Ray team :)

To help human contributors to focus on more relevant issues, I will automatically add the stale label to issues that have had no activity for more than 4 months.

If there is no further activity in the 14 days, the issue will be closed!

  • If you'd like to keep the issue open, just leave any comment, and the stale label will be removed!
  • If you'd like to get more attention to the issue, please tag one of Ray's contributors.

You can always ask for help on our discussion forum or Ray's public slack channel.

stale[bot] avatar Jan 21 '23 21:01 stale[bot]

Plz keep open

OrenLeung avatar Jan 22 '23 03:01 OrenLeung

Hi, I'm a bot from the Ray team :)

To help human contributors to focus on more relevant issues, I will automatically add the stale label to issues that have had no activity for more than 4 months.

If there is no further activity in the 14 days, the issue will be closed!

  • If you'd like to keep the issue open, just leave any comment, and the stale label will be removed!
  • If you'd like to get more attention to the issue, please tag one of Ray's contributors.

You can always ask for help on our discussion forum or Ray's public slack channel.

stale[bot] avatar Jun 10 '23 08:06 stale[bot]

Hi again! The issue will be closed because there has been no more activity in the 14 days since the last message.

Please feel free to reopen or open a new issue if you'd still like it to be addressed.

Again, you can always ask for help on our discussion forum or Ray's public slack channel.

Thanks again for opening the issue!

stale[bot] avatar Aug 12 '23 14:08 stale[bot]

Until 2024, the docs still not update yet...

duanzhaol avatar Apr 11 '24 03:04 duanzhaol