-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Core] Add env var to force using NvidiaGPUAcceleratorManager #49148
Open
HollowMan6
wants to merge
2
commits into
ray-project:master
Choose a base branch
from
HollowMan6:force-nvidia
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PR ray-project#42434 leads to breaks of Ray using AMD GPUs starting from v2.10.0, as an alternative, RAY_EXPERIMENTAL_NOSET_ROCR_VISIBLE_DEVICES is needed to fix: 1. vLLM: https://github.com/vllm-project/vllm/blob/v0.6.4.post1/Dockerfile.rocm#L131-L132 2. DeepSpeed: OpenRLHF/OpenRLHF#524 (comment) 3. One failure of Ray Collective Communication Lib example: https://github.com/ray-project/ray/blob/master/python/ray/util/collective/examples/nccl_allreduce_example.py ```log Traceback (most recent call last): File "nccl_allreduce_example.py", line 33, in <module> send = cp.ones((4,), dtype=cp.float32) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "cupy/cupy/_creation/basic.py", line 183, in ones a = cupy.ndarray(shape, dtype, order=order) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "cupy/_core/core.pyx", line 154, in cupy._core.core.ndarray.__new__ x._init(*args, **kwargs) File "cupy/_core/core.pyx", line 241, in cupy._core.core._ndarray_base._init self.data = memory.alloc(self.size * itemsize) File "cupy/cuda/memory.pyx", line 875, in cupy.cuda.memory.alloc return get_allocator()(size) File "cupy/cuda/memory.pyx", line 1579, in cupy.cuda.memory.MemoryPool.malloc cpdef MemoryPointer malloc(self, size_t size): File "cupy/cuda/memory.pyx", line 1599, in cupy.cuda.memory.MemoryPool.malloc mp = <SingleDeviceMemoryPool>self._pools[device.get_device_id()] File "cupy/cuda/device.pyx", line 40, in cupy.cuda.device.get_device_id return runtime.getDevice() File "cupy_backends/cuda/api/runtime.pyx", line 202, in cupy_backends.cuda.api.runtime.getDevice check_status(status) File "cupy_backends/cuda/api/runtime.pyx", line 146, in cupy_backends.cuda.api.runtime.check_status raise CUDARuntimeError(status) cupy_backends.cuda.api.runtime.CUDARuntimeError: hipErrorNoDevice: no ROCm-capable device is detected ``` However, for Ray Collective Communication Lib example, setting `RAY_EXPERIMENTAL_NOSET_ROCR_VISIBLE_DEVICES` is not enough, as further errors will still happen: ```log Traceback (most recent call last): File "nccl_allreduce_example.py", line 43, in <module> results = ray.get([w.compute.remote() for w in workers]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "ray/_private/auto_init_hook.py", line 21, in auto_init_wrapper return fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "ray/_private/client_mode_hook.py", line 103, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "ray/_private/worker.py", line 2755, in get values, debugger_breakpoint = worker.get_objects(object_refs, timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "ray/_private/worker.py", line 906, in get_objects raise value.as_instanceof_cause() ray.exceptions.RayTaskError(NcclError): ray::Worker.compute() (repr=<nccl_allreduce_example.Worker object at 0x1474faf38dd0>) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "nccl_allreduce_example.py", line 22, in compute collective.allreduce(self.send, "default") File "ray/util/collective/collective.py", line 273, in allreduce g.allreduce([tensor], opts) File "ray/util/collective/collective_group/nccl_collective_group.py", line 197, in allreduce self._collective(tensors, tensors, collective_fn) File "ray/util/collective/collective_group/nccl_collective_group.py", line 604, in _collective comms = self._get_nccl_collective_communicator(key, devices) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "ray/util/collective/collective_group/nccl_collective_group.py", line 451, in _get_nccl_collective_communicator nccl_util.groupEnd() File "cupy_backends/cuda/libs/nccl.pyx", line 210, in cupy_backends.cuda.libs.nccl.groupEnd File "cupy_backends/cuda/libs/nccl.pyx", line 243, in cupy_backends.cuda.libs.nccl.groupEnd File "cupy_backends/cuda/libs/nccl.pyx", line 129, in cupy_backends.cuda.libs.nccl.check_status cupy_backends.cuda.libs.nccl.NcclError: NCCL_ERROR_INVALID_USAGE: invalid usage (run with NCCL_DEBUG=WARN for details) ``` So let’s use an env var to determine if we do want to use AMDGPUAcceleratorManager, so that users can still revert to the behavior we have in v2.9.3 (before ray-project#42434) to get everything running again on AMD GPUs. Signed-off-by: Hollow Man <hollowman@opensuse.org>
HollowMan6
force-pushed
the
force-nvidia
branch
from
December 7, 2024 21:11
1e97c48
to
b1693b4
Compare
8 tasks
HollowMan6
added a commit
to HollowMan6/ray
that referenced
this pull request
Dec 8, 2024
This commits fix an error that is for AMD GPUs only (MI250x) Not exactly sure about the reason, but something goes wrong (probably caused by the side effect of __init__.py file for torch) behind the scenes, and NCCL (actually RCCL in AMD's case) will give errors and is unable to initialize (although it's OK for NVIDIA GPUs): Traceback (most recent call last): File "nccl_allreduce_example.py", line 43, in <module> results = ray.get([w.compute.remote() for w in workers]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "ray/_private/auto_init_hook.py", line 21, in auto_init_wrapper return fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "ray/_private/client_mode_hook.py", line 103, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "ray/_private/worker.py", line 2755, in get values, debugger_breakpoint = worker.get_objects(object_refs, timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "ray/_private/worker.py", line 906, in get_objects raise value.as_instanceof_cause() ray.exceptions.RayTaskError(NcclError): ray::Worker.compute() (repr=<nccl_allreduce_example.Worker object at 0x14dca472ebd0>) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "nccl_allreduce_example.py", line 22, in compute collective.allreduce(self.send, "default") File "ray/util/collective/collective.py", line 273, in allreduce g.allreduce([tensor], opts) File "ray/util/collective/collective_group/nccl_collective_group.py", line 197, in allreduce self._collective(tensors, tensors, collective_fn) File "ray/util/collective/collective_group/nccl_collective_group.py", line 604, in _collective comms = self._get_nccl_collective_communicator(key, devices) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "ray/util/collective/collective_group/nccl_collective_group.py", line 443, in _get_nccl_collective_communicator comms[i] = nccl_util.create_nccl_communicator( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "ray/util/collective/collective_group/nccl_util.py", line 113, in create_nccl_communicator comm = NcclCommunicator(world_size, nccl_unique_id, rank) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "cupy_backends/cuda/libs/nccl.pyx", line 283, in cupy_backends.cuda.libs.nccl.NcclCommunicator.__init__ File "cupy_backends/cuda/libs/nccl.pyx", line 129, in cupy_backends.cuda.libs.nccl.check_status cupy_backends.cuda.libs.nccl.NcclError: NCCL_ERROR_UNHANDLED_CUDA_ERROR: unhandled cuda error (run with NCCL_DEBUG=INFO for details) So, let's check the availability with importlib.util.find_spec instead. Tested and it can fix the issue here. We can fix the Ray Collective Communication Lib examples running issue when this combines with ray-project#49148 Signed-off-by: Hollow Man <hollowman@opensuse.org>
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.
|
stale
bot
added
the
stale
The issue is stale. It will be closed within 7 days unless there are further conversation
label
Jan 22, 2025
This is necessary to get ray working on AMD GPUs, so I would hope to get this reviewed and merged soon. |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
stale
The issue is stale. It will be closed within 7 days unless there are further conversation
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why are these changes needed?
(I'm using MI250x)
PR #42434 leads to breaks of Ray using AMD GPUs starting from v2.10.0, as an alternative,
RAY_EXPERIMENTAL_NOSET_ROCR_VISIBLE_DEVICES is needed to fix:
However, for Ray Collective Communication Lib example, setting
RAY_EXPERIMENTAL_NOSET_ROCR_VISIBLE_DEVICES
is not enough, as further errors will still happen:So let’s use an env var to determine if we do want to use AMDGPUAcceleratorManager, so that users can still revert to the behavior we have in v2.9.3 (before #42434) to get everything running again on AMD GPUs.
Related issue number
Caused by #42434
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.