在GeForce 9300M GS上运行CUDA时,对cuInit的调用导致CUDA_ERROR_NO_DEVICE

时间:2019-12-01 06:05:39

标签: python cuda

我有一个非常旧的图形卡GeForce 9300M GS。我正在尝试运行cuda,但出现错误。

运行nvidia-smi

+------------------------------------------------------+
| NVIDIA-SMI 342.01     Driver Version: 342.01         |
|-------------------------------+----------------------+----------------------+
| GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce 9300M GS   WDDM  | 0000:01:00.0     N/A |                  N/A |
| N/A   77C    P8    N/A /  N/A |    241MiB /   242MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Compute processes:                                               GPU Memory |
|  GPU       PID  Process name                                     Usage      |
|=============================================================================|
|    0            Not Supported                                               |
+-----------------------------------------------------------------------------+

nvcc --version

的结果
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:08:12_Central_Daylight_Time_2017
Cuda compilation tools, release 9.1, V9.1.85

我从互联网上获得了一个简单的cuda示例:

from numba import jit, cuda 
import numpy as np 
# to measure exec time 
from timeit import default_timer as timer    


# normal function to run on cpu 
def func(a):                                 
    for i in range(10000000): 
        a[i]+= 1      

# function optimized to run on gpu  
@jit(target ="cuda")                          
def func2(a): 
    for i in range(10000000): 
        a[i]+= 1
if __name__=="__main__": 

    n = 10000000                            
    a = np.ones(n, dtype = np.float64) 
    b = np.ones(n, dtype = np.float32) 

    start = timer() 
    func(a) 
    print("without GPU:", timer()-start)     

    start = timer() 
    func2(a) 
    print("with GPU:", timer()-start) 

不幸的是,我在运行时遇到此错误

在处理上述异常期间,发生了另一个异常:

Traceback (most recent call last):   File "p.py", line 30, in <module>
    func2(a)   File "E:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\dispatcher.py", line 42, in __call__
    return self.compiled(*args, **kws)   File "E:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\compiler.py", line 765, in __call__
    kernel = self.specialize(*args)   File "E:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\compiler.py", line 776, in specialize
    kernel = self.compile(argtypes)   File "E:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\compiler.py", line 786, in compile
    cc = get_current_device().compute_capability   File "E:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\api.py", line 304, in get_current_device
    return current_context().device   File "E:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\cudadrv\devices.py", line 194, in get_context
    return _runtime.get_or_create_context(devnum)   File "E:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\cudadrv\devices.py", line 162, in get_or_create_c ontext
    return self.push_context(self.gpus[devnum])   File "E:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\cudadrv\devices.py", line 40, in __getitem__
    return self.lst[devnum]   File "E:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\cudadrv\devices.py", line 26, in __getattr__
    numdev = driver.get_device_count()   File "E:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\cudadrv\driver.py", line 336, in get_device_count

    self.cuDeviceGetCount(byref(count))   File "E:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\cudadrv\driver.py", line 270, in __getattr__
    self.initialize()   File "E:\ProgramData\Anaconda3\lib\site-packages\numba\cuda\cudadrv\driver.py", line 230, in initialize
    raise CudaSupportError("Error at driver init: \n%s:" % e) numba.cuda.cudadrv.error.CudaSupportError: Error at driver init: [100] Call to cuInit results in CUDA_ERROR_NO_DEVICE:

如果有人可以帮助

0 个答案:

没有答案