Skip to content

Commit 7c47c07

Browse files
logan-ncclaude
andcommitted
KF - BUGFIX! - Static scheduling for the threaded kinetic kernel loop
The per-surface kernel loop indexed per-thread scratch (thread_intrs and the four matrix buffers) by threadid() under DEFAULT dynamic scheduling -- the only threaded loop in the codebase missing :static. Task migration at yield points lets two tasks share a buffer and corrupt matrix rows, making every calculated-kinetic run nondeterministic at rare-migration frequency (observed: three runs of an identical DIII-D deck gave et[1] = 1.0053, 1.1355, 0.9895). All other threadid-indexed loops already use :static per the GPEC convention. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LzbLFQKyuRE5DYZmLokKmk
1 parent 16317bc commit 7c47c07

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/KineticForces/CalculatedKineticMatrices.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function compute_calculated_kinetic_matrices(
120120
thread_block_w = [zeros(ComplexF64, mpert, mpert, 6) for _ in 1:nthreads]
121121
thread_block_t = [zeros(ComplexF64, mpert, mpert, 6) for _ in 1:nthreads]
122122

123-
Threads.@threads for ipsi in 1:mpsi
123+
Threads.@threads :static for ipsi in 1:mpsi
124124
tid = Threads.threadid()
125125
intr_t = thread_intrs[tid]
126126
full_w = thread_full_w[tid]

0 commit comments

Comments
 (0)