Commit ad070ed926c5cfc8babc86b543cf377a0012498f
Committed by
Jürgen Knödlseder
1 parent
24e385a1
Add 'nthreads' parameter to ctfindvar (#2713)
Showing
3 changed files
with
11 additions
and
0 deletions
doc/source/users/reference_manual/ctfindvar.rst
| ... | ... | @@ -108,6 +108,9 @@ Spatial binning parameters |
| 108 | 108 | Standard parameters |
| 109 | 109 | ------------------- |
| 110 | 110 | |
| 111 | +``(nthreads = 0) [integer]`` | |
| 112 | + Number of parallel processes (0=use all available CPUs). | |
| 113 | + | |
| 111 | 114 | ``(chatter = 2) [integer]`` |
| 112 | 115 | Verbosity of the executable: |
| 113 | 116 | ``chatter = 0``: no information will be logged | ... | ... |
src/ctfindvar/ctfindvar.cpp
| ... | ... | @@ -610,6 +610,13 @@ void ctfindvar::free_members(void) |
| 610 | 610 | ***************************************************************************/ |
| 611 | 611 | void ctfindvar::get_parameters(void) |
| 612 | 612 | { |
| 613 | + #ifdef _OPENMP | |
| 614 | + int nthreads = (*this)["nthreads"].integer(); | |
| 615 | + if (nthreads > 0) { | |
| 616 | + omp_set_num_threads(nthreads); | |
| 617 | + } | |
| 618 | + #endif | |
| 619 | + | |
| 613 | 620 | // Load the observations |
| 614 | 621 | setup_observations(m_obs, false, true, false); |
| 615 | 622 | ... | ... |
src/ctfindvar/ctfindvar.par
| ... | ... | @@ -50,6 +50,7 @@ ysrc, r, a, 22.51,-90,90, "Second coordinate of the source of interest (DEC |
| 50 | 50 | # |
| 51 | 51 | # Standard parameters |
| 52 | 52 | #==================== |
| 53 | +nthreads, i, h, 0,0,1000, "Number of parallel processes (0=use all available CPUs)" | |
| 53 | 54 | chatter, i, h, 2,0,4, "Chattiness of output" |
| 54 | 55 | clobber, b, h, yes,,, "Overwrite existing output files with new output files?" |
| 55 | 56 | debug, b, h, no,,, "Activate debugging mode?" | ... | ... |