16

I'm trying to use Python with Theano to accelerate some code with OpenCL. I installed libgpuarray and pygpu as instructed (I think), and got no errors. The installation detected the OpenCL runtime installed.

I just cannot run the Theano example for OpenCL, mainly because I don't know how to specify my GPU. My GPU is a Radeon HD 5340/5450/5470, according to inxi. All code in the Theano documentation uses device=cuda0 and the only place where OpenCL is mentioned, it says device=openclN where N is a number.

I tried device=opencl0 and got a pygpu error saying that the correct format is opencl<int>:<int>. I have since tried any number of combinations of numbers (opencl0:0 and such), and always an GpuArrayException: Unknown error.

My system is Ubuntu 14.04 x64 and my hardware is a Toshiba Satellite, 15". I installed Theano with pip, and later installed libgpuarray following the instructions on their site.

What am I doing wrong?

Alejandro Piad
  • 1,827
  • 1
  • 16
  • 23
  • What is the OS and compiler you're using? – Noob Saibot Jan 15 '15 at 22:26
  • Ubuntu 14.04 and for compiler, I don't know, I'm directly using `Theano` from Python. I suppose it should select the right compiler? – Alejandro Piad Jan 15 '15 at 22:35
  • How was Theano compiled? How was PyGPU compiled? How did you install them on your machine? – Noob Saibot Jan 15 '15 at 22:38
  • I installed `theano` with `pip` from a downloaded `tar.gz`, and `pygpu` by downloading and compiling `libgpuarray` manually. – Alejandro Piad Jan 15 '15 at 22:42
  • Which compiler did you use to do that? When dealing with low-level stuff like this, you'd typically need the details of the compiler, OS, and CPU (GPU) as a prerequisite for any help. – Noob Saibot Jan 15 '15 at 22:45
  • I really just downloaded `libgpuarray` and executed `make`, `make install`, etc. – Alejandro Piad Jan 15 '15 at 22:48
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/68926/discussion-between-alejandro-piad-and-noob-saibot). – Alejandro Piad Jan 15 '15 at 22:51
  • I really don't have anything more for you. Just trying to get you to put out more info for someone else who stumbles on this. From what I could *guess*, your compiler is GCC-something, on a "mobile version" of Ubuntu, with an AMD processor, and no GPU. See what I mean? Edit your question with the correct details. – Noob Saibot Jan 15 '15 at 22:55
  • I get the same exact error. I am using Intel HD4000 with the beignet 1.0.1 (openCL) drivers. Installed Theano from archlinux aur, installed clBLAS via source, installed libgpuarray via source. – Yahma Jan 30 '15 at 21:47

1 Answers1

10

opencl0:0 is correct. Could you confirm that pyopencl works? You may have a problem with your opencl (or drivers/cl compiler).

However, I think Theano does not quite work with OpenCL at the moment. The current state is there is partial support, enough for "hello world", but not enough to run any significant code.

See:

https://github.com/Theano/Theano/issues/2189

https://github.com/Theano/Theano/issues/1471

https://github.com/Theano/Theano/issues/2190

https://github.com/Theano/Theano/pull/1732

To summarize, no, most stuff is not ported (including Elemwise, for example, which is a common op). I would really like to see Theano on OpenCL though. That would be a great thing for AMD to pitch in on. Soon :)

Alex I
  • 19,689
  • 9
  • 86
  • 158
  • 3
    If that is the case, then there is no point in trying further until more sutff has been ported. Thanks for the hint. – Alejandro Piad Feb 27 '15 at 22:42
  • 2
    The latest version of Theano and pyopencl works fine with my AMD Radeon HD 7750 cards with the latest catalyst, libgpuarray installed in Ubuntu 14.04 64-bit. – hobs Apr 03 '16 at 02:08
  • 2
    Tried Theano+OpenCL and discovered that lasagne will not cooperate with OpenCL at this point in time. – HeikoG Jun 08 '16 at 08:12