threads icon indicating copy to clipboard operation
threads copied to clipboard

OpenMP

Open jakirkham opened this issue 7 years ago • 1 comments
trafficstars

Sorry if this is the wrong place to raise this, am very new to WebAssembly. So please forgive my ignorance. 😅

WebAssembly is very exciting for those of us in scientific domains as it opens up the web to programs that were bound to a desktop and only (if ever) connected to the web through running some sort of web server. Not to mention the possibilities WebAssembly offers in terms of sharing and using these often difficult to produce environments is intriguing. Though it does raise some questions about threading, SIMD instructions, GPU support, etc. that seem to be pretty well discussed in various locations.

Though haven't really seen much discussion of OpenMP support. So wanted to raise this as an interesting use case. It is very common for scientists to take advantage of OpenMP as it offers a mode of parallelism that is really easy to understand, requires little work to implement in a program, and is widely supported. So it is quite common to see this show up in C/C++ codes in the scientific domain. Even extensions to the Python language like Cython make using OpenMP quite easy. Similarly Julia exposes it with ParallelAccelerator. Using C/C++ extensions to R one can also easily leverage OpenMP.

Given the popularity of OpenMP, was wondering if any thought had been given to OpenMP support in the threading spec. Particularly in regards to C/C++ code that is compiled to WebAssembly. Thanks in advance for your thoughts. 😄

jakirkham avatar Aug 06 '18 15:08 jakirkham

I would rather see OpenMP support initially implemented as a custom thread pool using WebAssembly's primitives, i.e. zero VM work should need to be done to support OpenMP, only toolchain work. Eventually we might find shortcomings or want to target accelerators, but that's definitely not for v1.

jfbastien avatar Aug 06 '18 16:08 jfbastien