Using GPU.js in Angular

Compute matrix calculation using GPU in browser and Angular

In a typical client-server architecture, client is supposed to do a little processing of inputs and more of user interactions. A web client should capture user inputs and data and send it to a server where heavy computations will take place and result will be sent back to a client for presentation. This is/was the orthodox way of web application development. But with advancement in computer hardwares, browsers capabilities, power of JavaScript libraries, introduction of web workers, web assemblies (WASM) etc.; things are not the same, are they? Nowadays, a web client can do lots of pure computations in memory. The few examples are big data visualisation libraries like D3.js, games development using WebGL, applying math operations on big data using web workers at client side etc.

Nowadays, almost all desktops and laptops have a built-in General Purpose Graphics Processor Unit (GPGPU). These are powerful chips used for heavy computations which is generally required in graphics heavy games. But over the time period, programmers have found a way to apply GPGPU for other problems as well. On the server side, there are many toolkits and programming languages available for writing GPGPU code like CUDA but what if we can use client’s GPGPU to do our JavaScript heavy task? Interesting thought, isn’t it?


As usual, I have built a demo web application for matrix multiplication using GPU.js and Angular to see how it pans out. You can checkout the live demo here:

CPU matrix multiplication

GPU matrix multiplication


I am excited and looking forward to see how in future web developers will use client’s GPU functionalities to change the web development the way we know it!

Source Code


Cloud Solution Architect | Author | Full Stack Developer | |