On Mar 18, 2010, at 11:57 AM, Roy Stogner wrote: > Most of the Parallel:: functions would break right now if called from > more than one thread at once. It would be possible in theory to > change that - e.g. Parallel::max() would first take the max over all > threads, then take the max over all ranks, then distribute the max > back to all threads - but it would be pretty difficult in practice, > particularly since it's somewhat contrary to the task-based paradigm > in TBB.
Don't really like this... plus like you say it really doesn't mesh well with TBB. If you wanted to do a threaded max we might want to make a Threads::max that takes a vector... Then you can do Parallel::max(Threads::max(myvec)) to achieve the same thing ;-) If a single thread is calling Parallel::max().... there is a good chance that it's not operating on the same data the rest of the threads are. Then again... I can't really come up with a place that you would actually want to do that.... > I'd like to instead just "enforce" the current restrictions - set a > Threads::_now_multithreaded bool to true at the start of and false at > the end of any Threads::parallel_* call, and then do a > assert(!Threads::now_multithreaded()) in every Parallel:: call. This sounds good... as long as it only happens in debug. Derek ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Libmesh-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libmesh-devel
