From dec3afe5956c37d2e514bdd1c6345bbecc7b299e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 24 Jan 2023 21:15:37 -0500 Subject: [PATCH] make synchronization for timers optional. only enable with "timer sync" --- src/AMOEBA/amoeba_convolution.cpp | 9 +++++---- src/AMOEBA/amoeba_induce.cpp | 9 +++++---- src/AMOEBA/amoeba_multipole.cpp | 3 ++- src/AMOEBA/amoeba_polar.cpp | 3 ++- src/AMOEBA/pair_amoeba.cpp | 3 ++- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/AMOEBA/amoeba_convolution.cpp b/src/AMOEBA/amoeba_convolution.cpp index 609df1184e..e58bb33b41 100644 --- a/src/AMOEBA/amoeba_convolution.cpp +++ b/src/AMOEBA/amoeba_convolution.cpp @@ -22,6 +22,7 @@ #include "memory.h" #include "neighbor.h" #include "remap_wrap.h" +#include "timer.h" #include #include @@ -328,7 +329,7 @@ FFT_SCALAR *AmoebaConvolution::pre_convolution_3d() double time0,time1; - MPI_Barrier(world); + if (timer->has_sync()) MPI_Barrier(world); time0 = platform::walltime(); // perform forward FFT @@ -393,7 +394,7 @@ FFT_SCALAR *AmoebaConvolution::pre_convolution_4d() double time0,time1; - MPI_Barrier(world); + if (timer->has_sync()) MPI_Barrier(world); time0 = platform::walltime(); // perform forward FFT @@ -443,7 +444,7 @@ void *AmoebaConvolution::post_convolution_3d() double time0,time1; - MPI_Barrier(world); + if (timer->has_sync()) MPI_Barrier(world); time0 = platform::walltime(); fft2->compute(cfft,cfft,FFT3d::BACKWARD); @@ -494,7 +495,7 @@ void *AmoebaConvolution::post_convolution_4d() double time0,time1; - MPI_Barrier(world); + if (timer->has_sync()) MPI_Barrier(world); time0 = platform::walltime(); fft2->compute(cfft,cfft,FFT3d::BACKWARD); diff --git a/src/AMOEBA/amoeba_induce.cpp b/src/AMOEBA/amoeba_induce.cpp index 7ff9fe7121..6ac8148c59 100644 --- a/src/AMOEBA/amoeba_induce.cpp +++ b/src/AMOEBA/amoeba_induce.cpp @@ -24,6 +24,7 @@ #include "math_special.h" #include "my_page.h" #include "neigh_list.h" +#include "timer.h" #include @@ -545,7 +546,7 @@ void PairAmoeba::ufield0c(double **field, double **fieldp) } double time0, time1, time2; - MPI_Barrier(world); + if (timer->has_sync()) MPI_Barrier(world); time0 = platform::walltime(); // get the real space portion of the mutual field @@ -795,7 +796,7 @@ void PairAmoeba::dfield0c(double **field, double **fieldp) // get the reciprocal space part of the permanent field double time0, time1, time2; - MPI_Barrier(world); + if (timer->has_sync()) MPI_Barrier(world); time0 = platform::walltime(); if (polar_kspace_flag) udirect1(field); @@ -870,7 +871,7 @@ void PairAmoeba::umutual1(double **field, double **fieldp) // map 2 values to grid - MPI_Barrier(world); + if (timer->has_sync()) MPI_Barrier(world); time0 = platform::walltime(); grid_uind(fuind,fuinp,gridpre); @@ -915,7 +916,7 @@ void PairAmoeba::umutual1(double **field, double **fieldp) // get potential - MPI_Barrier(world); + if (timer->has_sync()) MPI_Barrier(world); time0 = platform::walltime(); fphi_uind(gridpost,fdip_phi1,fdip_phi2,fdip_sum_phi); diff --git a/src/AMOEBA/amoeba_multipole.cpp b/src/AMOEBA/amoeba_multipole.cpp index f302194193..848e1a13cb 100644 --- a/src/AMOEBA/amoeba_multipole.cpp +++ b/src/AMOEBA/amoeba_multipole.cpp @@ -21,6 +21,7 @@ #include "math_const.h" #include "math_special.h" #include "neigh_list.h" +#include "timer.h" #include @@ -80,7 +81,7 @@ void PairAmoeba::multipole() felec = electric / am_dielectric; - MPI_Barrier(world); + if (timer->has_sync()) MPI_Barrier(world); time0 = platform::walltime(); // compute the real space part of the Ewald summation diff --git a/src/AMOEBA/amoeba_polar.cpp b/src/AMOEBA/amoeba_polar.cpp index e2b85ed22c..e817e706dc 100644 --- a/src/AMOEBA/amoeba_polar.cpp +++ b/src/AMOEBA/amoeba_polar.cpp @@ -21,6 +21,7 @@ #include "math_const.h" #include "math_special.h" #include "neigh_list.h" +#include "timer.h" #include #include @@ -78,7 +79,7 @@ void PairAmoeba::polar() // compute the real space part of the dipole interactions - MPI_Barrier(world); + if (timer->has_sync()) MPI_Barrier(world); time0 = platform::walltime(); if (polar_rspace_flag) polar_real(); diff --git a/src/AMOEBA/pair_amoeba.cpp b/src/AMOEBA/pair_amoeba.cpp index a1b288348a..0812fe43f0 100644 --- a/src/AMOEBA/pair_amoeba.cpp +++ b/src/AMOEBA/pair_amoeba.cpp @@ -29,6 +29,7 @@ #include "my_page.h" #include "neigh_list.h" #include "neighbor.h" +#include "timer.h" #include "update.h" #include @@ -371,7 +372,7 @@ void PairAmoeba::compute(int eflag, int vflag) double time0,time1,time2,time3,time4,time5,time6,time7,time8; - MPI_Barrier(world); + if (timer->has_sync()) MPI_Barrier(world); time0 = platform::walltime(); // if reneighboring step: