Skip to content

Commit

Permalink
write less frequently to stdout to improve runtime (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
troyfrever-NOAA authored Dec 9, 2024
1 parent 5cd8356 commit 7bfb062
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/headless.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,7 @@ int main(int argc, char **argv) {
}
int sec = floor(remaining);
remainingStr += std::to_string(sec)+"s";
std::cout << "\rStep " << m->time << ": " << elapsed << "s elapsed; " << remainingStr << " remaining; " << m->livingIndividuals.size() << " living fish; " << m->exitedCount << " exited; " << m->deadCount << " dead";

std::cout.flush();
if (halt) {
halt = 0;
std::cout << std::endl << "Interrupted at step " << m->time << "; " << totalElapsed << "s elapsed since start" << std::endl;
Expand All @@ -179,6 +177,8 @@ int main(int argc, char **argv) {
}
}
if (m->time % 330 == 0) {
std::cout << "\rStep " << m->time << ": " << elapsed << "s elapsed; " << remainingStr << " remaining; " << m->livingIndividuals.size() << " living fish; " << m->exitedCount << " exited; " << m->deadCount << " dead";
std::cout.flush();
std::cout << std::endl << "Writing intermediary file at step: " << m->time << std::endl;
std::stringstream interruptfile;
interruptfile << outputPath << "/run_" << runID <<"_step_" << m->time << ".nc";
Expand Down

0 comments on commit 7bfb062

Please sign in to comment.