Skip to content

Commit

Permalink
Attempt to fix memory usage spike on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshingles committed Sep 21, 2024
1 parent 2561efe commit 1cc5ac7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions input.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1163,8 +1163,7 @@ void read_atomicdata_files() {
printout("total uptrans %d\n", totaluptrans);
printout("total downtrans %d\n", totaldowntrans);

printout("[info] mem_usage: transition lists occupy %.3f MB (this rank) and %.3f MB (shared on node)\n",
2 * uniquelevelindex * sizeof(LevelTransition *) / 1024. / 1024.,
printout("[info] mem_usage: transition lists occupy %.3f MB (shared on node)\n",
(totaluptrans + totaldowntrans) * sizeof(LevelTransition) / 1024. / 1024.);

if (globals::rank_in_node == 0) {
Expand Down Expand Up @@ -1214,8 +1213,9 @@ void read_atomicdata_files() {
#endif
if (globals::rank_in_node == 0) {
std::copy_n(temp_alltranslist.data(), totupdowntrans, globals::alltrans);
temp_alltranslist.clear();
}
temp_alltranslist.clear();
temp_alltranslist.shrink_to_fit();
}

// create a linelist shared on node and then copy data across, freeing the local copy
Expand All @@ -1239,8 +1239,9 @@ void read_atomicdata_files() {

if (globals::rank_in_node == 0) {
memcpy(static_cast<void *>(nonconstlinelist), temp_linelist.data(), globals::nlines * sizeof(TransitionLine));
temp_linelist.clear();
}
temp_linelist.clear();
temp_alltranslist.shrink_to_fit();

#ifdef MPI_ON
MPI_Barrier(MPI_COMM_WORLD);
Expand Down

0 comments on commit 1cc5ac7

Please sign in to comment.