Closed ergleb78 closed 1 month ago
As a sanity check, can you import pytorch and verify that it can access your GPUs?
@DarkLight1337
Absolutely. I'm not sure if this is the good way to test it, but this is what poped up instantly:
import torch
def check_pytorch_gpu():
try:
if torch.cuda.is_available():
print(f"PyTorch can access {torch.cuda.device_count()} GPU(s).")
for i in range(torch.cuda.device_count()):
print(f"GPU {i}: {torch.cuda.get_device_name(i)}")
else:
print("PyTorch cannot access any GPUs.")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
check_pytorch_gpu()
pyproject.toml
[tool.poetry]
name = "try-gpus"
version = "0.1.0"
description = ""
authors = ["Gleb Erokhin"]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.10"
torch = "^2.4.1"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Execution output:
PyTorch can access 8 GPU(s).
GPU 0: Tesla V100-SXM3-32GB
GPU 1: Tesla V100-SXM3-32GB
GPU 2: Tesla V100-SXM3-32GB
GPU 3: Tesla V100-SXM3-32GB
GPU 4: Tesla V100-SXM3-32GB
GPU 5: Tesla V100-SXM3-32GB
GPU 6: Tesla V100-SXM3-32GB
GPU 7: Tesla V100-SXM3-32GB
Perhaps you can try upgrading the vLLM version. It's possible that this issue has been fixed since v0.5.5.
Otherwise I'm not sure. @youkaichao any ideas?
please run https://github.com/vllm-project/vllm/blob/main/collect_env.py inside the docker image to collect the environment.
Perhaps you can try upgrading the vLLM version. It's possible that this issue has been fixed since v0.5.5.
Yeah, I tried that with v9.6.2 (posted the results above). Getting “Failed to infer device type” exception. I will run the python script in the container and post here, as requested.
please run https://github.com/vllm-project/vllm/blob/main/collect_env.py inside the docker image to collect the environment. @youkaichao Here you are. It looks like CUDA is not visible from docker, hovewer nvidia-docker-toolkit seems to be working fine and I can run nvidia-smi from cuda-12-6 container for test.
root@f6ca99dec4b4:/vllm-workspace/ttt# python3 collect_env.py
Collecting environment information...
PyTorch version: 2.4.0+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A
OS: Ubuntu 20.04.6 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.31
Python version: 3.10.14 (main, Apr 6 2024, 18:45:05) [GCC 9.4.0] (64-bit runtime)
Python platform: Linux-5.19.0-1010-nvidia-lowlatency-x86_64-with-glibc2.31
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
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
Byte Order: Little Endian
Address sizes: 46 bits physical, 48 bits virtual
CPU(s): 80
On-line CPU(s) list: 0-79
Thread(s) per core: 2
Core(s) per socket: 20
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Gold 6138 CPU @ 2.00GHz
Stepping: 4
CPU MHz: 999.871
CPU max MHz: 3700.0000
CPU min MHz: 1000.0000
BogoMIPS: 4000.00
Virtualization: VT-x
L1d cache: 1.3 MiB
L1i cache: 1.3 MiB
L2 cache: 40 MiB
L3 cache: 55 MiB
NUMA node0 CPU(s): 0-19,40-59
NUMA node1 CPU(s): 20-39,60-79
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed: Mitigation; IBRS
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Mitigation; Clear CPU buffers; SMT vulnerable
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 pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts pku ospke md_clear flush_l1d arch_capabilities
Versions of relevant libraries:
[pip3] flashinfer==0.1.4+cu121torch2.4
[pip3] numpy==1.26.4
[pip3] nvidia-cublas-cu12==12.1.3.1
[pip3] nvidia-cuda-cupti-cu12==12.1.105
[pip3] nvidia-cuda-nvrtc-cu12==12.1.105
[pip3] nvidia-cuda-runtime-cu12==12.1.105
[pip3] nvidia-cudnn-cu12==9.1.0.70
[pip3] nvidia-cufft-cu12==11.0.2.54
[pip3] nvidia-curand-cu12==10.3.2.106
[pip3] nvidia-cusolver-cu12==11.4.5.107
[pip3] nvidia-cusparse-cu12==12.1.0.106
[pip3] nvidia-ml-py==12.560.30
[pip3] nvidia-nccl-cu12==2.20.5
[pip3] nvidia-nvjitlink-cu12==12.6.20
[pip3] nvidia-nvtx-cu12==12.1.105
[pip3] pyzmq==26.2.0
[pip3] torch==2.4.0
[pip3] torchvision==0.19.0
[pip3] transformers==4.44.2
[pip3] triton==3.0.0
[conda] Could not collect
ROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.5.5
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
Could not collect
Well, I managed to solve the problem in a weird way. I commented the following section in docker compose file
#deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# capabilities: [GPU]
I have no idea why it fixes the issue. Earlier, it was a requirement to explicitly add Nvidia device and GPU capabilities. Maybe it's going to be userful for someone. The problem seems to have nothing to do with VLLM but the container toolkit.
thanks for reporting, you need to make cuda work before you can use vllm.
@youkaichao Would you please help to see how to resolve this? Thanks in advance.
Running in k3s (with containerd), the notebook computer has GPU support (Nvidia RTX 4070 mobile):
nvidia-smi
Sat Oct 19 20:28:30 2024
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.107.02 Driver Version: 550.107.02 CUDA Version: 12.4 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 4070 ... Off | 00000000
Running gpu-operator in k3s to bring the support of GPU to the containers:
NAME READY STATUS RESTARTS AGE
pod/gpu-feature-discovery-kgfkv 1/1 Running 0 2d5h
pod/gpu-operator-57748cc9d8-frq59 1/1 Running 2 (90m ago) 2d5h
pod/gpu-operator-node-feature-discovery-gc-5fcdc8894b-8l782 1/1 Running 0 2d5h
pod/gpu-operator-node-feature-discovery-master-7d84b856d7-7xrjv 1/1 Running 0 2d5h
pod/gpu-operator-node-feature-discovery-worker-wk2v4 1/1 Running 0 2d5h
pod/nvidia-container-toolkit-daemonset-ldlb2 1/1 Running 0 2d5h
pod/nvidia-cuda-validator-kkrvc 0/1 Completed 0 2d5h
pod/nvidia-dcgm-exporter-tq2h5 1/1 Running 0 2d5h
pod/nvidia-device-plugin-daemonset-f7tf5 1/1 Running 0 2d5h
pod/nvidia-operator-validator-wpd4t 1/1 Running 0 2d5h
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/gpu-operator ClusterIP 10.43.35.29 <none> 8080/TCP 2d5h
service/gpu-operator-node-feature-discovery-master ClusterIP 10.43.190.189 <none> 8080/TCP 2d5h
service/nvidia-dcgm-exporter ClusterIP 10.43.177.206 <none> 9400/TCP 2d5h
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
daemonset.apps/gpu-feature-discovery 1 1 1 1 1 nvidia.com/gpu.deploy.gpu-feature-discovery=true 2d5h
daemonset.apps/gpu-operator-node-feature-discovery-worker 1 1 1 1 1 <none> 2d5h
daemonset.apps/nvidia-container-toolkit-daemonset 1 1 1 1 1 nvidia.com/gpu.deploy.container-toolkit=true 2d5h
daemonset.apps/nvidia-dcgm-exporter 1 1 1 1 1 nvidia.com/gpu.deploy.dcgm-exporter=true 2d5h
daemonset.apps/nvidia-device-plugin-daemonset 1 1 1 1 1 nvidia.com/gpu.deploy.device-plugin=true 2d5h
daemonset.apps/nvidia-driver-daemonset 0 0 0 0 0 nvidia.com/gpu.deploy.driver=true 2d5h
daemonset.apps/nvidia-mig-manager 0 0 0 0 0 nvidia.com/gpu.deploy.mig-manager=true 2d5h
daemonset.apps/nvidia-operator-validator 1 1 1 1 1 nvidia.com/gpu.deploy.operator-validator=true 2d5h
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/gpu-operator 1/1 1 1 2d5h
deployment.apps/gpu-operator-node-feature-discovery-gc 1/1 1 1 2d5h
deployment.apps/gpu-operator-node-feature-discovery-master 1/1 1 1 2d5h
NAME DESIRED CURRENT READY AGE
replicaset.apps/gpu-operator-57748cc9d8 1 1 1 2d5h
replicaset.apps/gpu-operator-node-feature-discovery-gc-5fcdc8894b 1 1 1 2d5h
replicaset.apps/gpu-operator-node-feature-discovery-master-7d84b856d7 1 1 1 2d5h
Built a docker image to run vllm:
FROM nvidia/cuda:12.6.2-cudnn-runtime-ubuntu24.04
RUN apt-get update \
&& apt-get install -y python3-pip pipx nvidia-container-toolkit \
&& apt-get clean
RUN pipx install vllm
# Ensure pipx binary directory is in the PATH
ENV PATH="/root/.local/bin:$PATH"
# /usr/local/cuda/compat/libcuda.so.1
ENV LD_LIBRARY_PATH="/usr/local/cuda/compat:$LD_LIBRARY_PATH"
Created this deployment in k3s:
apiVersion: apps/v1
kind: Deployment
metadata:
name: ai-vllm
namespace: ai-vllm
spec:
replicas: 1
selector:
matchLabels:
app: ai-vllm
template:
metadata:
annotations:
labels:
app: ai-vllm
spec:
containers:
- name: main
#image: vllm/vllm-openai:v0.6.3
image: minixxie/vllm:0.0.1
imagePullPolicy: IfNotPresent
command: ["vllm", "serve", "--port", "80", "Qwen/Qwen2.5-Coder-7B-Instruct"]
resources:
limits:
nvidia.com/gpu: 1 # requesting 1 GPU
ports:
- name: http
containerPort: 80 # HTTP port
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 10
periodSeconds: 30
env:
- name: NVIDIA_VISIBLE_DEVICES
value: "all"
- name: NVIDIA_DRIVER_CAPABILITIES
value: "compute,utility"
However, there is error from the pod's logs:
Process SpawnProcess-1:
Traceback (most recent call last):
File "/usr/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap
self.run()
File "/usr/lib/python3.12/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/root/.local/share/pipx/venvs/vllm/lib/python3.12/site-packages/vllm/engine/multiprocessing/engine.py", line 390, in run_mp_engine
engine = MQLLMEngine.from_engine_args(engine_args=engine_args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/share/pipx/venvs/vllm/lib/python3.12/site-packages/vllm/engine/multiprocessing/engine.py", line 135, in from_engine_args
engine_config = engine_args.create_engine_config()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/share/pipx/venvs/vllm/lib/python3.12/site-packages/vllm/engine/arg_utils.py", line 902, in create_engine_config
device_config = DeviceConfig(device=self.device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/share/pipx/venvs/vllm/lib/python3.12/site-packages/vllm/config.py", line 1091, in __init__
raise RuntimeError("Failed to infer device type")
RuntimeError: Failed to infer device type
sorry I think I've fixed it by adding this missing line of "runtimeClassName":
spec:
template:
spec:
runtimeClassName: nvidia
and eventually switching back to the image vllm/vllm-openai:v0.6.3
, it works (with other problems coming out), thanks.
Your current environment
I'm trying to run inference in docker-compose, host: ubuntu 22.04
Model Input Dumps
No response
🐛 Describe the bug
It used to work just few hours ago, we simply restarted docker compose, same image, same tag, same mode. Not sure what might have happened
Why did it start checking compute capability <8 if it used to run on 7 just a day ago? I appreciate your help, I almost broke my head already.
on v0.6.2 getting a different error:
Before submitting a new issue...