openmc icon indicating copy to clipboard operation
openmc copied to clipboard

(potential bug) Use atomic add operations for incrementing source site rejection counters

Open gridley opened this issue 1 year ago • 0 comments

Bug Description

In #2916 it was mentioned that the source rejection counters, which are static variables, are not incremented in a threadsafe way. This has not resulted in any bugs so far, but may give behavior slightly different from what's expected. In most systems operations on 32 bit data are atomic in the first place so this hasn't been an issue. Rigorously, though, these should be atomic add operations.

This issue can be closed when OpenMP atomic statements are appropriately inserted for manipulating the source rejection counters, i.e. static variables which are related to EXTERNAL_SRC_REJECT_THRESHOLD.

gridley avatar May 14 '24 23:05 gridley