Logo ROOT  
Reference Guide
ROOT::Experimental::RooFitDriver Class Reference

Definition at line 38 of file RooFitDriver.h.

Public Types

using DataSpansMap = std::map< const TNamed *, RooSpan< const double > >

Public Member Functions

 RooFitDriver (const RooAbsReal &absReal, RooArgSet const &normSet, RooFit::BatchModeOption batchMode=RooFit::BatchModeOption::Cpu)
 Construct a new RooFitDriver. More...
 ~RooFitDriver ()
double getVal ()
 Returns the value of the top node in the computation graph. More...
std::vector< doublegetValues ()
void setData (DataSpansMap const &dataSpans)
void setData (RooAbsData const &data, std::string_view rangeName="", RooAbsCategory const *indexCatForSplitting=nullptr)
RooAbsReal const & topNode () const

Private Member Functions

void assignToGPU (const RooAbsArg *node)
 Assign a node to be computed in the GPU. More...
void computeCPUNode (const RooAbsArg *node, NodeInfo &info)
void determineOutputSizes ()
double getValHeterogeneous ()
 Returns the value of the top node in the computation graph. More...
bool isInComputationGraph (RooAbsArg const *arg) const
void markGPUNodes ()
 Decides which nodes are assigned to the gpu in a cuda fit. More...
void setOperMode (RooAbsArg *arg, RooAbsArg::OperMode opMode)
 Temporarily change the operation mode of a RooAbsArg until the RooFitDriver gets deleted. More...
std::chrono::microseconds simulateFit (std::chrono::microseconds h2dTime, std::chrono::microseconds d2hTime, std::chrono::microseconds diffThreshold)
 This methods simulates the computation of the whole graph and the time it takes and decides what to compute in gpu. More...

Private Attributes

const RooFit::BatchModeOption _batchMode = RooFit::BatchModeOption::Off
std::stack< RooHelpers::ChangeOperModeRAII_changeOperModeRAIIs
double_cudaMemDataset = nullptr
RooBatchCompute::DataMap _dataMapCPU
RooBatchCompute::DataMap _dataMapCUDA
int _getValInvocations = 0
std::unique_ptr< RooFit::NormalizationIntegralUnfolder_integralUnfolder
std::map< RooBatchCompute::DataKey, NodeInfo_nodeInfos
std::vector< double_nonDerivedValues
RooArgList _orderedNodes
std::stack< std::vector< double > > _vectorBuffers

#include </home/sftnight/build/workspace/root-makedoc-master/rootspi/rdoc/src/master/roofit/roofitcore/res/RooFitDriver.h>

Member Typedef Documentation

◆ DataSpansMap

Definition at line 43 of file RooFitDriver.h.

Constructor & Destructor Documentation

◆ RooFitDriver()

RooFitDriver::RooFitDriver ( const RooAbsReal absReal,
RooArgSet const &  normSet,
RooFit::BatchModeOption  batchMode = RooFit::BatchModeOption::Cpu 

Construct a new RooFitDriver.

The constructor analyzes and saves metadata about the graph, useful for the evaluation of it that will be done later. In case the CUDA mode is selected, there's also some CUDA-related initialization.

[in]absRealThe RooAbsReal object that sits on top of the computation graph that we want to evaluate.
[in]normSetNormalization set for the evaluation
[in]batchModeThe computation mode, accepted values are RooBatchCompute::Cpu and RooBatchCompute::Cuda.

Definition at line 112 of file RooFitDriver.cxx.

◆ ~RooFitDriver()

RooFitDriver::~RooFitDriver ( )

Definition at line 234 of file RooFitDriver.cxx.

Member Function Documentation

◆ assignToGPU()

void RooFitDriver::assignToGPU ( const RooAbsArg node)

Assign a node to be computed in the GPU.

Scan it's clients and also assign them in case they only depend on gpu nodes.

Definition at line 414 of file RooFitDriver.cxx.

◆ computeCPUNode()

void RooFitDriver::computeCPUNode ( const RooAbsArg node,
NodeInfo info 

Definition at line 262 of file RooFitDriver.cxx.

◆ determineOutputSizes()

void RooFitDriver::determineOutputSizes ( )

Definition at line 645 of file RooFitDriver.cxx.

◆ getVal()

double RooFitDriver::getVal ( )

Returns the value of the top node in the computation graph.

Definition at line 303 of file RooFitDriver.cxx.

◆ getValHeterogeneous()

double RooFitDriver::getValHeterogeneous ( )

Returns the value of the top node in the computation graph.

Definition at line 326 of file RooFitDriver.cxx.

◆ getValues()

std::vector< double > RooFitDriver::getValues ( )

Definition at line 241 of file RooFitDriver.cxx.

◆ isInComputationGraph()

bool RooFitDriver::isInComputationGraph ( RooAbsArg const *  arg) const

Definition at line 659 of file RooFitDriver.cxx.

◆ markGPUNodes()

void RooFitDriver::markGPUNodes ( )

Decides which nodes are assigned to the gpu in a cuda fit.

In the 1st iteration, everything is computed in cpu for measuring the cpu time. In the 2nd iteration, everything is computed in gpu (if possible) to measure the gpu time. In the 3rd iteration, simulate the computation of the graph by calling simulateFit with every distinct threshold found as timeDiff within the nodes of the graph and select the best configuration. In the end, mark the nodes and handle the details accordingly.

Definition at line 563 of file RooFitDriver.cxx.

◆ setData() [1/2]

void RooFitDriver::setData ( DataSpansMap const &  dataSpans)

Definition at line 175 of file RooFitDriver.cxx.

◆ setData() [2/2]

void RooFitDriver::setData ( RooAbsData const &  data,
std::string_view  rangeName = "",
RooAbsCategory const *  indexCatForSplitting = nullptr 

Definition at line 169 of file RooFitDriver.cxx.

◆ setOperMode()

void RooFitDriver::setOperMode ( RooAbsArg arg,
RooAbsArg::OperMode  opMode 

Temporarily change the operation mode of a RooAbsArg until the RooFitDriver gets deleted.

Definition at line 667 of file RooFitDriver.cxx.

◆ simulateFit()

std::chrono::microseconds RooFitDriver::simulateFit ( std::chrono::microseconds  h2dTime,
std::chrono::microseconds  d2hTime,
std::chrono::microseconds  diffThreshold 

This methods simulates the computation of the whole graph and the time it takes and decides what to compute in gpu.

The decision is made on the basis of avoiding leaving either the gpu or the cpu idle at any time, if possible, and on assigning to each piece of hardware a computation that is significantly slower on the other part. The nodes may be assigned to the non-efficient side (cpu or gpu) to prevent idleness only if the absolute difference cpuTime-cudaTime does not exceed the diffThreshold.

Definition at line 458 of file RooFitDriver.cxx.

◆ topNode()

RooAbsReal const & RooFitDriver::topNode ( ) const

Definition at line 674 of file RooFitDriver.cxx.

Member Data Documentation

◆ _batchMode

const RooFit::BatchModeOption ROOT::Experimental::RooFitDriver::_batchMode = RooFit::BatchModeOption::Off

Definition at line 77 of file RooFitDriver.h.

◆ _changeOperModeRAIIs

std::stack<RooHelpers::ChangeOperModeRAII> ROOT::Experimental::RooFitDriver::_changeOperModeRAIIs

Definition at line 95 of file RooFitDriver.h.

◆ _cudaMemDataset

double* ROOT::Experimental::RooFitDriver::_cudaMemDataset = nullptr

Definition at line 79 of file RooFitDriver.h.

◆ _dataMapCPU

RooBatchCompute::DataMap ROOT::Experimental::RooFitDriver::_dataMapCPU

Definition at line 82 of file RooFitDriver.h.

◆ _dataMapCUDA

RooBatchCompute::DataMap ROOT::Experimental::RooFitDriver::_dataMapCUDA

Definition at line 83 of file RooFitDriver.h.

◆ _getValInvocations

int ROOT::Experimental::RooFitDriver::_getValInvocations = 0

Definition at line 78 of file RooFitDriver.h.

◆ _integralUnfolder

std::unique_ptr<RooFit::NormalizationIntegralUnfolder> ROOT::Experimental::RooFitDriver::_integralUnfolder

Definition at line 92 of file RooFitDriver.h.

◆ _nodeInfos

std::map<RooBatchCompute::DataKey, NodeInfo> ROOT::Experimental::RooFitDriver::_nodeInfos

Definition at line 84 of file RooFitDriver.h.

◆ _nonDerivedValues

std::vector<double> ROOT::Experimental::RooFitDriver::_nonDerivedValues

Definition at line 90 of file RooFitDriver.h.

◆ _orderedNodes

RooArgList ROOT::Experimental::RooFitDriver::_orderedNodes

Definition at line 87 of file RooFitDriver.h.

◆ _vectorBuffers

std::stack<std::vector<double> > ROOT::Experimental::RooFitDriver::_vectorBuffers

Definition at line 91 of file RooFitDriver.h.

The documentation for this class was generated from the following files: