Skip to content

Commit

Permalink
fix: change where timer starts
Browse files Browse the repository at this point in the history
  • Loading branch information
pranav-sivaraman committed Oct 19, 2023
1 parent 8239f53 commit 7e6161f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 5 additions & 5 deletions kokkos/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ int main( int argc, char* argv[] )
}

// Start Simulation Timer
Kokkos::Timer start;
start.reset()


double elapsed_time = 0;
// Run simulation
if( in.simulation_method == EVENT_BASED )
{
if( in.kernel_id == 0 )
verification = run_event_based_simulation(in, SD, mype, &omp_end);
verification = run_event_based_simulation(in, SD, mype, &elapsed_time);
else
{
printf("Error: No kernel ID %d found!\n", in.kernel_id);
Expand All @@ -106,7 +106,7 @@ int main( int argc, char* argv[] )
verification = verification % 999983;

// Print / Save Results and Exit
int is_invalid_result = print_results( in, mype, start.seconds(), nprocs, verification );
int is_invalid_result = print_results( in, mype, elapsed_time, nprocs, verification );

Kokkos::finalize();

Expand Down
6 changes: 4 additions & 2 deletions kokkos/Simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ unsigned long long run_event_based_simulation(Inputs in, SimulationData SD, int
{
if( mype == 0)
printf("Beginning event based simulation...\n");

////////////////////////////////////////////////////////////////////////////////
// SUMMARY: Simulation Data Structure Manifest for "SD" Object
// Here we list all heap arrays (and lengths) in SD that would need to be
Expand All @@ -39,6 +38,9 @@ unsigned long long run_event_based_simulation(Inputs in, SimulationData SD, int
// Data movment and setup
int length_max_num_nucs = 1;

Kokkos::Timer start;
start.reset();

UIntView u_max_num_nucs(&SD.max_num_nucs, 1);
SD.d_max_num_nucs = new IntView("d_max_num_nucs", length_max_num_nucs);
Kokkos::deep_copy(*SD.d_max_num_nucs, u_max_num_nucs);
Expand Down Expand Up @@ -146,7 +148,7 @@ unsigned long long run_event_based_simulation(Inputs in, SimulationData SD, int
Kokkos::fence();

// End Simulation Timer
*end = omp_get_wtime();
*end = start.seconds();

// Reduce validation hash on the host
unsigned long long validation_hash = 0;
Expand Down

0 comments on commit 7e6161f

Please sign in to comment.