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

ACC*_*_80 8 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);
}"
Run Code Online (Sandbox Code Playgroud)

执行命令

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
Run Code Online (Sandbox Code Playgroud)

Rob*_*lla 6

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

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

Quadro 6000 是具有计算能力的 2.0 GPU。这可以通过deviceQueryCUDA 示例代码以编程方式确定,也可以通过google 搜索来确定。CUDA 9.0 不支持