From 4801ba597baba020f8565a989353694345ce6b14 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 20 Aug 2019 12:48:27 +0200 Subject: [PATCH] Fixed bug, regarding wrong datatype for timeing and only letting rank0 time. --- src/mc_electron/simulation.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/mc_electron/simulation.cpp b/src/mc_electron/simulation.cpp index 7c4ede8..9caa754 100644 --- a/src/mc_electron/simulation.cpp +++ b/src/mc_electron/simulation.cpp @@ -191,10 +191,13 @@ void Simulation::sync_cpus() { } void Simulation::sync_populations() { + double time1, time2; uint64_t t1, t2; - int time1, time2; - time1 = MPI_Wtime(); - __asm volatile ("rdtsc" : "=A"(t1)); + if (mpi_rank == 0) { + __asm volatile ("rdtsc" : "=A"(t1)); + time1 = MPI_Wtime(); + } + Population_Manager *populations = looper.get_populations(); Population_Container *container; double *global_delta_cumulated_time_s; @@ -232,10 +235,13 @@ void Simulation::sync_populations() { delete[] local_delta_cumulated_time_s; delete[] local_delta_offset; } - __asm volatile ("rdtsc" : "=A"(t2)); - time2=MPI_Wtime(); - cout<<"number of cycles: \t"<<(t2-t1)<<"\n"; - cout<<"time: \t"<<(time2-time1)<<"\n"; + if (mpi_rank == 0) { + __asm volatile ("rdtsc" : "=A"(t2)); + time2=MPI_Wtime(); + cout<<"number of cycles: \t"<<(t2-t1)<<"\n"; + cout<<"time: \t"<<(time2-time1)<<"\n"; + } + } void Simulation::do_statusUpdate() {