Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSL2 Ubuntu22.04 python3.9 CUDA11.8: no CUDA-capable device is detected while calling init #187

Open
LongHZ140516 opened this issue Dec 21, 2024 · 2 comments

Comments

@LongHZ140516
Copy link

LongHZ140516 commented Dec 21, 2024

I am currently using a WSL2 Ubuntu22.04 python3.9 environment with CUDA 11.8 for Genesis experiments. When I run gs.init(backend=gs.cpu), everything works fine, but the FPS is very low.

case0

Therefore, I would like to use CUDA to accelerate the computation. When I set gs.init(backend=gs.cuda), I encountered the following error.

[Genesis] [15:16:25] [INFO] ╭─────────────────────────────────────────────────────────────────────────────────────╮
[Genesis] [15:16:25] [INFO] │┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉ Genesis ┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉┈┉│
[Genesis] [15:16:25] [INFO] ╰─────────────────────────────────────────────────────────────────────────────────────╯
[Genesis] [15:16:26] [INFO] Running on [NVIDIA GeForce RTX 4080 SUPER] with backend gs.cuda. Device memory: 15.99 GB.
[E 12/21/24 15:16:26.157 71086] [cuda_driver.h:operator()@92] CUDA Error CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected while calling init (cuInit)


Traceback (most recent call last):
  File "/home/serein/code/Genesis/hello_genesis.py", line 21, in <module>
    gs.init(backend=gs.cuda)
  File "/home/serein/code/Genesis/genesis/__init__.py", line 97, in init
    ti.init(arch=TI_ARCH[platform][backend], debug=debug, force_scalarize_matrix=True)
  File "/home/serein/anaconda3/envs/genesis/lib/python3.9/site-packages/taichi/lang/misc.py", line 458, in init
    impl.get_runtime().create_program()
  File "/home/serein/anaconda3/envs/genesis/lib/python3.9/site-packages/taichi/lang/impl.py", line 388, in create_program
    self.prog = _ti_core.Program()
RuntimeError: [cuda_driver.h:operator()@92] CUDA Error CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected while calling init (cuInit)
[Genesis] [15:16:26] [INFO] 💤 Exiting Genesis and caching compiled kernels...

Here is my nvidia-smi:

Sat Dec 21 15:05:51 2024
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 555.42.06              Driver Version: 560.94         CUDA Version: 12.6     |
|-----------------------------------------+------------------------+----------------------+
| 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 4080 ...    On  |   00000000:01:00.0  On |                  N/A |
|  0%   40C    P5             18W /  340W |    3144MiB /  16376MiB |     18%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |

and nvcc --version:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:33:58_PDT_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0

Additionally, I checked CUDA using PyTorch, and the result was True. However, I still cannot run successfully with gs.cuda.
image

I also tried changing my CUDA version to 12.1, but the result remained exactly the same as before, with no changes. The result of running python -m taichi diagnose is as follows:

[Taichi] version 1.7.2, llvm 15.0.4, commit 0131dce9, linux, python 3.9.21

*******************************************
**      Taichi Programming Language      **
*******************************************

Docs:   https://docs.taichi-lang.org/
GitHub: https://github.com/taichi-dev/taichi/
Forum:  https://forum.taichi.graphics/

Taichi system diagnose:

python: 3.9.21 (main, Dec 11 2024, 16:24:11) 
[GCC 11.2.0]
system: linux
executable: /home/serein/anaconda3/envs/genesis/bin/python
platform: Linux-5.15.146.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
architecture: 64bit ELF
uname: uname_result(system='Linux', node='Serein', release='5.15.146.1-microsoft-standard-WSL2', version='#1 SMP Thu Jan 11 04:09:03 UTC 2024', machine='x86_64')
locale: en_US.UTF-8
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:        22.04
Codename:       jammy



import: <module 'taichi' from '/home/serein/anaconda3/envs/genesis/lib/python3.9/site-packages/taichi/__init__.py'>

cpu: True
metal: False
RHI Error: GLFW Error 65543: GLX: Failed to create context: GLXBadFBConfig
opengl: ERROR Command '['/home/serein/anaconda3/envs/genesis/bin/python', '-c', 'import taichi as ti; print("===="); print(ti.lang.misc.is_arch_supported(ti.opengl), end="")']' died with <Signals.SIGSEGV: 11>.
cuda: True
vulkan: False

`glewinfo` not available: [Errno 2] No such file or directory: 'glewinfo'

Sat Dec 21 14:12:15 2024       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 555.42.06              Driver Version: 560.94         CUDA Version: 12.6     |
|-----------------------------------------+------------------------+----------------------+
| 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 4080 ...    On  |   00000000:01:00.0  On |                  N/A |
|  0%   41C    P0             37W /  340W |    3479MiB /  16376MiB |      5%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
                                                                                         
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |
+-----------------------------------------------------------------------------------------+

[Taichi] version 1.7.2, llvm 15.0.4, commit 0131dce9, linux, python 3.9.21

[Taichi] version 1.7.2, llvm 15.0.4, commit 0131dce9, linux, python 3.9.21
[Taichi] Starting on arch=x64

RHI Error: GLFW Error 65543: GLX: Failed to create context: GLXBadFBConfig
Taichi OpenGL test failed: Command '['/home/serein/anaconda3/envs/genesis/bin/python', '-c', 'import taichi as ti; ti.init(arch=ti.opengl)']' died with <Signals.SIGSEGV: 11>.
[E 12/21/24 14:12:16.540 35656] [cuda_driver.h:operator()@92] CUDA Error CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected while calling init (cuInit)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/serein/anaconda3/envs/genesis/lib/python3.9/site-packages/taichi/lang/misc.py", line 458, in init
    impl.get_runtime().create_program()
  File "/home/serein/anaconda3/envs/genesis/lib/python3.9/site-packages/taichi/lang/impl.py", line 388, in create_program
    self.prog = _ti_core.Program()
RuntimeError: [cuda_driver.h:operator()@92] CUDA Error CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected while calling init (cuInit)
Taichi CUDA test failed: Command '['/home/serein/anaconda3/envs/genesis/bin/python', '-c', 'import taichi as ti; ti.init(arch=ti.cuda)']' returned non-zero exit status 1.
@Yzhang367
Copy link

Maybe you can try to update your OpenGL or reinstall CUDA in 12.6 version.

@yasuhiroinoue
Copy link

I encountered the same issue where the error message "no CUDA-capable device is detected" was displayed. In my case, adding the following line to the ~/.bashrc file resolved the problem:

export LD_LIBRARY_PATH=/usr/lib/wsl/lib:$LD_LIBRARY_PATH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants