2013-08-23 35 views
0

我是学习cuda的新手。我读了“CUDA by Example”并试图运行我的第一个程序hello world。它被编译,但我不知道为什么我不能执行二进制:你好世界编译但运行错误

[email protected]:~/Documents/Coba$ nvcc heloworld.cu -lcudart -o run 

[email protected]:~/Documents/Coba$ ls 
heloworld heloworld~ heloworld.cu run 

[email protected]:~/Documents/Coba$ ./run 
./run: error while loading shared libraries: libcudart.so.4: cannot open shared object file: No such file or directory 

谁能请帮助我如何解决这个问题?非常感谢:)

+0

源代码? –

+0

@ChristianIrwanHadiWicaksana:它的一个运行时链接加载器错误。源代码如何帮助? – talonmies

回答

2

运行时错误指示它找不到cudart库。在运行时用于查找库的路径可能与编译时间不同,因为nvcc(在你的路径上)知道去哪里看,但需要告诉Linux操作系统。运行以下你执行前:

export LD_LIBRARY_PATH=<path_to_cuda_libs>:$LD_LIBRARY_PATH 

看到Getting Started Guide对环境变量的部分获取更多信息。

假设您在此计算机上拥有管理权限,也可以考虑升级到最新版本的CUDA(5.5)。