Linux 加载共享库时出错:libcudart.so.4:无法打开共享对象文件:没有这样的文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10395866/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 06:06:31  来源:igfitidea点击:

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

clinuxcudaredhat

提问by Coder

I am trying to execute MPI and CUDA code on a cluster. The code works fine on single machine but when I try to execute it on cluster I get error:

我正在尝试在集群上执行 MPI 和 CUDA 代码。该代码在单机上运行良好,但是当我尝试在集群上执行它时出现错误:

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

加载共享库时出错:libcudart.so.4:无法打开共享对象文件:没有这样的文件或目录

I checked my PATH and LD_PATH and it looks ok. I have a .bashrc file which contains following entries -

我检查了我的 PATH 和 LD_PATH,它看起来没问题。我有一个 .bashrc 文件,其中包含以下条目 -

export PATH=$PATH:/usr/local/lib/:/usr/local/lib/openmpi:/usr/local/cuda/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/ lib/openmpi/:/usr/local/cuda/lib

export PATH=$PATH:/usr/local/lib/:/usr/local/lib/openmpi:/usr/local/cuda/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib /openmpi/:/usr/local/cuda/lib

All the machines haves same installation of CUDA and OpenMPI.

所有机器都安装了相同的 CUDA 和 OpenMPI。

I also have /usr/local/cuda/lib in /etc/ld.so.conf

我在 /etc/ld.so.conf 中也有 /usr/local/cuda/lib

Can anyone help me with this. This problem is really annoying.

谁能帮我这个。这个问题真的很烦。

Thanks.

谢谢。

采纳答案by Dmitri Chubarov

If you are sending a batch job on a cluster, please add commands like

如果您要在集群上发送批处理作业,请添加如下命令

echo $LD_LIBRARY_PATH 
ldd ./your_app 

to your batch script. This should help to debug the problem.

到您的批处理脚本。这应该有助于调试问题。

Also make sure that you export environment variables in mpirun. For instance, in OpenMPI you would run your code with

还要确保在 mpirun 中导出环境变量。例如,在 OpenMPI 中,您可以使用

mpirun -x LD_LIBRARY_PATH ...