简体   繁体   中英

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

I execute:

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)

Why is not using the 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. 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.

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). 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 ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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