Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
GradientCalculator.cxx
Go to the documentation of this file.
1#include "Minuit2/MnPrint.h"
3
4namespace ROOT {
5
6namespace Minuit2 {
7
8/**
9 * Enable parallelization of gradient calculation using OpenMP.
10 * This is different from the default parallel mechanism elsewhere (IMT, threads, TBB, ...).
11 * It can only be used to minimise thread-safe functions in Minuit2.
12 * \param doParallel true to enable, false to disable.
13 * \note Enabling this function does not guarantee that the derived gradient calculator class
14 * has implemented a OMP-parallelized version of the code. For example, the numeric Hessian
15 * computation (HessianGradientCalculator) does not make any use of OpenMP, only
16 * Numerical2PGradientCalculator makes use of OMP pragmas at the moment.
17 * \note If OPENMP is not available, i.e. ROOT was built without OpenMP support (minuit2_omp),
18 * and an error is printed if doParallel=true; parallelization is disabled in any case.
19 * \return false if OPENMP is not available and doParallel=true, otherwise it returns true.
20 */
22{
23#ifndef _OPENMP
24 if (doParallel) {
25 MnPrint print("GradientCalculator");
26 print.Error("Minuit 2 was built without OpenMP support! Can't enable OMP-parallel gradients.");
27 fDoParallelOMP = false;
28 return false;
29 } else {
30 fDoParallelOMP = false;
31 return true;
32 }
33#else
35 return true;
36#endif
37}
38
39} // namespace Minuit2
40
41} // namespace ROOT
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
static bool fDoParallelOMP
flag to indicate if parallel OpenMP processing is used
static bool SetParallelOMP(bool doParallel=true)
Enable parallelization of gradient calculation using OpenMP.
void Error(const Ts &... args)
Definition MnPrint.h:117
Namespace for new ROOT classes and functions.