无法编译cuda_ndarray.cu:libcublas.so.7.5:无法打开共享对象文件 [英] Failed to compile cuda_ndarray.cu: libcublas.so.7.5: cannot open shared object file

查看:223
本文介绍了无法编译cuda_ndarray.cu:libcublas.so.7.5:无法打开共享对象文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在aws实例中导入theano库以使用GPU.我已经使用boto编写了一个python脚本来自动执行aws设置,这实际上会从本地计算机对实例执行ssh,然后在我执行" python -c'import theano'" 的地方启动bash脚本.启动GPU.但出现以下错误:

I am trying to import theano library in an aws instance to use GPU. I have written a python script using boto to automate aws setup which will essentially do an ssh to the instance from my local machine and then start a bash script where I do "python -c 'import theano'" to start the GPU. But I get the following error:

错误(theano.sandbox.cuda):无法编译cuda_ndarray.cu:libcublas.so.7.5:无法打开共享对象文件:无此类文件或 目录

ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: libcublas.so.7.5: cannot open shared object file: No such file or directory

当我尝试直接在实例命令外壳中导入theano模块时,它会自动开始使用GPU.

When I tried to import theano module directly in the instance command shell it automatically starts using GPU.

使用gpu设备0:GRID K520(CNMeM已禁用)

Using gpu device 0: GRID K520 (CNMeM is disabled)

我想我缺少通过自动化python脚本导入时必须进行的其他一些导入.可能是什么解决方案?

I guess I am missing some other import that has to made while importing through my automation python script. What could possibly be the solution?

推荐答案

我将尝试简洁明了地解决此问题,因为我发现对于那些开始使用unix或不熟悉编译和链接的人来说,这不是一个很好的答案.

I will try to solve this problem clearly and concise, as I found not really good answer for people which are starting using unix or are not familiar with compilation and linking.

该问题与动态链接有关,可以通过两种方式解决.第一个是通过设置LD_LIBRARY_PATH环境变量.假设cuda安装在/usr/local/cuda/中,只需添加您的环境文件/etc/enviroment:

The problem has to do with dynamic linking and it can be solved in two ways. First one is by setting LD_LIBRARY_PATH enviroment variable. Assuming cuda is installed in /usr/local/cuda/, just add in your enviroment file /etc/enviroment:

LD_LIBRARY_PATH=/usr/local/cuda/

或者只是在您的bashrc中:

Or simply in your bashrc:

export LD_LIBRARY_PATH=/usr/local/cuda/lib64/

unix gurus不建议使用此解决方案(我不是一个刚刚在Internet上阅读过此书的人,我遵循linux gurus).因此,我发现的解决方案很简单,默认情况下,修改linux ld软件搜索库的路径.为此,只需执行此操作(您必须以root用户身份执行):

This solution is not recommended by unix gurus (i am not one i have just read that on the internet and i follow linux gurus). So the solution I found is simple, modify the path where the linux ld software search for libraries by default. To do that just do (you have to do it as root):

cd /etc/ld.so.conf.d/

然后选择示例并进行

vi libc.conf 

在此文件中,只需将路径添加到lib64根目录,如:

Inside this file just add the path to the lib64 root like:

/usr/local/cuda/lib64/

您将在文件中得到以下内容:

You would get something like this in the file:

\# libc default configuration

/usr/local/lib

/usr/local/cuda/lib64/

然后运行:

sudo ldconfig

希望这个答案对刚开始编程或使用高级语言的人(如python,使用下面的C代码的人(像theano一样)并且不熟悉编译,链接...)的人们有所帮助.

Hope this answer helps people which are starting seen programming, or using high level languages such as python that uses C code below (like theano does) and are not familiar with compilation, linkig...

这篇关于无法编译cuda_ndarray.cu:libcublas.so.7.5:无法打开共享对象文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆