How can I install pygpu? Is libgpuarray required in order to use gpu?

16,183 views
Skip to first unread message

Marco Ippolito

unread,
Oct 10, 2014, 5:59:21 AM10/10/14
to theano...@googlegroups.com
Hi all,
in order to correctly use theano in ubuntu 14.04, I followed the indications found here: http://deeplearning.net/software/theano/install.html and http://deeplearning.net/software/theano/install_ubuntu.html#install-ubuntu

The only thing I didn't install is libgpuarray

Now, I tested theano with gpu through: http://deeplearning.net/software/theano/tutorial/using_gpu.html#gpuarray

but it says:
marco@marco-All-Series:~/Theano-Testing$ THEANO_FLAGS=device=cuda0 python check1.py
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 16, in <module>
    import pygpu
ImportError: No module named pygpu
[Elemwise{exp,no_inplace}(<TensorType(float64, vector)>)]
Looping 1000 times took 3.85228896141 seconds
Result is [ 1.23178032  1.61879341  1.52278065 ...,  2.20771815  2.29967753
  1.62323285]
Used the cpu

so...it lookf for pygpu and doesn't find it

I looked in the ubuntu's and python index packages repositories and didn't find pygpu.

My questions are:
How can I install pygpu?
Is libgpuarray required in order to use gpu?

Looking forward to your kind help.
Kind regards.
Marco

Marco Ippolito

unread,
Oct 10, 2014, 9:03:05 AM10/10/14
to theano...@googlegroups.com
I read in another post that Frédèric said that"pygpu: for the new gpu back-end, not useful to you now"

Does it mean that I installed an obsolete (not working anymore) cuda-toolkit?
I installed through sudo apt-get install this cuda-toolkit: http://packages.ubuntu.com/trusty/devel/nvidia-cuda-toolkit

Two days ago I installed Cuda 6.5 Production Release from here: https://developer.nvidia.com/cuda-downloads
The use of the gpu (Nvidia GeForce GTX 770) by Theano went fine (speed up from 3 secs to 0,3 sec), but the PC was affected by an unfortunately well-spread bug (pc logging) (https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/1312526)
This is why I decided to re-install Ubuntu 14.04 and install nvidia-cuda-toolkit via sudo apt-get install

Pascal Lamblin

unread,
Oct 10, 2014, 12:04:47 PM10/10/14
to theano...@googlegroups.com
On Fri, Oct 10, 2014, Marco Ippolito wrote:
> but it says:
> marco@marco-All-Series:~/Theano-Testing$ THEANO_FLAGS=device=cuda0 python
> check1.py

If you use "device=gpu0" instead of "device=cuda0", it will use the
older back-end, which does not need libgpuarray.


--
Pascal

Marco Ippolito

unread,
Oct 10, 2014, 12:10:41 PM10/10/14
to theano...@googlegroups.com
Hi Pascal,
thanks for answering my questions.


As you suggested, I used device=gpu0, and the output is:

marco@marco-All-Series:~/Theano-Testing$ THEANO_FLAGS=device=gpu0 python check1.py
WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu0 is not available  (error: Unable to get the number of gpus available: no CUDA-capable device is detected)

[Elemwise{exp,no_inplace}(<TensorType(float64, vector)>)]
Looping 1000 times took 3.77982497215 seconds

Result is [ 1.23178032  1.61879341  1.52278065 ...,  2.20771815  2.29967753
  1.62323285]
Used the cpu


What do I have to modify?
Looking forward to your helpfull hints.
Kind regards.
Marco

Pascal Lamblin

unread,
Oct 10, 2014, 12:19:45 PM10/10/14
to theano...@googlegroups.com
On Fri, Oct 10, 2014, Marco Ippolito wrote:
> As you suggested, I used device=gpu0, and the output is:
>
> marco@marco-All-Series:~/Theano-Testing$ THEANO_FLAGS=device=gpu0 python
> check1.py
> WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu0 is not
> available (error: Unable to get the number of gpus available: no
> CUDA-capable device is detected)
> [Elemwise{exp,no_inplace}(<TensorType(float64, vector)>)]
> Looping 1000 times took 3.77982497215 seconds
> Result is [ 1.23178032 1.61879341 1.52278065 ..., 2.20771815 2.29967753
> 1.62323285]
> Used the cpu

I'm not sure why your GPU is reported as unavailable. What information
does "nvidia-smi" tell you?

--
Pascal

Marco Ippolito

unread,
Oct 10, 2014, 12:21:17 PM10/10/14
to theano...@googlegroups.com
Hi Pascal,

this is  the information reported by nvidia-smi:

marco@marco-All-Series:~/Theano-Testing$ nvidia-smi
Fri Oct 10 18:20:27 2014      
+------------------------------------------------------+                      
| NVIDIA-SMI 4.304...   Driver Version: 304.117        |                      
|-------------------------------+----------------------+----------------------+
| GPU  Name                     | Bus-Id        Disp.  | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap| Memory-Usage         | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 770          | 0000:01:00.0     N/A |                  N/A |
| 30%   32C  N/A     N/A /  N/A |  10%  214MB / 2047MB |     N/A      Default |
+-------------------------------+----------------------+----------------------+
                                                                              
+-----------------------------------------------------------------------------+
| Compute processes:                                               GPU Memory |
|  GPU       PID  Process name                                     Usage      |
|=============================================================================|
|    0            Not Supported                                               |
+-----------------------------------------------------------------------------+



Marco

Marco Ippolito

unread,
Oct 10, 2014, 12:28:28 PM10/10/14
to theano...@googlegroups.com
do you see something wrong with it?
Is it normal to have "not supported" for "compute processes"?

Marco

Pascal Lamblin

unread,
Oct 10, 2014, 12:32:43 PM10/10/14
to theano...@googlegroups.com
On Fri, Oct 10, 2014, Marco Ippolito wrote:
> do you see something wrong with it?
> Is it normal to have "not supported" for "compute processes"?

I think it is normal for gamer cards.

I have no idea what's wrong, so I'm going with the age-old suggestion:
did you try rebooting the machine?

--
Pascal

Marco Ippolito

unread,
Oct 10, 2014, 12:38:33 PM10/10/14
to theano...@googlegroups.com
Dear Pascal,
did reboot already few times before.

Anyway, after your post, I did it again.
But the output is still, unfortunately, the same:

marco@marco-All-Series:~$ cd Theano-Testing

marco@marco-All-Series:~/Theano-Testing$ THEANO_FLAGS=device=gpu0 python check1.py
WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu0 is not available  (error: Unable to get the number of gpus available: no CUDA-capable device is detected)
[Elemwise{exp,no_inplace}(<TensorType(float64, vector)>)]
Looping 1000 times took 3.7560210228 seconds

Result is [ 1.23178032  1.61879341  1.52278065 ...,  2.20771815  2.29967753
  1.62323285]
Used the cpu
marco@marco-All-Series:~/Theano-Testing$

Marco

Marco Ippolito

unread,
Oct 10, 2014, 12:46:52 PM10/10/14
to theano...@googlegroups.com
What do I really do not understand is why two days ago with Cuda 6.5 Production Release the test went fine (but later the login-bug appeared, and forced my to re-installed ubuntu 14.04),
and now with nvidia-current(304.117-0ubuntu1) doesn't recognize the gpu device.
Am I wrong in thinking is something related to the gpu's driver? Or is it due to something else? for example one of the required packages (http://deeplearning.net/software/theano/install.html) I installed via sudo apt-get?

Marco

Pascal Lamblin

unread,
Oct 10, 2014, 12:49:27 PM10/10/14
to theano...@googlegroups.com
On Fri, Oct 10, 2014, Marco Ippolito wrote:
> Dear Pascal,
> did reboot already few times before.
>
> Anyway, after your post, I did it again.
> But the output is still, unfortunately, the same:

What would "nvidia-smi -a" say? There may be a warning in there.

Are you able to compile and run the "deviceQuery" example in
<cuda_dir>/samples/1_Utilities?

>
> marco@marco-All-Series:~$ cd Theano-Testing
> marco@marco-All-Series:~/Theano-Testing$ THEANO_FLAGS=device=gpu0 python
> check1.py
> WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu0 is not
> available (error: Unable to get the number of gpus available: no
> CUDA-capable device is detected)
> [Elemwise{exp,no_inplace}(<TensorType(float64, vector)>)]
> Looping 1000 times took 3.7560210228 seconds
> Result is [ 1.23178032 1.61879341 1.52278065 ..., 2.20771815 2.29967753
> 1.62323285]
> Used the cpu
> marco@marco-All-Series:~/Theano-Testing$
>
> Marco
>
>
> On Friday, 10 October 2014 18:32:43 UTC+2, Pascal Lamblin wrote:
> >
> > On Fri, Oct 10, 2014, Marco Ippolito wrote:
> > > do you see something wrong with it?
> > > Is it normal to have "not supported" for "compute processes"?
> >
> > I think it is normal for gamer cards.
> >
> > I have no idea what's wrong, so I'm going with the age-old suggestion:
> > did you try rebooting the machine?
> >
> > --
> > Pascal
> >
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "theano-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to theano-users...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
Pascal

Pascal Lamblin

unread,
Oct 10, 2014, 12:50:18 PM10/10/14
to theano...@googlegroups.com
On Fri, Oct 10, 2014, Marco Ippolito wrote:
> What do I really do not understand is why two days ago with Cuda 6.5
> Production Release the test went fine (but later the login-bug appeared,
> and forced my to re-installed ubuntu 14.04),
> and now with nvidia-current(304.117-0ubuntu1) doesn't recognize the gpu
> device.
> Am I wrong in thinking is something related to the gpu's driver? Or is it
> due to something else? for example one of the required packages
> (http://deeplearning.net/software/theano/install.html) I installed via sudo
> apt-get?

My guess as well is it has to do with the driver.
--
Pascal

Deb Midya

unread,
Oct 11, 2014, 5:47:55 AM10/11/14
to theano...@googlegroups.com
Hi,

Can any one help me how to de-register from theano? I am not using any longer.

Regards,

Deb


--------------------------------------------
On Sat, 11/10/14, Marco Ippolito <ippolit...@gmail.com> wrote:

Subject: Re: [theano-users] How can I install pygpu? Is libgpuarray required in order to use gpu?
To: theano...@googlegroups.com
Received: Saturday, 11 October, 2014, 2:46 AM

Marco Ippolito

unread,
Oct 11, 2014, 9:31:18 AM10/11/14
to theano...@googlegroups.com
Hi Pascal and hi everyone,
through the expert knowledgeable guide of a friend I solved the problem.
It's actually a problem of incompatibility between nvidia driver, installed via official nvidia repository, and cuda, installed via official ubuntu repository (apt-get).

I asked my friend to make a detailed post on his blog to describe in details problem and solution, in order to spread as much as possible the knowledge about these issues.
Once ready, I will post here the link to his blog post.

Kind regards.
Marco

Pascal Lamblin

unread,
Oct 11, 2014, 4:54:59 PM10/11/14
to 'Deb Midya' via theano-users
On Sat, Oct 11, 2014, 'Deb Midya' via theano-users wrote:
> Can any one help me how to de-register from theano? I am not using any longer.

Literally every message that you receive from that mailing list contains the following information:

To unsubscribe from this group and stop receiving emails
from it, send an email to theano-users...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
Pascal

Chris Brown

unread,
Oct 23, 2014, 1:35:24 PM10/23/14
to theano...@googlegroups.com
Hi Marco,

I seem to have also run into this problem (also on Ubuntu 14.04).  Did your friend ever post on his blog?

Thanks,
Chris...

Frédéric Bastien

unread,
Oct 23, 2014, 3:11:01 PM10/23/14
to theano-users
I would recommand you to use the current GPU back-end that don't need libgpuarray:

http://deeplearning.net/software/theano/tutorial/using_gpu.html#cuda-backend

If you talk about something not related to libgpuarray, tell what it is.

Fred

Chris Brown

unread,
Oct 23, 2014, 4:12:28 PM10/23/14
to theano...@googlegroups.com
Hi Fred,

I didn't mean to hijack this (old) thread, I was just curious if a follow-up was pending. 

I'm having a similar problem to what Marco was reporting and I suspected it might be the same issue.  It is the same program Marco was running.  Here is the exec:

$ LD_LIBRARY_PATH=/usr/local/cuda-6.5/targets/x86_64-linux/lib/ THEANO_FLAGS="mode=FAST_RUN,device=gpu,cuda.root=/usr/local/cuda-6.5" python tgputest.py
Using gpu device 0: GeForce 210

[Elemwise{exp,no_inplace}(<TensorType(float64, vector)>)]
Looping 1000 times took 4.59172201157 seconds

Result is [ 1.23178032  1.61879341  1.52278065 ...,  2.20771815  2.29967753
  1.62323285]
Used the cpu

However I realize now that I'm not getting the error message that Marco was getting, so something else is going on.

Chris...

Marco Ippolito

unread,
Oct 23, 2014, 4:17:38 PM10/23/14
to theano...@googlegroups.com
Hi Chris,
unfortunately my friend didn't post on his blog yet.

I'm not that expert, but I will try to explain what I did with his
supervision, in order to solve the problem.

As said, the problem is due to the way nvidia packages and apt system
are deployed. Apt "sees" only the packages installed via apt-get,
while the auto-installing nvidia packages "see" only what is installed
through their packages.
Therefore the problem comes when you install the nvidia driver, then
cuda, but cuda requires a specific version of the driver, which is not
available in the ubuntu repositories...

Roughly these are the steps I followed which solved the problem:
1) I first removed from my PC everything related with nvidia,
dependencies included
2) Fundamental step: sudo apt-get install build-essential gcc g++ make
binutils linux-headers-`uname -r
Installing the linux headers, make nvidia driver "aware" of the
packages already present in the system, and therefore nvidia driver
from now on will be able to "see" them all
3) Installed cuda_6.5.14_linux_64.run (while normally for ubuntu you
have to install .deb packages)
4) Within the terminal (consolle:
http://ubuntuhandbook.org/index.php/2014/01/boot-into-text-console-ubuntu-linux-14-04/),
executed cuda_6.5.14_linux_64.run .
Important: installed this time the nvidia driver through cuda
5) Tested cuda with the examples
6) I set the path to cuda:
echo "export PATH=/usr/local/cuda-6.5/bin:$PATH" >> .bashrc
echo "export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib64:$LD_LIBRARY_PATH"
>> .bashrc
source .bashrc
7) Installed Theano and all its dependencies again
8) Tested Theano

I do hope I've been of help.
Kind regards.
Marco
> You received this message because you are subscribed to a topic in the
> Google Groups "theano-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/theano-users/_M1dJleZR4Q/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to

Frédéric Bastien

unread,
Oct 23, 2014, 4:18:32 PM10/23/14
to theano-users
Hi,

Read the doc about floatX. The problem is that you didn't used it. This line should work on the GPU:


$ LD_LIBRARY_PATH=/usr/local/cuda-6.5/targets/x86_64-linux/lib/ THEANO_FLAGS=floatX=float32,"mode=FAST_RUN,device=gpu,cuda.root=/usr/local/cuda-6.5" python tgputest.py

Rapidly, the gpu back-end support only float32. But by default, Theano variable are of dtype floatX, that default to float64.

Fred


--

Chris Brown

unread,
Oct 23, 2014, 4:26:09 PM10/23/14
to theano...@googlegroups.com
Hi Marco,

Thanks for your reply.  I've already done most of those steps (in that order, too).  I'll continue down the list!

Hi Fred,

I actually tried that earlier and just now again.  It adds a new warning and runs a bit faster (both on cpu and gpu), but still doesn't end up on the gpu:

LD_LIBRARY_PATH=/usr/local/cuda-6.5/targets/x86_64-linux/lib/ THEANO_FLAGS="mode=FAST_RUN,floatX=float32,device=gpu,cuda.root=/usr/local/cuda-6.5" python tgputest.py
Using gpu device 0: GeForce 210
WARNING (theano.sandbox.cuda.opt): Optimization Warning: Got the following error, but we can ignore it. This could cause less GpuElemwise fused together.

[HostFromGpu(<CudaNdarrayType(float32, vector)>), Elemwise{Exp{output_types_preference=transfer_type{0}}}[(0, 0)](HostFromGpu.0)]
Looping 1000 times took 2.62730097771 seconds
Result is [ 1.23178029  1.61879337  1.52278066 ...,  2.20771813  2.29967761
  1.62323284]
Used the cpu

Chris...

Frédéric Bastien

unread,
Oct 23, 2014, 5:44:44 PM10/23/14
to theano-users
On Thu, Oct 23, 2014 at 4:26 PM, Chris Brown <chr...@chibi.ca> wrote:
Hi Marco,

Thanks for your reply.  I've already done most of those steps (in that order, too).  I'll continue down the list!

Hi Fred,

I actually tried that earlier and just now again.  It adds a new warning and runs a bit faster (both on cpu and gpu), but still doesn't end up on the gpu:

LD_LIBRARY_PATH=/usr/local/cuda-6.5/targets/x86_64-linux/lib/ THEANO_FLAGS="mode=FAST_RUN,floatX=float32,device=gpu,cuda.root=/usr/local/cuda-6.5" python tgputest.py
Using gpu device 0: GeForce 210
WARNING (theano.sandbox.cuda.opt): Optimization Warning: Got the following error, but we can ignore it. This could cause less GpuElemwise fused together.

What is after that? It is that who prevent the GPU from being used.

Also, can you update Theano again? We just merged a fix. It should cause this problem, but depending when you did you checkout, it could fix other stuff.

Fred

Chris Brown

unread,
Oct 23, 2014, 6:24:31 PM10/23/14
to theano...@googlegroups.com
I replaced Theano:

pip uninstall theano #previously just the 'pip install theano' version
pip install git+git://github.com/Theano/Theano.git

And it now selects the gpu and runs at about twice the speed.  So I guess you were right about a bug in the release version of Theano possibly causing this issue.

Thanks,
Chris...
Reply all
Reply to author
Forward
0 new messages