hp-FEM
Adaptive hp-FEM suite for nano-optics
Loading...
Searching...
No Matches
Namespaces | Functions
parallel.hpp File Reference
#include <atomic>
#include <exception>
#include <utility>
#include "hpfem/core/types.hpp"
Include dependency graph for parallel.hpp:

Go to the source code of this file.

Namespaces

namespace  hpfem
 

Functions

bool hpfem::has_openmp () noexcept
 True if the library was built with OpenMP.
 
int hpfem::num_threads () noexcept
 Number of threads a parallel loop uses (1 without OpenMP).
 
void hpfem::set_num_threads (int threads) noexcept
 
int hpfem::thread_index () noexcept
 Index of the calling thread inside a parallel loop, 0 outside.
 
template<class Body >
void hpfem::parallel_for (Index n, Body &&body)
 

Detailed Description

Shared-memory parallel loops (OpenMP when the library was built with it, otherwise serial). Assembly and estimator loops run cell by cell with per-thread buffers; callers of parallel_for must make their bodies reentrant (no shared mutable state without a lock, per-thread accumulators merged afterwards). See docs/theory/solvers.md#parallel-assembly.