23 params.
addParam<
bool>(
"report_peak_value",
25 "If the vectorpostprocessor is executed more than once "
26 "during a time step, report the aggregated peak "
30 "The unit prefix used to report memory usage, default: Mebibytes");
38 _col_hardware_id(declareVector(
"hardware_id")),
39 _col_total_ram(declareVector(
"total_ram")),
40 _col_physical_mem(declareVector(
"physical_mem")),
41 _col_virtual_mem(declareVector(
"virtual_mem")),
42 _col_page_faults(declareVector(
"page_faults")),
43 _col_node_utilization(declareVector(
"node_utilization")),
44 _report_peak_value(getParam<bool>(
"report_peak_value")),
45 _peak_physical_mem(0.0),
46 _peak_virtual_mem(0.0)
58 for (std::size_t i = 0; i <
_nrank; ++i)
117 for (std::size_t i = 0; i <
_nrank; ++i)
120 for (std::size_t i = 0; i <
_nrank; ++i)
126 for (std::size_t i = 0; i <
_nrank; ++i)
registerMooseObject("MooseApp", VectorMemoryUsage)
bool checkingUOAuxState() const
Return a flag to indicate whether we are executing user objects and auxliary kernels for state check ...
This class is here to combine the VectorPostprocessor interface and the base class VectorPostprocesso...
static InputParameters validParams()
Mix-in class for querying memory metrics used by MemoryUsage and VectorMemoryUsage.
const std::vector< unsigned int > & _hardware_id
hardware IDs for each MPI rank (valid on rank zero only)
std::vector< unsigned long long > _hardware_memory_total
total RAM for each hardware ID (node) (valid on rank zero only)
processor_id_type _nrank
number of ranks in the object's communicator
processor_id_type _my_rank
this objects rank
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
void gather(const unsigned int root_id, const T &send_data, std::vector< T, A > &recv) const
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
Generate a table of various memory metrics indexed by MPI rank.
VectorPostprocessorValue & _col_node_utilization
RAM utilization of the physical node (i.e. what fraction of the total RAM is the simulation using)
static InputParameters validParams()
VectorPostprocessorValue & _col_virtual_mem
virtual memory usage per rank
virtual void timestepSetup() override
Gets called at the beginning of the timestep before this object is asked to do its job.
VectorPostprocessorValue & _col_total_ram
total RAM available on the physical node the rank is located at
VectorPostprocessorValue & _col_physical_mem
physical memory usage per rank
VectorMemoryUsage(const InputParameters ¶meters)
VectorPostprocessorValue & _col_page_faults
hard page faults per rank (Linux only), i.e. swap frequency
MemoryUtils::MemUnits _mem_units
The unit prefix for the reported memory statistics (kilobyte, megabyte, etc).
virtual void finalize() override
Finalize.
virtual void execute() override
Execute method.
const bool _report_peak_value
peak values
VectorPostprocessorValue & _col_hardware_id
hardware id for the physical node the rank is located at
const Parallel::Communicator & _communicator
std::size_t convertBytes(std::size_t bytes, MemUnits unit)
convert bytes to selected unit prefix
bool getMemoryStats(Stats &stats)
get all memory stats for the current process stats The Stats object to fill with the data
MooseEnum getMemUnitsEnum()
get the moose enum for the mem_unit_prefix parameter
std::size_t _virtual_memory
std::size_t _physical_memory