by nerfhammer · 9y ago · 0 comments
I thought there are only vertex/fragment shaders and compute shaders aren't supported yet? Do you just pretend everything is pixel data?
We store NDArrays as floating point WebGLTextures (in rgba channels). Mathematical operations are defined as fragment shaders that operate on WebGLTextures and produce new WebGLTextures.
The fragment shaders we write operate in the context of a single output value of our result NDArray, which gets parallelized by the WebGL stack. This is how we get the performance that we do.
It will be interesting to see if the industry will produce a standard for GPGPU in the browser. Giving that the desktop standard is less common than a proprietary standard.
They did: webcl Sadly, it had multiple security issues so the browsers that had implemented it in their beta channels (just Chrome and Firefox, I believe) ended up removing it. And now, I think it's totally stalled and no one is planning on implementing it.
Also sadly, SIMD.js support is coming along extremely slowly.
I ended up switching to OpenCL since I am running this on my desktop. Just curious to see what you did. Thanks!
Pretty much.
It's inconvenient because shaders are meant for vertices/fragments but it still works.
You want fast matrix multiplication? Pretend you're doing texture shading in a language primarily used for dynamic web frontends!
A texture is just data and a shader mutates that in a highly parallel way with specific coherence semantics. Before knocking it, I suggest educating yourself a bit more.
Granted it doesn't have AMD support, I'm fairly confident even the CPUs can out perform the javascript library.
Don't expect anything better soon as companies focus on performance per watt and will only develop things in that path.
JavaScript in the browser lacks good data manipulation libraries (nothing that comes close to using Pandas, or R). Even loading/saving files with the browser is a PITA (by design really, for security reasons).
I can see a day when JavaScript (or web assembly) has APIs like Numpy and Pandas, but for now It's simply easier to install one of those than try and do everything in JavaScript.
Node adds file support, but libraries for stuff like dataframes are still in their early days. That might not be a problem for example problems, but real world data needs cleaning up before you can start doing ML.
JS has improved over the year but you can also go with a typed language if you wanted like purescript or typescript.
* Error in line 392
After an hour of searching, the solution is:
"Just install these 100 packages. Package 1-20 need to be compiled from source, because the project requires an old version. And they all have dependencies of their own."