Revert "Fix timing: replace clock() with MPI_Wtime() for wall-clock measurement"

This reverts commit 09b937c022.
This commit is contained in:
2026-02-25 22:21:43 +08:00
parent 284ab80baf
commit f5a63f1e42
2 changed files with 80 additions and 80 deletions

View File

@@ -319,7 +319,7 @@ void scalar_class::Setup_Initial_Data()
}
void scalar_class::Evolve(int Steps)
{
double prev_clock, curr_clock;
clock_t prev_clock, curr_clock;
double LastDump = 0.0, LastCheck = 0.0;
LastAnas = 0;
@@ -328,7 +328,7 @@ void scalar_class::Evolve(int Steps)
for (int ncount = 1; ncount < Steps + 1; ncount++)
{
if (myrank == 0)
curr_clock = MPI_Wtime();
curr_clock = clock();
RecursiveStep(0);
LastDump += dT_mon;
@@ -346,9 +346,9 @@ void scalar_class::Evolve(int Steps)
if (myrank == 0)
{
prev_clock = curr_clock;
curr_clock = MPI_Wtime();
curr_clock = clock();
cout << " Timestep # " << ncount << ": integrating to time: " << PhysTime
<< " Computer used " << (curr_clock - prev_clock) << " seconds! " << endl;
<< " Computer used " << (double)(curr_clock - prev_clock) / ((double)CLOCKS_PER_SEC) << " seconds! " << endl;
}
if (PhysTime >= TotalTime)
break;
@@ -549,15 +549,15 @@ void scalar_class::Step(int lev, int YN)
#ifdef WithShell
if (lev == 0)
{
double prev_clock, curr_clock;
clock_t prev_clock, curr_clock;
if (myrank == 0)
curr_clock = MPI_Wtime();
curr_clock = clock();
SH->Synch(SynchList_pre, Symmetry);
if (myrank == 0)
{
prev_clock = curr_clock;
curr_clock = MPI_Wtime();
cout << " Shell stuff synchronization used " << (curr_clock - prev_clock) << " seconds! " << endl;
curr_clock = clock();
cout << " Shell stuff synchronization used " << (double)(curr_clock - prev_clock) / ((double)CLOCKS_PER_SEC) << " seconds! " << endl;
}
}
#endif
@@ -731,15 +731,15 @@ void scalar_class::Step(int lev, int YN)
#ifdef WithShell
if (lev == 0)
{
double prev_clock, curr_clock;
clock_t prev_clock, curr_clock;
if (myrank == 0)
curr_clock = MPI_Wtime();
curr_clock = clock();
SH->Synch(SynchList_cor, Symmetry);
if (myrank == 0)
{
prev_clock = curr_clock;
curr_clock = MPI_Wtime();
cout << " Shell stuff synchronization used " << (curr_clock - prev_clock) << " seconds! " << endl;
curr_clock = clock();
cout << " Shell stuff synchronization used " << (double)(curr_clock - prev_clock) / ((double)CLOCKS_PER_SEC) << " seconds! " << endl;
}
}
#endif
@@ -786,15 +786,15 @@ void scalar_class::Step(int lev, int YN)
#ifdef WithShell
if (lev == 0)
{
double prev_clock, curr_clock;
clock_t prev_clock, curr_clock;
if (myrank == 0)
curr_clock = MPI_Wtime();
curr_clock = clock();
SH->CS_Inter(SynchList_cor, Symmetry);
if (myrank == 0)
{
prev_clock = curr_clock;
curr_clock = MPI_Wtime();
cout << " CS_Inter used " << (curr_clock - prev_clock) << " seconds! " << endl;
curr_clock = clock();
cout << " CS_Inter used " << (double)(curr_clock - prev_clock) / ((double)CLOCKS_PER_SEC) << " seconds! " << endl;
}
}
#endif
@@ -1010,15 +1010,15 @@ void scalar_class::Step(int lev, int YN)
#ifdef WithShell
if (lev == 0)
{
double prev_clock, curr_clock;
clock_t prev_clock, curr_clock;
if (myrank == 0)
curr_clock = MPI_Wtime();
curr_clock = clock();
SH->Synch(SynchList_cor, Symmetry);
if (myrank == 0)
{
prev_clock = curr_clock;
curr_clock = MPI_Wtime();
cout << " Shell stuff synchronization used " << (curr_clock - prev_clock) << " seconds! " << endl;
curr_clock = clock();
cout << " Shell stuff synchronization used " << (double)(curr_clock - prev_clock) / ((double)CLOCKS_PER_SEC) << " seconds! " << endl;
}
}
#endif
@@ -1027,15 +1027,15 @@ void scalar_class::Step(int lev, int YN)
#ifdef WithShell
if (lev == 0)
{
double prev_clock, curr_clock;
clock_t prev_clock, curr_clock;
if (myrank == 0)
curr_clock = MPI_Wtime();
curr_clock = clock();
SH->CS_Inter(SynchList_cor, Symmetry);
if (myrank == 0)
{
prev_clock = curr_clock;
curr_clock = MPI_Wtime();
cout << " CS_Inter used " << (curr_clock - prev_clock) << " seconds! " << endl;
curr_clock = clock();
cout << " CS_Inter used " << (double)(curr_clock - prev_clock) / ((double)CLOCKS_PER_SEC) << " seconds! " << endl;
}
}
#endif