cazala / synaptic

architecture-free neural network library for node.js and the browser
http://caza.la/synaptic
Other
6.92k stars 666 forks source link

GPU Acceleration with gpu.js #245

Open LoopControl opened 6 years ago

LoopControl commented 6 years ago

There's a new library that seems to do matrix math on the GPU via webGL. Their benchmark on the homepage shows about an 18X speed increase compared to CPU. Maybe Synaptic could use it?

http://gpu.rocks/ (Github here: https://github.com/gpujs/gpu.js )

Jabher commented 6 years ago

There are several different implementations of gpgpu, this one is really pretty, but it has an issue - there's ton of overhead due to parsing of js and then wrapping it into a code. Cazala planned to use weblas (afaik)

AlexisTM commented 6 years ago

@LoopControl For me, it's only 4 times. (Yet, I'm cheating, the browser is running on the Intel GPU, not the NVidia one.)

wagenaartje commented 6 years ago

GPU.js seems pretty awesome, but it's not always faster: https://jsfiddle.net/zkL3av3o/1/ (change matrixSize to your needs). The benchmark also runs without taking the time to initialise a kernel into account.

So it's definitely faster for larger vectors / matrices, but you'd need some kind of check to predict if running on GPU is faster.

talvasconcelos commented 6 years ago

And, as an example, onde would get Synaptic or Neataptic runing through GPU.js ? Any example would be great.