Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #pragma once 11 : 12 : #include "GeneralVectorPostprocessor.h" 13 : #include "MemoryUsageReporter.h" 14 : #include "MemoryUtils.h" 15 : 16 : /** 17 : * Generate a table of various memory metrics indexed by MPI rank. Visualize this using 18 : * VectorPostprocessorVisualizationAux. 19 : */ 20 : class VectorMemoryUsage : public GeneralVectorPostprocessor, public MemoryUsageReporter 21 : { 22 : public: 23 : static InputParameters validParams(); 24 : 25 : VectorMemoryUsage(const InputParameters & parameters); 26 : 27 : virtual void timestepSetup() override; 28 : 29 166 : virtual void initialize() override {} 30 : virtual void execute() override; 31 : virtual void finalize() override; 32 : 33 : protected: 34 : /// The unit prefix for the reported memory statistics (kilobyte, megabyte, etc). 35 : MemoryUtils::MemUnits _mem_units; 36 : 37 : /// hardware id for the physical node the rank is located at 38 : VectorPostprocessorValue & _col_hardware_id; 39 : 40 : /// total RAM available on the physical node the rank is located at 41 : VectorPostprocessorValue & _col_total_ram; 42 : 43 : /// physical memory usage per rank 44 : VectorPostprocessorValue & _col_physical_mem; 45 : 46 : /// virtual memory usage per rank 47 : VectorPostprocessorValue & _col_virtual_mem; 48 : 49 : /// hard page faults per rank (Linux only), i.e. swap frequency 50 : VectorPostprocessorValue & _col_page_faults; 51 : 52 : /// RAM utilization of the physical node (i.e. what fraction of the total RAM is the simulation using) 53 : VectorPostprocessorValue & _col_node_utilization; 54 : 55 : ///@{ peak values 56 : const bool _report_peak_value; 57 : Real _peak_physical_mem; 58 : Real _peak_virtual_mem; 59 : ///@} 60 : };