linux - 关于 Linux 上 CUDA C 的程序 "Hello world"

标签 linux cuda

拜托,我需要帮助。 我是 linux 的新用户。我安装了 CUDA C 驱动程序。我已经测试了带宽示例并且效果很好。当我编译这个程序时:

 #include <stdio.h>
__global__ void helloFromGPU (void)
{
printf("Hello World from GPU!\n");
}
int main(void)
{
// hello from cpu
printf("Hello World from CPU!\n");
helloFromGPU <<<1, 10>>>();
cudaDeviceReset();
return 0;
}

并尝试执行我得到的二进制文件

$ ./code_1
Hello World from CPU!

并且设备代码没有显示重复字符串 10 次的预期结果。 亲爱的罗伯特,我得到了这个结果:

  yasin@yasin-Inspiron-5558:~/Documents/Programming$ cuda-memcheck ./code_1
    ========= CUDA-MEMCHECK
    Hello World from CPU!
    ========= ERROR SUMMARY: 0 errors
    yasin@yasin-Inspiron-5558:~/Documents/Programming$ 

我已经完成了你对@Robert 的要求:

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2013 NVIDIA Corporation
Built on Wed_Jul_17_18:36:13_PDT_2013
Cuda compilation tools, release 5.5, V5.5.0
yasin@yasin-Inspiron-5558:~$ nvidia-smi
Failed to initialize NVML: Unknown Error
yasin@yasin-Inspiron-5558:~$ 

最佳答案

问题很简单,是 CUDA 没有正确安装。

关于linux - 关于 Linux 上 CUDA C 的程序 "Hello world",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38984826/

相关文章:

python - 从 Bash 文件运行 Python 脚本导致导入错误

haskell - 如何在加速示例包的示例上启用 CUDA?

linux - 自定义 ZSH 波浪号扩展

linux - 交叉编译围棋

Linux C 信号与进程编程

memory - CUDA 合并访问全局内存

c++ - 使用 cudaMemcpy 时出现段错误

Cuda错误CUDA_ERROR_NO_BINARY_FOR_GPU

c++ - 乘以二维矩阵。 用pycuda

linux - 有什么工具可以在 Linux 上将 PDF 转换为 XL?