简体   繁体   English

在 Theano 中使用 GPU

[英]Using GPU with Theano

I'm trying to execute the next code https://github.com/erogol/KLP_KMEANS/blob/master/klp_kmeans.py using my gpu我正在尝试使用我的 gpu 执行下一个代码https://github.com/erogol/KLP_KMEANS/blob/master/klp_kmeans.py

I execute:我执行:

THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python klp_kmeans.py THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python klp_kmeans.py

But it says:但它说:

Using gpu device 0: GeForce GTX 750 Ti
Cluster number comparison ----
Used the cpu

After doing a little debug, I noticed that it has detected cpu usage due to an instance of class 'Gemm' (checked in line #71)在进行了一些调试后,我注意到由于类“Gemm”的实例(在第 71 行中检查),它已检测到 cpu 使用情况

Why is not using the gpu?为什么不使用gpu?

Thanks in advance提前致谢

You really need to contact the author of this script for support.您确实需要联系此脚本的作者以获得支持。 The ' Used the cpu ' message is coming from this script, not from Theano. ' Used the cpu ' 消息来自这个脚本,而不是来自 Theano。 It's the author's code that is doing the detection, and that detection logic may be faulty.是作者的代码在做检测,检测逻辑可能有问题。

As far as Theano is concerned, given your THEANO_FLAGS and the ' Using gpu device 0: GeForce GTX 750 Ti ' message you see at startup, it will use the GPU for all computation graphs that can be run on the GPU.就 Theano 而言,鉴于您的THEANO_FLAGS和您在启动时看到的“ Using gpu device 0: GeForce GTX 750 Ti ”消息,它将使用 GPU 来处理可以在 GPU 上运行的所有计算图。

Are you running the script as is?您是否按原样运行脚本? If so, it looks like parts of it are intended to be run on the CPU, and other parts on the GPU (it seems to be doing a speed comparison between the two).如果是这样,看起来它的一部分是打算在 CPU 上运行,而其他部分是在 GPU 上运行(似乎是在两者之间进行速度比较)。 Only those calls to klp_kmeans where use_gpu=True will run on the GPU because of the way the variables are typed (eg theano.tensor.dmatrix vs. theano.tensor.matrix ).由于变量的输入方式(例如theano.tensor.dmatrixtheano.tensor.matrix ),只有那些调用klp_kmeans use_gpu=True才会在 GPU 上运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM