Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
Config.cxx
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 * Authors:
4 * PB, Patrick Bos, Netherlands eScience Center, p.bos@esciencecenter.nl
5 *
6 * Copyright (c) 2021, CERN
7 *
8 * Redistribution and use in source and binary forms,
9 * with or without modification, are permitted according to the terms
10 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
11 */
12
15
16#include <thread> // std::thread::hardware_concurrency()
17#include <cstdio>
18
19namespace RooFit {
20namespace MultiProcess {
21
22/** \class Config
23 *
24 * \brief Configuration for MultiProcess infrastructure
25 *
26 * This class offers user-accessible configuration of the MultiProcess infrastructure.
27 * Since the rest of the MultiProcess classes are only accessible at compile time, a
28 * separate class is needed to set configuration. Currently, the only configurable
29 * part is the number of workers to be deployed.
30 *
31 * The default number of workers is set using 'std::thread::hardware_concurrency()'.
32 * To change it, use 'Config::setDefaultNWorkers()' to set it to a different value
33 * before creation of a new JobManager instance. Note that it cannot be set to zero
34 * and also cannot be changed after JobManager has been instantiated.
35 *
36 * Use Config::getDefaultNWorkers() to access the current value.
37 */
38
39void Config::setDefaultNWorkers(unsigned int N_workers)
40{
42 printf("Warning: Config::setDefaultNWorkers cannot set number of workers after JobManager has been instantiated!\n");
43 } else if (N_workers == 0) {
44 printf("Warning: Config::setDefaultNWorkers cannot set number of workers to zero.\n");
45 } else {
46 defaultNWorkers_ = N_workers;
47 }
48}
49
51{
52 return defaultNWorkers_;
53}
54
55// initialize static member
56unsigned int Config::defaultNWorkers_ = std::thread::hardware_concurrency();
57
58} // namespace MultiProcess
59} // namespace RooFit
static void setDefaultNWorkers(unsigned int N_workers)
Definition Config.cxx:39
static unsigned int defaultNWorkers_
Definition Config.h:24
static unsigned int getDefaultNWorkers()
Definition Config.cxx:50
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition Common.h:18