From b24dcf3cfc2f3f135eb5939c8acb7a25252fb090 Mon Sep 17 00:00:00 2001 From: Josh Cardenzana Date: Wed, 7 Nov 2018 17:09:50 +0100 Subject: [PATCH] Parallelize ctfindvar with OpenMP (#2713) --- src/ctfindvar/ctfindvar.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/ctfindvar/ctfindvar.cpp b/src/ctfindvar/ctfindvar.cpp index e7b7487..1c2f220 100644 --- a/src/ctfindvar/ctfindvar.cpp +++ b/src/ctfindvar/ctfindvar.cpp @@ -302,7 +302,6 @@ void ctfindvar::run(void) } //preparing the histogram with significance evolution for the source center and the highest sig-pix - GNdarray pixSig(nbins), pixSigMax(nbins); //Storing the significance for each GTI of the pixels m_pixsigsrc = GNdarray(srcInxPix.size(), nbins); m_pixsigmax = GNdarray(1,nbins); @@ -311,8 +310,10 @@ void ctfindvar::run(void) GSkyDir max_sig_dir; //looping over all the pixels in the cube + #pragma omp parallel for for (int pix_number=0; pix_number max_sig) + #pragma omp critical(ctfind_run) { - max_sig = max(pixSig); - // Store information for pixel with the maximum significance - for (int i=0; i max_sig) + { + max_sig = max(pixSig); + // Store information for pixel with the maximum significance + for (int i=0; i