Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
bertini::parallel Namespace Reference

Namespaces

namespace  detail

Classes

struct  StartPointTask
 Work item for the speculative-full-path model: a path index plus its start point. More...
struct  FullPathResult
 Result of executing one WHOLE path: start -> endgame boundary -> target. More...
class  ThreadSafeQueue
 A simple thread-safe (mutex + condition-variable) FIFO queue. More...
struct  PoolShutdownSentinel
class  WorkerThreadPool
 Thread pool for parallel path tracking within a single MPI worker rank. More...

Functions

void Finalize ()
 Finalize the parallel (MPI) environment.
void Initialize ()
 Initialize the parallel (MPI) environment.
int Rank ()
 Get this process's rank (0 in serial builds).
int Size ()
 Get the number of ranks (1 in serial builds).
bool IsManager ()
 Query whether this rank is the manager (rank 0).
bool IsWorker ()
 Query whether this rank is a worker (rank != 0).
unsigned AvailableCpuCount ()
 The number of CPUs this process may run on.
unsigned EffectiveThreadCount (unsigned configured=0)
 Resolve a configured thread count to the number of worker threads to actually spawn.

Variables

constexpr int TAG_WORK_ITEM = 1
 MPI message tag: manager -> worker work item.
constexpr int TAG_RESULT = 2
 MPI message tag: worker -> manager result.
constexpr int TAG_CAPACITY = 3
 MPI message tag: worker -> manager, max tasks in flight on that rank.

Function Documentation

◆ AvailableCpuCount()

unsigned bertini::parallel::AvailableCpuCount ( )
inline

The number of CPUs this process may run on.

On Linux, the size of the process's CPU affinity mask, so a process bound to a subset of the machine (an MPI rank that mpirun bound, a job step confined to a cpuset) counts only its own CPUs, as OpenMP's default thread count does. Elsewhere, and if the mask cannot be read, std::thread::hardware_concurrency(). Always >= 1.

◆ EffectiveThreadCount()

unsigned bertini::parallel::EffectiveThreadCount ( unsigned configured = 0)
inline

Resolve a configured thread count to the number of worker threads to actually spawn.

Precedence (highest first):

  1. The BERTINI_NUM_THREADS environment variable, if set to an integer >= 1.
  2. The configured value, if >= 1 (the num_threads config field).
  3. AvailableCpuCount() when configured == 0 ("auto"): every CPU this process may run on, the same default OpenMP uses, so a solve is threaded without any configuration.

The same rule serves the standalone threaded solve and each MPI rank. OMP_NUM_THREADS has no effect.

Always returns >= 1 (a return of 1 means "run serially, no pool").

◆ Finalize()

void bertini::parallel::Finalize ( )

Finalize the parallel (MPI) environment.

◆ Initialize()

void bertini::parallel::Initialize ( )

Initialize the parallel (MPI) environment.

◆ IsManager()

bool bertini::parallel::IsManager ( )

Query whether this rank is the manager (rank 0).

◆ IsWorker()

bool bertini::parallel::IsWorker ( )

Query whether this rank is a worker (rank != 0).

◆ Rank()

int bertini::parallel::Rank ( )

Get this process's rank (0 in serial builds).

◆ Size()

int bertini::parallel::Size ( )

Get the number of ranks (1 in serial builds).

Variable Documentation

◆ TAG_CAPACITY

int bertini::parallel::TAG_CAPACITY = 3
constexpr

MPI message tag: worker -> manager, max tasks in flight on that rank.

◆ TAG_RESULT

int bertini::parallel::TAG_RESULT = 2
constexpr

MPI message tag: worker -> manager result.

◆ TAG_WORK_ITEM

int bertini::parallel::TAG_WORK_ITEM = 1
constexpr

MPI message tag: manager -> worker work item.