Threads Namespace Reference


Classes

class  atomic
class  task_scheduler_init
class  split
class  spin_mutex
class  BlockedRange
class  scalable_allocator

Typedefs

typedef tbb::task_scheduler_init task_scheduler_init
typedef tbb::split split
typedef tbb::spin_mutex spin_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

spin_mutex spin_mtx

Detailed Description

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


Typedef Documentation

typedef tbb::spin_mutex Threads::spin_mutex

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

Definition at line 185 of file threads.h.

typedef tbb::split Threads::split

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

Definition at line 64 of file threads.h.

typedef tbb::task_scheduler_init Threads::task_scheduler_init

Scheduler to manage threads.

Definition at line 55 of file threads.h.


Function Documentation

template<typename Range , typename Body , typename Partitioner >
void 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 103 of file threads.h.

References PerfLog::disable_logging(), PerfLog::enable_logging(), libMesh::n_threads(), parallel_for(), and libMesh::perflog.

Referenced by MeshCommunication::assign_global_indices(), PatchRecoveryErrorEstimator::estimate_error(), and System::project_vector().

00104   { 
00105 #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING
00106     if (libMesh::n_threads() > 1)
00107       libMesh::perflog.disable_logging();
00108 #endif   
00109     
00110     if (libMesh::n_threads() > 1)
00111       tbb::parallel_for (range, body, partitioner); 
00112 
00113     else
00114       body(range);
00115 
00116 #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING
00117     if (libMesh::n_threads() > 1)
00118       libMesh::perflog.enable_logging();
00119 #endif
00120   }

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

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

Definition at line 75 of file threads.h.

References PerfLog::disable_logging(), PerfLog::enable_logging(), libMesh::n_threads(), and libMesh::perflog.

Referenced by DofMap::create_dof_constraints(), and parallel_for().

00076   {
00077 #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING
00078     if (libMesh::n_threads() > 1)
00079       libMesh::perflog.disable_logging();
00080 #endif   
00081 
00082     if (libMesh::n_threads() > 1)
00083       tbb::parallel_for (range, body, tbb::auto_partitioner());
00084 
00085     else 
00086       body(range);
00087 
00088 #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING
00089     if (libMesh::n_threads() > 1)
00090       libMesh::perflog.enable_logging();
00091 #endif
00092   }

template<typename Range , typename Body , typename Partitioner >
void 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 159 of file threads.h.

References PerfLog::disable_logging(), PerfLog::enable_logging(), libMesh::n_threads(), parallel_reduce(), and libMesh::perflog.

Referenced by MeshTools::bounding_box(), DofMap::compute_sparsity(), MeshTools::processor_bounding_box(), System::project_vector(), MeshTools::total_weight(), and MeshTools::weight().

00160   { 
00161 #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING
00162     if (libMesh::n_threads() > 1)
00163       libMesh::perflog.disable_logging();
00164 #endif   
00165 
00166        if (libMesh::n_threads() > 1)
00167          tbb::parallel_reduce (range, body); 
00168 
00169        else
00170          body(range);
00171 
00172 #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING
00173     if (libMesh::n_threads() > 1)
00174       libMesh::perflog.enable_logging();
00175 #endif
00176   }

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

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

Definition at line 131 of file threads.h.

References PerfLog::disable_logging(), PerfLog::enable_logging(), libMesh::n_threads(), and libMesh::perflog.

Referenced by parallel_reduce().

00132   { 
00133 #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING
00134     if (libMesh::n_threads() > 1)
00135       libMesh::perflog.disable_logging();
00136 #endif   
00137 
00138     if (libMesh::n_threads() > 1)
00139       tbb::parallel_reduce (range, body, tbb::auto_partitioner()); 
00140 
00141     else
00142       body(range);
00143 
00144 #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING
00145     if (libMesh::n_threads() > 1)
00146       libMesh::perflog.enable_logging();
00147 #endif
00148   }


Variable Documentation


Site Created By: libMesh Developers
Last modified: November 25 2009 03:45:23.

Hosted By:
SourceForge.net Logo