Pycuda._driver.Error: cuInit fehlgeschlagen: unbekannter FehlerPython

Python-Programme
Anonymous
 Pycuda._driver.Error: cuInit fehlgeschlagen: unbekannter Fehler

Post by Anonymous »

Ich habe ein Problem mit Pycuda. Ich habe es für ein Python-Skript verwendet, das ich entwickle. Ich weiß, dass dieses Skript funktioniert, weil ich es auf einem anderen Server verwende. Aber auf einem bestimmten Server habe ich ein Problem:

Code: Select all

>>> import pycuda.autoinit
Traceback (most recent call last):
File "", line 1, in 
File "/home/grl00/local_env/lib/python3.12/site-packages/pycuda/autoinit.py", line 9, in 
cuda.init()
pycuda._driver.Error: cuInit failed: unknown error
Der Import sollte nicht fehlschlagen, und der unbekannte Fehler hat mir bei dem Problem nicht wirklich weitergeholfen...
Das habe ich bereits getan:
Ich habe die richtige Version des Nvidia-Treibers: (sudo apt install nvidia-driver-580-server)

Code: Select all

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 580.95.05              Driver Version: 580.95.05      CUDA Version: 13.0     |
+-----------------------------------------+------------------------+----------------------+
| 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 P102-100                Off |   00000000:04:00.0 Off |                  N/A |
| 51%   27C    P8              9W /  250W |       5MiB /  10240MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   1  NVIDIA P102-100                Off |   00000000:83:00.0 Off |                  N/A |
| 51%   20C    P8              8W /  250W |       5MiB /  10240MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   2  NVIDIA P102-100                Off |   00000000:84:00.0 Off |                  N/A |
| 50%   14C    P8              8W /  250W |       5MiB /  10240MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A            2005      G   /usr/lib/xorg/Xorg                        4MiB |
|    1   N/A  N/A            2005      G   /usr/lib/xorg/Xorg                        4MiB |
|    2   N/A  N/A            2005      G   /usr/lib/xorg/Xorg                        4MiB |
+-----------------------------------------------------------------------------------------+
Ich versuche auch, Pycuda auf zwei verschiedene Arten zu installieren:

Code: Select all

#install 12.0
sudo apt install nvidia-cuda-toolkit
...
nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver                                                                   Copyright (c) 2005-2023 NVIDIA Corporation                                                              Built on Fri_Jan__6_16:45:21_PST_2023                                                                   Cuda compilation tools, release 12.0, V12.0.140                                                         Build cuda_12.0.r12.0/compiler.32267302_0
Oder das was: (Ich versuche Cuda 13-0 und 13-1)

Code: Select all

#install 13-0 :
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-ubuntu2404.pin
sudo mv cuda-ubuntu2404.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/13.0.0/local_installers/cuda-repo-ubuntu2404-13-0-local_13.0.0-580.65.06-1_amd64.debsudo dpkg -i cuda-repo-ubuntu2404-13-0-local_13.1.0-590.44.01-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2404-13-0-local_13.0.0-580.65.06-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2404-13-0-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda-toolkit-13-0

#locate with nvcc :
sudo ln -s /usr/local/cuda-13.0 /usr/local/cuda
echo 'export CUDA_HOME=/usr/local/cuda' >> ~/.bashrc
echo 'export PATH=$CUDA_HOME/bin:$PATH' >> ~/.bashrcecho 'export PATH=$CUDA_HOME/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver                                                                   Copyright (c) 2005-2025 NVIDIA Corporation                                                              Built on Wed_Jul_16_07:30:01_PM_PDT_2025                                                                Cuda compilation tools, release 13.0, V13.0.48                                                          Build cuda_13.0.r13.0/compiler.36260728_0
In beiden Fällen funktioniert das Kompilieren von Pycuda über Pip sehr gut.
Ich habe mehrmals versucht, es zu deinstallieren und neu zu installieren, und jedes Mal erhalte ich die gleiche Fehlermeldung.
Ich habe dieses Problem in der Vergangenheit (völlig zufällig) beheben können, aber ich bekomme es nicht wieder zum Laufen.
Haben Sie Vorschläge zur Behebung dieser Art von Problem?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post