From 7e6161f699b3d4014606832dc571e9b148f6bbe9 Mon Sep 17 00:00:00 2001 From: Pranav Sivaraman <14294205+pranav-sivaraman@users.noreply.github.com> Date: Sun, 24 Sep 2023 14:58:54 -0400 Subject: [PATCH] fix: change where timer starts --- kokkos/Main.cpp | 10 +++++----- kokkos/Simulation.cpp | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/kokkos/Main.cpp b/kokkos/Main.cpp index e2e5fe41..a8caa9d1 100644 --- a/kokkos/Main.cpp +++ b/kokkos/Main.cpp @@ -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); @@ -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(); diff --git a/kokkos/Simulation.cpp b/kokkos/Simulation.cpp index 87d0329e..6ac060ab 100644 --- a/kokkos/Simulation.cpp +++ b/kokkos/Simulation.cpp @@ -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 @@ -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); @@ -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;