Re: [eigen] Status of non-OpenMP-based multithreading

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]




On Mon, Mar 7, 2016 at 12:54 AM, Gael Guennebaud <gael.guennebaud@xxxxxxxxx> wrote:


On Fri, Mar 4, 2016 at 9:45 PM, Benoit Steiner <benoit.steiner.goog@xxxxxxxxx> wrote:
This is correct, we currently rely on c++11 threads, mutexes and condition variables to implement the thread pool use in the tensor module. The main reason to do this is that c++11 is now very commonly available, so this makes the code very portable (at least more so that having to implement the functionality for every target platform).

A lot if not all the functionality is already abstracted: for example, the Notification class wraps the std::condition_variable, and the ThreadPool hides the std::thread class. It should be possible to reimplement both classes using boost to remove the dependency on c++11. 

I guess, that one could also implement one on top of openmp.

That's probably possible. The ThreadPool class inherits from the virtual ThreadPoolInterface, so we could imagine implementing several different thread pools, for example one using openMP under the hood, one using boost, and one using c++11 threads.
 
 
Last but not least, all the multithreading code is guarded by a EIGEN_USE_THREADS #define. I think it's pretty reasonable to require either c++11 or boost to be able to enable this #define.

What about enabling threads by default and are rather add a EIGEN_NO_THREADS?

I wanted to keep the compatibility with older compilers, so anything that requires c++11 is currently opt-in. I'd be happy to revisit if needs be.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/