Skip to content

Commit

Permalink
device sync instead of stream sync
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed Aug 12, 2023
1 parent d0c613a commit 9f42e9f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Src/Base/AMReX_Random.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ void FillRandomNormal (Real* p, Long N, Real mean, Real stddev)
AMREX_CURAND_SAFE_CALL(curandGenerateNormalDouble(cuda_rand_gen, p, N, mean, stddev));
#endif

Gpu::synchronize();

#elif defined(AMREX_USE_HIP)

if (! generator_initialized) {
Expand All @@ -262,9 +264,9 @@ void FillRandomNormal (Real* p, Long N, Real mean, Real stddev)
AMREX_HIPRAND_SAFE_CALL(hiprandGenerateNormalDouble(hip_rand_gen, p, N, mean, stddev));
#endif

#endif
Gpu::synchronize();

Gpu::streamSynchronize();
#endif

#else
std::normal_distribution<Real> distribution(mean, stddev);
Expand Down

0 comments on commit 9f42e9f

Please sign in to comment.