alpaka
Abstraction Library for Parallel Kernel Acceleration
PhiloxStatelessKeyedBase.hpp
Go to the documentation of this file.
1 /* Copyright 2022 Jeffrey Kelling
2  * SPDX-License-Identifier: MPL-2.0
3  */
4 
5 #pragma once
6 
8 
9 namespace alpaka::rand::engine
10 {
11  /** Common class for Philox family engines
12  *
13  * Checks the validity of passed-in parameters and calls the backend methods to perform N rounds of the
14  * Philox shuffle.
15  *
16  * @tparam TParams Philox algorithm parameters \sa PhiloxParams
17  */
18  template<typename TParams>
19  struct PhiloxStatelessKeyedBase : public PhiloxStateless<TParams>
20  {
21  public:
24 
25  Key const m_key;
26 
27  PhiloxStatelessKeyedBase(Key&& key) : m_key(std::move(key))
28  {
29  }
30 
31  ALPAKA_FN_HOST_ACC auto operator()(Counter const& counter) const
32  {
33  return this->generate(counter, m_key);
34  }
35  };
36 } // namespace alpaka::rand::engine
A n-dimensional vector.
Definition: Vec.hpp:38
static ALPAKA_FN_HOST_ACC auto generate(Counter const &counter, Key const &key) -> Counter
#define ALPAKA_FN_HOST_ACC
Definition: Common.hpp:39
The random number generator engine specifics.
typename PhiloxStateless< TParams >::Key Key
ALPAKA_FN_HOST_ACC auto operator()(Counter const &counter) const