BIE::LikelihoodComputation Class Reference

Abstract base class for Likelihood computation. More...

#include <Likelihood.h>

Inheritance diagram for BIE::LikelihoodComputation:
Collaboration diagram for BIE::LikelihoodComputation:

List of all members.

Public Member Functions

virtual ~LikelihoodComputation ()
 create virtual destructor for subclasses
virtual double Likelihood (State &state, int indx)
 Determine liklihood for given state.
 LikelihoodComputation ()
 Constructor.
virtual ~LikelihoodComputation ()
 create virtual destructor for subclasses
virtual double Likelihood (State &, int indx)=0
 Determine liklihood for given state.
virtual double LikelihoodPrevious (State &, int indx)=0
 Determine liklihood for previous state.
virtual void init (Simulation *_simulation)
 Bind the likelihood object to a simulation.
virtual SimulationGetSimulation ()
 Return a pointer to the Simulation instance.
virtual ModelGetModel ()
 Return a pointer to the Model instance.
virtual BaseDataTreeGetBaseDataTree ()
 Return a pointer to the BaseDataTree instance.
virtual IntegrationGetIntegration ()
 Return a pointer to the Integration instance.
virtual LikelihoodFunctionGetLikeProb ()
 Return a pointer to the LikelihoodFunction instance.
virtual void normEvaluateList (Model *model, Tile *tile, const vector< double > &x, const vector< double > &y, SampleDistribution *sampleDistribution, vector< double > &evaluations)=0
 Evaluate the model norm at a list of points.
virtual void modelEvaluateList (Model *model, Tile *tile, const vector< double > &x, const vector< double > &y, SampleDistribution *sampleDistribution, vector< vector< double > > &evaluations)=0
 Evaluate the model value at a list of points.
virtual void Granularity (int mpi_type)
 Deprecated. Specify the kind of parallelism.
void TileCompare ()
 Print out 2-d images of theory, data, and comparison.
void SetTessTool (TessToolSender *ttsender)
 Attach TessToolSender.
void SampleNext ()
 Called by TessTool to generate a new sample of simulation values.
void SampleNext (int sessionid)
 Called by TessTool to generate a new sample of simulation values with sessionId checking.
void SwitchOnCLI ()
 Return control to the CLI.
void SuspendSimulation ()
 Request that the simulation suspend itself.
void ResumeSimulation ()
 Request that the simulation be restarted.
Semaphore * getLikelihoodSem ()
 Get the semaphore instance controlling the likelihood computation.
void setLikelihoodSem (Semaphore *s)
 Set the semaphore instance controlling the likelihood computation.
void setCLISem (Semaphore *s)
 Set the semaphore instance controlling the CLI.
void TessToolSynchronize ()
 synchronize with TessTool
virtual void InitializeTessToolTileDump ()
 Request a TessTool data dump.
virtual void TessToolTileDump (Tile *t, SampleDistribution *sd, vector< double > &z)
 The member function that performs the dump.
virtual void FinalizeTessToolTileDump ()
 Handshake closing up the TessTool Tile dump.
virtual int getNumAndIdsOfTileMasters (int *num, int **idlist)
 For internal use: return the number nodes controlling tile computation.
virtual void BuildTessToolTileDumpBaseStream ()
 Request that the.
virtual RecordOutputStreamGetTessToolTileDumpBaseStream ()
 Get a pointer to the stream.
virtual void SetTessToolTileDumpBaseStream (RecordOutputStream *bstrm)
 Set the TessTool RecordOutputStream.
virtual RecordOutputStreamAttachMPIFilterToTessTool (RecordOutputStream *rostrm)
 The final stream(after attaching required filters) is used to construct MPIFilter.
virtual void UpdateTessTool (RecordType *rt, RecordOutputStream *rostrm, MPIStreamFilter *mpifilter)
 The final record type, record output stream and the mpifilter are saved in tesstool.
virtual void TessToolTileDumpToBaseStream (Tile *t, SampleDistribution *sd, vector< double > &z)
 Call for the data dump.
virtual bool Serial ()=0
 Request serial or parallel evaluation For captive thread likelihood computation, parent thread should not be computing the prior probability.
void startThread ()
 Threading routines.
void stopThread ()
 Stop and join the enslaved worker thread.
virtual void enslave_worker (void *arg)
 Initialize the set of processors for subsequent likelihood calls.
virtual void free_workers ()
 Release the processors locked by enslave_workers.

Protected Member Functions

void thread_fork (int command)
 Make some threads.
void TileDump (Tile *t, SampleDistribution *sd, vector< double > &z)
 Per tile output diagnostic "image".
void SwitchedOnCLI ()
 Handler for TessTool inside LikelihoodComputation to prevent deadlocks.
void ResumedSimulation ()
 Called by the cli thread.
void SuspendedSimulation ()
 Make the cli thread active.
void DetachTessTool ()
 Request that the TessTool detach from the simulation.
int encode_command (int)
 Likelihood handling command packing for sending.
int decode_command (int)
 Likelihood handling command unpacking for handling request.
void setPriorFrontier ()
 Set the BaseDataTree frontier to the one at the previous level.
void setCurrentFrontier ()
 Set the BaseDataTree frontier to the one at the current level.
void StateToBuffer (State &, double *, unsigned int size)
 Take a state, pack into a buffer.
void BufferToState (State &, double *, unsigned int size)
 Unpack a buffer into a state.
virtual bool Slaves ()
 Likelihood computation may be enslaved.

Protected Attributes

thrd_pass_LikeComp td
 Threading stuff.
pthread_t * t
 Thread pointer.
bool threading_on
 Threading state.
int parent_id
 MPI node id for thread.
Semaphore likelihoodMutex
 Semaphore for sycrhonizing Mutex.
bool DEBUG_LIKE
 Turn on tile bin/point diagnostics (default: false).
TessToolSendertesstool
 The TessTool communicator.
RecordOutputStreamrostrm
 Pointer to the TessTool output stream.
int _sessionId
 The session id for this stream.
int _nextSessionId
 The next session id.
Frontierfd_temp
 Temporary frontier pointer.
int requestSynchronization
 Flags used to handle TessTool requests.
int sampleNext
 1 if new sample is requested
int switchCliOn
 1 if CLI switch is requested
int suspendSimulation
 1 if suspend is requested
int resumeSimulation
 1 if resume is requested
int detachTessTool
 1 if detach is requested
bool _builtTTBaseStream
 True if the TessTool output stream has been constructed.

Friends

class boost::serialization::access


Detailed Description

Abstract base class for Likelihood computation.

Compute the likelihood for the model given the data.

This class also supplies a default serial implementation.


Member Function Documentation

virtual double BIE::LikelihoodComputation::Likelihood ( State state,
int  indx 
) [virtual]

Determine liklihood for given state.

usually overriden in derived class.

Parameters:
state is the parameter vector and meta info
indx is the "temperature" level

Reimplemented in BIE::LikelihoodComputationMPI, BIE::LikelihoodComputationMPITP, and BIE::LikelihoodComputationSerial.

void BIE::LikelihoodComputation::TileCompare (  )  [inline]

Print out 2-d images of theory, data, and comparison.

Enable tile bin/point diagnostics for next evaluation

void BIE::LikelihoodComputation::SetTessTool ( TessToolSender ttsender  ) 

Attach TessToolSender.

Enable tile bin/point diagnostics for next evaluation

void BIE::LikelihoodComputation::startThread (  ) 

Threading routines.

Start the enslaved worker thread

virtual void BIE::LikelihoodComputation::enslave_worker ( void *  arg  )  [inline, virtual]

Initialize the set of processors for subsequent likelihood calls.

Called by each worker to enslave itself (enter server mode). This routine should be overridden to do the real work

Reimplemented in BIE::LikelihoodComputationMPI.

void BIE::LikelihoodComputation::ResumedSimulation (  )  [protected]

Called by the cli thread.

After this the cli thread disables itself does a post on the likelihood semaphore

void BIE::LikelihoodComputation::SuspendedSimulation (  )  [protected]

Make the cli thread active.

.. will be active until resume is called wait on suspendedSimulation semaphore


Member Data Documentation

Flags used to handle TessTool requests.

1 if sychronization is requested by TessTool


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

Send suggestions, questions, and feedback to WEINBERG at ASTRO dot UMASS dot EDU.
Documentation generated at Fri Mar 26 00:35:12 2010 by doxygen