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

@@ -2034,9 +2034,9 @@ void bssn_class::Read_Ansorg()
//================================================================================================
void bssn_class::Evolve(int Steps)
{
clock_t prev_clock, curr_clock;
void bssn_class::Evolve(int Steps)
{
double prev_clock = 0.0, curr_clock = 0.0;
double LastDump = 0.0, LastCheck = 0.0, Last2dDump = 0.0;
LastAnas = 0;
#if 0
@@ -2145,14 +2145,14 @@ void bssn_class::Evolve(int Steps)
GH->settrfls(trfls);
for (int ncount = 1; ncount < Steps + 1; ncount++)
{
for (int ncount = 1; ncount < Steps + 1; ncount++)
{
// special for large mass ratio consideration
// if(fabs(Porg0[0][0]-Porg0[1][0])+fabs(Porg0[0][1]-Porg0[1][1])+fabs(Porg0[0][2]-Porg0[1][2])<1e-6)
// { GH->levels=GH->movls; }
if (myrank == 0)
curr_clock = clock();
if (myrank == 0)
curr_clock = MPI_Wtime();
#if (PSTR == 0)
RecursiveStep(0);
#elif (PSTR == 1 || PSTR == 2 || PSTR == 3)
@@ -2205,16 +2205,16 @@ void bssn_class::Evolve(int Steps)
}
}
if (myrank == 0)
{
prev_clock = curr_clock;
curr_clock = clock();
cout << endl;
cout << " Timestep # " << ncount << ": integrating to time: " << PhysTime << " "
<< " Computer used " << (double)(curr_clock - prev_clock) / ((double)CLOCKS_PER_SEC)
<< " seconds! " << endl;
// cout << endl;
}
if (myrank == 0)
{
prev_clock = curr_clock;
curr_clock = MPI_Wtime();
cout << endl;
cout << " Timestep # " << ncount << ": integrating to time: " << PhysTime << " "
<< " Computer used " << (curr_clock - prev_clock)
<< " seconds! " << endl;
// cout << endl;
}
if (PhysTime >= TotalTime)
break;

View File

@@ -1891,7 +1891,7 @@ void bssn_class::Read_Ansorg()
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;
LastAnas = 0;
#if 0
@@ -2035,10 +2035,12 @@ void bssn_class::Evolve(int Steps)
GH->settrfls(trfls);
for (int ncount = 1; ncount < Steps + 1; ncount++)
{
cout << "Before Step: " << ncount << " My Rank: " << myrank
<< " takes " << MPI_Wtime() - beg_time << " seconds!" << endl;
for (int ncount = 1; ncount < Steps + 1; ncount++)
{
if (myrank == 0)
curr_clock = MPI_Wtime();
cout << "Before Step: " << ncount << " My Rank: " << myrank
<< " takes " << MPI_Wtime() - beg_time << " seconds!" << endl;
beg_time = MPI_Wtime();
#if (PSTR == 0)
RecursiveStep(0);
@@ -2095,10 +2097,10 @@ void bssn_class::Evolve(int Steps)
if (myrank == 0)
{
prev_clock = curr_clock;
curr_clock = clock();
cout << "Timestep # " << ncount << ": integrating to time: " << PhysTime << endl;
cout << "used " << (double)(curr_clock - prev_clock) / ((double)CLOCKS_PER_SEC) << " seconds!" << endl;
prev_clock = curr_clock;
curr_clock = MPI_Wtime();
cout << "Timestep # " << ncount << ": integrating to time: " << PhysTime << endl;
cout << "used " << (curr_clock - prev_clock) << " seconds!" << endl;
}
if (PhysTime >= TotalTime)

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;
}