-
Notifications
You must be signed in to change notification settings - Fork 71
Home
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 Lab’s 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.
If you would like to get a feel for the programming model and experiment with the API without installing Firefox Nightly, 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.
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 prebuilt version for Firefox running on Windows, MacOS and Linux (older versions for older browsers can be found here). If you would like to build the extension yourself, we have written a README that explains the process. If you are running Firefox on Windows or Linux, you additionally need to install Intel's OpenCL SDK (Please note the SDK's hardware requirements.).
Note that Firefox has deprecated the Components object in content code. However, we make heavy use of the Components.interfaces hierarchy in the compiler implementation. To still use River Trail, you have to set the dom.omit_components_in_content key in about:config to false. Detailed instructions on changing configuration variables are available in Mozilla's knowledge base.
If even after setting the above configuration flag you still cannot use River Trail, make sure that your OpenCL SDK is properly installed and supported by River Trail. Furthermore, not all device kinds on all platforms are supported. Take a look at the device selection settings to check whether your configuration is supported.
Once you have the extension installed and working, take a look at our demos:
- the sample applications in the RiverTrail/examples folder
- the particle simulation shown at IDF 2011
- our liquid image resizing demo first shown at Research @ Intel day 2011
Chris Whealy has created a demo that combines Mandelbrot and Julia sets into a fun fractal explorer. He also wrote an experience report about creating the demo.
For a first impression, you can watch this video, as well, or head over to InfoQ for an introductory talk recorded at TheStrangeLoop. 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 our
- Mandelbrot in RiverTrail based on Evgeny Demidov's WebCL version
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.
The Parallel JavaScript API is now available in Firefox Nightly. To use it, simply download Firefox Nightly - no browser extension required. Firefox Nightly supports all of Parallel JavaScript as described in the API specification.. More details and sample workloads are available in the Parallel JavaScript repository.
The API described in the wiki reflects what the prototype implements. Some design choices, like for instance the use of extra arguments, is dictated by limitations of what our implementation approach allows.
The Parallel JavaScript draft API specification (ECMA strawman) goes beyond the prototype's limitations 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.