vllm-project / vllm

A high-throughput and memory-efficient inference and serving engine for LLMs
https://docs.vllm.ai
Apache License 2.0
23.77k stars 3.41k forks source link

[Bug]: with `worker_use_ray = true`, and tensor_parallel_size > 1, the process is pending forever #4639

Open depenglee1707 opened 2 months ago

depenglee1707 commented 2 months ago

Your current environment

2024-05-07 01:43:26 (981 KB/s) - ‘collect_env.py’ saved [24877/24877]

Collecting environment information...
PyTorch version: 2.2.1+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.4 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.29.2
Libc version: glibc-2.35

Python version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (64-bit runtime)
Python platform: Linux-5.15.0-105-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 12.1.66
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration:
GPU 0: NVIDIA GeForce RTX 4090
GPU 1: NVIDIA GeForce RTX 4090

Nvidia driver version: 530.30.02
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Address sizes:                      39 bits physical, 48 bits virtual
Byte Order:                         Little Endian
CPU(s):                             32
On-line CPU(s) list:                0-31
Vendor ID:                          GenuineIntel
Model name:                         Intel(R) Core(TM) i9-14900KF
CPU family:                         6
Model:                              183
Thread(s) per core:                 2
Core(s) per socket:                 24
Socket(s):                          1
Stepping:                           1
CPU max MHz:                        6000.0000
CPU min MHz:                        800.0000
BogoMIPS:                           6374.40
Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr flush_l1d arch_capabilities
Virtualization:                     VT-x
L1d cache:                          896 KiB (24 instances)
L1i cache:                          1.3 MiB (24 instances)
L2 cache:                           32 MiB (12 instances)
L3 cache:                           36 MiB (1 instance)
NUMA node(s):                       1
NUMA node0 CPU(s):                  0-31
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit:        Not affected
Vulnerability L1tf:                 Not affected
Vulnerability Mds:                  Not affected
Vulnerability Meltdown:             Not affected
Vulnerability Mmio stale data:      Not affected
Vulnerability Retbleed:             Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Not affected

Versions of relevant libraries:
[pip3] numpy==1.23.5
[pip3] nvidia-nccl-cu12==2.19.3
[pip3] torch==2.2.1
[pip3] torchaudio==2.1.2
[pip3] torchmetrics==1.2.1
[pip3] torchvision==0.16.2
[pip3] triton==2.2.0
[pip3] vllm-nccl-cu12==2.18.1.0.4.0
[conda] Could not collectROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.4.1
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0    GPU1    CPU Affinity    NUMA Affinity
GPU0     X  PHB 0-31        N/A
GPU1    PHB  X  0-31        N/A

Legend:

  X    = Self
  SYS  = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
  NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
  PHB  = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
  PXB  = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge)
  PIX  = Connection traversing at most a single PCIe bridge
  NV#  = Connection traversing a bonded set of # NVLinks

🐛 Describe the bug

It's little complex for my case, I try to launch vllm in a ray cluster, since the latest vllm requires the driver process has GPU capability. but I do not want to waste a GPU for driver(could not use by worker), so I changed source code of vllm: https://github.com/vllm-project/vllm/blob/a98187cf7227695819e199e2e3ad35be0a9a84f3/vllm/executor/ray_gpu_executor.py#L66-L71 to always usenum_gpus = self.cache_config.gpu_memory_utilization, no matter tensor_parallel_size, that's means I can make worker and driver share one GPU.

unfortunate, the process is pending forever, to be specific it's pending in nccl.ncclCommInitRank Any suggestion? or any suggestion to launch vllm on ray cluster?

youkaichao commented 2 months ago

Does it work without your change?

depenglee1707 commented 2 months ago

I guess it could work, but cannot test since I have only 2 GPU, and assign driver with 0.1. So is worker with non-full GPU matter for nccl? @youkaichao

youkaichao commented 2 months ago

Yes, each nccl process need to own one GPU.

depenglee1707 commented 2 months ago

Fine, so to run vllm on ray cluster, I have to waste some GPU, that's not expected, any suggestion? @youkaichao

depenglee1707 commented 2 months ago

Actually it's not a problem just for ray cluster scenario, I mean on node if I have 2 GPU, I guess it cannot serve as tensor_parallel_size = 2 with vllm, since driver process will occupied some GPU

youkaichao commented 2 months ago

I don't know your setup with ray. Our CI works fine with 2 GPU machine for tensor_parallel_size = 2 .

depenglee1707 commented 2 months ago

you are right, on node it works. I guess I need dig in and figure out on ray cluster. thanks

seanxcwang commented 2 months ago

got the same issue,I solved it by updating accelerate from 0.26.0 to 0.30.0

depenglee1707 commented 2 months ago

num_gpus = self.cache_config.gpu_memory_utilization

so you also rewrite the original code to set num_gpus = self.cache_config.gpu_memory_utilization no matter the world_size? and it works after upgrade accelerate???

vincent-pli commented 2 months ago

I guess we hit the same scenario, and it's really a rare case. I try to use an existed ray cluster to launch vllm with model parallelism(world size > 1) in this scenario, in original design, a ray deployment(actor) will be launch to help to create placement group and init vllm engine with placement group create pervasively. the solution works at least with vllm version vllm>=0.2.0,<0.2.6.

but with vllm 4.x, it requires driver has GPU abilities, and it run same method in both driver and worker, really have no idea why to do that, see my question: https://github.com/vllm-project/vllm/issues/4999

Really expect some one give a clarification...

njhill commented 2 months ago

In case it helps, you can now use tensor parallel without Ray, see https://github.com/vllm-project/vllm/pull/4539.

vincent-pli commented 2 months ago

Actually, in my case I adopt ray as a unity workload platform and want to run variously LLM workload in a single ray cluster. for example: llm inference by pure hg transformer, inference by GGUF format, inference by vllm .etc

but when I try to integrated with vllm. I hit such problem. could you kindly give some suggestion in https://github.com/vllm-project/vllm/issues/4999 or here, thanks a lot! @njhill

RobertLiu0905 commented 2 weeks ago

I also encountered this problem. I solved it by compiling the nccl source code and then modifying the path of libnccl.so.2 in the vllm source code.