Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
RandomConcurrent_test::Experiment< GEN, threads > Struct Template Reference

Description

template<typename GEN, uint threads>
struct lib::test::RandomConcurrent_test::Experiment< GEN, threads >

Research setup to investigate concurrent access to a random generator.

From each test thread, the shared generator instance is invoked a huge number times (defined by NUM_INVOKES), thereby computing the mean value and checking for defect numbers outside the generator's definition range. This probe cycle is repeated several times (defined by NUM_SAMPLES) and the results are collected and evaluated afterwards to detect signs of a skewed distribution.

Template Parameters
GENa C++ compliant generator type
threadsnumber of threads to run in parallel
Remarks
Pseudo random number generation as such is not threadsafe, and pressing for concurrent access (as done here) will produce a corrupted internal generator state sooner or later. Under some circumstances however, theses glitches can be ignored, if quality of generated numbers actually does not matter.

Definition at line 114 of file random-concurrent-test.cpp.

Public Types

using ResVal = GEN::result_type
 

Public Attributes

deque< tuple< double, uint > > results
 
GEN generator
 
const uint N = NUM_INVOKES
 
const uint REPEATS = NUM_SAMPLES / threads
 
ResVal expect = (GEN::max() - GEN::min()) / 2
 
double percentGlitches {0.0}
 
double percentTilted {0.0}
 
bool isFailure {false}
 

Public Member Functions

void recordRun (double err, uint fails)
 
 Experiment (GEN &&fun)
 
void perform ()
 run the experiment series
 

Additional Inherited Members

- Static Public Member Functions inherited from Sync< CONF >
static MonitorgetMonitor (Sync const *forThis)
 

Constructor & Destructor Documentation

◆ Experiment()

template<typename GEN , uint threads>
Experiment ( GEN &&  fun)
inline

Definition at line 129 of file random-concurrent-test.cpp.

Member Typedef Documentation

◆ ResVal

template<typename GEN , uint threads>
using ResVal = GEN::result_type

Definition at line 135 of file random-concurrent-test.cpp.

Member Function Documentation

◆ recordRun()

template<typename GEN , uint threads>
void recordRun ( double  err,
uint  fails 
)
inline

Definition at line 120 of file random-concurrent-test.cpp.

References RandomConcurrent_test::Experiment< GEN, threads >::results.

Referenced by RandomConcurrent_test::Experiment< GEN, threads >::perform().

+ Here is the caller graph for this function:

◆ perform()

template<typename GEN , uint threads>
void perform ( )
inline

Member Data Documentation

◆ results

template<typename GEN , uint threads>
deque<tuple<double,uint> > results

◆ generator

template<typename GEN , uint threads>
GEN generator

◆ N

template<typename GEN , uint threads>
const uint N = NUM_INVOKES

◆ REPEATS

template<typename GEN , uint threads>
const uint REPEATS = NUM_SAMPLES / threads

◆ expect

template<typename GEN , uint threads>
ResVal expect = (GEN::max() - GEN::min()) / 2

◆ percentGlitches

template<typename GEN , uint threads>
double percentGlitches {0.0}

◆ percentTilted

template<typename GEN , uint threads>
double percentTilted {0.0}

◆ isFailure

template<typename GEN , uint threads>
bool isFailure {false}
+ Inheritance diagram for RandomConcurrent_test::Experiment< GEN, threads >:
+ Collaboration diagram for RandomConcurrent_test::Experiment< GEN, threads >:

The documentation for this struct was generated from the following file: