Skip to content

Commit e1962f4

Browse files
committed
feat(ui): Report memory after model init
Log memory usage per rank and globally using the new memory reporter. Separates application vs FFT memory and reports per-voxel and system usage percent. - Calls report_memory_usage() after model.initialize() - Includes memory_reporter.hpp
1 parent e9eeaff commit e1962f4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/openpfc/ui/app.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "from_json.hpp"
2727
#include "json_helpers.hpp"
2828
#include "openpfc/openpfc.hpp"
29+
#include "openpfc/utils/memory_reporter.hpp"
2930
#include "openpfc/utils/timeleft.hpp"
3031
#include "openpfc/utils/toml_to_json.hpp"
3132
#include <filesystem>
@@ -253,6 +254,15 @@ template <class ConcreteModel> class App {
253254
std::cout << "Initializing model... " << std::endl;
254255
model.initialize(time.get_dt());
255256

257+
// Report memory usage
258+
{
259+
size_t model_mem = model.get_allocated_memory_bytes();
260+
size_t fft_mem = fft.get_allocated_memory_bytes();
261+
pfc::utils::MemoryUsage usage{model_mem, fft_mem};
262+
pfc::Logger logger{pfc::LogLevel::Info, rank_id};
263+
pfc::utils::report_memory_usage(usage, world, logger, m_comm);
264+
}
265+
256266
add_result_writers(simulator);
257267
add_initial_conditions(simulator);
258268
add_boundary_conditions(simulator);

0 commit comments

Comments
 (0)