AmpTools
LikelihoodCalculatorMPI Class Reference

#include <LikelihoodCalculatorMPI.h>

Inheritance diagram for LikelihoodCalculatorMPI:
Collaboration diagram for LikelihoodCalculatorMPI:

Public Types

enum  { kFirstId = MPITag::kMaxTags }
 

Public Member Functions

 LikelihoodCalculatorMPI (const IntensityManager &intenManager, const NormIntInterface &normInt, DataReader *dataReaderSignal, DataReader *dataReaderBkgnd, ParameterManagerMPI &parManager)
 
 ~LikelihoodCalculatorMPI ()
 
double operator() ()
 
- Public Member Functions inherited from LikelihoodCalculator
 LikelihoodCalculator (const IntensityManager &intenManager, const NormIntInterface &normInt, DataReader *dataReaderSignal, DataReader *dataReaderBkgnd, const ParameterManager &parManager)
 
virtual ~LikelihoodCalculator ()
 
string reactionName () const
 
- Public Member Functions inherited from MIFunctionContribution
 MIFunctionContribution (MinuitMinimizationManager *)
 
virtual ~MIFunctionContribution ()
 
virtual double derivative (const MinuitParameter &par)
 
virtual void update (const MISubject *)
 
virtual double contribution ()
 
void stopContributing ()
 
void restartContributing ()
 
bool contributing () const
 
- Public Member Functions inherited from MIObserver
 MIObserver ()
 
virtual ~MIObserver ()
 

Friends

class LikelihoodManagerMPI
 

Additional Inherited Members

- Static Public Attributes inherited from MIFunctionContribution
static const double kUnknownDerivative = -54321
 
- Protected Member Functions inherited from LikelihoodCalculator
double dataTerm ()
 
double normIntTerm ()
 
double sumBkgWeights () const
 
double numBkgEvents () const
 
double numDataEvents () const
 
void setSumBkgWeights (double sum)
 
void setNumBkgEvents (double num)
 
void setNumDataEvents (double num)
 

Detailed Description

This class is implements the parallel likelihood calculation in the MPI enviornment. The general idea is that MPI communications are confined to this class, which utilizes the base class for doing the actual computation. This avoids replication of likelihood computation in this class and confines MPI impliementation to just the methods in this class.

Definition at line 57 of file LikelihoodCalculatorMPI.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

This enum allows multiple instances of the likelihoodCalculatorMPI to synchronize themselves across many processes. One instance of the likelihoodCalculatorMPI is created for every reaction in the fit. The code uses the MPI tags to send commands (via LikelihoodManagerMPI) to each instance. Therefore the instance numbering starts with the first tag available after the commands listed in MPITags.

Enumerator
kFirstId 

Definition at line 73 of file LikelihoodCalculatorMPI.h.

Constructor & Destructor Documentation

◆ LikelihoodCalculatorMPI()

LikelihoodCalculatorMPI::LikelihoodCalculatorMPI ( const IntensityManager intenManager,
const NormIntInterface normInt,
DataReader dataReaderSignal,
DataReader dataReaderBkgnd,
ParameterManagerMPI parManager 
)

This is the constructor. On all nodes setupMPI() is called first to define the rank and number of processes. On the woker nodes, each instance of LikelihoodCalulatorMPI registers itself with the LikelihoodManagerMPI. Each instance on the worker nodes has a unique ID which is derived from the cuerrent value of the static member data m_idCounter.

Arguments to this constructor are similar to those for LikelihoodCalculator. This helps to maintain a familar interface for the user.

Parameters
[in]ampManagerA reference to the amplitude manager that this likelihood calculator should use for amplitude calculations
[in]normIntA reference to the appropriate normalization integral interface
[in]dataReaderA reference to the DataReader that will supply the data
[in]parManagerA reference to the ParameterManagerMPI instance that has been created to manage parameters on the node.
See also
LikelihoodCalculator
LikelihoodManagerMPI

Definition at line 44 of file LikelihoodCalculatorMPI.cc.

Here is the call graph for this function:

◆ ~LikelihoodCalculatorMPI()

LikelihoodCalculatorMPI::~LikelihoodCalculatorMPI ( )

This is the destructor. When the instance of LikelihoodCalculatorMPI is destroyed on the master node, it sends the exit flag (via the LikelihoodManagerMPI) to the corresponding LikelihoodCalculatorMPI that exists on the worker nodes.

Definition at line 83 of file LikelihoodCalculatorMPI.cc.

Member Function Documentation

◆ operator()()

double LikelihoodCalculatorMPI::operator() ( )
virtual

The following operator should only ever be called on the master. It overrides the operator()() that is called from MIFunctionContribution class. Using the LikelihoodManagerMPI, it directs all of the workers to compute and then send partial contributions of the sum of log intensities. The routine on the master collects and sums the contributions from the workers. It then, if necessary, triggers an update of the normalization integral calculculation on the workers. Finally it provides the new -2 ln( likelihood ) for the fit.

Reimplemented from LikelihoodCalculator.

Definition at line 105 of file LikelihoodCalculatorMPI.cc.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ LikelihoodManagerMPI

friend class LikelihoodManagerMPI
friend

Definition at line 60 of file LikelihoodCalculatorMPI.h.


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