From ad070ed926c5cfc8babc86b543cf377a0012498f Mon Sep 17 00:00:00 2001 From: Josh Cardenzana Date: Wed, 7 Nov 2018 17:30:58 +0100 Subject: [PATCH] Add 'nthreads' parameter to ctfindvar (#2713) --- doc/source/users/reference_manual/ctfindvar.rst | 3 +++ src/ctfindvar/ctfindvar.cpp | 7 +++++++ src/ctfindvar/ctfindvar.par | 1 + 3 files changed, 11 insertions(+), 0 deletions(-) diff --git a/doc/source/users/reference_manual/ctfindvar.rst b/doc/source/users/reference_manual/ctfindvar.rst index 86bfc32..49a1c38 100644 --- a/doc/source/users/reference_manual/ctfindvar.rst +++ b/doc/source/users/reference_manual/ctfindvar.rst @@ -108,6 +108,9 @@ Spatial binning parameters Standard parameters ------------------- +``(nthreads = 0) [integer]`` + Number of parallel processes (0=use all available CPUs). + ``(chatter = 2) [integer]`` Verbosity of the executable: ``chatter = 0``: no information will be logged diff --git a/src/ctfindvar/ctfindvar.cpp b/src/ctfindvar/ctfindvar.cpp index 44906c6..f667662 100644 --- a/src/ctfindvar/ctfindvar.cpp +++ b/src/ctfindvar/ctfindvar.cpp @@ -610,6 +610,13 @@ void ctfindvar::free_members(void) ***************************************************************************/ void ctfindvar::get_parameters(void) { + #ifdef _OPENMP + int nthreads = (*this)["nthreads"].integer(); + if (nthreads > 0) { + omp_set_num_threads(nthreads); + } + #endif + // Load the observations setup_observations(m_obs, false, true, false); diff --git a/src/ctfindvar/ctfindvar.par b/src/ctfindvar/ctfindvar.par index 1200ca0..a200270 100644 --- a/src/ctfindvar/ctfindvar.par +++ b/src/ctfindvar/ctfindvar.par @@ -50,6 +50,7 @@ ysrc, r, a, 22.51,-90,90, "Second coordinate of the source of interest (DEC # # Standard parameters #==================== +nthreads, i, h, 0,0,1000, "Number of parallel processes (0=use all available CPUs)" chatter, i, h, 2,0,4, "Chattiness of output" clobber, b, h, yes,,, "Overwrite existing output files with new output files?" debug, b, h, no,,, "Activate debugging mode?" -- libgit2 0.21.4