sameh4
Posts: 40
Joined: Wed Nov 29, 2017 6:58 pm

Machine Learning on the Video Core of the Pi's

Tue Dec 26, 2017 5:41 pm

I am wondering if the GPU (video core) part can be used for numerical analysis? Like the Nvidia GPU's are now used for machine learning?

The way I think of it is:

I am on bare metal, and I've got a small single purpose OS that's driving a car around using PWM DC motor control, and collecting data from IR and LiDAR sensors using I2C.

I want to do some numerical calculation on this data on the GPU while the CPU is being used for I2C and PWM, so I can feedback loop the results back to the CPU for more driving instructions.

Any thoughts on the viability of this? Can the video core be used in this way?

On the Pi 3 there's multi core, so with clever programming, I can off load the analysis to one or more cores. But the Zero is single core. If I am on zero and in bare metal, the video core is not being used. Can I utilize it for this?

Also, assuming I am on Pi 3, would the video core be faster at this numerical calculation than one CPU core?

sameh4
Posts: 40
Joined: Wed Nov 29, 2017 6:58 pm

Re: Machine Learning on the Video Core of the Pi's

Tue Dec 26, 2017 8:03 pm

I found a good article on this, which has references back to this very forum.

https://petewarden.com/2014/08/07/how-t ... g-its-gpu/

And another

https://rpiplayground.wordpress.com/201 ... ofit-pt-1/

It would still be good to get some advice from the experienced people here.

dwelch67
Posts: 944
Joined: Sat May 26, 2012 5:32 pm

Re: Machine Learning on the Video Core of the Pi's

Wed Dec 27, 2017 1:32 am

did you read up on the gpu and its instruction set? it is floating point heavy, so if you you want to do a fair amount of math then perhaps that is a/the way to go. as far as what algorithms you write that have some purpose that is up to you. I have not messed with it in a very long time, back when it wasnt published and the folks where hacking through the discovery of the instruction set. I think there are tools and ways to run your software without losing the use of the arm or dram, etc.

sameh4
Posts: 40
Joined: Wed Nov 29, 2017 6:58 pm

Re: Machine Learning on the Video Core of the Pi's

Wed Dec 27, 2017 11:55 am

@dwelch67 thanks!

I hadn't yet the the gpu instruction set. I have seen several blogs that say: "Broadcom released the GPU specs", but all links are broken now.

The ML algorithm part is easier for me, since I've taken a couple Coursera's and Udacity courses. I did a very simple feed forward neural network in python with numpy a year ago. I think I'd like to re-do that in C on bare metal.

mic_s
Posts: 78
Joined: Sun Oct 26, 2014 4:15 pm

Re: Machine Learning on the Video Core of the Pi's

Sat Jan 06, 2018 9:10 pm

Numerical analysis with Pi Zero ?
Yes.

There are 12 SIMD processing units (QPUs) in your Pi Zero. Each of those QPUs with 16 FloatingPoint-Units.

Lot of options:

(1)
QPULib (C,C++, small footprint) details :
viewtopic.php?f=63&t=145447&p=962040
https://github.com/mn416/QPULib ...

(2) Open CL (C,C++, work in progress) details :
viewtopic.php?f=67&t=194952 and links therein

(3) the python way. Example:
https://github.com/nineties/py-videocore ...

(4) QPU assembler is another option :
http://www.aholme.co.uk/GPU_FFT/Main.htm ...

(5) ….

Please note: There are limitations.

Heeee - there are allways limitations. You do not believe me ? Then please look at your account balance or in your purse. :-)

Return to “Bare metal, Assembly language”