[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52913] trunk/blender/source/blender: add threshold for bmesh & openmp so its not used with low poly meshes, BM_OMP_LIMIT may need tweaking.
Campbell Barton
ideasman42 at gmail.com
Wed Dec 12 08:20:35 CET 2012
Revision: 52913
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52913
Author: campbellbarton
Date: 2012-12-12 07:20:34 +0000 (Wed, 12 Dec 2012)
Log Message:
-----------
add threshold for bmesh & openmp so its not used with low poly meshes, BM_OMP_LIMIT may need tweaking.
Modified Paths:
--------------
trunk/blender/source/blender/bmesh/bmesh_class.h
trunk/blender/source/blender/bmesh/intern/bmesh_marking.c
trunk/blender/source/blender/bmesh/intern/bmesh_mesh.c
trunk/blender/source/blender/bmesh/intern/bmesh_operators.c
trunk/blender/source/blender/editors/mesh/editmesh_utils.c
Modified: trunk/blender/source/blender/bmesh/bmesh_class.h
===================================================================
--- trunk/blender/source/blender/bmesh/bmesh_class.h 2012-12-12 06:57:41 UTC (rev 52912)
+++ trunk/blender/source/blender/bmesh/bmesh_class.h 2012-12-12 07:20:34 UTC (rev 52913)
@@ -277,5 +277,6 @@
* but should not error on valid cases */
#define BM_LOOP_RADIAL_MAX 10000
#define BM_NGON_MAX 100000
+#define BM_OMP_LIMIT 10000
#endif /* __BMESH_CLASS_H__ */
Modified: trunk/blender/source/blender/bmesh/intern/bmesh_marking.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_marking.c 2012-12-12 06:57:41 UTC (rev 52912)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_marking.c 2012-12-12 07:20:34 UTC (rev 52913)
@@ -165,7 +165,7 @@
int ok;
/* we can use 2 sections here because the second loop isnt checking edge selection */
-#pragma omp parallel sections
+#pragma omp parallel sections if (bm->totedge + bm->totface >= BM_OMP_LIMIT)
{
#pragma omp section
{
@@ -227,7 +227,7 @@
int ok;
/* we can use 2 sections here because the second loop isnt checking edge selection */
-#pragma omp parallel sections
+#pragma omp parallel sections if (bm->totedge + bm->totface >= BM_OMP_LIMIT)
{
#pragma omp section
{
@@ -848,7 +848,7 @@
/* fast path for deselect all, avoid topology loops
* since we know all will be de-selected anyway. */
-#pragma omp parallel for schedule(dynamic)
+#pragma omp parallel for schedule(dynamic) if (bm->totvert + bm->totedge + bm->totface >= BM_OMP_LIMIT)
for (i = 0; i < 3; i++) {
BMIter iter;
BMElem *ele;
Modified: trunk/blender/source/blender/bmesh/intern/bmesh_mesh.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_mesh.c 2012-12-12 06:57:41 UTC (rev 52912)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_mesh.c 2012-12-12 07:20:34 UTC (rev 52913)
@@ -71,7 +71,7 @@
bm->etoolflagpool = BLI_mempool_create(sizeof(BMFlagLayer), max_ii(512, bm->totedge), 512, 0);
bm->ftoolflagpool = BLI_mempool_create(sizeof(BMFlagLayer), max_ii(512, bm->totface), 512, 0);
-#pragma omp parallel sections
+#pragma omp parallel sections if (bm->totvert + bm->totedge + bm->totface >= BM_OMP_LIMIT)
{
#pragma omp section
{
@@ -468,7 +468,7 @@
BM_ELEM_INDEX_VALIDATE(bm, "Should Never Fail!", __func__);
#endif
-#pragma omp parallel sections
+#pragma omp parallel sections if (bm->totvert + bm->totedge + bm->totface >= BM_OMP_LIMIT)
{
#pragma omp section
{
Modified: trunk/blender/source/blender/bmesh/intern/bmesh_operators.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_operators.c 2012-12-12 06:57:41 UTC (rev 52912)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_operators.c 2012-12-12 07:20:34 UTC (rev 52913)
@@ -599,7 +599,7 @@
BMElemF *ele;
int i;
-#pragma omp parallel for schedule(dynamic)
+#pragma omp parallel for schedule(dynamic) if (bm->totvert + bm->totedge + bm->totface >= BM_OMP_LIMIT)
for (i = 0; i < 3; i++) {
if (htype & flag_types[i]) {
BM_ITER_MESH (ele, &iter, bm, iter_types[i]) {
@@ -1176,7 +1176,7 @@
bm->etoolflagpool = BLI_mempool_create(sizeof(BMFlagLayer) * bm->totflags, max_ii(512, bm->totedge), 512, 0);
bm->ftoolflagpool = BLI_mempool_create(sizeof(BMFlagLayer) * bm->totflags, max_ii(512, bm->totface), 512, 0);
-#pragma omp parallel sections
+#pragma omp parallel sections if (bm->totvert + bm->totedge + bm->totface >= BM_OMP_LIMIT)
{
#pragma omp section
{
@@ -1257,7 +1257,7 @@
bm->etoolflagpool = BLI_mempool_create(new_totflags_size, bm->totedge, 512, 0);
bm->ftoolflagpool = BLI_mempool_create(new_totflags_size, bm->totface, 512, 0);
-#pragma omp parallel sections
+#pragma omp parallel sections if (bm->totvert + bm->totedge + bm->totface >= BM_OMP_LIMIT)
{
#pragma omp section
{
@@ -1328,7 +1328,7 @@
BMIter iter;
const int totflags_offset = bm->totflags - 1;
-#pragma omp parallel sections
+#pragma omp parallel sections if (bm->totvert + bm->totedge + bm->totface >= BM_OMP_LIMIT)
{
/* now go through and memcpy all the flag */
#pragma omp section
Modified: trunk/blender/source/blender/editors/mesh/editmesh_utils.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_utils.c 2012-12-12 06:57:41 UTC (rev 52912)
+++ trunk/blender/source/blender/editors/mesh/editmesh_utils.c 2012-12-12 07:20:34 UTC (rev 52913)
@@ -409,7 +409,7 @@
em->face_index = MEM_mallocN(sizeof(void **) * em->bm->totface, "em->face_index");
}
-#pragma omp parallel sections
+#pragma omp parallel sections if (em->bm->totvert + em->bm->totedge + em->bm->totface >= BM_OMP_LIMIT)
{
#pragma omp section
{
@@ -1306,7 +1306,7 @@
/* Use tag flag to remember what was hidden before all is revealed.
* BM_ELEM_HIDDEN --> BM_ELEM_TAG */
-#pragma omp parallel for schedule(dynamic)
+#pragma omp parallel for schedule(dynamic) if (em->bm->totvert + em->bm->totedge + em->bm->totface >= BM_OMP_LIMIT)
for (i = 0; i < 3; i++) {
BM_ITER_MESH (ele, &iter, em->bm, iter_types[i]) {
BM_elem_flag_set(ele, BM_ELEM_TAG, BM_elem_flag_test(ele, BM_ELEM_HIDDEN));
More information about the Bf-blender-cvs
mailing list