Cuda 示例正常工作,但我的代码显示没有功能的设备

Cuda samples working but my code shows no capable device?

本文关键字:显示 代码 我的 功能 常工作 工作 Cuda      更新时间:2023-10-16

我正在尝试运行以下代码:

void wrapper(double *h_res, const double *h_em, const double *h_obs)
{
double *dev_res = 0;
double *dev_em = 0;
double *dev_obs = 0;
int dc;
cudaGetDeviceCount(&dc);
cout << "Device count: " << dc << endl;
}

同样适用于:

cudaStatus = cudaSetDevice(0);
    if (cudaStatus != cudaSuccess)
    {
        cerr << "cudaSetDevice failed! Do you have a CUDA-capable GPU installed?" << endl;
        goto Error;
    }

我得到Device count: 0cudaSetDevice failed! Do you have a CUDA-capable GPU installed?

现在,当我尝试运行 6.5 提供的 deviceQuery 示例时,我得到以下结果:

Detected 1 CUDA Capable device(s)
Device 0: "GeForce GT 740M"
  CUDA Driver Version / Runtime Version          7.0 / 6.5
  CUDA Capability Major/Minor version number:    3.0
  Total amount of global memory:                 2048 MBytes (2147483648 bytes)
  ( 2) Multiprocessors, (192) CUDA Cores/MP:     384 CUDA Cores
  GPU Clock rate:                                895 MHz (0.89 GHz)
  Memory Clock rate:                             901 Mhz
  Memory Bus Width:                              128-bit
  L2 Cache Size:                                 262144 bytes
  Maximum Texture Dimension Size (x,y,z)         1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)
  Maximum Layered 1D Texture Size, (num) layers  1D=(16384), 2048 layers
  Maximum Layered 2D Texture Size, (num) layers  2D=(16384, 16384), 2048 layers
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       49152 bytes
  Total number of registers available per block: 65536
  Warp size:                                     32
  Maximum number of threads per multiprocessor:  2048
  Maximum number of threads per block:           1024
  Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
  Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             512 bytes
  Concurrent copy and kernel execution:          Yes with 1 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Alignment requirement for Surfaces:            Yes
  Device has ECC support:                        Disabled
  CUDA Device Driver Mode (TCC or WDDM):         WDDM (Windows Display Driver Model)
  Device supports Unified Addressing (UVA):      No
  Device PCI Bus ID / PCI location ID:           1 / 0
  Compute Mode:
     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 7.0, CUDA Runtime Version = 6.5, NumDevs = 1, Device0 = GeForce GT 740M
Result = PASS

我该如何解决这个问题?我拥有华硕N56VB,如果这会有任何帮助...

我最终所做的是更新我的图形驱动程序,一切都解决了。