libMesh::Threads Namespace Reference

Classes

class  BoolAcquire
class  Thread
class  atomic
class  task_scheduler_init
class  split
class  spin_mutex
class  recursive_mutex
class  BlockedRange
class  scalable_allocator

Typedefs

typedef std::thread Thread
typedef tbb::task_scheduler_init task_scheduler_init
typedef tbb::split split
typedef tbb::spin_mutex spin_mutex
typedef tbb::recursive_mutex recursive_mutex

Functions

template<typename Range , typename Body >
void parallel_for (const Range &range, const Body &body)
template<typename Range , typename Body , typename Partitioner >
void parallel_for (const Range &range, const Body &body, const Partitioner &partitioner)
template<typename Range , typename Body >
void parallel_reduce (const Range &range, Body &body)
template<typename Range , typename Body , typename Partitioner >
void parallel_reduce (const Range &range, Body &body, const Partitioner &partitioner)

Variables

bool in_threads = false
spin_mutex spin_mtx
recursive_mutex recursive_mtx

Detailed Description

The Threads namespace is for wrapper functions for common general multithreading algorithms and tasks.


Typedef Documentation

typedef tbb::recursive_mutex libMesh::Threads::recursive_mutex

Recursive mutex. Implements mutual exclusion by busy-waiting in user space for the lock to be acquired. The same thread can aquire the same lock multiple times

Definition at line 286 of file threads.h.

typedef tbb::spin_mutex libMesh::Threads::spin_mutex

Spin mutex. Implements mutual exclusion by busy-waiting in user space for the lock to be acquired.

Definition at line 278 of file threads.h.

typedef tbb::split libMesh::Threads::split

Dummy "splitting object" used to distinguish splitting constructors from copy constructors.

Definition at line 141 of file threads.h.

typedef tbb::task_scheduler_init libMesh::Threads::task_scheduler_init

Scheduler to manage threads.

Definition at line 132 of file threads.h.

typedef tbb::tbb_thread libMesh::Threads::Thread

Use std::thread when available.

Fall back to tbb::tbb_thread when available.

Definition at line 86 of file threads.h.


Function Documentation

template<typename Range , typename Body , typename Partitioner >
void libMesh::Threads::parallel_for ( const Range &  range,
const Body &  body,
const Partitioner &  partitioner 
) [inline]

Exectue the provided function object in parallel on the specified range with the specified partitioner.

Definition at line 341 of file threads.h.

References in_threads.

00342   {
00343     BoolAcquire b(in_threads);
00344     body(range);
00345   }

template<typename Range , typename Body >
void libMesh::Threads::parallel_for ( const Range &  range,
const Body &  body 
) [inline]
template<typename Range , typename Body , typename Partitioner >
void libMesh::Threads::parallel_reduce ( const Range &  range,
Body &  body,
const Partitioner &  partitioner 
) [inline]

Exectue the provided reduction operation in parallel on the specified range with the specified partitioner.

Definition at line 367 of file threads.h.

References in_threads.

00368   {
00369     BoolAcquire b(in_threads);
00370     body(range);
00371   }

template<typename Range , typename Body >
void libMesh::Threads::parallel_reduce ( const Range &  range,
Body &  body 
) [inline]

Exectue the provided reduction operation in parallel on the specified range.

Definition at line 354 of file threads.h.

References in_threads.

Referenced by libMesh::FEMSystem::assemble_qoi(), libMesh::MeshTools::bounding_box(), libMesh::DofMap::build_sparsity(), libMesh::MeshTools::processor_bounding_box(), libMesh::System::project_vector(), libMesh::MeshTools::total_weight(), and libMesh::MeshTools::weight().

00355   {
00356     BoolAcquire b(in_threads);
00357     body(range);
00358   }


Variable Documentation

A boolean which is true iff we are in a Threads:: function It may be useful to assert(!Threadsin_threads) in any code which is known to not be thread-safe.

Definition at line 33 of file threads.C.

Referenced by parallel_for(), parallel_reduce(), libMesh::MeshBase::point_locator(), and libMesh::MeshBase::sub_point_locator().

A recursive mutex object which

Definition at line 32 of file threads.C.


Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:49 UTC

Hosted By:
SourceForge.net Logo