Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 * *
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#include <atomic>
40#include "Rtypes.h"
41#include "TString.h"
42
43#include "Executor.h"
44
45namespace TMVA {
46
47 class MsgLogger;
48
49 class Config {
50 protected:
51
52 Executor fExecutor; // Executor for multi-thread or serial execution
53
54 public:
55
56 static Config& Instance();
57 static void DestroyInstance();
58
61
62 Bool_t IsSilent() const { return fSilent; }
63 void SetSilent( Bool_t s ) { fSilent = s; }
64
67
71
72 UInt_t GetNumWorkers() const { return fNWorkers; }
74
75#ifdef R__USE_IMT
77// ROOT::TSequentialExecutor &GetSeqExecutor() { return *fSeqfPool; }
78#endif
79 /// Get executor class for multi-thread usage
80 /// In case when MT is not enabled will return a serial executor
82
83 /// Enable MT in TMVA (by default is on when ROOT::EnableImplicitMT() is set
84 void EnableMT(int numthreads = 0) { fExecutor = Executor(numthreads); }
85
86 /// Force disabling MT running and release the thread pool by using instead seriaql execution
87 void DisableMT() { fExecutor = Executor(1); }
88
89 ///Check if IMT is enabled
90 Bool_t IsMTEnabled() const { return fExecutor.GetPoolSize() > 1; }
91
92 public:
93
94 class VariablePlotting;
95 class IONames;
96
99
100 // publicly accessible global settings
102 // data collection class to configure plotting of variables
103 public:
104
112 Bool_t fUsePaperStyle; // set to get eps output
113 enum { kPNG = 0, kGIF = 1, kPDF = 2, kEPS = 3 };
114 Int_t fPlotFormat; // (0: png , 1: gif, 2: pdf, 3: eps)
115
116 } fVariablePlotting; // Customisable plotting properties
117
118 // for file names and similar
119 class IONames {
120
121 public:
122 // this is name of weight file directory
127 } fIONames; // Customisable weight file properties
128
129
130 private:
131
132 // private constructor
133 Config();
134 Config( const Config& );
136 virtual ~Config();
137 static std::atomic<Config*> fgConfigPtr;
138 private:
139
140 std::atomic<Bool_t> fDrawProgressBar; ///< draw progress bar to indicate training evolution
141 std::atomic<UInt_t> fNWorkers; ///< Default number of workers for multi-process jobs
142 std::atomic<Bool_t> fUseColoredConsole; ///< coloured standard output
143 std::atomic<Bool_t> fSilent; ///< no output at all
144 std::atomic<Bool_t> fWriteOptionsReference; ///< if set true: Configurable objects write file with option reference
145 mutable MsgLogger* fLogger; ///<! message logger
146 MsgLogger& Log() const { return *fLogger; }
147
148 ClassDef(Config,0); // Singleton class for global configuration settings
149 };
150
151 // global accessor
153}
154
155#endif
#define d(i)
Definition RSha256.hxx:102
float Float_t
Definition RtypesCore.h:57
#define ClassDef(name, id)
Definition Rtypes.h:342
This class provides a simple interface to execute the same task multiple times in parallel threads,...
TString fWeightFileDir
Definition Config.h:124
TString fOptionsReferenceFileDir
Definition Config.h:126
TString fWeightFileDirPrefix
Definition Config.h:123
TString fWeightFileExtension
Definition Config.h:125
Int_t fMaxNumOfAllowedVariablesForScatterPlots
Definition Config.h:109
Singleton class for global configuration settings used by TMVA.
Definition Config.h:49
void SetDrawProgressBar(Bool_t d)
Definition Config.h:69
Bool_t WriteOptionsReference() const
Definition Config.h:65
class TMVA::Config::IONames fIONames
ROOT::TThreadExecutor & GetMultiThreadExecutor()
Definition Config.h:76
Executor & GetThreadExecutor()
Get executor class for multi-thread usage In case when MT is not enabled will return a serial executo...
Definition Config.h:81
void SetWriteOptionsReference(Bool_t w)
Definition Config.h:66
std::atomic< Bool_t > fDrawProgressBar
draw progress bar to indicate training evolution
Definition Config.h:140
Bool_t IsMTEnabled() const
Check if IMT is enabled.
Definition Config.h:90
void SetNumWorkers(UInt_t n)
Definition Config.h:73
void SetUseColor(Bool_t uc)
Definition Config.h:60
UInt_t GetNCpu()
Definition Config.h:70
void EnableMT(int numthreads=0)
Enable MT in TMVA (by default is on when ROOT::EnableImplicitMT() is set.
Definition Config.h:84
std::atomic< Bool_t > fUseColoredConsole
coloured standard output
Definition Config.h:142
static std::atomic< Config * > fgConfigPtr
Definition Config.h:137
MsgLogger & Log() const
Definition Config.h:146
Config & operator=(const Config &)
static void DestroyInstance()
static function: destroy TMVA instance
Definition Config.cxx:90
std::atomic< UInt_t > fNWorkers
Default number of workers for multi-process jobs.
Definition Config.h:141
Config(const Config &)
virtual ~Config()
destructor
Definition Config.cxx:82
UInt_t GetNumWorkers() const
Definition Config.h:72
std::atomic< Bool_t > fSilent
no output at all
Definition Config.h:143
Bool_t DrawProgressBar() const
Definition Config.h:68
static Config & Instance()
static function: returns TMVA instance
Definition Config.cxx:98
Config()
constructor - set defaults
Definition Config.cxx:51
Bool_t UseColor() const
Definition Config.h:59
MsgLogger * fLogger
! message logger
Definition Config.h:145
void DisableMT()
Force disabling MT running and release the thread pool by using instead seriaql execution.
Definition Config.h:87
Executor fExecutor
Definition Config.h:52
Bool_t IsSilent() const
Definition Config.h:62
VariablePlotting & GetVariablePlotting()
Definition Config.h:97
std::atomic< Bool_t > fWriteOptionsReference
if set true: Configurable objects write file with option reference
Definition Config.h:144
class TMVA::Config::VariablePlotting fVariablePlotting
void SetSilent(Bool_t s)
Definition Config.h:63
IONames & GetIONames()
Definition Config.h:98
Base Executor class.
Definition Executor.h:36
unsigned int GetPoolSize() const
Definition Executor.h:106
ROOT::TThreadExecutor * GetMultiThreadExecutor()
Definition Executor.h:96
ostringstream derivative to redirect and format output
Definition MsgLogger.h:57
Basic string class.
Definition TString.h:139
const Int_t n
Definition legend1.C:16
create variable transformations
Config & gConfig()