Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooFit::Evaluator Class Reference

Definition at line 40 of file Evaluator.h.

Public Member Functions

 Evaluator (const RooAbsReal &absReal, bool useGPU=false)
 Construct a new Evaluator.
 
 ~Evaluator ()
 
RooArgSet getParameters () const
 Gets all the parameters of the RooAbsReal.
 
void print (std::ostream &os) const
 
std::span< const doublerun ()
 Returns the value of the top node in the computation graph.
 
void setInput (std::string const &name, std::span< const double > inputArray, bool isOnDevice)
 

Private Member Functions

void assignToGPU (NodeInfo &info)
 Assign a node to be computed in the GPU.
 
void computeCPUNode (const RooAbsArg *node, NodeInfo &info)
 
std::span< const doublegetValHeterogeneous ()
 Returns the value of the top node in the computation graph.
 
void markGPUNodes ()
 Decides which nodes are assigned to the GPU in a CUDA fit.
 
void processVariable (NodeInfo &nodeInfo)
 Process a variable in the computation graph.
 
void setClientsDirty (NodeInfo &nodeInfo)
 Flags all the clients of a given node dirty.
 
void setOperMode (RooAbsArg *arg, RooAbsArg::OperMode opMode)
 Temporarily change the operation mode of a RooAbsArg until the Evaluator gets deleted.
 
void syncDataTokens ()
 If there are servers with the same name that got de-duplicated in the _nodes list, we need to set their data tokens too.
 
void updateOutputSizes ()
 

Private Attributes

std::unique_ptr< Detail::BufferManager_bufferManager
 
std::stack< std::unique_ptr< ChangeOperModeRAII > > _changeOperModeRAIIs
 
RooFit::Detail::DataMap _dataMapCPU
 
RooFit::Detail::DataMap _dataMapCUDA
 
bool _needToUpdateOutputSizes = false
 
int _nEvaluations = 0
 
std::vector< NodeInfo_nodes
 
RooAbsReal_topNode
 
const bool _useGPU = false
 

#include <RooFit/Evaluator.h>

Constructor & Destructor Documentation

◆ Evaluator()

Evaluator::Evaluator ( const RooAbsReal absReal,
bool  useGPU = false 
)

Construct a new Evaluator.

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.

Parameters
[in]absRealThe RooAbsReal object that sits on top of the computation graph that we want to evaluate.
[in]useGPUWhether the evaluation should be preferably done on the GPU.

Definition at line 153 of file Evaluator.cxx.

◆ ~Evaluator()

Evaluator::~Evaluator ( )

Definition at line 345 of file Evaluator.cxx.

Member Function Documentation

◆ assignToGPU()

void Evaluator::assignToGPU ( NodeInfo info)
private

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 540 of file Evaluator.cxx.

◆ computeCPUNode()

void Evaluator::computeCPUNode ( const RooAbsArg node,
NodeInfo info 
)
private

Definition at line 352 of file Evaluator.cxx.

◆ getParameters()

RooArgSet Evaluator::getParameters ( ) const

Gets all the parameters of the RooAbsReal.

This is in principle not necessary, because we can always ask the RooAbsReal itself, but the Evaluator has the cached information to get the answer quicker. Therefore, this is not meant to be used in general, just where it matters.

Warning
If we find another solution to get the parameters efficiently, this function might be removed without notice.

Definition at line 665 of file Evaluator.cxx.

◆ getValHeterogeneous()

std::span< const double > Evaluator::getValHeterogeneous ( )
private

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

Definition at line 459 of file Evaluator.cxx.

◆ markGPUNodes()

void Evaluator::markGPUNodes ( )
private

Decides which nodes are assigned to the GPU in a CUDA fit.

Definition at line 576 of file Evaluator.cxx.

◆ print()

void Evaluator::print ( std::ostream &  os) const

Definition at line 603 of file Evaluator.cxx.

◆ processVariable()

void Evaluator::processVariable ( NodeInfo nodeInfo)
private

Process a variable in the computation graph.

This is a separate non-inlined function such that we can see in performance profiles how long this takes.

Definition at line 403 of file Evaluator.cxx.

◆ run()

std::span< const double > Evaluator::run ( )

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

Definition at line 427 of file Evaluator.cxx.

◆ setClientsDirty()

void Evaluator::setClientsDirty ( NodeInfo nodeInfo)
private

Flags all the clients of a given node dirty.

This is a separate non-inlined function such that we can see in performance profiles how long this takes.

Definition at line 419 of file Evaluator.cxx.

◆ setInput()

void Evaluator::setInput ( std::string const &  name,
std::span< const double inputArray,
bool  isOnDevice 
)

Definition at line 246 of file Evaluator.cxx.

◆ setOperMode()

void Evaluator::setOperMode ( RooAbsArg arg,
RooAbsArg::OperMode  opMode 
)
private

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

Definition at line 596 of file Evaluator.cxx.

◆ syncDataTokens()

void Evaluator::syncDataTokens ( )
private

If there are servers with the same name that got de-duplicated in the _nodes list, we need to set their data tokens too.

We find such nodes by visiting the servers of every known node.

Definition at line 230 of file Evaluator.cxx.

◆ updateOutputSizes()

void Evaluator::updateOutputSizes ( )
private

Definition at line 304 of file Evaluator.cxx.

Member Data Documentation

◆ _bufferManager

std::unique_ptr<Detail::BufferManager> RooFit::Evaluator::_bufferManager
private

Definition at line 61 of file Evaluator.h.

◆ _changeOperModeRAIIs

std::stack<std::unique_ptr<ChangeOperModeRAII> > RooFit::Evaluator::_changeOperModeRAIIs
private

Definition at line 69 of file Evaluator.h.

◆ _dataMapCPU

RooFit::Detail::DataMap RooFit::Evaluator::_dataMapCPU
private

Definition at line 66 of file Evaluator.h.

◆ _dataMapCUDA

RooFit::Detail::DataMap RooFit::Evaluator::_dataMapCUDA
private

Definition at line 67 of file Evaluator.h.

◆ _needToUpdateOutputSizes

bool RooFit::Evaluator::_needToUpdateOutputSizes = false
private

Definition at line 65 of file Evaluator.h.

◆ _nEvaluations

int RooFit::Evaluator::_nEvaluations = 0
private

Definition at line 64 of file Evaluator.h.

◆ _nodes

std::vector<NodeInfo> RooFit::Evaluator::_nodes
private

Definition at line 68 of file Evaluator.h.

◆ _topNode

RooAbsReal& RooFit::Evaluator::_topNode
private

Definition at line 62 of file Evaluator.h.

◆ _useGPU

const bool RooFit::Evaluator::_useGPU = false
private

Definition at line 63 of file Evaluator.h.

Libraries for RooFit::Evaluator:

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