From ecb92de244f4768e7698a94174b12d2d5a812cc2 Mon Sep 17 00:00:00 2001 From: John Tramm Date: Fri, 12 Feb 2021 22:47:24 +0000 Subject: [PATCH] Added fix for the relaxed memory ordering problem in the SharedArray object. --- include/openmc/shared_array.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/openmc/shared_array.h b/include/openmc/shared_array.h index 1fa744f83..bdce58fab 100644 --- a/include/openmc/shared_array.h +++ b/include/openmc/shared_array.h @@ -73,12 +73,12 @@ public: { // Atomically capture the index we want to write to int64_t idx; - #pragma omp atomic capture + #pragma omp atomic capture seq_cst idx = size_++; // Check that we haven't written off the end of the array if (idx >= capacity_) { - #pragma omp atomic write + #pragma omp atomic write seq_cst size_ = capacity_; return -1; }