Repository navigation
[DONOTMERGE] POC for Ray+torch.distributed - #51078
stephanie-wang wants to merge 11 commits into
Conversation
Signed-off-by: Stephanie wang <[email protected]>
Signed-off-by: Stephanie wang <[email protected]>
…TOR error type Signed-off-by: Stephanie wang <[email protected]>
…orking Signed-off-by: Stephanie wang <[email protected]>
Signed-off-by: Stephanie wang <[email protected]>
Signed-off-by: Stephanie wang <[email protected]>
Signed-off-by: Stephanie wang <[email protected]>
Signed-off-by: Stephanie wang <[email protected]>
Signed-off-by: Stephanie wang <[email protected]>
|
|
||
| if __name__ == "__main__": | ||
| actors = [Actor.remote() for _ in range(WORLD_SIZE)] | ||
| ray.get([a.ping.remote() for a in actors]) |
| init_method = "tcp://localhost:8889" | ||
| ray.get([actor.setup.remote(WORLD_SIZE, rank, init_method) for rank, actor in enumerate(actors)]) | ||
| actor_ids = [actor._ray_actor_id for actor in actors] | ||
| ray._private.worker.global_worker.core_worker.register_actor_nccl_group(actor_ids) |
There was a problem hiding this comment.
driver knows the (actor id -> rank) mapping
|
|
||
| shape = (100, ) | ||
|
|
||
| ref = actors[0].randn.remote(shape) |
There was a problem hiding this comment.
actors[0] is sender, and actors[1] is receiver.
| @@ -4362,6 +4423,8 @@ cdef class CoreWorker: | |||
| task_output_inlined_bytes = 0 | |||
| i = -1 | |||
| for i, output in enumerate(outputs): | |||
There was a problem hiding this comment.
Step 1: after the sender finishes task executions, it needs to handle the output. If the output is tensor,
(1) Store the tensor in in_actor_object_store.
(2) Return RayActorObjectMetadata to driver and only serialize the RayActorObjectMetadata (shape, dtype, src_rank, obj_id(?))
(3) Return error code OBJECT_IN_ACTOR.
| # Replace with OBJECT_IN_ACTOR metadata, so that the driver can | ||
| # see that this object is actually stored on the actor. | ||
| metadata_str = str(ray.core.generated.common_pb2.ErrorType.OBJECT_IN_ACTOR) | ||
| # TODO: |
| else: | ||
| actor_id = None | ||
| return ActorUnavailableError(error_info.error_message, actor_id) | ||
| elif error_type == ErrorType.Value( |
There was a problem hiding this comment.
The receiver task execution handler reads the data from in_actor_object_store which is NCCL recv by fetch_p2p_dependency_handler.
| self._task_id_to_future = {} | ||
| self.event_loop_executor = None | ||
|
|
||
| def register_actor_nccl_group(self, actor_ids): |
There was a problem hiding this comment.
Used in test_gpu.py. This should not be called by users in the future.
| std::unordered_map<ObjectID, std::shared_ptr<Buffer>> TaskSpecification::GetInActorDependenciesMetadata() const { | ||
| std::unordered_map<ObjectID, std::shared_ptr<Buffer>> deps; | ||
| for (const auto &dep : message_->in_actor_dependencies()) { | ||
| deps[ObjectID::FromBinary(dep.object_id())] = std::make_shared<LocalMemoryBuffer>(reinterpret_cast<const uint8_t *>(dep.metadata().data()), dep.metadata().size()); |
There was a problem hiding this comment.
metadata = RayActorObjectMetadata
| const auto it = in_actor_dependencies_metadata.find(task.ArgId(i)); | ||
| RAY_CHECK(it != in_actor_dependencies_metadata.end()); | ||
| data = it->second; | ||
| metadata = std::make_shared<LocalMemoryBuffer>(const_cast<uint8_t *>(task.ArgMetadata(i)), |
There was a problem hiding this comment.
RayActorObjectMetadata this is passed to task_execution_handler by args, and then Cython can use the src_rank from metadata to call NCCL recv.
| RAY_LOG(INFO) << "Adding IN_ACTOR dep " << id << " to task " << task.TaskId(); | ||
| // Add the IN_ACTOR error as the metadata value. | ||
| RAY_CHECK(it->second->HasMetadata()); | ||
| const auto &metadata = it->second->GetMetadata(); |
There was a problem hiding this comment.
Metadata here is OBJECT_IN_ACTOR, and the data is RayActorObjectMetadata. This is called by driver.
Signed-off-by: Stephanie wang <[email protected]>
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
|
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
|
This pull request has been automatically closed because there has been no more activity in the 14 days Please feel free to reopen or open a new pull request if you'd still like this to be addressed. Again, you can always ask for help on our discussion forum or Ray's public slack channel. Thanks again for your contribution! |
Why are these changes needed?
Related issue number
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.