From b29a59f3d892a2df1f20dbf4c6426a607f67beb2 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Wed, 4 Dec 2019 12:23:13 -0600 Subject: [PATCH] Rewrite potentially concurrent writes to use atomics (closes #30) --- boxtree/rotation_classes.py | 4 ++-- boxtree/tree_build_kernels.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/boxtree/rotation_classes.py b/boxtree/rotation_classes.py index 97df572..4fee327 100644 --- a/boxtree/rotation_classes.py +++ b/boxtree/rotation_classes.py @@ -132,7 +132,7 @@ TRANSLATION_CLASS_FINDER_TEMPLATE = ElementwiseTemplate( // Ensure levels are the same. if (box_levels[source_box_id] != box_levels[target_box_id]) { - *error_flag = 1; + atomic_or(error_flag, 1); PYOPENCL_ELWISE_CONTINUE; } @@ -148,7 +148,7 @@ TRANSLATION_CLASS_FINDER_TEMPLATE = ElementwiseTemplate( // Ensure valid translation class. if (translation_class == -1) { - *error_flag = 1; + atomic_or(error_flag, 1); PYOPENCL_ELWISE_CONTINUE; } diff --git a/boxtree/tree_build_kernels.py b/boxtree/tree_build_kernels.py index 3bab74b..9742c4c 100644 --- a/boxtree/tree_build_kernels.py +++ b/boxtree/tree_build_kernels.py @@ -878,7 +878,7 @@ LEVEL_RESTRICT_TPL = Template( box_force_split[child_box_id])) { box_force_split[box_id] = 1; - *have_upper_level_split_box = 1; + atomic_or(have_upper_level_split_box, 1); continue_walk = false; } } -- GitLab