qualpal 2.3.0
Loading...
Searching...
No Matches
qualpal::Threads Class Reference

Manages OpenMP thread settings across qualpal. More...

#include <threads.h>

Static Public Member Functions

static void set (const std::size_t n)
 Set the number of threads to use for parallel computations.
 
static std::size_t get ()
 Get the current number of threads.
 

Detailed Description

Manages OpenMP thread settings across qualpal.

This class provides a centralized way to control thread settings for parallel computations. It handles both OpenMP and non-OpenMP builds, defaulting to sequential execution when OpenMP is not available.

Thread count defaults to half of the available threads (typically the number of physical CPU cores) to avoid performance degradation from hyperthreading when using Eigen.

Usage:

Threads::set(4); // Set to use 4 threads
std::size_t n = Threads::get(); // Get current thread count
static void set(const std::size_t n)
Set the number of threads to use for parallel computations.
Definition threads.h:41
static std::size_t get()
Get the current number of threads.
Definition threads.h:58

Definition at line 33 of file threads.h.

Member Function Documentation

◆ get()

static std::size_t qualpal::Threads::get ( )
inlinestatic

Get the current number of threads.

Returns
Current thread count

Definition at line 58 of file threads.h.

◆ set()

static void qualpal::Threads::set ( const std::size_t  n)
inlinestatic

Set the number of threads to use for parallel computations.

Parameters
nNumber of threads. Must be positive.

Definition at line 41 of file threads.h.


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