14 #include "libmesh/libmesh_common.h" 15 #include "libmesh/threads.h" 17 #ifdef LIBMESH_HAVE_TBB_API 18 #include "tbb/concurrent_queue.h" 19 #include "tbb/tbb_thread.h" 20 #elif LIBMESH_HAVE_OPENMP 22 #elif LIBMESH_HAVE_PTHREAD 34 #ifdef LIBMESH_HAVE_TBB_API 36 #elif LIBMESH_HAVE_OPENMP 37 id = omp_get_thread_num();
38 #elif LIBMESH_HAVE_PTHREAD 39 Threads::spin_mutex::scoped_lock lock(_pthread_id_mutex);
43 "No Thread IDs available in ParallelUniqueID. Did you forget to initialize()?");
55 #ifdef LIBMESH_HAVE_TBB_API 57 #elif !defined(LIBMESH_HAVE_OPENMP) && defined(LIBMESH_HAVE_PTHREAD) 58 Threads::spin_mutex::scoped_lock lock(_pthread_id_mutex);
74 #if defined(LIBMESH_HAVE_TBB_API) || \ 75 (!defined(LIBMESH_HAVE_OPENMP) && defined(LIBMESH_HAVE_PTHREAD)) 85 #ifdef LIBMESH_HAVE_TBB_API 86 static tbb::concurrent_bounded_queue<unsigned int>
_ids;
87 #elif !defined(LIBMESH_HAVE_OPENMP) && defined(LIBMESH_HAVE_PTHREAD) 88 static std::queue<unsigned int>
_ids;
static void initialize()
Must be called by main thread before any threaded computation! Do NOT call in a worker thread! ...
static tbb::concurrent_bounded_queue< unsigned int > _ids
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
static Threads::spin_mutex _pthread_id_mutex
Provides a way for users to bail out of the current solve.
static std::queue< unsigned int > _ids