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

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


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. 

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.

 

On Fri, Mar 4, 2016 at 12:31 PM, Mark Borgerding <mark@xxxxxxxxxxxxxx> wrote:
It looks like TF's threadpool uses c++11 constructs.  Won't that be a barrier to wide acceptance in Eigen?

What about a solution/discipline that uses boost::thread for c++03 and maybe std::thread for c++11? They are very similar.  While boost::thread would be a new dependency for Eigen, it would only be necessary for those still tied to older compilers (like me) and boost::thread might be an easier dependency to swallow than OpenMP.

--Mark

PS. I echo the dislike for OpenMP.  The implementations I've tried in gcc and intel seem like a collection of half-broken promises.



On 03/04/2016 02:51 PM, Rasmus Larsen wrote:
This is something that frustrates me as well. The tensor library has its own threadpool implementation and most operations are multi-threaded. In particular it provides a multi-threaded contraction, which is a super set of GEMM - Benoit Steiner can give more details. I would be in favor making this mechanism available to the rest of Eigen (maybe implement a simple ParallelFor mechanism on top of it for developers to use), such that we can provide multi-threading independent of OpenMP.  I'd be happy to help.

Rasmus

On Fri, Mar 4, 2016 at 11:33 AM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
Hi,

I keep running into Eigen users who can't get good multithreading, either because their toolchain doesn't support OpenMP, or because they run into performance bugs in their OpenMP implementation.

I would like to know what is the current status of non-OpenMP-based multithreading in Eigen?

In particular, does the Tensor module offer its own implementation of a multi-threaded GEMM? Can that be merged into Core?

Cheers,
Benoit






--
Benoit


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