正确理解cuda版本和兼容性

时间:2013-02-15 00:29:21

标签: cuda

CUDA编程指南指出:

the driver API is backward compatible, meaning that applications, plug-ins, and libraries (including the C runtime) compiled against a particular version of the driver API will continue to work on subsequent device driver releases

我理解这一点,如果我的代码是在CUDA4上编译的,那么二进制文件将在CUDA5上运行。然而,事实证明在CUDA5上运行CUDA5编译的二进制文件导致:

error while loading shared libraries: libcudart.so.4: cannot open shared object file: No such file or directory

请注意,我使用Linux中的“模块”工具在不同的cuda版本之间切换,即

module load cuda4
compile
module unload cuda4
module load cuda5
run

1 个答案:

答案 0 :(得分:2)

开发人员有责任将libcudart.so.4与应用程序打包在一起。 module命令可能会更改LD_LIBRARY_PATH或PATH变量,因此LDD找不到libcudart.so.4。我建议您添加一个post build步骤,将所需的.so复制到您的应用程序目录中。

位于CUDA Toolkit目录根目录的EULA.txt中的附件A列出了可再发行软件。这包括libcudart.so(以及在文件名中嵌入版本号信息的变体)。这还包括libcufft,libcublas,......