让Theano使用GPU [英] Getting Theano to use the GPU

查看:310
本文介绍了让Theano使用GPU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置Theano与我的图形卡一起工作时,我遇到了很多麻烦-希望你们能帮帮我.

I am having quite a bit of trouble setting up Theano to work with my graphics card - I hope you guys can give me a hand.

我以前使用过CUDA,并且已正确安装了CUDA,这对于运行Nvidia Nsight必不可少.但是,我现在想将其与PyDev一起使用,并且在

I have used CUDA before and it is properly installed as would be necessary to run Nvidia Nsight. However, I now want to use it with PyDev and am having several problems following the 'Using the GPU' part of the tutorial at http://deeplearning.net/software/theano/install.html#gpu-linux

第一个很基本,那就是如何设置环境变量.它说我应该"定义一个$ CUDA_ROOT环境变量".有几位消息人士说过要在我的主目录中创建一个新的".pam_environment"文件.我已经完成并编写了以下内容:

The first is quite basic, and that is how to set up the environment variables. It says I should 'Define a $CUDA_ROOT environment variable'. Several sources have said to create a new '.pam_environment' file in my home directory. I have done this and written the following:

CUDA_ROOT = /usr/local/cuda-5.5/bin
LD_LIBRARY_PATH = /usr/local/cuda-5.5/lib64/lib

我不确定这是否就是必须编写的方式-如果这是一个基本问题,我们深表歉意.如果我能确认这确实也是编写它的正确地方,那将是有帮助的.

I am not sure if this is exactly the way it has to be written - apologies if this is a basic question. If I could get confirmation that this is indeed the correct place to have written it, too, that would be helpful.

第二个问题在本教程的以下部分中.它说"更改设备选项以在您的计算机中命名GPU设备".显然,这与THEANO_FLAGS和.theanorc有关,但是我无处可查到它们是什么:它们是文件吗?如果是这样,我在哪里可以找到它们?该教程似乎在假设一些我没有的知识!

The second problem is in the following part of the tutorial. It says to 'change the device option to name the GPU device in your computer'. Apparently this has something to do with THEANO_FLAGS and .theanorc, but nowhere am I able to find out what these are: are they files? If so where do I find them? The tutorial seems to be assuming some knowledge that I don't have!

感谢您抽出宝贵的时间阅读本文:非常感谢所有答案-目前我已经完全陷入困境了!

Thanks for taking the time to read this: any and all answers are greatly appreciated - I am very much completely stuck at the moment!

推荐答案

在Linux/OSX上:

On Linux/OSX:

编辑或创建文件~/.theanorc.该文件应包含:

Edit or create the file ~/.theanorc. The file should contain:

[global]
floatX = float32
device = gpu0

[nvcc]
fastmath = True

[cuda]
root=/usr/local/cuda-5.5/  
# On a mac, this will probably be /Developer/NVIDIA/CUDA-5.5/

您需要将cuda添加到$ LD_LIBRARY_PATH变量中.如果您正在运行eclipse,则可以转到项目"属性>解释器">配置和解释器...">环境",然后添加指向您的cuda lib文件夹的LD_LIBRARY_PATH变量(可能是/Developer/NVIDIA/CUDA-5.5/lib64 )

You need to add cuda to the $LD_LIBRARY_PATH variable. If you're running eclipse, you can go to Project properties > Interpreters > Configure and interpreter ... > Environment, and then add an LD_LIBRARY_PATH variable that points to your cuda lib folder (probably /Developer/NVIDIA/CUDA-5.5/lib64)

现在,当您导入theano时,它应该会显示一条有关查找gpu的消息.您可以在 http://deeplearning.net/software/theano/tutorial/using_gpu.html 上运行测试代码a>查看是否正在使用GPU.

Now when you import theano it should print a message about finding the gpu. You can run the test code at http://deeplearning.net/software/theano/tutorial/using_gpu.html to see if it's using the gpu.

这篇关于让Theano使用GPU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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