Share
Embed
Transcript
15 slides
-
Scientific computing? Applied mathematical, statistical computing – applications across
data science, astrophysics, biostatistics, cheminformatics, and many others. It doesn’t stop there: computational finance uses the same libraries, languages and tools. Current languages: Python, R, Julia. -
So what’s wrong with Python or R? Nothing’s “wrong”
with them. But for one, they don’t have Javascript’s advantages – async, runs everywhere. -
Javascript: The PhoneGap for scientific computing? PhoneGap changed mobile
app dev. Javascript could do the same for technical computing. A powerful experience across servers, clients and embedded hardware. -
Applications Enormous. Calculating airline ticket costs on the basis
of aviation fuel rates, and Great Circle routes, all on the client side. Running clustering/classification/regression algorithms on the server, and passing their results to the client as D3.js visualizations. Running Javascript-based neural networks on the server, and sharing them with Parrot drones running Javascript, for facial recognition. The possibilities, to put it mildly, are rather endless. -
But. Is Javascript really suitable? Two basic guidelines to
evaluate any language’s feasibility for a problem: Does the language provide the right semantic constructs to model your problem and its possible solution(s)? Does the language have a decent ecosystem to help you solve your problem? -
Javascript does straddle the two disparate worlds of object-oriented
programming. The ecosystem is a bit of a challenge, however. But, there’s a solution to that too. -
Demo: Some sample libraries and their applications. Numbers.js –
Basic differential and integral calculus, linear algebra. Numerical Javascript – Advanced linear algebra, mathematical optimization. Clusterfck – Hierarchical clustering, for machine learning. Brain.js – Neural networks for deep learning. All these libraries, work with Node, browsers and embedded Javascript. -
Not enough, though. Obviously, Javascript just doesn’t have the
kind of libraries that Python or R or Julia do. Three options: Drop the whole idea of using Javascript. Start writing libraries for Javascript. Compile existing libraries to Javascript. Let’s be honest. Dropping it isn’t a nice option. Neither is writing libraries. But the third one sounds interesting! -
The power of Emscripten Emscripten is Mozilla’s implementation of
the asm.js specification. A gcc-compatible compiler, that translates C/C++ into runnable Javascript. C/C++ module LLVM bitcode Javascript -
Forging ahead with Emscripten Cython + Emscripten = Numpy
and SciPy on Javascript Emscripten + MLPACK, Intel’s MKL “Piggyback” off existing ecosystems to build one for scientific computing around Javascript. Biggest challenge – exploring Emscripten’s optimization methods, and using them to make models faster. -
Not just Emscripten… Heard of Duetto? It’s called Cheerp
now. #dontask LLVM+Clang, like Emscripten. Bi-directional interop between C++/Javascript. Uses RPC. Allows access to DOM elements in a lightweight manner – think C++ manipulating d3. Battle-tested on a large library on bullet physics. -
“One language, to rule them all.” Elm. RESTify
scientific models using Express. Math on the client, for rendering more powerful WebGL scenes, or interfacing with Famo.us. NaCL – running complicated models in the browser. Cylon.js – running scientific models on Raspberry Pis, Parrot Drones and more. Tessel.io – sharing intelligent neural nets across servers and microcontrollers to make automation more intelligent.