Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
| if key in self.storage_dict: | ||
| del self.storage_dict[key] | ||
|
|
||
| @StorageClientFactory.register("RAY") |
There was a problem hiding this comment.
| @StorageClientFactory.register("RAY") | |
| @StorageClientFactory.register("RayStorageClient") |
| except ValueError: | ||
| self.storage_actor = RayObjectRefStorage.options( | ||
| name="RayObjectRefStorage", | ||
| lifetime="detached", |
There was a problem hiding this comment.
will this actor still exist even after the current training task ends, and interferes with new training tasks?
There was a problem hiding this comment.
maybe we don't need to explicitly define lifetime="detached", since there always are som client that holds its reference
There was a problem hiding this comment.
It was found during the test that it did cause interference. It has now been removed.
| if isinstance(v, torch.Tensor) and v.is_cuda and self.use_gpu: | ||
| # GPU Tensor → use NIXL | ||
| ref = ray.put(v, _tensor_transport="nixl") | ||
| else: |
There was a problem hiding this comment.
what if this is a gpu tensor while self.use_gpu=False? maybe we need a more fine-grained if-else?
There was a problem hiding this comment.
It has been modified. The current logic is that as long as the input is tensors, NIXL will be used, regardless of the device. Thus, RDT can be used in both CPUs and GPUs.
| def __init__(self): | ||
| self.storage_dict = {} | ||
|
|
||
| def put_gpu_obj_ref(self, keys: list[str], gpu_obj_refs: list[ray.ObjectRef]): |
There was a problem hiding this comment.
| def put_gpu_obj_ref(self, keys: list[str], gpu_obj_refs: list[ray.ObjectRef]): | |
| def put_obj_ref(self, keys: list[str], gpu_obj_refs: list[ray.ObjectRef]): |
| for key, gpu_obj_ref in zip(keys, gpu_obj_refs): | ||
| self.storage_dict[key] = gpu_obj_ref | ||
|
|
||
| def get_gpu_obj_ref(self, keys: list[str]) -> list[ray.ObjectRef]: |
There was a problem hiding this comment.
| def get_gpu_obj_ref(self, keys: list[str]) -> list[ray.ObjectRef]: | |
| def get_obj_ref(self, keys: list[str]) -> list[ray.ObjectRef]: |
| obj_refs = [self.storage_dict.get(key, None) for key in keys] | ||
| return obj_refs | ||
|
|
||
| def clear_gpu_obj_ref(self, keys: list[str]): |
There was a problem hiding this comment.
| def clear_gpu_obj_ref(self, keys: list[str]): | |
| def clear_obj_ref(self, keys: list[str]): |
| if not isinstance(keys, list): | ||
| raise ValueError(f"keys must be a list, but got {type(keys)}") | ||
|
|
||
| gpu_obj_refs = ray.get(self.storage_actor.get_gpu_obj_ref.remote(keys)) |
There was a problem hiding this comment.
see above comments; we need to change the name
| await self.notify_data_update(list(data.keys()), metadata.global_indexes, per_field_dtypes, per_field_shapes) | ||
| # await self.notify_data_update(list(data.keys()), metadata.global_indexes, per_field_dtypes, per_field_shapes) | ||
| await self.notify_data_update( | ||
| partition_id=metadata.samples[0].partition_id if metadata.samples else "unknown", |
There was a problem hiding this comment.
we'd better tackle metadata.samples == None at the beginning
There was a problem hiding this comment.
This part of the code has been modified by other PRs and has been updated.
| from transfer_queue.storage.managers.base import KVStorageManager | ||
| from transfer_queue.storage.managers.factory import TransferQueueStorageManagerFactory | ||
|
|
||
| @TransferQueueStorageManagerFactory.register("RAY") |
There was a problem hiding this comment.
| @TransferQueueStorageManagerFactory.register("RAY") | |
| @TransferQueueStorageManagerFactory.register("RayKVStorageManager") |
| from transfer_queue.storage.managers.factory import TransferQueueStorageManagerFactory | ||
|
|
||
| @TransferQueueStorageManagerFactory.register("RAY") | ||
| class RayKVStorageManager(KVStorageManager): |
There was a problem hiding this comment.
why we need a dedicated RayKVStorageManager, rather than using KVStorageManager?
There was a problem hiding this comment.
We hope the KVStorageManager acts as a general class for all KV based storage backend
There was a problem hiding this comment.
RayKVStorageManager has been removed and replaced with KVStorageManager.
| from transfer_queue.storage.managers.factory import TransferQueueStorageManagerFactory # noqa: E402 | ||
|
|
||
|
|
||
| @TransferQueueStorageManagerFactory.register("KV") |
There was a problem hiding this comment.
| @TransferQueueStorageManagerFactory.register("KV") | |
| @TransferQueueStorageManagerFactory.register("KVStorageManager") |
Summary
Implemented the class RayStorageClient and tested on the cpu using object_store (requires using NIXL on GPUs further testing)
Change
Added
transfer_queue/storage/clients/ray_storage_clients.py: Added classes RayStorageClient and RayGpuObjectRefStorage, encapsulating the invocation of the NIXL transport interface used in Ray.Add p2p tests:
tests/test_ray_p2p.py.Testing
Test RayStorageClient on CPU (Requires installing ray >= 2.50):
python tests/test_ray_p2p.pyRelated Links
Issue: [Feat]: Add general key-value storage interface (KVStorageManager) & yuanrong storage backend
Ray-RDT: Ray Direct Transport Usage with NIXL (CPUs or NVIDIA GPUs)
Previous issues can be viewed: [Feat]: Add RayStorageClient to support the RDT feature of Ray
TODO
Summary by CodeRabbit
New Features
Tests