Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.
Lindsey Kuper edited this page Feb 17, 2015 · 96 revisions

Background

In a world where the web browser is the user's window into computing, browser applications must leverage all available computing resources to provide the best possible user experience. Today web applications do not take full advantage of parallel hardware due to the lack of appropriate programming models. The goal of Intel Labs' River Trail project, also known as Parallel JavaScript, is to put the parallel compute power of the client's hardware into the hands of the web developer while staying within the safe and secure boundaries of the familiar JavaScript programming paradigm. River Trail gently extends JavaScript with simple deterministic data-parallel constructs that are translated at runtime into a low-level hardware abstraction layer. By leveraging multiple CPU cores and vector instructions, River Trail achieves significant speedup over sequential JavaScript.

Using the River Trail interactive shell

If you would like to get a feel for the programming model and experiment with the API without installing anything, take a look at our interactive River Trail shell. The shell runs in any current version of Firefox, Chrome, and Safari. However, the code you write in the shell will be executed sequentially using a library implementation and you won't see any speedup.

However if you are running Firefox and you have installed the River Trail browser extension for Firefox (see below on how), your code will run in parallel.

Getting River Trail

You need to install our Firefox extension to use our prototype compiler that enables execution of River Trail on parallel hardware. You can download a pre-built version compatible with Firefox 33+ for Windows, Mac OS X and Linux. (An archive of all versions of the extension can be found here.)

If you would like to build the extension yourself, we have written a README that explains the process.

OpenCL settings

The River Trail Firefox extension allows JavaScript to interface with OpenCL. Therefore, to benefit from having the extension installed, you must install OpenCL. (Mac OS X users can skip this step, since OpenCL is already part of the system.)

It is possible to use River Trail with various OpenCL platforms and devices. In particular, it's possiblet to run River Trail applications on a supported GPU. Not all device kinds on all platforms are supported; once you have the extension and OpenCL installed, take a look at the extension's device selection settings to check whether your configuration is supported.

Sample Applications

Once you have the extension installed and working, take a look at our demos:

There are also third-party demos, such as this fractal explorer demo by Chris Whealy, who wrote an experience report about its creation.

For a first impression, you can watch this video, as well, or head over to InfoQ for an introductory talk recorded at Strange Loop 2012. For a interesting discussion of various problems we are trying to solve, you can view this interview, which discusses our approach and objectives.

A smaller example that gives a look behind the scenes and serves as an easy comparison of our programming model with WebCL is this Mandelbrot set demo, based on Evgeny Demidov's WebCL version.

A good way to get started with programming with the River Trail API is to go through our tutorial. To dive deeper, the API design or the beginnings of our API documentation are a good starting point.

A word of caution: River Trail is a prototype and the extension is not yet meant for use on the public web. Please uninstall or disable the extension when surfing the web and use it only for web pages you trust.

Parallel JavaScript language specification

The API described in the wiki reflects what the River Trail prototype implements. Some design choices, such as, for instance, the use of extra arguments, are dictated by limitations of what our implementation approach (i.e., as a browser extension) allows.

The Parallel JavaScript draft API specification (ECMA strawman) differs from the River Trail implementation in a number of ways and is the API currently being considered for standardization by the ECMA TC39 committee. Feedback is highly appreciated and should be directed to the es-discuss mailing list.

Clone this wiki locally