Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence Thread Sanitizer in InitRandom #4281

Closed
wants to merge 3 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Src/Base/AMReX_Random.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ InitRandom (ULong cpu_seed, int nprocs, ULong gpu_seed)
#endif

#ifdef AMREX_USE_OMP
#pragma omp parallel
#pragma omp parallel for
#endif
for (int tid = 0; tid < nthreads; tid++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#ifdef AMREX_USE_OMP
#pragma omp parallel
#pragma omp parallel for
#endif
for (int tid = 0; tid < nthreads; tid++) {
for (int tid = 0; tid < nthreads; tid++)

With the for loop, the parallel region isn't even required anymore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was thinking the same. Not sure it matters...

{
int tid = OpenMP::get_thread_num();
ULong init_seed = cpu_seed + tid*nprocs;
generators[tid].seed(init_seed);
}
Expand Down
Loading