abacusorg / zeldovich-PLT

Generates initial conditions for cosmological N-body simulations, optionally applying Particle Linear Theory corrections.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Race condition in zeroing Nyquist plane

lgarrison opened this issue · comments

The ky=k_nyquist plane may not be zeroed correctly due to an OpenMP race condition:

zeldovich-PLT/zeldovich.cpp

Lines 537 to 542 in 82e268e

#pragma omp parallel for schedule(static)
for (int zres=0;zres<array.block;zres++) {
for (a=0;a<array.narray;a++) {
for (x=0;x<array.ppd;x++) AZYX(slab,a,zres,y,x) = 0.0;
}
}

Loop variables for #pragma-annotated loops are thread-private by default, but I am pretty sure this does not apply to nested loops. We could double-check this.

As to what this means, clearly the values weren't garbage or nans, as we would have noticed that in the AbacusSummit sims. Maybe they are recycled values, in which case the error would be mild. I need to remind myself how the block loading works.