Skip to content

Commit

Permalink
feat: add zone cyles per wallclock second calculation and output
Browse files Browse the repository at this point in the history
  • Loading branch information
AstroBarker committed Jul 6, 2024
1 parent 6fd3742 commit 6da343e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,19 @@ int main( int argc, char *argv[] ) {
WriteState( &state, Grid, &S_Limiter, ProblemName, t, order, 0 );

// --- Timer ---
Kokkos::Timer timer;
Kokkos::Timer timer_total;
Kokkos::Timer timer_zone_cycles;
Real zc_ws = 0.0; // zone cycles / wall second

// --- Evolution loop ---
int iStep = 0;
int i_print = 100; // std out
int i_write = 10; // h5 out
int i_out = 1; // output label, start 1
std::cout << " ~ Step\tt\tdt" << std::endl;
std::cout << " ~ Step t dt zone_cycles / wall_second\n"
<< std::endl;
while ( t < t_end && iStep >= 0 ) {
timer_zone_cycles.reset( );

// TODO: ComputeTimestep_Rad
dt = ComputeTimestep_Fluid( state.Get_uCF( ), &Grid, &eos, CFL );
Expand All @@ -124,7 +128,7 @@ int main( int argc, char *argv[] ) {
}

if ( iStep % i_print == 0 ) {
std::printf( " ~ %d \t %.5e \t %.5e\n", iStep, t, dt );
std::printf( " ~ %d %.5e %.5e %.5e \n", iStep, t, dt, zc_ws );
}

if ( !opts.do_rad ) {
Expand All @@ -140,7 +144,7 @@ int main( int argc, char *argv[] ) {
}

#ifdef ATHELAS_DEBUG
check_state( &state, Grid.Get_ihi( ) );
check_state( &state, Grid.Get_ihi( ), pin.do_rad );
#endif

t += dt;
Expand All @@ -152,10 +156,12 @@ int main( int argc, char *argv[] ) {
}

iStep++;
Real time_cycle = timer_zone_cycles.seconds( );
zc_ws = nX / time_cycle;
}

// --- Finalize timer ---
Real time = timer.seconds( );
Real time = timer_total.seconds( );
std::printf( " ~ Done! Elapsed time: %f seconds.\n", time );
ApplyBC( state.Get_uCF( ), &Grid, order, BC );
WriteState( &state, Grid, &S_Limiter, ProblemName, t, order, -1 );
Expand Down

0 comments on commit 6da343e

Please sign in to comment.