3

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?

Thanks.

Aphire
  • 217
  • 4
  • 16

1 Answers1

2

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).

goldilocks
  • 60,325
  • 17
  • 117
  • 234