Logo ROOT   6.18/05
Reference Guide
Config.h
Go to the documentation of this file.
1// @(#)root/tmva $Id$
2// Author: Andreas Hoecker, Joerg Stelzer, Fredrik Tegenfeldt, Helge Voss
3
4/**********************************************************************************
5 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6 * Package: TMVA *
7 * Class : Config *
8 * Web : http://tmva.sourceforge.net *
9 * *
10 * Description: *
11 * GLobal configuration settings (singleton) *
12 * *
13 * Authors (alphabetical): *
14 * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
15 * Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland *
16 * Fredrik Tegenfeldt <Fredrik.Tegenfeldt@cern.ch> - Iowa State U., USA *
17 * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, GER *
18 * *
19 * Copyright (c) 2006: *
20 * CERN, Switzerland *
21 * Iowa State U., USA *
22 * MPI-K Heidelberg, Germany *
23 * *
24 * Redistribution and use in source and binary forms, with or without *
25 * modification, are permitted according to the terms listed in LICENSE *
26 * (http://mva.sourceforge.net/license.txt) *
27 **********************************************************************************/
28
29#ifndef ROOT_TMVA_Config
30#define ROOT_TMVA_Config
31
32//////////////////////////////////////////////////////////////////////////
33// //
34// Config //
35// //
36// Singleton class for global configuration settings used by TMVA //
37// //
38//////////////////////////////////////////////////////////////////////////
39#if __cplusplus > 199711L
40#include <atomic>
41#endif
42#include "Rtypes.h"
43#include "TString.h"
44
45#include "Executor.h"
46
47namespace TMVA {
48
49 class MsgLogger;
50
51 class Config {
52 protected:
53
54 Executor fExecutor; // Executor for multi-thread or serial execution
55
56 public:
57
58 static Config& Instance();
59 static void DestroyInstance();
60
63
64 Bool_t IsSilent() const { return fSilent; }
65 void SetSilent( Bool_t s ) { fSilent = s; }
66
69
73
74 UInt_t GetNumWorkers() const { return fNWorkers; }
76
77#ifdef R__USE_IMT
79// ROOT::TSequentialExecutor &GetSeqExecutor() { return *fSeqfPool; }
80#endif
81 /// Get executor class for multi-thread usage
82 /// In case when MT is not enabled will return a serial executor
84
85 /// Enable MT in TMVA (by default is on when ROOT::EnableImplicitMT() is set
86 void EnableMT(int numthreads = 0) { fExecutor = Executor(numthreads); }
87
88 /// Force disabling MT running and release the thread pool by using instead seriaql execution
89 void DisableMT() { fExecutor = Executor(1); }
90
91 ///Check if IMT is enabled
92 Bool_t IsMTEnabled() const { return fExecutor.GetPoolSize() > 1; }
93
94 public:
95
96 class VariablePlotting;
97 class IONames;
98
101
102 // publicly accessible global settings
104 // data collection class to configure plotting of variables
105 public:
106
114
115 } fVariablePlotting; // Customisable plotting properties
116
117 // for file names and similar
118 class IONames {
119
120 public:
121
125 } fIONames; // Customisable weight file properties
126
127
128 private:
129
130 // private constructor
131 Config();
132 Config( const Config& );
134 virtual ~Config();
135#if __cplusplus > 199711L
136 static std::atomic<Config*> fgConfigPtr;
137#else
139#endif
140 private:
141
142#if __cplusplus > 199711L
143 std::atomic<Bool_t> fDrawProgressBar; // draw progress bar to indicate training evolution
144 std::atomic<UInt_t> fNWorkers; // Default number of workers for multi-process jobs
145 std::atomic<Bool_t> fUseColoredConsole; // coloured standard output
146 std::atomic<Bool_t> fSilent; // no output at all
147 std::atomic<Bool_t> fWriteOptionsReference; // if set true: Configurable objects write file with option reference
148#else
149 Bool_t fDrawProgressBar; // draw progress bar to indicate training evolution
150 UInt_t fNWorkers; // Default number of workers for multi-process jobs
151 Bool_t fUseColoredConsole; // coloured standard output
152 Bool_t fSilent; // no output at all
153 Bool_t fWriteOptionsReference; // if set true: Configurable objects write file with option reference
154#endif
155 mutable MsgLogger* fLogger; // message logger
156 MsgLogger& Log() const { return *fLogger; }
157
158 ClassDef(Config,0); // Singleton class for global configuration settings
159 };
160
161 // global accessor
163}
164
165#endif
#define d(i)
Definition: RSha256.hxx:102
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
bool Bool_t
Definition: RtypesCore.h:59
float Float_t
Definition: RtypesCore.h:53
#define ClassDef(name, id)
Definition: Rtypes.h:326
This class provides a simple interface to execute the same task multiple times in parallel,...
TString fWeightFileDir
Definition: Config.h:122
TString fOptionsReferenceFileDir
Definition: Config.h:124
TString fWeightFileExtension
Definition: Config.h:123
Int_t fMaxNumOfAllowedVariablesForScatterPlots
Definition: Config.h:110
Singleton class for global configuration settings used by TMVA.
Definition: Config.h:51
void SetDrawProgressBar(Bool_t d)
Definition: Config.h:71
Bool_t WriteOptionsReference() const
Definition: Config.h:67
UInt_t fNWorkers
Definition: Config.h:150
class TMVA::Config::IONames fIONames
ROOT::TThreadExecutor & GetMultiThreadExecutor()
Definition: Config.h:78
Executor & GetThreadExecutor()
Get executor class for multi-thread usage In case when MT is not enabled will return a serial executo...
Definition: Config.h:83
void SetWriteOptionsReference(Bool_t w)
Definition: Config.h:68
Bool_t IsMTEnabled() const
Check if IMT is enabled.
Definition: Config.h:92
void SetNumWorkers(UInt_t n)
Definition: Config.h:75
void SetUseColor(Bool_t uc)
Definition: Config.h:62
UInt_t GetNCpu()
Definition: Config.h:72
void EnableMT(int numthreads=0)
Enable MT in TMVA (by default is on when ROOT::EnableImplicitMT() is set.
Definition: Config.h:86
static Config * fgConfigPtr
Definition: Config.h:138
MsgLogger & Log() const
Definition: Config.h:156
Config & operator=(const Config &)
static void DestroyInstance()
static function: destroy TMVA instance
Definition: Config.cxx:93
Config(const Config &)
Bool_t fDrawProgressBar
Definition: Config.h:149
virtual ~Config()
destructor
Definition: Config.cxx:85
UInt_t GetNumWorkers() const
Definition: Config.h:74
Bool_t fUseColoredConsole
Definition: Config.h:151
Bool_t DrawProgressBar() const
Definition: Config.h:70
static Config & Instance()
static function: returns TMVA instance
Definition: Config.cxx:105
Config()
constructor - set defaults
Definition: Config.cxx:57
Bool_t UseColor() const
Definition: Config.h:61
MsgLogger * fLogger
Definition: Config.h:155
void DisableMT()
Force disabling MT running and release the thread pool by using instead seriaql execution.
Definition: Config.h:89
Executor fExecutor
Definition: Config.h:54
Bool_t IsSilent() const
Definition: Config.h:64
VariablePlotting & GetVariablePlotting()
Definition: Config.h:99
Bool_t fWriteOptionsReference
Definition: Config.h:153
class TMVA::Config::VariablePlotting fVariablePlotting
void SetSilent(Bool_t s)
Definition: Config.h:65
IONames & GetIONames()
Definition: Config.h:100
Bool_t fSilent
Definition: Config.h:152
Base Excutor class.
Definition: Executor.h:35
unsigned int GetPoolSize() const
Definition: Executor.h:99
ROOT::TThreadExecutor * GetMultiThreadExecutor()
Definition: Executor.h:89
ostringstream derivative to redirect and format output
Definition: MsgLogger.h:59
Basic string class.
Definition: TString.h:131
const Int_t n
Definition: legend1.C:16
static constexpr double s
create variable transformations
Config & gConfig()