← Documentation
ADS-IDAC Engine 5.0.0
ParallelGlobal.h File Reference

Shared declarations for MPI parallel execution: message tags, utilities, Fortran callbacks. More...

#include "../Global/SimulationContext.h"
#include <fstream>
#include <sstream>
#include <filesystem>
#include <iostream>
#include <cstdlib>
#include <lz4.h>
#include <cstring>
#include <boost/serialization/vector.hpp>
#include <boost/serialization/string.hpp>
Include dependency graph for ParallelGlobal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SequenceReport
 Report sent by client when a sequence completes (for DET visualization). More...
 
struct  SequenceOutputEvent
 Lightweight PE event record (extracted from AnalysisInfoContainerUnit). More...
 
struct  SequenceOutputEndState
 Lightweight end state record (extracted from BranchEndState). More...
 
struct  SequenceOutputData
 Per-sequence output payload sent from client to server via MPI. More...
 

Namespaces

namespace  PG
 Parallel globals namespace — MPI rank/size and message tag definitions.
 

Enumerations

enum  {
  PG::server_branch_this , PG::server_done_simulating , PG::client_simulate_this , PG::client_restart_run ,
  PG::client_shutdown , PG::client_debug_resume , PG::server_branch_meta , PG::client_peer_assign ,
  PG::client_peer_restart , PG::client_send_to_peer , PG::client_run_held , PG::server_send_complete ,
  PG::server_done_with_report , PG::server_output_data , PG::client_checkpoint
}
 MPI message tags for Server/Client communication. More...
 

Functions

void interfc_ ()
 Called every RELAP5 timestep from dtstep.f. Triggers crew/diagnosis decisions. More...
 
void actonce_ ()
 Execute crew actions once per transient. More...
 
void secini_ ()
 Security initialization callback. More...
 
void actte_ ()
 Execute crew actions at each timestep. More...
 
void restartforanewsequence_ ()
 Find next unexplored branch, generate indeck.i restart input. More...
 
void initiationforrestart_ ()
 Initialize restart mode for next sequence. More...
 
void mutiproactonce_ ()
 
void setrnode_ ()
 Set restart node information in r5pars_. More...
 
void relap5_ ()
 
std::string restart_path (const std::string &name)
 Get restart file path (shm or local). More...
 
long get_rss_mb ()
 Get current process RSS in MB (Linux + macOS, returns 0 elsewhere). More...
 
bool should_use_memory_restart ()
 Decide whether to use memory mode for this restart operation. memory_limit_mb == 0 → unlimited (always memory). > 0 → check RSS. More...
 
std::vector< char > lz4_compress (const char *data, int size)
 LZ4-compress a buffer with a 4-byte original-size header. More...
 
std::vector< char > lz4_decompress (const char *data, int size)
 LZ4-decompress a buffer that has a 4-byte original-size header. More...
 
void cleanup_fort_temps ()
 Clean up Fortran temporary files (fort*) left by RELAP5. More...
 
bool viz_outputs_any ()
 True if any viz output streaming is enabled. More...
 

Variables

int PG::rank
 MPI rank of this process. More...
 
int PG::size
 Total number of MPI processes. More...
 
bool PG::log = true
 Enable/disable rank-specific logging. More...
 

Detailed Description

Shared declarations for MPI parallel execution: message tags, utilities, Fortran callbacks.

Definition in file ParallelGlobal.h.

Function Documentation

◆ actonce_()

void actonce_ ( )

Execute crew actions once per transient.

Definition at line 592 of file ADSIDAC.cpp.

References getActiveSolver(), and getActiveSolverCallback().

Here is the call graph for this function:

◆ actte_()

void actte_ ( )

Execute crew actions at each timestep.

Definition at line 580 of file ADSIDAC.cpp.

References getActiveSolver(), and getActiveSolverCallback().

Here is the call graph for this function:

◆ cleanup_fort_temps()

void cleanup_fort_temps ( )
inline

Clean up Fortran temporary files (fort*) left by RELAP5.

Definition at line 107 of file ParallelGlobal.h.

Referenced by main(), and Client::Work().

Here is the caller graph for this function:

◆ get_rss_mb()

long get_rss_mb ( )
inline

Get current process RSS in MB (Linux + macOS, returns 0 elsewhere).

Definition at line 41 of file ParallelGlobal.h.

Referenced by Server::dispatch_available_tasks(), main(), AdsidacCallback::onBranchingPoint(), should_use_memory_restart(), and Server::Simulation().

Here is the caller graph for this function:

◆ initiationforrestart_()

void initiationforrestart_ ( )

Initialize restart mode for next sequence.

Definition at line 610 of file ADSIDAC.cpp.

References engine_callback, AdsidacCallback::initiationForRestart(), and solver_raw.

Here is the call graph for this function:

◆ interfc_()

void interfc_ ( )

Called every RELAP5 timestep from dtstep.f. Triggers crew/diagnosis decisions.

Definition at line 574 of file ADSIDAC.cpp.

References getActiveSolver(), and getActiveSolverCallback().

Here is the call graph for this function:

◆ lz4_compress()

std::vector< char > lz4_compress ( const char *  data,
int  size 
)
inline

LZ4-compress a buffer with a 4-byte original-size header.

Definition at line 75 of file ParallelGlobal.h.

References PG::size.

Referenced by DETCheckpoint::lz4_pack_string(), AdsidacCallback::onBranchingPoint(), and DETCheckpoint::save().

Here is the caller graph for this function:

◆ lz4_decompress()

std::vector< char > lz4_decompress ( const char *  data,
int  size 
)
inline

LZ4-decompress a buffer that has a 4-byte original-size header.

Definition at line 90 of file ParallelGlobal.h.

References PG::size.

Referenced by DETCheckpoint::load(), DETCheckpoint::lz4_unpack_string(), main(), and Client::restore_relap_state().

Here is the caller graph for this function:

◆ mutiproactonce_()

void mutiproactonce_ ( )

Definition at line 614 of file ADSIDAC.cpp.

◆ relap5_()

void relap5_ ( )

References relap5_().

Referenced by relap5_().

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

◆ restart_path()

std::string restart_path ( const std::string &  name)
inline

Get restart file path (shm or local).

Definition at line 36 of file ParallelGlobal.h.

References SimulationContext::config, g_sim, SimConfig::memory_restart, and SimConfig::shm_prefix.

Referenced by build_serial_checkpoint(), AdsidacCallback::initiationForRestart(), main(), and AdsidacCallback::restartForNewSequence().

Here is the caller graph for this function:

◆ restartforanewsequence_()

void restartforanewsequence_ ( )

Find next unexplored branch, generate indeck.i restart input.

Definition at line 606 of file ADSIDAC.cpp.

References engine_callback, AdsidacCallback::restartForNewSequence(), and solver_raw.

Here is the call graph for this function:

◆ secini_()

void secini_ ( )

Security initialization callback.

Definition at line 586 of file ADSIDAC.cpp.

References getActiveSolver(), and getActiveSolverCallback().

Here is the call graph for this function:

◆ setrnode_()

void setrnode_ ( )

Set restart node information in r5pars_.

Definition at line 618 of file ADSIDAC.cpp.

◆ should_use_memory_restart()

bool should_use_memory_restart ( )
inline

Decide whether to use memory mode for this restart operation. memory_limit_mb == 0 → unlimited (always memory). > 0 → check RSS.

Definition at line 68 of file ParallelGlobal.h.

References SimulationContext::config, g_sim, get_rss_mb(), SimConfig::memory_limit_mb, and SimConfig::memory_restart.

Referenced by main(), and AdsidacCallback::onBranchingPoint().

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

◆ viz_outputs_any()

bool viz_outputs_any ( )
inline

True if any viz output streaming is enabled.

Definition at line 132 of file ParallelGlobal.h.

References SimulationContext::config, g_sim, SimConfig::viz_output_end_states, and SimConfig::viz_output_events.

Referenced by Client::complete_sequence().

Here is the caller graph for this function: