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

@@ -2036,7 +2036,7 @@ void bssn_class::Read_Ansorg()
void bssn_class::Evolve(int Steps) void bssn_class::Evolve(int Steps)
{ {
clock_t prev_clock, curr_clock; double prev_clock = 0.0, curr_clock = 0.0;
double LastDump = 0.0, LastCheck = 0.0, Last2dDump = 0.0; double LastDump = 0.0, LastCheck = 0.0, Last2dDump = 0.0;
LastAnas = 0; LastAnas = 0;
#if 0 #if 0
@@ -2152,7 +2152,7 @@ void bssn_class::Evolve(int Steps)
// { GH->levels=GH->movls; } // { GH->levels=GH->movls; }
if (myrank == 0) if (myrank == 0)
curr_clock = clock(); curr_clock = MPI_Wtime();
#if (PSTR == 0) #if (PSTR == 0)
RecursiveStep(0); RecursiveStep(0);
#elif (PSTR == 1 || PSTR == 2 || PSTR == 3) #elif (PSTR == 1 || PSTR == 2 || PSTR == 3)
@@ -2208,10 +2208,10 @@ void bssn_class::Evolve(int Steps)
if (myrank == 0) if (myrank == 0)
{ {
prev_clock = curr_clock; prev_clock = curr_clock;
curr_clock = clock(); curr_clock = MPI_Wtime();
cout << endl; cout << endl;
cout << " Timestep # " << ncount << ": integrating to time: " << PhysTime << " " cout << " Timestep # " << ncount << ": integrating to time: " << PhysTime << " "
<< " Computer used " << (double)(curr_clock - prev_clock) / ((double)CLOCKS_PER_SEC) << " Computer used " << (curr_clock - prev_clock)
<< " seconds! " << endl; << " seconds! " << endl;
// cout << endl; // cout << endl;
} }

View File

@@ -1891,7 +1891,7 @@ void bssn_class::Read_Ansorg()
void bssn_class::Evolve(int Steps) void bssn_class::Evolve(int Steps)
{ {
clock_t prev_clock, curr_clock; double prev_clock = 0.0, curr_clock = 0.0;
double LastDump = 0.0, LastCheck = 0.0, Last2dDump = 0.0; double LastDump = 0.0, LastCheck = 0.0, Last2dDump = 0.0;
LastAnas = 0; LastAnas = 0;
#if 0 #if 0
@@ -2037,6 +2037,8 @@ void bssn_class::Evolve(int Steps)
for (int ncount = 1; ncount < Steps + 1; ncount++) for (int ncount = 1; ncount < Steps + 1; ncount++)
{ {
if (myrank == 0)
curr_clock = MPI_Wtime();
cout << "Before Step: " << ncount << " My Rank: " << myrank cout << "Before Step: " << ncount << " My Rank: " << myrank
<< " takes " << MPI_Wtime() - beg_time << " seconds!" << endl; << " takes " << MPI_Wtime() - beg_time << " seconds!" << endl;
beg_time = MPI_Wtime(); beg_time = MPI_Wtime();
@@ -2096,9 +2098,9 @@ void bssn_class::Evolve(int Steps)
if (myrank == 0) if (myrank == 0)
{ {
prev_clock = curr_clock; prev_clock = curr_clock;
curr_clock = clock(); curr_clock = MPI_Wtime();
cout << "Timestep # " << ncount << ": integrating to time: " << PhysTime << endl; cout << "Timestep # " << ncount << ": integrating to time: " << PhysTime << endl;
cout << "used " << (double)(curr_clock - prev_clock) / ((double)CLOCKS_PER_SEC) << " seconds!" << endl; cout << "used " << (curr_clock - prev_clock) << " seconds!" << endl;
} }
if (PhysTime >= TotalTime) if (PhysTime >= TotalTime)

View File

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