All -

For a while we've supported the TBB 'task-based' parallelism, whereby a loop is 
executed across multiple threads and the results are combined in some way.  

As of yesterday I've added support for the other multithreading use case, 
asynchronous execution of an operation that would otherwise block.  This is 
commonly used in GUI programming but not needed as frequently in scientific 
computing.  Still, there are some use cases where I've wanted it, and now it is 
available.  The first such occurrence is overlapping disk I/O with MPI 
communication.

For some background on the important ideas see here:
http://www.devx.com/SpecialReports/Article/38883

for the actual implementation, I've introduced Threads::Thread.  This is a 
typedef to std::thread where available, falling back to a typedef to 
tbb::tbb_thread where available, or a simple shim class otherwise.

The only thing to watch out for is that the tbb::tbb_thread implementation is 
incomplete in that it does not support assignment, so while strictly

std::threat t = std::thread(foo);

will work, 

tbb::tbb_thread t = tbb::tbb_thread(foo);

will not.  Therefore I'm generally inclined to use AutoPtr<Threads::Thread> to 
overcome this limitation where assignment is desireable.

Note that boost::thread is also a workable alternative here, and I'll probably 
add support for it too along the lines of 'BEST_STD_THREAD'…

Of course, this programming model introduces a whole new opportunity for 
Heisenbugs, so please report any issues and be careful out there!

-Ben
 


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to