← Documentation
ADS-IDAC Engine 5.0.0
adsidac Namespace Reference

Namespaces

namespace  merge
 
namespace  pe
 

Classes

struct  RestartLayout
 Byte offsets of the structural landmarks in a restart buffer. An offset is meaningful only when its have_* flag is true. More...
 

Functions

template<class Archive , class T >
void save_array_state (Archive &ar, const std::vector< std::unique_ptr< T > > &v)
 
template<class Archive , class T >
void load_array_state (Archive &ar, std::vector< std::unique_ptr< T > > &v, const char *what)
 
void fingerprint_feed (uint64_t &h, const char *data, size_t n)
 Fold n bytes at data into the running 64-bit FNV-1a hash h (xor the byte, then multiply by the FNV prime 1099511628211). More...
 
void fingerprint_feed_file (uint64_t &h, const std::filesystem::path &p)
 Fold the contents of file p into h, read in 64 KiB blocks. A file that cannot be opened contributes nothing and is not reported. More...
 
uint64_t compute_config_fingerprint (const std::string &project_dir, const std::string &deck_path)
 Digest the configuration inputs of a project. More...
 
RestartLayout scan_restart (const std::vector< char > &buf, std::int32_t want)
 Walk the record chain and locate the header, the base dump and the target dump. More...
 
bool has_complete_restart (const std::vector< char > &buf)
 Does this buffer contain a complete restart dump (the base)? More...
 
std::vector< char > extract_header_and_base (const std::vector< char > &buf)
 [header][complete base], the run-wide constant that is cached per rank and published as <project>/restart_base.bin. More...
 
std::vector< char > extract_record_no_base (const std::vector< char > &buf, std::int32_t want)
 [header][target], the wire payload with the base omitted. More...
 
std::vector< char > splice_base (const std::vector< char > &hdr_base, const std::vector< char > &body)
 Put the cached base back in front of a base-less transfer. More...
 
std::vector< char > extract_restart_record (const std::vector< char > &buf, std::int32_t want)
 [header][complete base][target]: self-contained, no cache needed. More...
 
const Procedures * shared_procedures ()
 
void set_shared_procedures (const Procedures *master)
 
const ControlPanel * shared_control_panel ()
 
void set_shared_control_panel (const ControlPanel *master)
 
const KB * shared_kb (int operator_type)
 
void set_shared_kb (int operator_type, const KB *master)
 
const EventSymptomMatrix * shared_diagnosis_matrix (int operator_type)
 
void set_shared_diagnosis_matrix (int operator_type, const EventSymptomMatrix *master)
 

Function Documentation

◆ compute_config_fingerprint()

uint64_t adsidac::compute_config_fingerprint ( const std::string &  project_dir,
const std::string &  deck_path 
)
inline

Digest the configuration inputs of a project.

Feeds, in ascending order of the key, each file's key followed by its bytes. The key is the file's path relative to project_dir (computed lexically, '/' separators); a file outside the project, such as a deck stored elsewhere, is keyed by its file name alone. A deck located under Input/ is listed twice (as the deck and by the Input/ sweep) and is fed twice, which is deterministic. Files that do not exist are skipped, so the result is never an error: a project with none of the inputs yields the FNV offset basis 1469598103934665603. Reads files only; safe to call concurrently from several ranks.

Parameters
project_dirProject directory (holds ZCtrlPar.txt and Input/).
deck_pathInput deck path, absolute or relative to the working directory; empty = no deck.
Returns
64-bit FNV-1a digest. 0 is reserved by callers for "not computed".

Definition at line 65 of file ConfigFingerprint.h.

References e, fingerprint_feed(), and fingerprint_feed_file().

Referenced by Scheduler::initiationForSimulation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extract_header_and_base()

std::vector< char > adsidac::extract_header_and_base ( const std::vector< char > &  buf)
inline

[header][complete base], the run-wide constant that is cached per rank and published as <project>/restart_base.bin.

Returns
A new buffer, or empty if buf has no dump or no complete dump.

Definition at line 113 of file RestartTrim.h.

References adsidac::RestartLayout::base, adsidac::RestartLayout::base_end, adsidac::RestartLayout::have_base, adsidac::RestartLayout::have_header, adsidac::RestartLayout::header_end, and scan_restart().

Referenced by AdsidacCallback::onBranchingPoint(), RelapSolver::restore(), and Client::restore_buffer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extract_record_no_base()

std::vector< char > adsidac::extract_record_no_base ( const std::vector< char > &  buf,
std::int32_t  want 
)
inline

[header][target], the wire payload with the base omitted.

If the target is itself the base dump, the result contains it and is self-contained.

Parameters
bufFull restart buffer.
wantncount of the dump to keep (the value card 103 selects on).
Returns
A new buffer, or empty if the record is absent, so callers fall back to the whole buffer: extra bandwidth is survivable, a wrong restart is not.

Definition at line 132 of file RestartTrim.h.

References adsidac::RestartLayout::have_header, adsidac::RestartLayout::have_target, adsidac::RestartLayout::header_end, scan_restart(), adsidac::RestartLayout::target, and adsidac::RestartLayout::target_end.

Referenced by AdsidacCallback::onBranchingPoint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extract_restart_record()

std::vector< char > adsidac::extract_restart_record ( const std::vector< char > &  buf,
std::int32_t  want 
)
inline

[header][complete base][target]: self-contained, no cache needed.

When the target is the base dump it is emitted once. Not called by the engine, which ships [header][target] (extract_record_no_base).

Returns
A new buffer, or empty if the header, the base or the target is missing.

Definition at line 168 of file RestartTrim.h.

References adsidac::RestartLayout::base, adsidac::RestartLayout::base_end, adsidac::RestartLayout::have_base, adsidac::RestartLayout::have_header, adsidac::RestartLayout::have_target, adsidac::RestartLayout::header_end, scan_restart(), adsidac::RestartLayout::target, and adsidac::RestartLayout::target_end.

Here is the call graph for this function:

◆ fingerprint_feed()

void adsidac::fingerprint_feed ( uint64_t &  h,
const char *  data,
size_t  n 
)
inline

Fold n bytes at data into the running 64-bit FNV-1a hash h (xor the byte, then multiply by the FNV prime 1099511628211).

Definition at line 34 of file ConfigFingerprint.h.

Referenced by compute_config_fingerprint(), and fingerprint_feed_file().

Here is the caller graph for this function:

◆ fingerprint_feed_file()

void adsidac::fingerprint_feed_file ( uint64_t &  h,
const std::filesystem::path &  p 
)
inline

Fold the contents of file p into h, read in 64 KiB blocks. A file that cannot be opened contributes nothing and is not reported.

Definition at line 43 of file ConfigFingerprint.h.

References fingerprint_feed().

Referenced by compute_config_fingerprint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ has_complete_restart()

bool adsidac::has_complete_restart ( const std::vector< char > &  buf)
inline

Does this buffer contain a complete restart dump (the base)?

The test is presence anywhere in the buffer, not position. Callers use it to tell a self-contained buffer from a base-less [header][target] transfer, which RELAP cannot restore until the base is spliced back on.

Definition at line 105 of file RestartTrim.h.

References adsidac::RestartLayout::have_base, and scan_restart().

Referenced by RelapSolver::restore(), and Client::restore_buffer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_array_state()

template<class Archive , class T >
void adsidac::load_array_state ( Archive &  ar,
std::vector< std::unique_ptr< T > > &  v,
const char *  what 
)

Definition at line 24 of file PanelOverlayIO.h.

References e.

Referenced by ControlPanelAlarm::load(), ControlPanelControl::load(), and ControlPanelDisplay::load().

Here is the caller graph for this function:

◆ save_array_state()

template<class Archive , class T >
void adsidac::save_array_state ( Archive &  ar,
const std::vector< std::unique_ptr< T > > &  v 
)

Definition at line 16 of file PanelOverlayIO.h.

References e.

Referenced by ControlPanelAlarm::save(), ControlPanelControl::save(), and ControlPanelDisplay::save().

Here is the caller graph for this function:

◆ scan_restart()

RestartLayout adsidac::scan_restart ( const std::vector< char > &  buf,
std::int32_t  want 
)
inline

Walk the record chain and locate the header, the base dump and the target dump.

The walk stops, keeping what it has found, at a negative record length or a record that would run past the end of the buffer.

Parameters
bufRestart buffer in the layout described above.
wantncount of the dump to locate; pass -1 (any negative value) to locate no target.
Returns
The landmarks found; all flags false for an empty or foreign buffer.

Definition at line 70 of file RestartTrim.h.

References adsidac::RestartLayout::base, adsidac::RestartLayout::base_end, adsidac::RestartLayout::have_base, adsidac::RestartLayout::have_header, adsidac::RestartLayout::have_target, adsidac::RestartLayout::header_end, adsidac::RestartLayout::target, and adsidac::RestartLayout::target_end.

Referenced by extract_header_and_base(), extract_record_no_base(), extract_restart_record(), has_complete_restart(), and splice_base().

Here is the caller graph for this function:

◆ set_shared_control_panel()

void adsidac::set_shared_control_panel ( const ControlPanel *  master)

Definition at line 15 of file SharedConfig.cpp.

Referenced by Client::Client(), main(), AdsidacCallback::onFirstInit(), and Server::Simulation().

Here is the caller graph for this function:

◆ set_shared_diagnosis_matrix()

void adsidac::set_shared_diagnosis_matrix ( int  operator_type,
const EventSymptomMatrix *  master 
)

Definition at line 37 of file SharedConfig.cpp.

References sim::Operator::ODM.

Referenced by Client::Client(), main(), AdsidacCallback::onFirstInit(), and Server::Simulation().

Here is the caller graph for this function:

◆ set_shared_kb()

void adsidac::set_shared_kb ( int  operator_type,
const KB *  master 
)

Definition at line 25 of file SharedConfig.cpp.

References sim::Operator::ODM.

Referenced by Client::Client(), main(), AdsidacCallback::onFirstInit(), and Server::Simulation().

Here is the caller graph for this function:

◆ set_shared_procedures()

void adsidac::set_shared_procedures ( const Procedures *  master)

Definition at line 12 of file SharedConfig.cpp.

Referenced by Client::Client(), main(), AdsidacCallback::onFirstInit(), and Server::Simulation().

Here is the caller graph for this function:

◆ shared_control_panel()

const ControlPanel * adsidac::shared_control_panel ( )

Definition at line 14 of file SharedConfig.cpp.

Referenced by ControlPanel::load().

Here is the caller graph for this function:

◆ shared_diagnosis_matrix()

const EventSymptomMatrix * adsidac::shared_diagnosis_matrix ( int  operator_type)

Definition at line 34 of file SharedConfig.cpp.

References sim::Operator::ODM.

Referenced by Operator::seedDiagnosisMatrixFromMaster().

Here is the caller graph for this function:

◆ shared_kb()

const KB * adsidac::shared_kb ( int  operator_type)

Definition at line 22 of file SharedConfig.cpp.

References sim::Operator::ODM.

Referenced by Operator::seedKnowledgeBaseFromMaster().

Here is the caller graph for this function:

◆ shared_procedures()

const Procedures * adsidac::shared_procedures ( )

Definition at line 11 of file SharedConfig.cpp.

Referenced by Procedures::load().

Here is the caller graph for this function:

◆ splice_base()

std::vector< char > adsidac::splice_base ( const std::vector< char > &  hdr_base,
const std::vector< char > &  body 
)
inline

Put the cached base back in front of a base-less transfer.

hdr_base is [header][base]; body is [header][target]. The header is a run-wide constant too, so the result is hdr_base followed by body's portion after its own header. hdr_base is copied as is, without checks.

Returns
[header][base][target], or empty if no dump is found in body.

Definition at line 150 of file RestartTrim.h.

References adsidac::RestartLayout::have_header, adsidac::RestartLayout::header_end, and scan_restart().

Referenced by RelapSolver::restore(), and Client::restore_buffer().

Here is the call graph for this function:
Here is the caller graph for this function: