3 #include <AMReX_Config.H>
26 #if defined (__SYCL_DEVICE_ONLY__)
27 mkl::rng::device::uniform<Real> distr;
28 return mkl::rng::device::generate(distr, *random_engine.engine);
33 return 1.0f - hiprand_uniform(random_engine.
rand_state); ,
34 return 1.0f - curand_uniform(random_engine.
rand_state);
40 return 1.0 - hiprand_uniform_double(random_engine.
rand_state); ,
41 return 1.0 - curand_uniform_double(random_engine.
rand_state);
64 #if defined (__SYCL_DEVICE_ONLY__)
65 mkl::rng::device::gaussian<Real> distr(mean, stddev);
66 return mkl::rng::device::generate(distr, *random_engine.engine);
71 return stddev * hiprand_normal(random_engine.
rand_state) + mean; ,
72 return stddev * curand_normal(random_engine.
rand_state) + mean;
78 return stddev * hiprand_normal_double(random_engine.
rand_state) + mean; ,
79 return stddev * curand_normal_double(random_engine.
rand_state) + mean;
104 #if defined (__SYCL_DEVICE_ONLY__)
105 mkl::rng::device::poisson<unsigned int> distr(lambda);
106 return mkl::rng::device::generate(distr, *random_engine.engine);
110 return hiprand_poisson(random_engine.
rand_state, lambda); ,
111 return curand_poisson(random_engine.
rand_state, lambda);
133 #if defined(__SYCL_DEVICE_ONLY__)
134 mkl::rng::device::uniform<unsigned int> distr(0,n);
135 return mkl::rng::device::generate(distr, *random_engine.engine);
139 constexpr
unsigned int RAND_M = 4294967295;
143 }
while (rand > (RAND_M - RAND_M % n));
210 bool printSet =
false);
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_HIP_OR_CUDA(a, b)
Definition: AMReX_GpuControl.H:21
#define AMREX_IF_ON_DEVICE(CODE)
Definition: AMReX_GpuQualifiers.H:56
#define AMREX_IF_ON_HOST(CODE)
Definition: AMReX_GpuQualifiers.H:58
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
int MyProc() noexcept
return the rank number local to the current Parallel Context
Definition: AMReX_ParallelDescriptor.H:125
int NProcs() noexcept
return the number of MPI ranks local to the current Parallel Context
Definition: AMReX_ParallelDescriptor.H:243
ULong DefaultGpuSeed()
Definition: AMReX_Random.H:170
Definition: AMReX_Amr.cpp:49
void FillRandomNormal(MultiFab &mf, int scomp, int ncomp, Real mean, Real stddev)
Fill MultiFab with random numbers from normal distribution.
Definition: AMReX_MultiFabUtil.cpp:1212
void FillRandom(MultiFab &mf, int scomp, int ncomp)
Fill MultiFab with random numbers from uniform distribution.
Definition: AMReX_MultiFabUtil.cpp:1199
void InitRandom(ULong cpu_seed, int nprocs, ULong gpu_seed)
Set the seed of the random number generator.
Definition: AMReX_Random.cpp:89
unsigned int Random_int(unsigned int n)
Generates one pseudorandom unsigned integer which is uniformly distributed on [0,n-1]-interval for ea...
Definition: AMReX_Random.cpp:137
Real Random()
Generate a psuedo-random double from uniform distribution.
Definition: AMReX_Random.cpp:123
void ResetRandomSeed(ULong cpu_seed, ULong gpu_seed)
Definition: AMReX_Random.cpp:205
Real RandomNormal(Real mean, Real stddev)
Generate a psuedo-random double from a normal distribution.
Definition: AMReX_Random.cpp:116
ULong Random_long(ULong n)
Generates one pseudorandom unsigned long which is uniformly distributed on [0,n-1]-interval for each ...
Definition: AMReX_Random.cpp:144
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void ignore_unused(const Ts &...)
This shuts up the compiler about unused variables.
Definition: AMReX.H:111
void UniqueRandomSubset(Vector< int > &uSet, int setSize, int poolSize, bool printSet)
Create a unique subset of random numbers from a pool of integers in the range [0, poolSize - 1] the s...
Definition: AMReX_Random.cpp:183
unsigned int RandomPoisson(Real lambda)
Generate a psuedo-random integer from a Poisson distribution.
Definition: AMReX_Random.cpp:130
void DeallocateRandomSeedDevArray()
Definition: AMReX_Random.cpp:211
void SaveRandomState(std::ostream &os)
Save and restore random state.
Definition: AMReX_Random.cpp:152
void RestoreRandomState(std::istream &is, int nthreads_old, int nstep_old)
Definition: AMReX_Random.cpp:160
Definition: AMReX_FabArrayCommI.H:841
Definition: AMReX_RandomEngine.H:57
randState_t * rand_state
Definition: AMReX_RandomEngine.H:58