Skip to content

Commit

Permalink
Updated memory recorder.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmageeLANL committed Mar 8, 2024
1 parent 7a4cfa8 commit 6d9fa96
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions utils/memory_recorder/memory_recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,9 @@ void MemoryRecorder::write_rss(int filewrite) {
this->summarizeMaxRSS();
}

std::cout << std::fixed << std::dec;
std::ios_base::fmtflags fls;
fls = std::cout.flags();
std::cout << std::fixed << std::dec << std::setprecision(4);
if (localrank == 0) {
unsigned long noderam = this->getRamSize()/kb;
unsigned long totalram = noderam * numnodes;
Expand All @@ -267,6 +269,7 @@ void MemoryRecorder::write_rss(int filewrite) {
if (filewrite) {
std::ofstream outfile;
outfile.open(rssfileOut, std::ios::out);
outfile << std::setprecision(4);

outfile << "Node Number " << nodenum << "/" << numnodes << " " << local_maxrss.index << std::endl;
outfile << "Mem Used: " << local_maxrss.val << " - " << local_maxrss.val/mb << " (GiB)" << std::endl;
Expand All @@ -286,14 +289,23 @@ void MemoryRecorder::write_rss(int filewrite) {
double pcttotalram = (double)global_maxrss/totalram;
double pctminram = (double)min_maxrss.val/noderam;
double pctmaxram = (double)max_maxrss.val/noderam;
std::cout << "Mem Used: " << global_maxrss << " Total Ram: " << totalram << " Fraction Ram: " << round_pct(pcttotalram) << "%" << std::endl;
std::cout << "TOTAL RSS MAX: " << global_maxrss/mb << " (GiB) - " << round_pct(pcttotalram) << "%" << std::endl;
std::cout << "MIN RSS MAX: " << min_maxrss.val << " " << min_maxrss.val/mb << " (GiB) - " << round_pct(pctminram) << "%";
std::cout << " -- On NODE: " << min_maxrss.index << " - " << hostlist.at(min_maxrss.index) << std::endl;
std::cout << "MAX RSS MAX: " << max_maxrss.val << " " << max_maxrss.val/mb << " (GiB) - " << round_pct(pctmaxram) << "%";
std::cout << " -- On NODE: " << max_maxrss.index << " - " << hostlist.at(max_maxrss.index) << std::endl;
// PRINT TOTAL
std::cout << "Mem Used: " << global_maxrss << " Total Ram: " << totalram << " Fraction Ram: ";
std::cout << round_pct(pcttotalram) << "%" << std::endl;
// PRINT TOTAL SUMMARY
std::cout << "TOTAL RSS MAX: " << global_maxrss/mb << " (GiB) - ";
std::cout << round_pct(pcttotalram) << "%" << std::endl;
// PRINT MIN
std::cout << "MIN RSS MAX: " << min_maxrss.val << " " << min_maxrss.val/mb << " (GiB) - ";
std::cout << round_pct(pctminram) << "%" << " -- On NODE: " << min_maxrss.index;
std::cout << " - " << hostlist.at(min_maxrss.index) << std::endl;
// PRINT MAX
std::cout << "MAX RSS MAX: " << max_maxrss.val << " " << max_maxrss.val/mb << " (GiB) - ";
std::cout << round_pct(pctmaxram) << "%" << " -- On NODE: " << max_maxrss.index;
std::cout << " - " << hostlist.at(max_maxrss.index) << std::endl;
}
}
std::cout.flags(fls);
}


Expand Down

0 comments on commit 6d9fa96

Please sign in to comment.