piranha  0.10
Static Public Member Functions | List of all members
piranha::settings_< typename > Class Template Reference

Global settings. More...

#include <piranha/settings.hpp>

Inherits piranha::detail::base_settings<>.

Static Public Member Functions

static unsigned get_n_threads ()
 Get the number of threads available for use by piranha. More...
 
static void set_n_threads (unsigned n)
 Set the number of threads available for use by piranha. More...
 
static void reset_n_threads ()
 Reset the number of threads available for use by piranha. More...
 
static void set_thread_binding (bool flag)
 Set the thread binding policy. More...
 
static bool get_thread_binding ()
 Get the thread binding policy. More...
 
static unsigned get_cache_line_size ()
 Get the cache line size. More...
 
static void set_cache_line_size (unsigned n)
 Set the cache line size. More...
 
static void reset_cache_line_size ()
 Reset the cache line size. More...
 
static unsigned long get_max_term_output ()
 Get max term output. More...
 
static void set_max_term_output (unsigned long n)
 Set max term output. More...
 
static void reset_max_term_output ()
 Reset max term output. More...
 
static unsigned long long get_min_work_per_thread ()
 Get the minimum work per thread. More...
 
static void set_min_work_per_thread (unsigned long long n)
 Set the minimum work per thread. More...
 
static void reset_min_work_per_thread ()
 Reset the minimum work per thread. More...
 

Detailed Description

template<typename = void>
class piranha::settings_< typename >

Global settings.

Note
The template parameter in this class is unused: its only purpose is to prevent the instantiation of the class' methods if they are not explicitly used. Client code should always employ the piranha::settings alias.

This class stores the global settings of piranha's runtime environment. The methods of this class are thread-safe.

Definition at line 89 of file settings.hpp.

Member Function Documentation

◆ get_cache_line_size()

template<typename = void>
static unsigned piranha::settings_< typename >::get_cache_line_size ( )
inlinestatic

Get the cache line size.

The initial value is set to the output of piranha::runtime_info::get_cache_line_size(). The value can be overridden with set_cache_line_size() in case the detection fails and the value is set to zero.

Returns
data cache line size (in bytes).
Exceptions
std::system_errorin case of failure(s) by threading primitives.

Definition at line 166 of file settings.hpp.

◆ get_max_term_output()

template<typename = void>
static unsigned long piranha::settings_< typename >::get_max_term_output ( )
inlinestatic

Get max term output.

Returns
maximum number of terms displayed when printing series.
Exceptions
std::system_errorin case of failure(s) by threading primitives.

Definition at line 202 of file settings.hpp.

◆ get_min_work_per_thread()

template<typename = void>
static unsigned long long piranha::settings_< typename >::get_min_work_per_thread ( )
inlinestatic

Get the minimum work per thread.

Returns
the minimum work per thread.

Definition at line 233 of file settings.hpp.

◆ get_n_threads()

template<typename = void>
static unsigned piranha::settings_< typename >::get_n_threads ( )
inlinestatic

Get the number of threads available for use by piranha.

The initial value is set to the maximum between 1 and piranha::runtime_info::get_hardware_concurrency(). This function is equivalent to piranha::thread_pool::size().

Returns
the number of threads that will be available for use by piranha.
Exceptions
unspecifiedany exception thrown by piranha::thread_pool::size().

Definition at line 101 of file settings.hpp.

◆ get_thread_binding()

template<typename = void>
static bool piranha::settings_< typename >::get_thread_binding ( )
inlinestatic

Get the thread binding policy.

This method is an alias for piranha::thread_pool::get_binding(). It will return the flag set by settings::set_thread_binding() (which is false by default on program startup).

Returns
the active thread binding policy.
Exceptions
unspecifiedany exception thrown by piranha::thread_pool::get_binding().

Definition at line 153 of file settings.hpp.

◆ reset_cache_line_size()

template<typename = void>
static void piranha::settings_< typename >::reset_cache_line_size ( )
inlinestatic

Reset the cache line size.

Will set the value to the output of piranha::runtime_info::get_cache_line_size().

Exceptions
std::system_errorin case of failure(s) by threading primitives.

Definition at line 191 of file settings.hpp.

◆ reset_max_term_output()

template<typename = void>
static void piranha::settings_< typename >::reset_max_term_output ( )
inlinestatic

Reset max term output.

Will set the max term output value to the default.

Exceptions
std::system_errorin case of failure(s) by threading primitives.

Definition at line 224 of file settings.hpp.

◆ reset_min_work_per_thread()

template<typename = void>
static void piranha::settings_< typename >::reset_min_work_per_thread ( )
inlinestatic

Reset the minimum work per thread.

The value will be reset to the default initial value.

Definition at line 254 of file settings.hpp.

◆ reset_n_threads()

template<typename = void>
static void piranha::settings_< typename >::reset_n_threads ( )
inlinestatic

Reset the number of threads available for use by piranha.

Will set the number of threads to the maximum between 1 and piranha::runtime_info::get_hardware_concurrency().

Exceptions
unspecifiedany exception thrown by set_n_threads().

Definition at line 123 of file settings.hpp.

◆ set_cache_line_size()

template<typename = void>
static void piranha::settings_< typename >::set_cache_line_size ( unsigned  n)
inlinestatic

Set the cache line size.

Overrides the detected cache line size. This method should be used only if the automatic detection fails.

Parameters
ndata cache line size (in bytes).
Exceptions
std::system_errorin case of failure(s) by threading primitives.

Definition at line 180 of file settings.hpp.

◆ set_max_term_output()

template<typename = void>
static void piranha::settings_< typename >::set_max_term_output ( unsigned long  n)
inlinestatic

Set max term output.

Parameters
nmaximum number of terms to be displayed when printing series.
Exceptions
std::system_errorin case of failure(s) by threading primitives.

Definition at line 213 of file settings.hpp.

◆ set_min_work_per_thread()

template<typename = void>
static void piranha::settings_< typename >::set_min_work_per_thread ( unsigned long long  n)
inlinestatic

Set the minimum work per thread.

Parameters
nthe minimum work per thread.
Exceptions
std::invalid_argumentif
is zero.

Definition at line 243 of file settings.hpp.

◆ set_n_threads()

template<typename = void>
static void piranha::settings_< typename >::set_n_threads ( unsigned  n)
inlinestatic

Set the number of threads available for use by piranha.

This function is equivalent to piranha::thread_pool::resize().

Parameters
nthe desired number of threads.
Exceptions
unspecifiedany exception thrown by piranha::thread_pool::resize().

Definition at line 113 of file settings.hpp.

◆ set_thread_binding()

template<typename = void>
static void piranha::settings_< typename >::set_thread_binding ( bool  flag)
inlinestatic

Set the thread binding policy.

This method is an alias for piranha::thread_pool::set_binding(). If flag is true, each thread used by piranha will be bound to a different processor/core. If flag is false, this method will unbind piranha's threads from any processor/core to which they might be bound.

By default piranha's threads are not bound to any specific processor/core.

Parameters
flagthe desired thread binding policy.
Exceptions
unspecifiedany exception thrown by piranha::thread_pool::set_binding().

Definition at line 140 of file settings.hpp.


The documentation for this class was generated from the following file: