star-enclosures-3d

Extract enclosures from 3D geometry
git clone git://git.meso-star.fr/star-enclosures-3d.git
Log | Files | Refs | README | LICENSE

commit efd30b9ec5bad416af326ee72274b6b342150945
parent 4f21c3b2bf5840f8bd12575a2c7aac92a9c288ed
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Thu, 12 Apr 2018 15:08:56 +0200

BugFix: thread count was not set at the correct time.

Need to reset it at the specified count everytime it is used.

Diffstat:
Msrc/senc_device.c | 4++--
Msrc/senc_device_c.h | 2+-
Msrc/senc_scene_analyze.c | 8++++----
3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/senc_device.c b/src/senc_device.c @@ -106,8 +106,8 @@ senc_device_create dev->logger = log; dev->allocator = allocator; dev->verbose = verbose; - dev->nthreads = MMIN(nthreads_hint, (unsigned)omp_get_num_procs()); - omp_set_num_threads((int)dev->nthreads); + /* Cannot use int args for MMIN here as default is -1 */ + dev->nthreads = (int)MMIN(nthreads_hint, (unsigned)omp_get_num_procs()); ref_init(&dev->ref); exit: diff --git a/src/senc_device_c.h b/src/senc_device_c.h @@ -27,7 +27,7 @@ struct senc_device { struct logger* logger; struct mem_allocator* allocator; int verbose; - unsigned nthreads; + int nthreads; ref_T ref; }; diff --git a/src/senc_scene_analyze.c b/src/senc_scene_analyze.c @@ -237,7 +237,7 @@ extract_connex_components } #endif - #pragma omp parallel + #pragma omp parallel num_threads(scn->dev->nthreads) { struct darray_side_id stack; darray_side_id_init(alloc, &stack); @@ -545,7 +545,7 @@ group_connex_components cc_count = (component_id_t)tmp; /* Cast rays to find links between connex components */ - #pragma omp parallel for + #pragma omp parallel for num_threads(desc->scene->dev->nthreads) for(ccc = 0; ccc < (int64_t)cc_count; ccc++) { component_id_t c = (component_id_t)ccc; struct s3d_hit hit = S3D_HIT_NULL; @@ -753,7 +753,7 @@ collect_and_link_neighbours ASSERT(scn->nutris == darray_triangle_tmp_size_get(triangles_tmp_array)); - #pragma omp parallel + #pragma omp parallel num_threads(scn->dev->nthreads) { const int thread_count = omp_get_num_threads(); const int rank = omp_get_thread_num(); @@ -980,7 +980,7 @@ build_result error_); triangles_enc = darray_triangle_enc_data_get(&desc->triangles_enc); - #pragma omp parallel + #pragma omp parallel num_threads(desc->scene->dev->nthreads) { struct htable_vrtx_id vtable; int64_t tt;