Skip to content

Commit 2b6a581

Browse files
committed
feat(models): Expose model memory usage
Override get_allocated_memory_bytes() in Tungsten and Aluminum to return existing mem_allocated computed during allocate(). - Leverages utils::sizeof_vec() tracking already in place - Enables accurate app vs FFT memory breakdown in reports
1 parent e1962f4 commit 2b6a581

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

apps/aluminumNew/Aluminum.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,13 @@ class Aluminum : public Model {
326326
fft.backward(psi_F, psi);
327327
}
328328

329+
/**
330+
* @brief Calculate memory allocated by the Aluminum model
331+
*
332+
* @return Total allocated memory in bytes for all model fields and operators
333+
*/
334+
size_t get_allocated_memory_bytes() const override { return mem_allocated; }
335+
329336
/**
330337
* @brief Constructs an Aluminum model with the given World object.
331338
*

apps/tungsten/tungsten_model.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,13 @@ class Tungsten : public Model {
382382
CHECK_AND_ABORT_IF_NANS(psi);
383383
}
384384

385+
/**
386+
* @brief Calculate memory allocated by the Tungsten model
387+
*
388+
* @return Total allocated memory in bytes for all model fields and operators
389+
*/
390+
size_t get_allocated_memory_bytes() const override { return mem_allocated; }
391+
385392
/**
386393
* @brief Constructs a Tungsten model with the given World object
387394
*

0 commit comments

Comments
 (0)