| 261 | } |
| 262 | |
| 263 | void FillRandom (Real* p, Long N) |
| 264 | { |
| 265 | #ifdef AMREX_USE_CUDA |
| 266 | |
| 267 | # ifdef BL_USE_FLOAT |
| 268 | AMREX_CURAND_SAFE_CALL(curandGenerateUniform(gpu_rand_generator, p, N)); |
| 269 | # else |
| 270 | AMREX_CURAND_SAFE_CALL(curandGenerateUniformDouble(gpu_rand_generator, p, N)); |
| 271 | # endif |
| 272 | Gpu::synchronize(); |
| 273 | |
| 274 | #elif defined(AMREX_USE_HIP) |
| 275 | |
| 276 | # ifdef BL_USE_FLOAT |
| 277 | AMREX_HIPRAND_SAFE_CALL(hiprandGenerateUniform(gpu_rand_generator, p, N)); |
| 278 | # else |
| 279 | AMREX_HIPRAND_SAFE_CALL(hiprandGenerateUniformDouble(gpu_rand_generator, p, N)); |
| 280 | # endif |
| 281 | Gpu::synchronize(); |
| 282 | |
| 283 | #elif defined(AMREX_USE_SYCL) |
| 284 | |
| 285 | oneapi::mkl::rng::uniform<Real> distr; |
| 286 | auto event = oneapi::mkl::rng::generate(distr, *gpu_rand_generator, N, p); |
| 287 | event.wait(); |
| 288 | |
| 289 | #else |
| 290 | std::uniform_real_distribution<Real> distribution(Real(0.0), Real(1.0)); |
| 291 | auto& gen = generators[OpenMP::get_thread_num()]; |
| 292 | for (Long i = 0; i < N; ++i) { |
| 293 | p[i] = distribution(gen); |
| 294 | } |
| 295 | #endif |
| 296 | } |
| 297 | |
| 298 | void FillRandomNormal (Real* p, Long N, Real mean, Real stddev) |
| 299 | { |
no test coverage detected