MTMCSim
0.5
|
Multithread Monte Carlo Simulator Boss-Worker model scheduler. More...
#include <MTMCScheduler.h>
Public Member Functions | |
MTMCScheduler (unsigned int nRunThreads_, unsigned int RNQSize, boost::shared_ptr< MTMCSimBase > simulator) | |
MTMCScheduler () | |
The default constructor does nothing. More... | |
void | genRN () |
Generates the random number sequences and put into the queue. More... | |
void | oneThreadSimu (MCThreadInfo threadInfo) |
Each worker thread call this function to work. More... | |
void | start () |
Start simulation. More... | |
void | setSimulator (boost::shared_ptr< MTMCSimBase > simulator_) |
void | setNRunThreads (unsigned int nRunThreads_) |
void | setRNQSize (unsigned int RNQSize_) |
Multithread Monte Carlo Simulator Boss-Worker model scheduler.
In general, the Monte Carlo Simulation computes E[Y], Y = f(X), and X is the random sequence driving the simulation. The scheduler runs in the boss worker model, i.e., one thread generates random sequences X and several threads computes f(X) and obtain the samples of Y. Between the boss and the worker, there is a queue as a buffer of the random sequences. The simulator should be derived classes of the abstract calss MTMCSimBase
This model is suitable when the computation of the function f() is high. Usually this is the case in coding theory. In particular, in coding theory, X is the random sequences, f() contains encoding, channel effect if there is any, decoding. Y = 1 if the frame is in error after decoding so E[Y] = probably of error. This is a top level description of Monte Carlo. The X and Y here and X, Y in the multistage LDPC DSC are different.(There, they are source sequences and they corresponds to the X here.
MTMCSim::MTMCScheduler::MTMCScheduler | ( | unsigned int | nRunThreads_, |
unsigned int | RNQSize, | ||
boost::shared_ptr< MTMCSimBase > | simulator | ||
) |
nRunThreads_ | The number of running threads (workers) |
RNQSize | The size of the random number queue |
simulator | The (smart) pointer to the simulator object |
|
inline |
The default constructor does nothing.
Should call setSimulator, setNRunThreads and setRNQSize before calling start().
void MTMCSim::MTMCScheduler::genRN | ( | ) |
Generates the random number sequences and put into the queue.
void MTMCSim::MTMCScheduler::oneThreadSimu | ( | MCThreadInfo | threadInfo) |
Each worker thread call this function to work.
|
inline |
|
inline |
|
inline |
void MTMCSim::MTMCScheduler::start | ( | ) |
Start simulation.