in Ubuntu MATE 16.04 I'm trying to run the deep-learning python examples here using the GPU:
I did run the example code,
THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python check1.py
but it seems that it is used the CPU and not the GPU. Here is the last part of terminal output:
WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu0 is not available (error: cuda unavailable)
...
Used the cpu
I tried to run this code too:
THEANO_FLAGS=device=cuda0 python check1.py
but the output is:
ERROR (theano.sandbox.gpuarray): pygpu was configured but could not be imported
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/gpuarray/__init__.py", line 20, in <module>
import pygpu
ImportError: No module named pygpu
...
used cpu
I installed the cuda toolkit from apt.
Here there are (hopefully) useful data:
python --version
Python 2.7.12
g++ -v
gcc version 5.4.0
nvcc --version
Cuda compilation tools, release 7.5, V7.5.17
lspci
NVIDIA Corporation GM107 [GeForce GTX 750 Ti] (rev a2)
nvidia-smi
+------------------------------------------------------+
| NVIDIA-SMI 361.42 Driver Version: 361.42 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 750 Ti Off | 0000:01:00.0 On | N/A |
| 29% 35C P8 1W / 38W | 100MiB / 2044MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 2861 G /usr/lib/xorg/Xorg 90MiB |
+-----------------------------------------------------------------------------+
Best Answer
Finally I solved! This post Ubuntu 16.04, Theano and Cuda
suggests to add flag
to command line, so the command line becomes:
It seems to fix a bug in using glibc 2.23
fix for glibc 2.23
Now the program uses correctly the GPU, this is the correct output:
Note that before trying this solution, I removed nvidia-cuda-toolkit and installed CUDA from Nvidia website, following part of instructions found here:
CUDA with Ubuntu 16.04
This is what exactly I did:
1) I downloaded CUDA from here CUDA 7.5 download selecting LINUX, x86_64, Ubuntu 15.04, deb local
2) I installed the deb file
3) Then run
This gives some errors! I fixed it overwriting the file Release in \var\cuda-repo-7.5-local with the following lines:
(sorry, I do not remember where I read this solution).
4) I succesfully run
5) Everything was insatlled in \usr\local\cuda-7.5
6) I commented the line n 115 in file \usr\local\cuda-7.5\include\host-config.h
which seems to prevent CUDA from using gcc 5.4 After all these operations, I updated the .theanorc file, adding the cuda root
That's all :)
PS: I do not know if it would work even with nvidia-cuda-toolkit!