Use wall time for timestep logging

This commit is contained in:
2026-03-30 20:38:41 +08:00
parent 5f664716ab
commit 087d034ee3
3 changed files with 40 additions and 38 deletions

View File

@@ -317,9 +317,9 @@ void scalar_class::Setup_Initial_Data()
#endif
}
}
void scalar_class::Evolve(int Steps)
{
clock_t prev_clock, curr_clock;
void scalar_class::Evolve(int Steps)
{
double prev_clock = 0.0, curr_clock = 0.0;
double LastDump = 0.0, LastCheck = 0.0;
LastAnas = 0;
@@ -327,8 +327,8 @@ void scalar_class::Evolve(int Steps)
for (int ncount = 1; ncount < Steps + 1; ncount++)
{
if (myrank == 0)
curr_clock = clock();
if (myrank == 0)
curr_clock = MPI_Wtime();
RecursiveStep(0);
LastDump += dT_mon;
@@ -343,13 +343,13 @@ void scalar_class::Evolve(int Steps)
#endif
LastDump = 0;
}
if (myrank == 0)
{
prev_clock = curr_clock;
curr_clock = clock();
cout << " Timestep # " << ncount << ": integrating to time: " << PhysTime
<< " Computer used " << (double)(curr_clock - prev_clock) / ((double)CLOCKS_PER_SEC) << " seconds! " << endl;
}
if (myrank == 0)
{
prev_clock = curr_clock;
curr_clock = MPI_Wtime();
cout << " Timestep # " << ncount << ": integrating to time: " << PhysTime
<< " Computer used " << (curr_clock - prev_clock) << " seconds! " << endl;
}
if (PhysTime >= TotalTime)
break;
}