Cuda - nvcc - 没有可在设备上执行的内核镜像。问题是什么?

标签 cuda nvcc

我正在尝试将 nvcc 与最简单的示例一起使用,但它无法正常工作。我正在编译并执行来自 https://devblogs.nvidia.com/easy-introduction-cuda-c-and-c/ 的示例,但是我的服务器无法执行 全局功能。我重写了代码以获取一些错误消息,并收到以下消息:
“没有内核镜像可用于在设备上执行”

我的 GPU 是 Quadro 6000,cuda 版本是 9.0。

#include <stdio.h>
#include <cuda_runtime.h>

__global__ void saxpy(int n, float a, float *x, float *y)
{
  int i = blockIdx.x*blockDim.x + threadIdx.x;
  y[i] = 10.0; //a*x[i] + y[i];  
}

int main(int argc, char *argv[])
{
  int N = 120;
  int nDevices;
  float *x, *y, *d_x, *d_y;

  cudaError_t err = cudaGetDeviceCount(&nDevices);
  if (err != cudaSuccess) 
    printf("%s\n", cudaGetErrorString(err));
  else
    printf("Number of devices %d\n", nDevices);

  x = (float*)malloc(N*sizeof(float));
  y = (float*)malloc(N*sizeof(float));

  cudaMalloc(&d_x, N*sizeof(float)); 
  cudaMalloc(&d_y, N*sizeof(float));

  for (int i = 0; i < N; i++) {
    x[i] = 1.0f;
    y[i] = 2.0f;
  }

  cudaMemcpy(d_x, x, N*sizeof(float), cudaMemcpyHostToDevice);
  cudaMemcpy(d_y, y, N*sizeof(float), cudaMemcpyHostToDevice);

  // Perform SAXPY on 1M elements  
  saxpy<<<1, 1>>>(N, 2.0f, d_x, d_y);
  cudaDeviceSynchronize(); 

  err = cudaMemcpy(y, d_y, N*sizeof(float), cudaMemcpyDeviceToHost);  

  printf("%s\n",cudaGetErrorString(err));

  cudaError_t errSync  = cudaGetLastError();
  cudaError_t errAsync = cudaDeviceSynchronize();
  if (errSync != cudaSuccess) 
    printf("Sync kernel error: %s\n", cudaGetErrorString(errSync));
  if (errAsync != cudaSuccess)
    printf("Async kernel error: %s\n", cudaGetErrorString(errAsync)); 


  cudaFree(d_x);
  cudaFree(d_y);
  free(x);
  free(y);
}"

执行命令
bash-4.1$ nvcc  -o sapx simples_cuda.cu
bash-4.1$ ./sapx
Number of devices 1
no error
Sync kernel error: no kernel image is available for execution on the device

最佳答案

计算能力低于 2.0 的 GPU 仅受 6.5 及更早版本的 CUDA 工具包支持。

计算能力小于 3.0(但大于或等于 2.0)的 GPU 仅支持 8.0 及更早版本的 CUDA 工具包。

您的 Quadro 6000 是具有计算能力的 2.0 GPU。这可以通过 deviceQuery 以编程方式确定。 CUDA 示例代码,或通过 google search . CUDA 9.0 不支持

关于Cuda - nvcc - 没有可在设备上执行的内核镜像。问题是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55538036/

相关文章:

cuda - CUDA/CUDA Thrust 中的多态性和派生类

c++ - 查找 GpuMat 所在的 GPU

python - 避免 Numba CUDA Jit 竞争条件

c++ - cuda中虚方法的缺点

c++ - 无法在 device_memory 中创建 cusp::coo_matrix 的 thrust::host_vector?

c++ - 库达 |对多处理器数量的兴趣 - 与 SM 混淆

CUDA - 无效的设备功能,如何知道[架构,代码]?

nvcc 不支持 C++11 函数 iota()?

c++ - nvcc fatal : Unsupported gpu architecture 'compute_20' while cuda9. 0 已安装

c - make : *. h 没有那个文件或目录