JavaScript running on the GPU

Ajaxian » Front Page • by Dion Almaer • 6 days ago

I love programmers like Alex Miltsev. He won the Jetpack 0.5 content by prototyping access to the GPU from JavaScript!

Alex’s work is an alpha-prototype that shows the feasibility of the project and it requires a custom build of Firefox to use — it’s not easy to demo. However, the code sample below shows how the technology works. In this example, we are transposing a matrix at lightening speed:


  1. jetpack.statusBar.append({
  2. html: « Transpose! »,
  3. onReady: function(widget){
  4. $(widget).click(function(){
  5. var myStorage = jetpack.cuda-storage;
  6. var matrix = new Array();
  7. var size = 32;
  8. for(var i=0; i<size *size; ++i)
  9. array[i] = i;
  10. var transposedMatrix = myStorage.transpose(size, matrix);
  11. transposedMatrix.forEach(function (v) { console.log( v ); })
  12. });
  13. });

Alex discussed why this matters:

People are using the internet to collaborate more than ever before. Collaboration on the internet has been evolving at a rapid pace, and the applications and technology that will drive the next wave of internet collaboration will require even greater technical complexity and more significant computing resources than is currently available through the browser environment today. While text documents, videos, music, and image-base forms of collaboration are now common place, there are many needs require a level of compute performace beyond the web platform as it exists today, such as:

  • consumption of high-quality digital video or music streams,
  • complex image or speech recognition,
  • manipulation and processing large pictures of nature or space,
  • processing large sets of tabular data locally in the browser,
  • complex animations with DOM elements (via DirectX or OpenGL),
  • exploring 3D worlds, such as SecondLife or an OpenSim Grid,
  • real-time audio and video editing,
  • having an integrated development environment that runs entirely in the browser

There are endless examples of such complex uses of the internet platform that are just not feasible with the status quo web platform. Developers have tried to overcome such barriers in the past with client-side enhancements like ActiveX, Netscape Plugins, Java Applets, but each in its own way was flawed and failed to gain mass adoption. It is possible that the Native Client project will change all this, but standardization of such initiatives across the browser landscape is a lengthy endeavor. For the near future the tools that the developer uses to provide a rich user experience remain JavaScript and ActionScript, plug-ins, such as the ones previously mentioned, are significantly limited by the architectural mismatch of performance requirements they place on the CPU.

Ben tends to get a little giddy when he hears about GPU access 🙂

Cet article a été publié dans Uncategorized. Ajoutez ce permalien à vos favoris.

Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:


Vous commentez à l'aide de votre compte Déconnexion /  Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion /  Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion /  Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion /  Changer )


Connexion à %s