104

Is it possible to use the GPU for calculations? (e.g. CUDA/OpenCL)

67

As of 2012, your best bet was to implement your computation as a fragment shader in GLSL ES and find a way to represent the output as a RGBA (32-bit) texture.

Eben stated in this 2012 talk that OpenCL is not likely to be implemented, but that there may be an API developed in the future; the answer starts at 21:20, and Eben says "we may provide some way for people to get some of that general purpose compute out".

Recent developments such as the VC4CL project have attempted to implement OpenCL on the VideoCore IV GPU used by the Raspberry Pi, and other related projects now provide access to some of the general compute power of the GPU.

  • 6
    AFAIK that talk is the most definitive answer so far... the answer starts at 21:20, and Eben says "we may provide some way for people to get some of that general purpose compute out" – je4d Jun 12 '12 at 22:31
  • 5
    Some of the GPU code has been opensourced! github.com/raspberrypi/userland – John La Rooy Oct 25 '12 at 0:14
  • It is equivalent to implementing OpenCL, as someone can just add a VideoCore OpenCL backend to LLVM to compile OpenCL to VC. – Maxthon Chan Apr 11 '15 at 4:58
  • 2
    The situtation has changed in 2014 with the official release of documentation and various blogposts about GPGPU on the official blog itself. – flakeshake Jan 11 '16 at 13:22
29

Not at present - there is only a framebuffer interface for display purposes. There is no OpenCL and no plans for it nor is there documentation available to create OpenCL. CUDA is Nvida only so isn't applicable. Once an OpenGL driver becomes available you may be able to engineer some calculations via the GPU but how useful that will be remains to be seen.

Check out this detailed thread on the RPi forum: GPU Processing API

11

This one may be useful.. GPGPU python library for the raspberry pi. https://github.com/nineties/py-videocore

A general-purpose GPU (GPGPU) is a graphics processing unit (GPU) that performs non-specialized calculations that would typically be conducted by the CPU

9

You can write high-level programs that run on the Pi's GPU using QPULib:

https://github.com/mn416/QPULib

It's a programming language and compiler targeting the 12 vector processors (QPUs) inside the Pi's GPU. It aims to be easy to use and is implemented as an EDSL (Embedded Domain Specific Language) -- a lightweight alternative to a full-blown OpenCL backend.

7

The Raspberry Pi foundation has been endorsing GPGPU on the Pi since 2014 , shortly after Broadcom released documentation for the QPU units inside the GPU.

An experimental OpenCL compiler was created by Simon J. Hall (the winner of the tightly related 2014 10,000 $ competition to make Quake run acceptably without using the GPU BLOB) : see here.

protected by Darth Vader Dec 27 '18 at 23:20

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.