108

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

ramblinjan
  • 4,030
  • 7
  • 33
  • 52
Alex L
  • 7,605
  • 12
  • 42
  • 53

5 Answers5

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.

Aurora0001
  • 6,308
  • 3
  • 23
  • 38
finnw
  • 5,790
  • 3
  • 32
  • 42
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

Greenonline
  • 2,740
  • 4
  • 23
  • 36
Nick McCloud
  • 1,156
  • 10
  • 9
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

raspi-ninja
  • 879
  • 2
  • 8
  • 15
9

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.

flakeshake
  • 6,235
  • 1
  • 14
  • 33
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.

user46562
  • 91
  • 1
  • 1