Reference documentation for deal.II version Git 1448398 2018-02-21 21:14:18 -0500

#include <deal.II/base/multithread_info.h>

## Static Public Member Functions

static unsigned int n_cores ()

static std::size_t memory_consumption ()

## Static Private Member Functions

static unsigned int get_n_cpus ()

## Static Private Attributes

static unsigned int n_max_threads = numbers::invalid_unsigned_int

static const unsigned int n_cpus = MultithreadInfo::get_n_cpus()

## Detailed Description

Definition at line 47 of file multithread_info.h.

## Constructor & Destructor Documentation

delete

Constructor. This constructor is deleted because no instance of this class needs to be constructed (all members are static).

## Member Function Documentation

static

The number of CPUs in the system. At the moment detection of CPUs is only implemented on Linux, FreeBSD, and Mac computers. It is one if detection failed or is not implemented on your system.

If it is one, although you are on a multi-processor machine, please refer to the documentation in multithread_info.cc near to the error directive.

Definition at line 102 of file multithread_info.cc.

static

Return the number of threads to use. This is initially set to the number of cores the system has (see n_cores()) but can be further restricted by set_thread_limit() and the environment variable DEAL_II_NUM_THREADS.

Definition at line 155 of file multithread_info.cc.

static

Return an estimate for the memory consumption, in bytes, of this object. This is not exact (but will usually be close) because calculating the memory usage of trees (e.g., std::map) is difficult.

Definition at line 193 of file multithread_info.cc.

 void MultithreadInfo::set_thread_limit ( const unsigned int max_threads = numbers::invalid_unsigned_int )
static

Set the maximum number of threads to be used to the minimum of the environment variable DEAL_II_NUM_THREADS and the given argument (or its default value). This affects the initialization of the TBB. If neither is given, the default from TBB is used (based on the number of cores in the system).

This routine is executed automatically with the default argument before your code in main() is running (using a static constructor). It is also executed by Utilities::MPI::MPI_InitFinalize. Use the appropriate argument of the constructor of Utilities::MPI::MPI_InitFinalize if you have an MPI based code.

Definition at line 108 of file multithread_info.cc.

static

Return if the TBB is running using a single thread either because of thread affinity or because it is set via a call to set_thread_limit. This is used in the PETScWrappers to avoid using the interface that is not thread-safe.

Definition at line 186 of file multithread_info.cc.

staticprivate

Private function to determine the number of CPUs. Implementation for Linux, OSF, SGI, and Sun machines; if no detection of the number of CPUs is supported, or if detection fails, this function returns one.

Definition at line 95 of file multithread_info.cc.

## Member Data Documentation

staticprivate

Variable representing the maximum number of threads.

Definition at line 116 of file multithread_info.h.