CUDA内核不启动 [英] CUDA kernel not launching

查看:286
本文介绍了CUDA内核不启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是GeForce 9800 GX2。我安装驱动程序和CUDA SDK我写了一个简单的程序,看起来像这样:

I'm using a GeForce 9800 GX2. I installed drivers and the CUDA SDK i wrote simple program which look s like this:

__global__ void myKernel(int *d_a) 
{ 
    int tx=threadIdx.x; 
    d_a[tx]+=1; 
    cuPrintf("Hello, world from the device!\n"); 


} 
int main() 
{ 
    int *a=(int*)malloc(sizeof(int)*10); 
    int *d_a; 
    int i; 
    for(i=0;i<10;i++) 
        a[i]=i; 
    cudaPrintfInit(); 
    cudaMalloc((void**)&d_a,10*sizeof(int)); 
    cudaMemcpy(d_a,a,10*sizeof(int),cudaMemcpyHostToDevice); 
    myKernel<<<1,10>>>(d_a); 
    cudaPrintfDisplay(stdout, true); 
    cudaMemcpy(a,d_a,10*sizeof(int),cudaMemcpyDeviceToHost); 

    cudaPrintfEnd(); 
    cudaFree(d_a); 
} 

代码正确编译,但内核似乎没有启动。 。没有从内核打印消息。

The code is compiling properly, but the kernel appear not to be launching... No message is printed from the kernel side. What should I do to resolve this?

推荐答案

鉴于您在评论中说您收到了无CUDA功能的设备这意味着你没有一个CUDA能力的GPU或者你没有安装正确的驱动程序。

Given that in your comments you say you are getting "No CUDA-capable device" that implies that either you do not have a CUDA-capable GPU or that you do not have the correct driver installed. Given that you say you have both, I suggest you try reinstalling your driver to check.

其他一些注意事项:


  1. 您是否尝试通过远程桌面执行此操作?这不会工作,因为与RDP Microsoft使用虚拟显示设备为了远程转发显示器,Tesla GPU支持 TCC 允许RDP通过使GPU作为非显示设备工作,但使用显示GPU(如Geforce)是不可能的。

  2. 也请尝试运行deviceQuery SDK代码示例,以检查其是否正确检测到您的GPU和驱动程序/运行时版本。

  3. 您应该检查所有CUDA API调用是否有错误。

  4. 在<$ c之前调用 cudaDeviceSynchronize() $ c> cudaPrintfDisplay()。

  1. Are you trying to do this through Remote Desktop? That won't work since with RDP Microsoft uses a dummy display device in order to forward the display remotely, the Tesla GPUs support TCC which allows RDP to work by making the GPU behave as a non-display device, but with display GPUs like Geforce this is not possible. Either run at the console or login at the console and use VNC.
  2. Also try running the deviceQuery SDK code sample to check that it detects your GPU and driver/runtime version correctly.
  3. You should check all CUDA API calls for errors.
  4. Call cudaDeviceSynchronize() before cudaPrintfDisplay().

这篇关于CUDA内核不启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆