Add peak memory footprint monitoring & output to FullMonte
FullMonte should track its peak memory footprint and print it out alongside the compile time at the end of a run. If this works for FullMonteCuda too that's great (and probably it will, if we put the code in the general shared code).
Should also do for PDT-SPACE.
VTR has code to do this that we can copy (taken from https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/e5ff75cc76f83ee2a7a5c4bbda0a278e6980239c/libs/libvtrutil/src/vtr_rusage.cpp#L1)
#include "vtr_rusage.h"
#ifdef __unix__
# include <sys/time.h>
# include <sys/resource.h>
#endif
namespace vtr {
///@brief Returns the maximum resident set size in bytes, or zero if unable to determine.
size_t get_max_rss() {
size_t max_rss = 0;
#ifdef __unix__
rusage usage;
int result = getrusage(RUSAGE_SELF, &usage);
if (result == 0) { //Success
//ru_maxrss is in kilobytes, convert to bytes
max_rss = usage.ru_maxrss * 1024;
}
#else
//Do nothing, other platform specific code could be added here
//with appropriate defines
#endif
return max_rss;
}
} // namespace vtr
Edited by Vaughn Betz