2013-08-23 34 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)。