I am using my Pi2 to run some Python scripts that are heavily use the CSI camera (being pulled with the picamera module), being processed with OpenCV, and draw a GUI to screen (using the PyGame module)

I would like to improve the speed/performance in these areas, which is why I plan to split my memory (giving more to the GPU), but before I do this, I wondered how much of my code is likely to actually be processed by the GPU.

I understand the GPU is for all graphic tasks, however the code that performs these tasks run concurrently and are presumably being processed originally by the CPU? and with regards to pulling frames from the CSI camera, I have no idea if this would be a task for the GPU or not?

So I suppose my question is, in these two areas, is it worth putting all my eggs in the GPU basket, or just going for a even split?


  • I don't know. However I'd just benchmark various splits to find the answer. It may depend on the precise details of what you are doing.
    – joan
    Jun 4, 2015 at 10:17
  • 1
    Yeah, this does seem like the logical thing to do, I was just interested to knows what goes up "under the hood" so to speak.
    – Aphire
    Jun 4, 2015 at 10:20

1 Answer 1


I understand the GPU is for all graphic tasks

Not necessarily. For example, the 2D stuff which makes up a GUI desktop and applications is done by the CPU. As far as I know, the only stuff that exploits the GPU would be openGL ES code (presumably including PyGame) and stuff that links to other things in /opt/vc/lib -- you could check your other python modules for that. At a glance (/opt/vc/include) I'd say that's mostly about encoding/decoding the various hardware accelerated video formats.

I plan to split my memory (giving more to the GPU)

You could try using a dynamic split; the official docs are here. You can check on it with vcgencmd get_mem gpu.

That would help to answer the question, "How much of my code is likely to actually be processed by the GPU?", and "Is it worth putting all my eggs in the GPU basket?" (since you would not need to do so).

  • Great, thanks a lot, I will look into dynamic splitting. Cheers for the informative answer
    – Aphire
    Jun 4, 2015 at 13:13
  • There is a caveat I guess if you are using most of the available RAM. I'd guess the CPU will win out in that case. Beware that refers to memory not including system buffers/cache, which often confuses people (e.g., real memory committed is in the second line of output from free, not the first, which will always be higher). Since you're running a GUI you might want to have a glance at that and if it is in excess of ~750 MB enforce a static split; I think giving the GPU 128 MB is the usual recommendation for picam stuff, maybe that could be doubled to include the openGL aspect.
    – goldilocks
    Jun 4, 2015 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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