27 #ifndef LBANN_UTILS_RNG_HPP 28 #define LBANN_UTILS_RNG_HPP 51 fast_generator(42ULL),
52 active_thread_id(std::thread::id())
56 : generator(other.generator),
57 fast_generator(other.fast_generator),
58 active_thread_id(other.active_thread_id.
load())
67 std::thread::id prev_tid =
69 if (prev_tid != std::thread::id()) {
70 LBANN_ERROR(
"Acquired a \'locked\' RNG that isn't owned by this thread");
73 explicit operator io_rng_t&() {
return *rng_; }
76 std::thread::id prev_tid =
78 if (prev_tid != std::this_thread::get_id()) {
80 "Releasing a \'locked\' RNG that isn't owned by this thread");
173 #endif // LBANN_UTILS_RNG_HPP void init_io_random(int seed=-1, int num_io_RNGs=1)
fast_rng_gen & get_fast_generator()
locked_io_rng_ref set_io_generators_local_index(size_t idx)
Sets the local index for a thread to access the correct I/O RNGs.
lbann::fast_rng_gen fast_generator
locked_io_rng_ref(io_rng_t &rng)
std::minstd_rand fast_rng_gen
fast_rng_gen & get_ltfb_generator()
void load(std::string const &pbuf_filename, google::protobuf::Message &msg)
Fill the protobuf message from a binary file.
std::atomic< std::thread::id > active_thread_id
rng_gen & get_io_generator()
void init_data_seq_random(int seed=-1)
void init_ltfb_random(int seed=-1)
io_rng_t(const io_rng_t &other)
fast_rng_gen & get_fast_io_generator()
#define LBANN_WARNING(...)
rng_gen & get_data_seq_generator()
rng_gen & get_generator()
void init_random(int seed=-1, int num_io_RNGs=1, lbann_comm *comm=nullptr)
Initialize the random number generator (with optional seed).
int get_num_io_generators()
Returns the number of provisioned I/O generators.