Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2014-06-08 02:13:28 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-06-08 02:39:02 +0400
commitf8f25c38d3352c7f480bbf1eba6415f76f62c76e (patch)
tree2da7ccbfe052f88d8d3306aa766de6a17bce3a4b /source/blender
parent918f6a49a7c0fcef29800460202cad40eeec99b5 (diff)
Fix T40510, revert openmp thread count to how it was in
2.70 for non Apple systems. Also refactored the code that restores the previous openmp thread count. The logic here was weird, mostly due to all the commit madness with Apple openmp support. The restored thread count though should not depend on the on/off state of threaded sculpting (since it has to do with systems other than sculpting only). For OSX threads are restored to the system thread count but Jens should recheck here.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenlib/BLI_threads.h2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c19
2 files changed, 10 insertions, 11 deletions
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index 1c9e75d950a..74291ca305e 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -74,8 +74,6 @@ void BLI_end_threaded_malloc(void);
int BLI_system_thread_count(void); /* gets the number of threads the system can make use of */
void BLI_system_num_threads_override_set(int num);
int BLI_system_num_threads_override_get(void);
-
-int BLI_system_thread_count_omp(void);
/* Global Mutex Locks
*
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index abbb8dd55ce..9324656309b 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -178,7 +178,7 @@ typedef struct StrokeCache {
float initial_mouse[2];
/* Pre-allocated temporary storage used during smoothing */
- int num_threads, max_threads;
+ int num_threads, init_num_threads;
float (**tmpgrid_co)[3], (**tmprow_co)[3];
float **tmpgrid_mask, **tmprow_mask;
@@ -3624,6 +3624,12 @@ static void sculpt_omp_start(Sculpt *sd, SculptSession *ss)
StrokeCache *cache = ss->cache;
#ifdef _OPENMP
+
+#if defined(__APPLE__)
+ cache->init_num_threads = BLI_system_thread_count();
+#else
+ cache->init_num_threads = omp_get_max_threads();
+#endif
/* If using OpenMP then create a number of threads two times the
* number of processor cores.
* Justification: Empirically I've found that two threads per
@@ -3632,13 +3638,12 @@ static void sculpt_omp_start(Sculpt *sd, SculptSession *ss)
#if defined(__APPLE__)
cache->num_threads = system_physical_thread_count();
#else
- cache->num_threads = omp_get_num_procs();
+ cache->num_threads = 2 * omp_get_num_procs();
#endif
}
else {
cache->num_threads = 1;
}
- cache->max_threads = omp_get_max_threads();
omp_set_num_threads(cache->num_threads);
#else
(void)sd;
@@ -3671,8 +3676,9 @@ static void sculpt_omp_start(Sculpt *sd, SculptSession *ss)
static void sculpt_omp_done(SculptSession *ss)
{
#ifdef _OPENMP
- omp_set_num_threads(ss->cache->max_threads);
+ omp_set_num_threads(ss->cache->init_num_threads);
#endif
+
if (ss->multires) {
int i;
@@ -4500,11 +4506,6 @@ static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(str
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
}
-#ifdef _OPENMP
- if (!(sd->flags & SCULPT_USE_OPENMP))
- omp_set_num_threads(BLI_system_thread_count()); /* set back to original logical corecount */
-#endif
-
sculpt_brush_exit_tex(sd);
}