On Mon, Jun 4, 2012 at 11:52 AM, Roy Stogner <royst...@ices.utexas.edu> wrote: > > On Mon, 4 Jun 2012, John Peterson wrote: > >> BTW, since Metis is using OpenMP (no raw pthreads that I can see) the >> proper TLS mechanism is probably something like >> >> #pragma omp threadprivate(var) > > > OpenMP uses pthreads under the hood on POSIX systems, IIRC, so > thread local storage variables ought to work fine as well. Probably > safer for the corner cases to use consistent idioms, though. > > >> I feel like my patch (which effectively makes those variables global) >> will potentially break anyone actually running libmesh with >> OMP_NUM_THREADS > 1. > > > Almost certainly. > > >> Not sure how much work this would be to fix and test. > > > To fix? Your pragma (suitably replicated and made specific) will > probably do it. > > To test? We can't and shouldn't try to test that unmodified Metis is > thread-safe, but it might be easy enough to write fprintf debugging > code that makes sure the different threads are still getting openmp > compatible tls variables after our patch.
> Check and see if the unmodified parmetis (which includes the metis > files we upgraded to) works on Mac? They might have some hack in > their build system, which I ignored and threw away. If unmodified > parmetis doesn't build on Mac either, then definitely notify them. On a Mac, I followed their basic instructions (make config && make) for compiling and I see that they pass -D__thread= on the compile line, effectively disabling the TLS stuff. This would seem to be equivalent to what my patch does. Also, a cursory examination of the code suggests that the handful of variables that they marked __thread are not even used in the openmp parts of csr.c. Perhaps they were just trying to make the overall library a bit more thread-safe by adding TLS? Anyway, my opinion is we can probably go ahead and go with the patch removing the __shared stuff as-is. -- John ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Libmesh-devel mailing list Libmesh-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-devel