Skip to content

fix intialization of thread private variable#107

Open
aoymt wants to merge 1 commit into
sissaschool:develfrom
aoymt:fix.thread_private
Open

fix intialization of thread private variable#107
aoymt wants to merge 1 commit into
sissaschool:develfrom
aoymt:fix.thread_private

Conversation

@aoymt

@aoymt aoymt commented Mar 14, 2026

Copy link
Copy Markdown

Fix OpenMP bug in upvpotdiag_b.f90:

  • thread-private variable iondb was passed to veps_b uninitialized.
  • veps_b reads the second argument before updating it, so with OpenMP enabled each thread used undefined iondb and produced wrong/non-deterministic gradients.
  • Fix: set iondb=0.d0 immediately before the call to veps_b inside the parallel region.
  • The issue is detected by testad when OpenMP is enabled, including with OMP_NUM_THREADS=1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant