commit 4b598e09a00c205dfd0d7276e0296c2443c4dba6
parent a3b98165385fab126f0bb7a13a1a5cce86100a3f
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Fri, 5 Jul 2024 11:24:01 +0200
Fix debug code being executed multiple times
When openMP runs in parallel, some debug code aimed at dumping connex
components is executed by every single thread. The correct behaviour is
to execute it just once.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/senc3d_scene_analyze.c b/src/senc3d_scene_analyze.c
@@ -1151,7 +1151,7 @@ group_connex_components
ASSERT(scn->analyze.enclosures_count == 1);
#ifndef NDEBUG
-#pragma omp single
+ #pragma omp single
{
/* Ensure reproducible cc_ids for debugging purpose */
*res = reorder_components(scn, connex_components, triangles_comp);
@@ -1164,6 +1164,7 @@ group_connex_components
cc_count = (component_id_t)tmp;
positions = darray_position_cdata_get(&scn->vertices);
+ #pragma omp single
if(dump_components) {
/* Do it now before any other problem can occur (fingers crossed).
* Do it sequential and not optimized as it is debug code.
@@ -1222,7 +1223,6 @@ group_connex_components
scene_cpt++;
}
-
ctx0.type = FCTX0;
ctx0.c.ctx0.triangles_comp = triangles_comp;
ctx1.type = FCTX1;