gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 02:45:25 26 4
gpt4 key购买 nike

我正在尝试将 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com