|
Boost Users : |
Subject: Re: [Boost-users] Cost of constructing models of RandomDistribution
From: Jesse Perla (jesseperla_at_[hidden])
Date: 2010-02-19 12:00:20
Robert Patterson <riap2 <at> cam.ac.uk> writes:
> I have a fairly large simulation code, that I need to get into a state
> in which I can multi-thread it. One of my problems is a global random
> number generator state.
I ran into the same problem, and for better or worse I created a singleton to
manage the global state (to preempt the anti-singleton crowd:
I didn't want to construct if not necessary, wanted easy solution to ODR
for header only, not worry about destruction order with singleton dependencies,
etc.)
I used the loki singleton class, though I am would love a boost version.
One thing I really wanted to do was have this singleton theadlocal, but
wasn't sure how to do it properly.
Here is my simple code, including creation of a MKL stream. I use the
reset_all_seeds for simulations when I want to repeat results.
http://econtoolkit.com/browser/libraries/trunk/etk/etk/random/random.hpp
-Jesse
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net