FSDP: CUDA failure 217 'peer access is not supported between these two devices' on RTX 5090 during set_model_state_dict
🐛 Bug Report
I encountered a CUDA failure 217 'peer access is not supported between these two devices' when using FSDP2 (fully_shard) and FSDP on a multi-GPU machine with two RTX 5090 GPUs.
The error consistently occurs during:
set_model_state_dict(model, full_state_dict, options)
For FSDP2, the error comes like
TaskRunner pid=22435) Unhandled error (suppress with 'RAY_IGNORE_UNHANDLED_ERRORS=1'): ray::WorkerDict.ref_init_model() (pid=23635, ip=172.17.0.4, actor_id=ab9190a0c75062c35e0c67d501000000, repr=<verl.single_controller.ray.base.WorkerDict object at 0x7f640e3da000>)
(TaskRunner pid=22435) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=22435) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=22435) File "/home/chenweilong/r1_household_chara/verl/single_controller/ray/base.py", line 720, in func
(TaskRunner pid=22435) return getattr(self.worker_dict[key], name)(*args, **kwargs)
(TaskRunner pid=22435) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=22435) File "/home/chenweilong/r1_household_chara/verl/single_controller/base/decorator.py", line 514, in inner
(TaskRunner pid=22435) return func(*args, **kwargs)
(TaskRunner pid=22435) ^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=22435) File "/home/chenweilong/r1_household_chara/verl/workers/fsdp_workers.py", line 629, in init_model
(TaskRunner pid=22435) self.ref_module_fsdp = self._build_model_optimizer(
(TaskRunner pid=22435) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=22435) File "/home/chenweilong/r1_household_chara/verl/workers/fsdp_workers.py", line 405, in _build_model_optimizer
(TaskRunner pid=22435) fsdp2_load_full_state_dict(actor_module, full_state, fsdp_mesh, cpu_offload)
(TaskRunner pid=22435) File "/home/chenweilong/r1_household_chara/verl/utils/fsdp_utils.py", line 471, in fsdp2_load_full_state_dict
(TaskRunner pid=22435) set_model_state_dict(model, full_state, options=options)
(TaskRunner pid=22435) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/distributed/checkpoint/state_dict.py", line 1277, in set_model_state_dict
(TaskRunner pid=22435) return _load_model_state_dict(model, model_state_dict, info)
(TaskRunner pid=22435) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=22435) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
(TaskRunner pid=22435) return func(*args, **kwargs)
(TaskRunner pid=22435) ^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=22435) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/distributed/checkpoint/state_dict.py", line 590, in _load_model_state_dict
(TaskRunner pid=22435) _broadcast_state_dict(
(TaskRunner pid=22435) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/distributed/_state_dict_utils.py", line 633, in _broadcast_state_dict
(TaskRunner pid=22435) _broadcast_tensors(ret, local_state_dict, keys, device, pg)
(TaskRunner pid=22435) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/distributed/_state_dict_utils.py", line 545, in _broadcast_tensors
(TaskRunner pid=22435) dist.broadcast(tensors[0], src=0, group=pg)
(TaskRunner pid=22435) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/distributed/c10d_logger.py", line 81, in wrapper
(TaskRunner pid=22435) return func(*args, **kwargs)
(TaskRunner pid=22435) ^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=22435) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/distributed/distributed_c10d.py", line 2714, in broadcast
(TaskRunner pid=22435) work = group.broadcast([tensor], opts)
(TaskRunner pid=22435) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=22435) torch.distributed.DistBackendError: NCCL error in: /home/chenweilong/pytorch/torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp:3356, unhandled cuda error (run with NCCL_DEBUG=INFO for details), NCCL version 2.27.3
(TaskRunner pid=22435) ncclUnhandledCudaError: Call to CUDA function failed.
(TaskRunner pid=22435) Last error:
(TaskRunner pid=22435) Cuda failure 217 'peer access is not supported between these two devices'
For FSDP, the error comes like
(TaskRunner pid=516914) Unhandled error (suppress with 'RAY_IGNORE_UNHANDLED_ERRORS=1'): ray::WorkerDict.ref_init_model() (pid=523350, ip=172.17.0.4, actor_id=4d79e98096779388a81fc38201000000, repr=<verl.single_controller.ray.base.WorkerDict object at 0x7c5d46a985c0>)
(TaskRunner pid=516914) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=516914) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=516914) File "/home/chenweilong/r1_household_chara/verl/single_controller/ray/base.py", line 720, in func
(TaskRunner pid=516914) return getattr(self.worker_dict[key], name)(*args, **kwargs)
(TaskRunner pid=516914) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=516914) File "/home/chenweilong/r1_household_chara/verl/single_controller/base/decorator.py", line 514, in inner
(TaskRunner pid=516914) return func(*args, **kwargs)
(TaskRunner pid=516914) ^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=516914) File "/home/chenweilong/r1_household_chara/verl/workers/fsdp_workers.py", line 629, in init_model
(TaskRunner pid=516914) self.ref_module_fsdp = self._build_model_optimizer(
(TaskRunner pid=516914) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=516914) File "/home/chenweilong/r1_household_chara/verl/workers/fsdp_workers.py", line 372, in _build_model_optimizer
(TaskRunner pid=516914) actor_module_fsdp = FSDP(
(TaskRunner pid=516914) ^^^^^
(TaskRunner pid=516914) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/distributed/fsdp/fully_sharded_data_parallel.py", line 473, in __init__
(TaskRunner pid=516914) _auto_wrap(
(TaskRunner pid=516914) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/distributed/fsdp/_wrap_utils.py", line 101, in _auto_wrap
(TaskRunner pid=516914) _recursive_wrap(**recursive_wrap_kwargs, **root_kwargs) # type: ignore[arg-type]
(TaskRunner pid=516914) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=516914) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/distributed/fsdp/wrap.py", line 533, in _recursive_wrap
(TaskRunner pid=516914) wrapped_child, num_wrapped_params = _recursive_wrap(
(TaskRunner pid=516914) ^^^^^^^^^^^^^^^^
(TaskRunner pid=516914) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/distributed/fsdp/wrap.py", line 533, in _recursive_wrap
(TaskRunner pid=516914) wrapped_child, num_wrapped_params = _recursive_wrap(
(TaskRunner pid=516914) ^^^^^^^^^^^^^^^^
(TaskRunner pid=516914) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/distributed/fsdp/wrap.py", line 533, in _recursive_wrap
(TaskRunner pid=516914) wrapped_child, num_wrapped_params = _recursive_wrap(
(TaskRunner pid=516914) ^^^^^^^^^^^^^^^^
(TaskRunner pid=516914) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/distributed/fsdp/wrap.py", line 551, in _recursive_wrap
(TaskRunner pid=516914) return _wrap(module, wrapper_cls, **kwargs), nonwrapped_numel
(TaskRunner pid=516914) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=516914) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/distributed/fsdp/wrap.py", line 480, in _wrap
(TaskRunner pid=516914) return wrapper_cls(module, **kwargs)
(TaskRunner pid=516914) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(TaskRunner pid=516914) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/distributed/fsdp/fully_sharded_data_parallel.py", line 499, in __init__
(TaskRunner pid=516914) _init_param_handle_from_module(
(TaskRunner pid=516914) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/distributed/fsdp/_init_utils.py", line 615, in _init_param_handle_from_module
(TaskRunner pid=516914) _sync_module_params_and_buffers(
(TaskRunner pid=516914) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/distributed/fsdp/_init_utils.py", line 1112, in _sync_module_params_and_buffers
(TaskRunner pid=516914) _sync_params_and_buffers(
(TaskRunner pid=516914) File "/home/chenweilong/new-env/lib/python3.12/site-packages/torch/distributed/utils.py", line 322, in _sync_params_and_buffers
(TaskRunner pid=516914) dist._broadcast_coalesced(
(TaskRunner pid=516914) torch.distributed.DistBackendError: NCCL error in: /home/chenweilong/pytorch/torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp:3356, unhandled cuda error (run with NCCL_DEBUG=INFO for details), NCCL version 2.27.3
(TaskRunner pid=516914) ncclUnhandledCudaError: Call to CUDA function failed.
(TaskRunner pid=516914) Last error:
(TaskRunner pid=516914) Cuda failure 217 'peer access is not supported between these two devices'
✅ Environment
- GPUs: 2x NVIDIA RTX 5090 (same node)
- PyTorch: 2.7.1-cu128
- NCCL: 2.26.3
- CUDA: 12.8
- Ubuntu 24.04
- Python 3.12
✅ Setup Description
- Using
fully_shard(FSDP2) withDTensorparameters - Model state dict is loaded with:
options = StateDictOptions(
full_state_dict=True,
cpu_offload=True,
broadcast_from_rank0=True
)
set_model_state_dict(model, full_state_dict, options=options)
- Model parameters are all confirmed to be
DTensor - NCCL environment flags have been set as:
export NCCL_P2P_DISABLE=1
export NCCL_DEBUG=INFO
❌ Error Trace
Even with cpu_offload=True and broadcast_from_rank0=True, the error still occurs:
torch.distributed.DistBackendError:
NCCL error in: .../ProcessGroupNCCL.cpp:3356,
unhandled cuda error (ncclUnhandledCudaError: Call to CUDA function failed.)
Cuda failure 217 'peer access is not supported between these two devices'
✅ Additional Observations
- When using DeepSpeed, there is nothing wrong.
- The
peer accesserror suggestsdist.broadcast()insideset_model_state_dict()may still try to use GPU P2P, even with CPU offload enabled.
🙏 Request
Could you help confirm:
- Is this expected behavior for FSDP2?
- Should
cpu_offload=Truecombined withbroadcast_from_rank0=Trueavoid NCCL P2P entirely? - Is there any fallback mechanism if P2P is not available?
Let me know if I can provide further logs or a reproducible script.
Thanks!
same issue
same issue
hey! I think it might be the torch issue. Have u tried upgrade the torch version?
I met the same question... even using deepspeed.
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/openrlhf/OpenRLHF-MOGDPO/openrlhf/cli/train_mogdpo_ray.py", line 570, in <module>
train(args)
File "/openrlhf/OpenRLHF-MOGDPO/openrlhf/cli/train_mogdpo_ray.py", line 172, in train
ray.get(refs)
File "/usr/local/lib/python3.12/dist-packages/ray/_private/auto_init_hook.py", line 22, in auto_init_wrapper
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/ray/_private/client_mode_hook.py", line 104, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/ray/_private/worker.py", line 2858, in get
values, debugger_breakpoint = worker.get_objects(object_refs, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/ray/_private/worker.py", line 958, in get_objects
raise value.as_instanceof_cause()
ray.exceptions.RayTaskError(DistBackendError): ray::ReferenceModelActor.init_model_from_pretrained() (pid=46951, ip=0.0.0.0, actor_id=51ad505ada522dd73dd7eae806000000, repr=<openrlhf.trainer.ray.launcher.ReferenceModelActor object at 0x7efc67583170>)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/openrlhf/OpenRLHF-MOGDPO/openrlhf/trainer/ray/launcher.py", line 108, in init_model_from_pretrained
model = Actor(
^^^^^^
File "/openrlhf/OpenRLHF-MOGDPO/openrlhf/models/actor.py", line 85, in __init__
self.model = model_class.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/transformers/models/auto/auto_factory.py", line 600, in from_pretrained
return model_class.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/transformers/modeling_utils.py", line 315, in _wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/transformers/modeling_utils.py", line 4930, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/deepspeed/runtime/zero/partition_parameters.py", line 529, in wrapper
f(module, *args, **kwargs)
File "/usr/local/lib/python3.12/dist-packages/transformers/models/qwen2/modeling_qwen2.py", line 405, in __init__
self.model = Qwen2Model(config)
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/deepspeed/runtime/zero/partition_parameters.py", line 529, in wrapper
f(module, *args, **kwargs)
File "/usr/local/lib/python3.12/dist-packages/transformers/models/qwen2/modeling_qwen2.py", line 311, in __init__
self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/deepspeed/runtime/zero/partition_parameters.py", line 539, in wrapper
self._post_init_method(module)
File "/usr/local/lib/python3.12/dist-packages/deepspeed/runtime/zero/partition_parameters.py", line 1157, in _post_init_method
self._zero_init_param(param)
File "/usr/local/lib/python3.12/dist-packages/deepspeed/runtime/zero/partition_parameters.py", line 1112, in _zero_init_param
dist.broadcast(param.data, 0, self.get_dp_process_group())
File "/usr/local/lib/python3.12/dist-packages/deepspeed/comm/comm.py", line 118, in log_wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/deepspeed/comm/comm.py", line 225, in broadcast
return cdb.broadcast(tensor=tensor, src=src, group=group, async_op=async_op)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/deepspeed/comm/torch.py", line 218, in broadcast
return torch.distributed.broadcast(tensor=tensor, src=src, group=group, async_op=async_op)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/torch/distributed/c10d_logger.py", line 81, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/torch/distributed/distributed_c10d.py", line 2714, in broadcast
work = group.broadcast([tensor], opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
torch.distributed.DistBackendError: NCCL error in: /pytorch/torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp:3356, unhandled cuda error (run with NCCL_DEBUG=INFO for details), NCCL version 2.26.2
ncclUnhandledCudaError: Call to CUDA function failed.
Last error:
Cuda failure 217 'peer access is not supported between these two devices'
this is insane
same issue here:
Traceback (most recent call last):
File "/home/nicholas_lee/rllm/examples/miniwob/train_miniwob_agent.py", line 36, in main
trainer.train()
File "/home/nicholas_lee/rllm/rllm/trainer/agent_trainer.py", line 55, in train
ray.get(train_agent.remote(self.config, self.agent_class, self.env_class, self.agent_args, self.env_args))
File "/home/nicholas_lee/anaconda3/envs/rllm/lib/python3.10/site-packages/ray/_private/auto_init_hook.py", line 22, in auto_init_wrapper
return fn(*args, **kwargs)
File "/home/nicholas_lee/anaconda3/envs/rllm/lib/python3.10/site-packages/ray/_private/client_mode_hook.py", line 104, in wrapper
return func(*args, **kwargs)
File "/home/nicholas_lee/anaconda3/envs/rllm/lib/python3.10/site-packages/ray/_private/worker.py", line 2858, in get
values, debugger_breakpoint = worker.get_objects(object_refs, timeout=timeout)
File "/home/nicholas_lee/anaconda3/envs/rllm/lib/python3.10/site-packages/ray/_private/worker.py", line 958, in get_objects
raise value.as_instanceof_cause()
ray.exceptions.RayTaskError(DistBackendError): ray::train_agent() (pid=3105031, ip=169.229.49.60)
File "/home/nicholas_lee/rllm/rllm/trainer/verl/train_agent_ppo.py", line 111, in train_agent
trainer.init_workers()
File "/home/nicholas_lee/rllm/rllm/trainer/verl/agent_ppo_trainer.py", line 61, in init_workers
super().init_workers()
File "/home/nicholas_lee/rllm/verl/verl/trainer/ppo/ray_trainer.py", line 862, in init_workers
self.actor_rollout_wg.init_model()
File "/home/nicholas_lee/rllm/verl/verl/single_controller/ray/base.py", line 51, in __call__
output = ray.get(output)
ray.exceptions.RayTaskError(DistBackendError): ray::WorkerDict.actor_rollout_init_model() (pid=3106278, ip=169.229.49.60, actor_id=5827edbf6779b2e7ff00acca01000000, repr=<verl.single_controller.ray.base.WorkerDict object at 0x7af9eb11d3c0>)
File "/home/nicholas_lee/anaconda3/envs/rllm/lib/python3.10/concurrent/futures/_base.py", line 458, in result
return self.__get_result()
File "/home/nicholas_lee/anaconda3/envs/rllm/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "/home/nicholas_lee/rllm/verl/verl/single_controller/ray/base.py", line 638, in func
return getattr(self.worker_dict[key], name)(*args, **kwargs)
File "/home/nicholas_lee/rllm/verl/verl/single_controller/base/decorator.py", line 540, in inner_regular
return func(*args, **kwargs)
File "/home/nicholas_lee/rllm/verl/verl/workers/fsdp_workers.py", line 589, in init_model
) = self._build_model_optimizer(
File "/home/nicholas_lee/rllm/verl/verl/workers/fsdp_workers.py", line 324, in _build_model_optimizer
actor_module_fsdp = FSDP(
File "/home/nicholas_lee/anaconda3/envs/rllm/lib/python3.10/site-packages/torch/distributed/fsdp/fully_sharded_data_parallel.py", line 473, in __init__
_auto_wrap(
File "/home/nicholas_lee/anaconda3/envs/rllm/lib/python3.10/site-packages/torch/distributed/fsdp/_wrap_utils.py", line 101, in _auto_wrap
_recursive_wrap(**recursive_wrap_kwargs, **root_kwargs) # type: ignore[arg-type]
File "/home/nicholas_lee/anaconda3/envs/rllm/lib/python3.10/site-packages/torch/distributed/fsdp/wrap.py", line 533, in _recursive_wrap
wrapped_child, num_wrapped_params = _recursive_wrap(
File "/home/nicholas_lee/anaconda3/envs/rllm/lib/python3.10/site-packages/torch/distributed/fsdp/wrap.py", line 533, in _recursive_wrap
wrapped_child, num_wrapped_params = _recursive_wrap(
File "/home/nicholas_lee/anaconda3/envs/rllm/lib/python3.10/site-packages/torch/distributed/fsdp/wrap.py", line 533, in _recursive_wrap
wrapped_child, num_wrapped_params = _recursive_wrap(
File "/home/nicholas_lee/anaconda3/envs/rllm/lib/python3.10/site-packages/torch/distributed/fsdp/wrap.py", line 551, in _recursive_wrap
return _wrap(module, wrapper_cls, **kwargs), nonwrapped_numel
File "/home/nicholas_lee/anaconda3/envs/rllm/lib/python3.10/site-packages/torch/distributed/fsdp/wrap.py", line 480, in _wrap
return wrapper_cls(module, **kwargs)
File "/home/nicholas_lee/anaconda3/envs/rllm/lib/python3.10/site-packages/torch/distributed/fsdp/fully_sharded_data_parallel.py", line 499, in __init__
_init_param_handle_from_module(
File "/home/nicholas_lee/anaconda3/envs/rllm/lib/python3.10/site-packages/torch/distributed/fsdp/_init_utils.py", line 615, in _init_param_handle_from_module
_sync_module_params_and_buffers(
File "/home/nicholas_lee/anaconda3/envs/rllm/lib/python3.10/site-packages/torch/distributed/fsdp/_init_utils.py", line 1112, in _sync_module_params_and_buffers
_sync_params_and_buffers(
File "/home/nicholas_lee/anaconda3/envs/rllm/lib/python3.10/site-packages/torch/distributed/utils.py", line 322, in _sync_params_and_buffers
dist._broadcast_coalesced(
torch.distributed.DistBackendError: NCCL error in: /pytorch/torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp:3356, unhandled cuda error (run with NCCL_DEBUG=INFO for details), NCCL version 2.26.2
ncclUnhandledCudaError: Call to CUDA function failed.
Last error:
Cuda failure 217 'peer access is not supported between these two devices'
is there any idea on how to mitigate this?
Same issue with 4090 cards.
Same issue with 2x A10
Same issue with 4xA100
+ nvidia-smi topo -m
GPU0 GPU1 GPU2 GPU3 CPU Affinity NUMA Affinity GPU NUMA ID
GPU0 X NV12 SYS SYS 0-23 0 N/A
GPU1 NV12 X SYS SYS 24-47 1 N/A
GPU2 SYS SYS X NV12 48-71 2 N/A
GPU3 SYS SYS NV12 X 72-95 3 N/A
FSDP and FSDP2 both meet this issue
FSDP2
[36m(TaskRunner pid=7197)[0m Unhandled error (suppress with 'RAY_IGNORE_UNHANDLED_ERRORS=1'): [36mray::WorkerDict.actor_rollout_init_model()[39m (pid=10064, ip=10.0.0.5, actor_id=c75e4d61093e11d8b773c4eb01000000, repr=<verl.single_controller.ray.base.WorkerDict object at 0x1508befe1ea0>)
[36m(TaskRunner pid=7197)[0m File "/mnt/azureml/cr/j/6d7cee7e7ddd44b68f3a180a595fcdc8/exe/wd/verl/verl/single_controller/ray/base.py", line 701, in func
[36m(TaskRunner pid=7197)[0m return getattr(self.worker_dict[key], name)(*args, **kwargs)
[36m(TaskRunner pid=7197)[0m File "/mnt/azureml/cr/j/6d7cee7e7ddd44b68f3a180a595fcdc8/exe/wd/verl/verl/single_controller/base/decorator.py", line 430, in inner
[36m(TaskRunner pid=7197)[0m return func(*args, **kwargs)
[36m(TaskRunner pid=7197)[0m File "/mnt/azureml/cr/j/6d7cee7e7ddd44b68f3a180a595fcdc8/exe/wd/verl/verl/workers/fsdp_workers.py", line 615, in init_model
[36m(TaskRunner pid=7197)[0m ) = self._build_model_optimizer(
[36m(TaskRunner pid=7197)[0m File "/mnt/azureml/cr/j/6d7cee7e7ddd44b68f3a180a595fcdc8/exe/wd/verl/verl/workers/fsdp_workers.py", line 457, in _build_model_optimizer
[36m(TaskRunner pid=7197)[0m fsdp2_load_full_state_dict(actor_module, full_state, fsdp_mesh, cpu_offload)
[36m(TaskRunner pid=7197)[0m File "/mnt/azureml/cr/j/6d7cee7e7ddd44b68f3a180a595fcdc8/exe/wd/verl/verl/utils/fsdp_utils.py", line 475, in fsdp2_load_full_state_dict
[36m(TaskRunner pid=7197)[0m set_model_state_dict(model, full_state, options=options)
[36m(TaskRunner pid=7197)[0m File "/usr/local/lib/python3.10/dist-packages/torch/distributed/checkpoint/state_dict.py", line 1277, in set_model_state_dict
[36m(TaskRunner pid=7197)[0m return _load_model_state_dict(model, model_state_dict, info)
[36m(TaskRunner pid=7197)[0m File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 116, in decorate_context
[36m(TaskRunner pid=7197)[0m return func(*args, **kwargs)
[36m(TaskRunner pid=7197)[0m File "/usr/local/lib/python3.10/dist-packages/torch/distributed/checkpoint/state_dict.py", line 590, in _load_model_state_dict
[36m(TaskRunner pid=7197)[0m _broadcast_state_dict(
[36m(TaskRunner pid=7197)[0m File "/usr/local/lib/python3.10/dist-packages/torch/distributed/_state_dict_utils.py", line 633, in _broadcast_state_dict
[36m(TaskRunner pid=7197)[0m _broadcast_tensors(ret, local_state_dict, keys, device, pg)
[36m(TaskRunner pid=7197)[0m File "/usr/local/lib/python3.10/dist-packages/torch/distributed/_state_dict_utils.py", line 545, in _broadcast_tensors
[36m(TaskRunner pid=7197)[0m dist.broadcast(tensors[0], src=0, group=pg)
[36m(TaskRunner pid=7197)[0m File "/usr/local/lib/python3.10/dist-packages/torch/distributed/c10d_logger.py", line 81, in wrapper
[36m(TaskRunner pid=7197)[0m return func(*args, **kwargs)
[36m(TaskRunner pid=7197)[0m File "/usr/local/lib/python3.10/dist-packages/torch/distributed/distributed_c10d.py", line 2714, in broadcast
[36m(TaskRunner pid=7197)[0m work = group.broadcast([tensor], opts)
[36m(TaskRunner pid=7197)[0m torch.distributed.DistBackendError: NCCL error in: /pytorch/torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp:3353, unhandled cuda error (run with NCCL_DEBUG=INFO for details), NCCL version 2.27.7
[36m(TaskRunner pid=7197)[0m ncclUnhandledCudaError: Call to CUDA function failed.
[36m(TaskRunner pid=7197)[0m Last error:
[36m(TaskRunner pid=7197)[0m Cuda failure 217 'peer access is not supported between these two devices'
I think it cause by some rank can not use p2p access. I try the following method
export NCCL_P2P_DISABLE=1- upgrade torch version
But still not working.
Could you try setting sync_module_states=False when initializing FSDP? This resolved the issue on my end but I'm not sure if it doesn't impact other parts of the code.
Is there any resolution on this?
Could you try setting
sync_module_states=Falsewhen initializing FSDP? This resolved the issue on my end but I'm not sure if it doesn't impact other parts of the code.
I try this. Work for me.
NCCL_SHM_DISABLE=1 and NCCL_P2P_DISABLE=1 should work.
Meet same issue with Megatron + sglang.
you can reference this page: https://docs.vllm.ai/en/v0.11.0/usage/troubleshooting.html#nccl-error-unhandled-system-error-during-ncclcomminitrank ”In some PCIe machines (e.g. machines without NVLink), if you see an error like transport/shm.cc:590 NCCL WARN Cuda failure 217 'peer access is not supported between these two devices', it's likely caused by a driver bug. See this issue for more details. In that case, you can try to set NCCL_CUMEM_HOST_ENABLE=0 to disable the feature, or upgrade your driver to the latest version.”
export NCCL_CUMEM_HOST_ENABLE=0
Same issue for me. NCCL_SHM_DISABLE=1 makes it ok to run but very slow.
you can reference this page: https://docs.vllm.ai/en/v0.11.0/usage/troubleshooting.html#nccl-error-unhandled-system-error-during-ncclcomminitrank ”In some PCIe machines (e.g. machines without NVLink), if you see an error like transport/shm.cc:590 NCCL WARN Cuda failure 217 'peer access is not supported between these two devices', it's likely caused by a driver bug. See this issue for more details. In that case, you can try to set NCCL_CUMEM_HOST_ENABLE=0 to disable the feature, or upgrade your driver to the latest version.”
export NCCL_CUMEM_HOST_ENABLE=0
This does work for me without impacting the speed. Thanks a lot! You saved my new year's day
Setting NCCL_CUMEM_HOST_ENABLE=0 works for me. This seems to be a bug in the NVIDIA driver where, on PCIe GPUs without NVLink, NCCL attempts to use peer-to-peer access, but this feature is not supported. Setting NCCL_CUMEM_HOST_ENABLE=0 disables this problematic feature.
you can reference this page: https://docs.vllm.ai/en/v0.11.0/usage/troubleshooting.html#nccl-error-unhandled-system-error-during-ncclcomminitrank ”In some PCIe machines (e.g. machines without NVLink), if you see an error like transport/shm.cc:590 NCCL WARN Cuda failure 217 'peer access is not supported between these two devices', it's likely caused by a driver bug. See this issue for more details. In that case, you can try to set NCCL_CUMEM_HOST_ENABLE=0 to disable the feature, or upgrade your driver to the latest version.”
export NCCL_CUMEM_HOST_ENABLE=0
This perfectly addresses my issue. Thanks a lot !
中文:
根据目前的代码路径和本 issue 后续反馈,这个问题更像是 NCCL/driver 在 PCIe、无 NVLink 或部分 GPU pair 不支持 P2P 的拓扑上的已知问题,而不是 cpu_offload=True 能完全绕开的 verl 层逻辑。
在当前 verl 代码中,FSDP2 的 full-state load 仍会使用 StateDictOptions(..., broadcast_from_rank0=True) 调用 set_model_state_dict,底层仍会走 PyTorch distributed broadcast;FSDP 初始化也会同步 module states。因此即使设置了 CPU offload,初始化/加载阶段仍可能触发 NCCL collective。这里 cpu_offload=True 不应被理解为“完全避免 NCCL/P2P 通信”。
已有多个用户在本 issue 中反馈以下 workaround 有效,且外部 vLLM troubleshooting 与 NVIDIA/nccl#1838 也指向同一类 Cuda failure 217 'peer access is not supported between these two devices' 问题。建议优先在启动 verl 前设置:
export NCCL_CUMEM_HOST_ENABLE=0
如果仍失败,可以再尝试:
export NCCL_SHM_DISABLE=1
export NCCL_P2P_DISABLE=1
但已有反馈显示 NCCL_SHM_DISABLE=1 可能明显变慢,所以建议先试 NCCL_CUMEM_HOST_ENABLE=0。如果这些都不能解决,请补充 nvidia-smi topo -m、NVIDIA driver 版本、完整 NCCL_DEBUG=INFO 日志,以及 PyTorch/NCCL/CUDA 版本,方便判断是否还有 verl 侧可规避的路径。
English:
Based on the current code path and later reports in this issue, this looks more like a known NCCL/driver issue on PCIe machines, machines without NVLink, or GPU topologies where some pairs do not support P2P, rather than something that cpu_offload=True can fully avoid at the verl layer.
In current verl, FSDP2 full-state loading still calls set_model_state_dict with StateDictOptions(..., broadcast_from_rank0=True), which goes through PyTorch distributed broadcast underneath. FSDP initialization also synchronizes module states. So cpu_offload=True should not be interpreted as completely avoiding NCCL/P2P communication during initialization/loading.
Several users in this issue have reported that the following workaround works, and the vLLM troubleshooting docs plus NVIDIA/nccl#1838 point to the same Cuda failure 217 'peer access is not supported between these two devices' class of failures. Please try setting this before launching verl first:
export NCCL_CUMEM_HOST_ENABLE=0
If it still fails, you can also try:
export NCCL_SHM_DISABLE=1
export NCCL_P2P_DISABLE=1
However, NCCL_SHM_DISABLE=1 may significantly slow things down, so NCCL_CUMEM_HOST_ENABLE=0 is the better first workaround to test. If none of these help, please share nvidia-smi topo -m, NVIDIA driver version, full NCCL_DEBUG=INFO logs, and PyTorch/NCCL/CUDA versions so maintainers can check whether there is still a verl-side mitigation path.
This response was generated by a scheduled Codex GPT5.5 issue processing task.