alpaka
Abstraction Library for Parallel Kernel Acceleration
|
#include <PhiloxSingle.hpp>
Public Types | |
using | Base = PhiloxBaseCommon< TParams, PhiloxSingle< TParams > > |
using | Counter = typename Base::Counter |
Counter type. More... | |
using | Key = typename Base::Key |
Key type. More... | |
using | State = PhiloxStateSingle< Counter, Key > |
State type. More... | |
Public Types inherited from alpaka::rand::engine::PhiloxBaseCommon< TParams, PhiloxSingle< TParams > > | |
using | Counter = typename PhiloxStateless< TParams >::Counter |
using | Key = typename PhiloxStateless< TParams >::Key |
using | ResultContainer = typename alpaka::Vec< alpaka::DimInt< TParams::counterSize >, TDistributionResultScalar > |
Distribution container type. More... | |
Public Types inherited from alpaka::rand::engine::PhiloxStateless< TParams > | |
using | Constants = PhiloxConstants< TParams > |
using | Counter = alpaka::Vec< alpaka::DimInt< TParams::counterSize >, std::uint32_t > |
using | Key = alpaka::Vec< alpaka::DimInt< TParams::counterSize/2 >, std::uint32_t > |
Public Member Functions | |
ALPAKA_FN_HOST_ACC | PhiloxSingle (uint64_t seed=0, uint64_t subsequence=0, uint64_t offset=0) |
ALPAKA_FN_HOST_ACC auto | operator() () |
Public Attributes | |
State | state |
Internal engine state. More... | |
Protected Member Functions | |
ALPAKA_FN_HOST_ACC void | advanceState () |
ALPAKA_FN_HOST_ACC auto | nextNumber () |
ALPAKA_FN_HOST_ACC void | skip (uint64_t offset) |
Skips the next offset numbers. More... | |
Protected Member Functions inherited from alpaka::rand::engine::PhiloxBaseCommon< TParams, PhiloxSingle< TParams > > | |
ALPAKA_FN_HOST_ACC void | advanceCounter (Counter &counter) |
ALPAKA_FN_HOST_ACC void | skip4 (uint64_t offset) |
ALPAKA_FN_HOST_ACC void | skipSubsequence (uint64_t subsequence) |
Additional Inherited Members | |
Static Public Member Functions inherited from alpaka::rand::engine::PhiloxStateless< TParams > | |
static ALPAKA_FN_HOST_ACC auto | generate (Counter const &counter, Key const &key) -> Counter |
Static Public Member Functions inherited from alpaka::rand::engine::PhiloxConstants< TParams > | |
static constexpr std::uint32_t | MULTIPLITER_4x32_0 () |
First Philox S-box multiplier. More... | |
static constexpr std::uint32_t | MULTIPLITER_4x32_1 () |
Second Philox S-box multiplier. More... | |
static constexpr std::uint32_t | WEYL_32_0 () |
1st Weyl sequence parameter, 32 bits More... | |
static constexpr std::uint32_t | WEYL_32_1 () |
2nd Weyl sequence parameter, 32 bits More... | |
static constexpr std::uint64_t | WEYL_64_0 () |
First Weyl sequence parameter: the golden ratio. More... | |
static constexpr std::uint64_t | WEYL_64_1 () |
Second Weyl sequence parameter: . More... | |
Static Protected Member Functions inherited from alpaka::rand::engine::PhiloxStateless< TParams > | |
static ALPAKA_FN_HOST_ACC auto | bumpKey (Key const &key) |
static ALPAKA_FN_HOST_ACC auto | nRounds (Counter const &counter_in, Key const &key_in) -> Counter |
static ALPAKA_FN_HOST_ACC auto | singleRound (Counter const &counter, Key const &key) |
Philox engine generating a single number
This engine's operator() will return a single number. Since the result is the same size as the counter, and so it contains more than one number, it has to be stored between individual invocations of operator(). Additionally a pointer has to be stored indicating which part of the result array is to be returned next.
TParams | Basic parameters for the Philox algorithm |
Definition at line 46 of file PhiloxSingle.hpp.
using alpaka::rand::engine::PhiloxSingle< TParams >::Base = PhiloxBaseCommon<TParams, PhiloxSingle<TParams> > |
Definition at line 49 of file PhiloxSingle.hpp.
using alpaka::rand::engine::PhiloxSingle< TParams >::Counter = typename Base::Counter |
Counter type.
Definition at line 52 of file PhiloxSingle.hpp.
using alpaka::rand::engine::PhiloxSingle< TParams >::Key = typename Base::Key |
Key type.
Definition at line 54 of file PhiloxSingle.hpp.
using alpaka::rand::engine::PhiloxSingle< TParams >::State = PhiloxStateSingle<Counter, Key> |
State type.
Definition at line 56 of file PhiloxSingle.hpp.
|
inline |
Construct a new Philox engine with single-value output
seed | Set the Philox generator key |
subsequence | Select a subsequence of size 2^64 |
offset | Skip offset numbers form the start of the subsequence |
Definition at line 131 of file PhiloxSingle.hpp.
|
inlineprotected |
Advance internal counter to the next value
Advances the full internal counter array, resets the position pointer and stores the intermediate result to be recalled when the user requests a number.
Definition at line 67 of file PhiloxSingle.hpp.
|
inlineprotected |
Get the next random number and advance internal state
The intermediate result stores N = TParams::counterSize numbers. Check if we've already given out all of them. If so, generate a new intermediate result (this also resets the pointer to the position of the actual number). Finally, we return the actual number.
Definition at line 82 of file PhiloxSingle.hpp.
|
inline |
Get the next random number
Definition at line 143 of file PhiloxSingle.hpp.
|
inlineprotected |
Skips the next offset numbers.
Definition at line 107 of file PhiloxSingle.hpp.
State alpaka::rand::engine::PhiloxSingle< TParams >::state |
Internal engine state.
Definition at line 59 of file PhiloxSingle.hpp.