|
core 1.5.0
Shared MPI block decomposition, asynchronous ghost-layer exchange, SDF geometry, load balancing (header-only C++20)
|
#include <anderson.hpp>
Public Types | |
| enum class | Status : int { Active = 0 , Disabled = 1 } |
Public Member Functions | |
| AndersonCore (AndersonState state, int window=5, double mixing=1.0) | |
| Allocates the history (design §6.3: (2m+3)·n_s·8·n_pad bytes). | |
| AndersonCore (const AndersonCore &)=delete | |
| AndersonCore & | operator= (const AndersonCore &)=delete |
| AndersonCore (AndersonCore &&)=default | |
| AndersonCore & | operator= (AndersonCore &&)=default |
| bool | prepare (bool accelerate) |
| §4.3 steps 0–1. | |
| bool | stepFailed (const std::string &what) |
| §4.3 step 2, the caller's step threw. | |
| void | complete (bool pressureSolveFailed=false) |
| §4.3 steps 3–7, after the caller's step. | |
| void | reset () |
| Clears the history and the counters (design §4.2); keeps the previous evaluation, so the next call forms a column at once. | |
| void | invalidate () |
| The caller's map changed (flow: its parameter signature) or the state was written: reset() and forget the previous evaluation; counts in numResets(). | |
| void | disable () |
| Stops acceleration for good: prepare/complete become no-ops around a plain step. | |
| Status | status () const |
| const char * | statusName () const |
| "active" | "disabled". | |
| const std::string & | reason () const |
| double | residual () const |
| Relative velocity residual of the last evaluation whose output the state holds (design §3.2; after a restart, the restored output's); +inf before the first. | |
| int | numRestarts () const |
| int | numResets () const |
| int | numColumns () const |
| Window columns in use (mk). | |
| int | window () const |
| double | mixing () const |
| bool | engaged () const |
| bool | pending () const |
| A mix is pending for the next accelerated call. | |
| std::vector< double > | gamma () const |
| The pending coefficients γ, oldest column first (numColumns() of them). | |
| std::size_t | memoryBytes () const |
| Bytes held by the history, X, Rprev and Gprev: equals memoryBytesFor(window(), n_s, n_pad). | |
| const AndersonState & | state () const |
Static Public Member Functions | |
| static std::size_t | memoryBytesFor (int window, std::size_t numFields, Index nPad) |
| The §6.3 memory formula: (2m + 3)·n_s·8·n_pad bytes. | |
Static Public Attributes | |
| static constexpr int | kMaxWindow = detail::anderson::kMaxWindow |
| static constexpr int | kEngageDecreases = 2 |
| static constexpr double | kRestartGrowth = 4.0 |
| static constexpr int | kMaxRestarts = 5 |
| static constexpr double | kNoiseFloor = 1e-10 |
| static constexpr double | kCondMin = 1e-12 |
Definition at line 329 of file anderson.hpp.
| Enumerator | |
|---|---|
| Active | |
| Disabled | |
Definition at line 342 of file anderson.hpp.
|
inlineexplicit |
Allocates the history (design §6.3: (2m+3)·n_s·8·n_pad bytes).
Collective over state.comm (one 2-double sum {invalid descriptor, failed allocation}, so that every rank throws when one rank's descriptor is inconsistent or one rank's allocation fails). Throws std::invalid_argument (on every rank) for an inconsistent descriptor and std::runtime_error (on every rank) when the history does not fit.
Definition at line 349 of file anderson.hpp.
References peclet::core::solver::AndersonState::fields, and memoryBytesFor().
|
delete |
|
default |
|
delete |
|
default |
|
inlinestatic |
The §6.3 memory formula: (2m + 3)·n_s·8·n_pad bytes.
Definition at line 406 of file anderson.hpp.
References window().
Referenced by AndersonCore().
§4.3 steps 0–1.
Detects an external write of the state (inner entries only), then either applies the pending mix (accelerate, pending, active) or records the input. Returns whether the state now holds a mixed iterate. Collective (one 1-double sum) while active; one host synchronisation (the COUNT read-back).
Definition at line 417 of file anderson.hpp.
References Active, peclet::core::solver::detail::anderson::MixColumns::count, peclet::core::solver::detail::anderson::countChanged(), peclet::core::solver::AndersonState::extent, peclet::core::solver::AndersonState::fields, peclet::core::solver::AndersonState::ghost, invalidate(), and peclet::core::solver::detail::anderson::mix().
§4.3 step 2, the caller's step threw.
Returns true when the failure was absorbed: the input was a mixed iterate, so the state is restored to the last map output, acceleration is disabled and the caller continues (plain). Returns false when the caller must rethrow.
Definition at line 461 of file anderson.hpp.
References Active, peclet::core::solver::AndersonState::comm, Disabled, peclet::core::solver::AndersonComm::rank, and reset().
§4.3 steps 3–7, after the caller's step.
pressureSolveFailed must be rank-consistent. Collective while active: a (2·columns + 2)-double sum and a broadcast of rank 0's decisions; one host synchronisation (the pass-2 read-back). The device copies are stream-ordered.
Definition at line 480 of file anderson.hpp.
References Active, Disabled, peclet::core::solver::AndersonState::extent, peclet::core::solver::AndersonState::fields, peclet::core::solver::AndersonState::ghost, kCondMin, kEngageDecreases, kMaxRestarts, kMaxWindow, kNoiseFloor, kRestartGrowth, reset(), peclet::core::solver::AndersonState::roles, and peclet::core::solver::Velocity.
|
inline |
Clears the history and the counters (design §4.2); keeps the previous evaluation, so the next call forms a column at once.
Definition at line 638 of file anderson.hpp.
Referenced by complete(), invalidate(), and stepFailed().
|
inline |
The caller's map changed (flow: its parameter signature) or the state was written: reset() and forget the previous evaluation; counts in numResets().
Definition at line 647 of file anderson.hpp.
References reset().
Referenced by prepare().
|
inline |
Stops acceleration for good: prepare/complete become no-ops around a plain step.
Definition at line 654 of file anderson.hpp.
|
inline |
Definition at line 665 of file anderson.hpp.
|
inline |
Definition at line 668 of file anderson.hpp.
|
inline |
Relative velocity residual of the last evaluation whose output the state holds (design §3.2; after a restart, the restored output's); +inf before the first.
Definition at line 671 of file anderson.hpp.
|
inline |
Definition at line 672 of file anderson.hpp.
|
inline |
Definition at line 673 of file anderson.hpp.
|
inline |
Window columns in use (mk).
Definition at line 675 of file anderson.hpp.
|
inline |
Definition at line 676 of file anderson.hpp.
Referenced by memoryBytesFor().
|
inline |
Definition at line 677 of file anderson.hpp.
|
inline |
Definition at line 678 of file anderson.hpp.
|
inline |
A mix is pending for the next accelerated call.
Definition at line 680 of file anderson.hpp.
|
inline |
The pending coefficients γ, oldest column first (numColumns() of them).
Definition at line 682 of file anderson.hpp.
|
inline |
Bytes held by the history, X, Rprev and Gprev: equals memoryBytesFor(window(), n_s, n_pad).
Definition at line 684 of file anderson.hpp.
References peclet::core::add().
|
inline |
Definition at line 699 of file anderson.hpp.
|
staticconstexpr |
Definition at line 332 of file anderson.hpp.
Referenced by complete().
Definition at line 333 of file anderson.hpp.
Referenced by complete().
Definition at line 334 of file anderson.hpp.
Referenced by complete().
Definition at line 335 of file anderson.hpp.
Referenced by complete().
Definition at line 336 of file anderson.hpp.
Referenced by complete().
Definition at line 337 of file anderson.hpp.
Referenced by complete().