/home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/threads.hh Source File#

DiFfRG: /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/threads.hh Source File
DiFfRG
Discretization Framework for functional Renormalization Group flows
threads.hh
Go to the documentation of this file.
1#pragma once
2
3namespace DiFfRG
4{
13 enum class ThreadSource {
19 config,
24 };
25
27 const char *to_string(const ThreadSource source);
28
45 unsigned int n_threads();
46
49
53 unsigned int threads;
56 const char *name;
57 };
58
69 ThreadResolution resolve_thread_count(const unsigned int configured_threads);
70
82 void set_thread_limit(const unsigned int threads);
83} // namespace DiFfRG
Definition complex_math.hh:10
ThreadResolution resolve_thread_count(const unsigned int configured_threads)
Apply the precedence order to the environment and one configured thread count.
const char * to_string(const ThreadSource source)
The name of a thread-count source, as it appears in the precedence warning.
ThreadSource n_threads_source()
Which rule produced n_threads(). ThreadSource::automatic before anything has been resolved.
void set_thread_limit(const ConfigTree &config)
Limit the number of CPU threads from a configuration tree.
ThreadSource
Where the CPU thread budget came from, in order of precedence (highest first).
Definition threads.hh:13
@ config
/discretization/threads.
@ automatic
Nothing was set: the machine, divided among the node-local ranks that share its CPUs.
@ other_env
OMP_NUM_THREADS, DEAL_II_NUM_THREADS, KOKKOS_NUM_THREADS.
@ diffrg_env
DiFfRG_NUM_THREADS (or DIFFRG_NUM_THREADS).
@ launcher
The CPU allocation this process was given: its affinity mask, or SLURM_* if it has none.
unsigned int n_threads()
The CPU thread budget this process resolved.
What the precedence rules picked, and which setting it came from.
Definition threads.hh:51
ThreadSource source
Definition threads.hh:54
unsigned int threads
0 when nothing was set anywhere, i.e. the automatic tier applies.
Definition threads.hh:53
const char * name
The winning setting's name, e.g. "SLURM_CPUS_PER_TASK". Never null.
Definition threads.hh:56