OpenMPCD
Philox4x32-10.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  * Defines the `OpenMPCD::CUDA::Random::Generators::Philox4x32_10` class.
4  */
5 
6 #ifndef OPENMPCD_CUDA_RANDOM_GENERATORS_PHILOX4X32_10_HPP
7 #define OPENMPCD_CUDA_RANDOM_GENERATORS_PHILOX4X32_10_HPP
8 
10 
11 #include <curand.h>
12 #include <curand_philox4x32_x.h>
13 #include <curand_kernel.h>
14 
15 namespace OpenMPCD
16 {
17 namespace CUDA
18 {
19 namespace Random
20 {
21 namespace Generators
22 {
23 
24 /**
25  * Philox4x32-10 @cite Salmon2011 counter-bases PRNG.
26  *
27  * This class is compatible with the Philox4x32-10 PRNG as implemented in the
28  * cuRAND library.
29  */
31 {
32 public:
33  /**
34  * The constructor.
35  *
36  * @param[in] seed The seed.
37  * @param[in] subsequence The subsequence number.
38  */
41  const unsigned long long seed,
42  const unsigned long long subsequence)
43  {
44  curand_init(seed, subsequence, 0, getState());
45  }
46 
47 public:
48  /**
49  * Returns a pointer to the internal cuRAND state.
50  */
52  curandStatePhilox4_32_10_t* getState()
53  {
54  return &state;
55  }
56 
57 private:
58  curandStatePhilox4_32_10_t state; ///< The internal cuRAND state.
59 }; //class Philox4x32_10
60 
61 } //namespace Generators
62 } //namespace Random
63 } //namespace CUDA
64 } //namespace OpenMPCD
65 
66 
67 #endif //OPENMPCD_CUDA_RANDOM_GENERATORS_PHILOX4X32_10_HPP
OpenMPCD::CUDA::Random::Generators::Philox4x32_10::Philox4x32_10
OPENMPCD_CUDA_DEVICE Philox4x32_10(const unsigned long long seed, const unsigned long long subsequence)
The constructor.
Definition: Philox4x32-10.hpp:40
OPENMPCD_CUDA_DEVICE
#define OPENMPCD_CUDA_DEVICE
Denotes a function to be callable from a CUDA Device.
Definition: Macros.hpp:25
OpenMPCD::CUDA::Random::Generators::Philox4x32_10::getState
OPENMPCD_CUDA_DEVICE curandStatePhilox4_32_10_t * getState()
Returns a pointer to the internal cuRAND state.
Definition: Philox4x32-10.hpp:52
Macros.hpp
OpenMPCD::CUDA::Random::Generators::Philox4x32_10
Philox4x32-10 counter-bases PRNG.
Definition: Philox4x32-10.hpp:30