vllm icon indicating copy to clipboard operation
vllm copied to clipboard

[Bug]: RuntimeError: CUDA error: no kernel image is available for execution on the device

Open seungyoonee opened this issue 1 year ago • 21 comments

Your current environment

The output of `python collect_env.py`

PyTorch version: 2.3.0 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.5 Libc version: glibc-2.35

Python version: 3.11.9 (main, Apr 19 2024, 16:48:06) [GCC 11.2.0] (64-bit runtime) Python platform: Linux-5.15.0-107-generic-x86_64-with-glibc2.35 Is CUDA available: True CUDA runtime version: 11.7.99 CUDA_MODULE_LOADING set to: LAZY GPU models and configuration: GPU 0: Tesla V100-PCIE-32GB

Nvidia driver version: 535.171.04 cuDNN version: Probably one of the following: /usr/lib/x86_64-linux-gnu/libcudnn.so.8.5.0 /usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.5.0 /usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.5.0 /usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.5.0 /usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.5.0 /usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.5.0 /usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.5.0 HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True

Versions of relevant libraries: [pip3] ctransformers==0.2.27 [pip3] numpy==1.26.4 [pip3] nvidia-nccl-cu12==2.20.5 [pip3] torch==2.3.0 [pip3] torchaudio==2.3.1+cu121 [pip3] torchmetrics==1.1.2 [pip3] torchvision==0.18.0 [pip3] transformers==4.41.2 [pip3] triton==2.3.0 [conda] blas 1.0 mkl
[conda] ctransformers 0.2.27 pypi_0 pypi [conda] ffmpeg 4.3 hf484d3e_0 pytorch [conda] libjpeg-turbo 2.0.0 h9bf148f_0 pytorch [conda] mkl 2023.1.0 h213fc3f_46344
[conda] mkl-fft 1.3.8 pypi_0 pypi [conda] mkl-random 1.2.4 pypi_0 pypi [conda] mkl-service 2.4.0 pypi_0 pypi [conda] mkl_fft 1.3.8 py311h5eee18b_0
[conda] mkl_random 1.2.4 py311hdb19cb5_0
[conda] numpy 1.26.4 pypi_0 pypi [conda] numpy-base 1.26.4 py311hf175353_0
[conda] nvidia-nccl-cu12 2.20.5 pypi_0 pypi [conda] pytorch 2.3.0 py3.11_cuda12.1_cudnn8.9.2_0 pytorch [conda] pytorch-cuda 12.1 ha16c6d3_5 pytorch [conda] pytorch-mutex 1.0 cuda pytorch [conda] torch 2.3.0 pypi_0 pypi [conda] torchaudio 2.3.0 pypi_0 pypi [conda] torchmetrics 1.1.2 pypi_0 pypi [conda] torchtriton 2.3.0 py311 pytorch [conda] torchvision 0.18.0 pypi_0 pypi [conda] transformers 4.41.2 pypi_0 pypi [conda] triton 2.3.0 pypi_0 pypi ROCM Version: Could not collect Neuron SDK Version: N/A vLLM Version: 0.5.0 vLLM Build Flags: CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled GPU Topology: GPU0 GPU1 GPU2 GPU3 CPU Affinity NUMA Affinity GPU NUMA ID GPU0 X SYS SYS SYS 0-9,20-29 0 N/A GPU1 SYS X NODE NODE 10-19,30-39 1 N/A GPU2 SYS NODE X NODE 10-19,30-39 1 N/A GPU3 SYS NODE NODE X 10-19,30-39 1 N/A

🐛 Describe the bug

This is the message I get:

[rank0]:     out = torch.empty_like(x)
[rank0]:           ^^^^^^^^^^^^^^^^^^^
[rank0]: RuntimeError: CUDA error: no kernel image is available for execution on the device
[rank0]: Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.

And this is my code for vllm:

llm = LLM(model="yanolja/EEVE-Korean-Instruct-10.8B-v1.0", dtype='half', enable_lora=True)
sampling_params = SamplingParams(
    temperature=0.0,
    max_tokens=100,
    stop=["<|im_end|>"],
)

def test_gen(test_dataset):

    for x in test_dataset:
        question = x["question"]
        answer = x["answer"]
        
        prompts = [
            "Answer the question.\nHuman: {answer}\nAssistant:\n"
        ]

        outputs = llm.generate(
            prompts,
            sampling_params,
            lora_request=LoRARequest("eeve_adapter", 1, hparams.adapter_path),
)

test_gen(datasets['test'])

I tried to reinstall vllm and other libs but I still get this issue. Does anyone know what's wrong? Please ask for further info if needed. Thanks a lot in advance.

seungyoonee avatar Jun 14 '24 16:06 seungyoonee

CUDA used to build PyTorch: 12.1 CUDA runtime version: 11.7.99

You have mixed cuda version. Please follow https://docs.vllm.ai/en/latest/getting_started/installation.html to have a clean installation.

youkaichao avatar Jun 14 '24 16:06 youkaichao

I followed the installation process but still get the same issue. This is the new conda environment I have:

PyTorch version: 2.3.0+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.5
Libc version: glibc-2.35

Python version: 3.11.9 (main, Apr 19 2024, 16:48:06) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-112-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: Tesla V100-PCIE-32GB

Nvidia driver version: 535.171.04
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.5.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.5.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.5.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.5.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.5.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.5.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.5.0
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

...

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 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 hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke md_clear flush_l1d arch_capabilities
Virtualization:                     VT-x
L1d cache:                          640 KiB (20 instances)
L1i cache:                          640 KiB (20 instances)
L2 cache:                           20 MiB (20 instances)
L3 cache:                           27.5 MiB (2 instances)
NUMA node(s):                       2
NUMA node0 CPU(s):                  0-9,20-29
NUMA node1 CPU(s):                  10-19,30-39
Vulnerability Gather data sampling: Mitigation; Microcode
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 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; IBRS; IBPB conditional; STIBP conditional; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Mitigation; Clear CPU buffers; SMT vulnerable

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] nvidia-nccl-cu12==2.20.5
[pip3] torch==2.3.0
[pip3] torchmetrics==1.4.0.post0
[pip3] transformers==4.41.2
[pip3] triton==2.3.0
[conda] blas                      1.0                         mkl  
[conda] mkl                       2023.1.0         h213fc3f_46344  
[conda] mkl-fft                   1.3.8                    pypi_0    pypi
[conda] mkl-random                1.2.4                    pypi_0    pypi
[conda] mkl-service               2.4.0                    pypi_0    pypi
[conda] mkl_fft                   1.3.8           py311h5eee18b_0  
[conda] mkl_random                1.2.4           py311hdb19cb5_0  
[conda] numpy                     1.26.4                   pypi_0    pypi
[conda] numpy-base                1.26.4          py311hf175353_0  
[conda] nvidia-nccl-cu12          2.20.5                   pypi_0    pypi
[conda] torch                     2.3.0                    pypi_0    pypi
[conda] torchmetrics              1.4.0.post0              pypi_0    pypi
[conda] transformers              4.41.2                   pypi_0    pypi
[conda] triton                    2.3.0                    pypi_0    pypi
ROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.5.0.post1
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled

And this is the error I have:

[rank0]:     llm = LLM(model=model_id, dtype='half', enable_lora=True)
[rank0]:           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/vllm/entrypoints/llm.py", line 144, in __init__
[rank0]:     self.llm_engine = LLMEngine.from_engine_args(
[rank0]:                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/vllm/engine/llm_engine.py", line 363, in from_engine_args
[rank0]:     engine = cls(
[rank0]:              ^^^^
[rank0]:   File ".../lib/python3.11/site-packages/vllm/engine/llm_engine.py", line 236, in __init__
[rank0]:     self._initialize_kv_caches()
[rank0]:   File ".../lib/python3.11/site-packages/vllm/engine/llm_engine.py", line 313, in _initialize_kv_caches
[rank0]:     self.model_executor.determine_num_available_blocks())
[rank0]:     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/vllm/executor/gpu_executor.py", line 75, in determine_num_available_blocks
[rank0]:     return self.driver_worker.determine_num_available_blocks()
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
[rank0]:     return func(*args, **kwargs)
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/vllm/worker/worker.py", line 162, in determine_num_available_blocks
[rank0]:     self.model_runner.profile_run()
[rank0]:   File ".../lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
[rank0]:     return func(*args, **kwargs)
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/vllm/worker/model_runner.py", line 844, in profile_run
[rank0]:     self.execute_model(seqs, kv_caches)
[rank0]:   File ".../lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
[rank0]:     return func(*args, **kwargs)
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/vllm/worker/model_runner.py", line 749, in execute_model
[rank0]:     hidden_states = model_executable(
[rank0]:                     ^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
[rank0]:     return self._call_impl(*args, **kwargs)
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl
[rank0]:     return forward_call(*args, **kwargs)
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File "...t/lib/python3.11/site-packages/vllm/model_executor/models/llama.py", line 371, in forward
[rank0]:     hidden_states = self.model(input_ids, positions, kv_caches,
[rank0]:                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
[rank0]:     return self._call_impl(*args, **kwargs)
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl
[rank0]:     return forward_call(*args, **kwargs)
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/vllm/model_executor/models/llama.py", line 288, in forward
[rank0]:     hidden_states, residual = layer(
[rank0]:                               ^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
[rank0]:     return self._call_impl(*args, **kwargs)
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl
[rank0]:     return forward_call(*args, **kwargs)
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/vllm/model_executor/models/llama.py", line 223, in forward
[rank0]:     hidden_states = self.input_layernorm(hidden_states)
[rank0]:                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
[rank0]:     return self._call_impl(*args, **kwargs)
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl
[rank0]:     return forward_call(*args, **kwargs)
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/vllm/model_executor/custom_op.py", line 13, in forward
[rank0]:     return self._forward_method(*args, **kwargs)
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File ".../lib/python3.11/site-packages/vllm/model_executor/layers/layernorm.py", line 61, in forward_cuda
[rank0]:     out = torch.empty_like(x)
[rank0]:           ^^^^^^^^^^^^^^^^^^^
[rank0]: RuntimeError: CUDA error: no kernel image is available for execution on the device
[rank0]: Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.

I tried to compile with TORCH_USE_CUDA_DSA={GPU_NOs} but still getting the error. Is there any other solution? Or am I still having mixed cuda version? Thanks in advance.

seungyoonee avatar Jun 17 '24 13:06 seungyoonee

[rank0]: out = torch.empty_like(x) [rank0]: ^^^^^^^^^^^^^^^^^^^

Looks like the error comes from pytorch. Can you try:

import torch
a = torch.ones((5,)).cuda()
print(a.sum().item())

youkaichao avatar Jun 17 '24 17:06 youkaichao

[rank0]: out = torch.empty_like(x) [rank0]: ^^^^^^^^^^^^^^^^^^^

看起来错误来自 pytorch。你可以尝试:

import torch
a = torch.ones((5,)).cuda()
print(a.sum().item())

i meet the same problem

torch.empty_like(torch.tensor([1])) tensor([139918808922800]) a = torch.ones((5,)).cuda() print(a.sum().item()) 5.0

but [rank0]: out = torch.empty_like(x) [rank0]: RuntimeError: CUDA error: no kernel image is available for execution on the device [rank0]: CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect. [rank0]: For debugging consider passing CUDA_LAUNCH_BLOCKING=1. [rank0]: Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.

MiuNa-Yang avatar Jul 12 '24 09:07 MiuNa-Yang

similar issue

samzong avatar Sep 12 '24 03:09 samzong

+1

ankdesh avatar Oct 02 '24 06:10 ankdesh

The same error.

yannqi avatar Oct 31 '24 08:10 yannqi

+1

hj-lang avatar Oct 31 '24 08:10 hj-lang

+1

Hello,what's your GPU devices? I suspect it's the V100 causing this problem.

yannqi avatar Oct 31 '24 09:10 yannqi

same issue with H20. Any solution to this problem?

James-YM-Zhang avatar Nov 13 '24 00:11 James-YM-Zhang

This issue has been automatically marked as stale because it has not had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this issue should remain open. Thank you!

github-actions[bot] avatar Feb 11 '25 01:02 github-actions[bot]

I am having the same issue. Could you please help?

I tried all options on installation page. Building from source, building with docker, using pre-built docker etc. I always encounter this error.

hasansalimkanmaz avatar Feb 13 '25 08:02 hasansalimkanmaz

+1

thomas-hiddenpeak avatar Feb 14 '25 22:02 thomas-hiddenpeak

Sorry. It was my bad. I was using an old GPU which offers compute capability less than 7. Switching the GPU solved the issue

hasansalimkanmaz avatar Feb 14 '25 22:02 hasansalimkanmaz

same issue on A800

wa008 avatar Mar 20 '25 02:03 wa008

我的Quadro RTX6000上也有相同的问题

warspite1913 avatar Mar 20 '25 06:03 warspite1913

same issue on P100

ferdyzhang avatar Mar 28 '25 08:03 ferdyzhang

same, on Jetson Orin

thomas-hiddenpeak avatar May 07 '25 16:05 thomas-hiddenpeak

same issue on P100

https://github.com/sasha0552/pascal-pkgs-ci

gilbrotheraway avatar May 13 '25 10:05 gilbrotheraway

~~same issue on titan v with vllm v0.9.0~~ Confirming that building with --build-arg "CUDA_VERSION=12.6.3" worked for me https://github.com/vllm-project/vllm/issues/18818

NaiveYan avatar May 28 '25 07:05 NaiveYan

Can you try not installing from conda?

maybe try virtualenv.

aarnphm avatar Jun 19 '25 08:06 aarnphm

same issue with H20. Any solution to this problem?

I have met the same issue with H20. Have you solved this problem?

Kunting-Mu avatar Jul 01 '25 12:07 Kunting-Mu

This issue has been automatically marked as stale because it has not had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this issue should remain open. Thank you!

github-actions[bot] avatar Sep 30 '25 02:09 github-actions[bot]

This issue has been automatically closed due to inactivity. Please feel free to reopen if you feel it is still relevant. Thank you!

github-actions[bot] avatar Oct 30 '25 02:10 github-actions[bot]