alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
alpaka::rand::engine::internal::PhiloxBaseCommon< T_Params, T_Impl > Class Template Reference

Common class for Philox family engines. More...

#include <PhiloxBaseCommon.hpp>

Inheritance diagram for alpaka::rand::engine::internal::PhiloxBaseCommon< T_Params, T_Impl >:

Public Types

using Counter = typename PhiloxStateless<T_Params>::Counter
using Key = typename PhiloxStateless<T_Params>::Key
template<typename TDistributionResultScalar>
using ResultContainer = Vec<TDistributionResultScalar, T_Params::counterSize>
 Distribution container type.
using State = PhiloxState<Counter, Key, T_Impl>
 State type.
Public Types inherited from alpaka::rand::engine::internal::PhiloxStateless< T_Params >
using Counter = alpaka::Vec<std::uint32_t, T_Params::counterSize>
using Key = alpaka::Vec<std::uint32_t, T_Params::counterSize / 2>

Public Member Functions

constexpr PhiloxBaseCommon (State &&state)

Public Attributes

State state
 Internal engine state.

Protected Member Functions

constexpr void skip4 (uint64_t offset)
 Advance the internal state counter by offset N-vectors (N = counter size).
constexpr void skipSubsequence (uint64_t subsequence)
 Advance the counter by the length of subsequence.

Static Protected Member Functions

template<typename T, auto N>
static constexpr void advanceCounter (alpaka::Vec< T, N > &counter)
 Advance the counter to the next state.
Static Protected Member Functions inherited from alpaka::rand::engine::internal::PhiloxStateless< T_Params >
static constexpr auto bumpKey (Key const &key)
 Bump the key by the Weyl sequence step parameter.
static constexpr auto nRounds (Counter const &counter_in, Key const &key_in) -> Counter
 Performs N rounds of the Philox shuffle.
static constexpr auto singleRound (Counter const &counter, Key const &key)
 Single round of the Philox shuffle.

Additional Inherited Members

Static Public Member Functions inherited from alpaka::rand::engine::internal::PhiloxStateless< T_Params >
static constexpr auto generate (Counter const &counter, Key const &key) -> Counter
 Generates a random number (TCounterSize x32-bit).

Detailed Description

template<typename T_Params, typename T_Impl>
class alpaka::rand::engine::internal::PhiloxBaseCommon< T_Params, T_Impl >

Common class for Philox family engines.

Relies on PhiloxStateless to provide the PRNG and adds state to handling the counting.

Template Parameters
T_ParamsPhilox algorithm parameters
See also
PhiloxParams
Template Parameters
T_Implengine type implementation (CRTP)

static const data members are transformed into functions, because GCC assumes types with static data members to be not mappable and makes not exception for constexpr ones. This is a valid interpretation of the OpenMP <= 4.5 standard. In OpenMP >= 5.0 types with any kind of static data member are mappable.

Definition at line 26 of file PhiloxBaseCommon.hpp.

Member Typedef Documentation

◆ Counter

template<typename T_Params, typename T_Impl>
using alpaka::rand::engine::internal::PhiloxBaseCommon< T_Params, T_Impl >::Counter = typename PhiloxStateless<T_Params>::Counter

Definition at line 29 of file PhiloxBaseCommon.hpp.

◆ Key

template<typename T_Params, typename T_Impl>
using alpaka::rand::engine::internal::PhiloxBaseCommon< T_Params, T_Impl >::Key = typename PhiloxStateless<T_Params>::Key

Definition at line 30 of file PhiloxBaseCommon.hpp.

◆ ResultContainer

template<typename T_Params, typename T_Impl>
template<typename TDistributionResultScalar>
using alpaka::rand::engine::internal::PhiloxBaseCommon< T_Params, T_Impl >::ResultContainer = Vec<TDistributionResultScalar, T_Params::counterSize>

Distribution container type.

Definition at line 38 of file PhiloxBaseCommon.hpp.

◆ State

template<typename T_Params, typename T_Impl>
using alpaka::rand::engine::internal::PhiloxBaseCommon< T_Params, T_Impl >::State = PhiloxState<Counter, Key, T_Impl>

State type.

Definition at line 32 of file PhiloxBaseCommon.hpp.

Constructor & Destructor Documentation

◆ PhiloxBaseCommon()

template<typename T_Params, typename T_Impl>
alpaka::rand::engine::internal::PhiloxBaseCommon< T_Params, T_Impl >::PhiloxBaseCommon ( State && state)
inlineexplicitconstexpr

Definition at line 40 of file PhiloxBaseCommon.hpp.

Member Function Documentation

◆ advanceCounter()

template<typename T_Params, typename T_Impl>
template<typename T, auto N>
constexpr void alpaka::rand::engine::internal::PhiloxBaseCommon< T_Params, T_Impl >::advanceCounter ( alpaka::Vec< T, N > & counter)
inlinestaticconstexprprotected

Advance the counter to the next state.

Increments the passed-in counter by one with a 128-bit carry.

Parameters
counterreference to the counter which is to be advanced

Definition at line 52 of file PhiloxBaseCommon.hpp.

◆ skip4()

template<typename T_Params, typename T_Impl>
void alpaka::rand::engine::internal::PhiloxBaseCommon< T_Params, T_Impl >::skip4 ( uint64_t offset)
inlineconstexprprotected

Advance the internal state counter by offset N-vectors (N = counter size).

Advances the internal value of this->state.counter

Parameters
offsetnumber of N-vectors to skip

Definition at line 77 of file PhiloxBaseCommon.hpp.

◆ skipSubsequence()

template<typename T_Params, typename T_Impl>
void alpaka::rand::engine::internal::PhiloxBaseCommon< T_Params, T_Impl >::skipSubsequence ( uint64_t subsequence)
inlineconstexprprotected

Advance the counter by the length of subsequence.

Advances the internal value of this->state.counter

Parameters
subsequencenumber of subsequences to skip

Definition at line 93 of file PhiloxBaseCommon.hpp.

Member Data Documentation

◆ state

template<typename T_Params, typename T_Impl>
State alpaka::rand::engine::internal::PhiloxBaseCommon< T_Params, T_Impl >::state

Internal engine state.

Definition at line 35 of file PhiloxBaseCommon.hpp.


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