boinc
boinc copied to clipboard
Enable browser-based computing in BOINC
It's possible to do scientific computing with GPUs using WebGL, on a variety of devices including phones. The easiest way to do this is from Javascript running in a browser.
Here's an idea: write a lightweight "BOINC client" in JS, which gets jobs from BOINC servers via the scheduler RPC protocol (or maybe a JSON-ized version of it). The jobs would be JS programs, possibly using WebGL.
Note: modern browsers have a provision for "background jobs" that run independently of browser windows.
Some people have talked about compiling BOINC (and apps) with Emscripten to run them on browsers. I don't know how far that work has progressed. I can't remember any status updates right now.
JavaScript itself is slow. Machine-converted code from c++ with its complexity to JavaScript, I'm afraid, will produce very slow solution. So personally I'd rather create JS client from scratch than use Emscripten. But as a fast first solution is fine, I believe. Maybe later we could find someone who could do this from scratch on JS (I believe it's easier than find someone to build c++ code on MacOS 😉
чт, 4 апр. 2019 г. в 19:26, Juha Sointusalo [email protected]:
Some people have talked about compiling BOINC (and apps) with Emscripten to run them on browsers. I don't know how far that work has progressed. I can't remember any status updates right now.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/BOINC/boinc/issues/3086#issuecomment-479968714, or mute the thread https://github.com/notifications/unsubscribe-auth/ADFZoVbcRylT66GeXi1rumdc-Wl_xb25ks5vdie2gaJpZM4cboTe .
-- Best regards, Vitalii Koshura
Sent via iPhone
I do remember playing Doom (Quake? Wolfenstein?) and running Linux on browser. Emscriptem docs claim
Emscripten generates fast code! Its default output format is asm.js , a highly optimizable subset of JavaScript that can execute at close to native speed in many cases (check out the current benchmark results or run the benchmark tests yourself).
Of course they say good things about themselves and I can't really understand the linked benchmarks. But I certainly wouldn't shrug it off without benchmarking our apps first.
Emscripten can convert to Web Assembly as well. While not as fully universal, it's on the major browsers and runs at a much faster speed. Multithreading is not actually supported in js, but Chrome does have a test of it (on production) in WebAssembly so that would allow for easier porting.
What's the use case of a browser-based client? It's temporary, and slower then a native client. The only thing I can think of is running boinc temporary on a machine which I don't have permission to install the boinc permanently.
What's the use case of a browser-based client? It's temporary, and slower then a native client. The only thing I can think of is running boinc temporary on a machine which I don't have permission to install the boinc permanently.
This could also be used to run BOINC applications on platforms that don't natively support them (for example, you could use this to run BOINC on a Windows Phone, or on a Chromebook that doesn't have the new native Linux apps support).
Also, while it would indeed be worse in terms of performance than native code, it may not actually end up being as bad as you might think. WebAssembly and asm.js are actually surprisingly fast if done right (yes, it's not native speeds, but it's exponentially faster than JavaScript).
Windows Phone is dead. Can't Chromebook run Android Boinc?
@adamradocz They were just the first two platforms that came to mind, there are of course other platforms out there that are not widely supported by BOINC applications that could benefit from this.
Alternatively though, if combined with a headless web browser with some extra stuff added in, this could potentially be used as a much more portable alternative to the current VM app functionality in BOINC (the VirtualBox functionality is still locked to the CPU architecture, this would allow the app to not care about that).
Running on browser would allow iOS to use it which would allow more people to use BOINC. There's also the ease of use to it. If I'm not technical, going to a website is much easier than installing something. It might not seem like a whole lot different but I used to use folding@home over BOINC because it ran in the browser and that was easier for me at the time.
@Ferroin Make sense. @RoboticMind For iOS, there's a similar app like boinc, called DreamLab. I think, visiting a website every day is tedious, so contributing in such a way, you have to be very conscious about the cause. But I accept your view.
It looks like WebAssemly is the future. Maybe worth considering converting the client to Wasm, rather than JavaScript. It will be much faster, especially in the future, when the WebAssemly gets more optimization. A Real-World WebAssembly Benchmark
I played around compiling with emscripten emsdk
Basically source ./emsdk_env.sh and emconfigure ./configure and emmake make
OpenSSL compile works with no-asm no-shared -D__STDC_NO_ATOMICS__=1
https://github.com/openssl/openssl/issues/5443
libcurl doesn't seem to work with emsdk at the moment, at least no one documents it.
./configure script fails at compiler does not halt on function prototype mismatch, disable that in configure.ac and another roadblock with cannot find function connect in libraries
Maybe need to rewrite libcurl part with WebAssembly equivalent
zlib is provided by emsdk with linker flag -s USE_ZLIB=1
After that maybe can compile boinc with emsdk to create wasm executable
After looking further into this, I think emsdk can be used to create wasm-based science apps. The client however probably need to be rewrite as a simple JS-based program. Pthreads, POSIX ports and other hostinfo features maybe problematic through different web browsers implementations so fat native wasm-based client is not going to happen. Node.js runtime can be used for running wasm and its fairly stable I think, need more testing.
We may try package node.js runtime + wasm-based science apps for testing on current platforms. Probably in the future its possible to run on web browsers, or maybe now if someone knows.
It might also be possible to include a WASM "engine" in the BOINC client.
Wasm-based apps are highly portable. It can probably be deployed in some edge devices (routers, nas, IoT with somehow powerful computation capabilities, etc).
JavaScript itself is slow. Machine-converted code from c++ with its complexity to JavaScript, I'm afraid, will produce very slow solution.
that aged well lmaoo
I don't think WASM is slow. It has nothing to do with Javascript as well
I don't think WASM is slow. It has nothing to do with Javascript as well
Could you please share any comparison if you have one? That would be great.
@AenBleidd Webassembly isn't really javascript. from my understanding you can compile to it from C(#)/(++) to use traditionally desktop libraries on the web. Also from what I understand the performance it great and near native.
WASM is completely unrelated to JS other than being a web platform. It’s typically compiled from some other language (most commonly Rust from what I’ve seen, but C/C++ work as well).
Performance is indeed near-native, though it has some caveats, namely that initialization overhead for a WASM context is non-negligible and anything that actually hits Web APIs is essentially no faster than well optimized JS (the API itself is slow, not the code accessing it), though neither of those are likely to matter for the type of usage that would be required by BOINC.
It might also be possible to include a WASM "engine" in the BOINC client.
To addon, yeah it is possible to ship other engines besides Node.js, such as those described in https://github.com/emscripten-core/emscripten/wiki/WebAssembly-Standalone
It will be better if there's some project willing to give out source code for experimentation to kick start this initiative...
I thnk the MLC client (or at least a usable subset of it) could be built to target WASM and be a decent testbed.
As someone who is not a coder but has been a long time boinc user and webassembly fan it seems like idea of a webassembly gui client with its write once deploy everywhere would certainly free up you alls limited time for other boinc issues. Could use webassembly either in a browser or WAVM goal is to run webassembly on a virtual machine. https://github.com/WAVM/WAVM
Currently vlc is also working to port to webassembly