[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12655] branches/cloth/blender: svn merge -r 12607:12653 https://svn.blender.org/svnroot/bf-blender/trunk/ blender + add OpenMP for msvc/gcc to scons, cmake and Makefiles ( libs + compiler flags are still missing in Makefiles)
Daniel Genrich
daniel.genrich at gmx.net
Thu Nov 22 21:28:24 CET 2007
Revision: 12655
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12655
Author: genscher
Date: 2007-11-22 21:28:24 +0100 (Thu, 22 Nov 2007)
Log Message:
-----------
svn merge -r 12607:12653 https://svn.blender.org/svnroot/bf-blender/trunk/blender + add OpenMP for msvc/gcc to scons, cmake and Makefiles (libs + compiler flags are still missing in Makefiles)
Modified Paths:
--------------
branches/cloth/blender/CMakeLists.txt
branches/cloth/blender/intern/elbeem/CMakeLists.txt
branches/cloth/blender/intern/elbeem/extern/elbeem.h
branches/cloth/blender/intern/elbeem/intern/attributes.cpp
branches/cloth/blender/intern/elbeem/intern/loop_tools.h
branches/cloth/blender/intern/elbeem/intern/ntl_vector3dim.h
branches/cloth/blender/intern/elbeem/intern/paraloopend.h
branches/cloth/blender/intern/elbeem/intern/particletracer.cpp
branches/cloth/blender/intern/elbeem/intern/simulation_object.cpp
branches/cloth/blender/intern/elbeem/intern/solver_class.h
branches/cloth/blender/intern/elbeem/intern/solver_init.cpp
branches/cloth/blender/intern/elbeem/intern/solver_interface.cpp
branches/cloth/blender/intern/elbeem/intern/solver_interface.h
branches/cloth/blender/intern/elbeem/intern/solver_main.cpp
branches/cloth/blender/intern/elbeem/intern/solver_util.cpp
branches/cloth/blender/intern/elbeem/intern/utilities.cpp
branches/cloth/blender/intern/elbeem/intern/utilities.h
branches/cloth/blender/projectfiles_vc7/blender/blenlib/BLI_blenlib.vcproj
branches/cloth/blender/release/scripts/bpymodules/BPyMessages.py
branches/cloth/blender/release/scripts/flt_export.py
branches/cloth/blender/release/scripts/flt_filewalker.py
branches/cloth/blender/release/scripts/flt_import.py
branches/cloth/blender/release/scripts/import_dxf.py
branches/cloth/blender/release/scripts/mesh_skin.py
branches/cloth/blender/release/scripts/mesh_wire.py
branches/cloth/blender/release/scripts/weightpaint_average.py
branches/cloth/blender/source/blender/blenkernel/BKE_lattice.h
branches/cloth/blender/source/blender/blenkernel/intern/armature.c
branches/cloth/blender/source/blender/blenkernel/intern/key.c
branches/cloth/blender/source/blender/blenkernel/intern/modifier.c
branches/cloth/blender/source/blender/blenkernel/intern/object.c
branches/cloth/blender/source/blender/blenloader/intern/readfile.c
branches/cloth/blender/source/blender/include/BSE_sequence.h
branches/cloth/blender/source/blender/makesdna/DNA_armature_types.h
branches/cloth/blender/source/blender/makesdna/DNA_key_types.h
branches/cloth/blender/source/blender/makesdna/DNA_modifier_types.h
branches/cloth/blender/source/blender/makesdna/DNA_sequence_types.h
branches/cloth/blender/source/blender/python/api2_2x/Mesh.c
branches/cloth/blender/source/blender/python/api2_2x/Window.c
branches/cloth/blender/source/blender/python/api2_2x/doc/Curve.py
branches/cloth/blender/source/blender/python/api2_2x/doc/Text3d.py
branches/cloth/blender/source/blender/python/api2_2x/doc/Texture.py
branches/cloth/blender/source/blender/python/api2_2x/doc/Window.py
branches/cloth/blender/source/blender/python/api2_2x/sceneSequence.c
branches/cloth/blender/source/blender/src/buttons_editing.c
branches/cloth/blender/source/blender/src/buttons_shading.c
branches/cloth/blender/source/blender/src/drawarmature.c
branches/cloth/blender/source/blender/src/drawimage.c
branches/cloth/blender/source/blender/src/drawseq.c
branches/cloth/blender/source/blender/src/edit.c
branches/cloth/blender/source/blender/src/editarmature.c
branches/cloth/blender/source/blender/src/editimasel.c
branches/cloth/blender/source/blender/src/editseq.c
branches/cloth/blender/source/blender/src/filesel.c
branches/cloth/blender/source/blender/src/poseobject.c
branches/cloth/blender/source/blender/src/sequence.c
branches/cloth/blender/source/blender/src/transform_conversions.c
branches/cloth/blender/source/gameengine/Converter/BL_SkinDeformer.cpp
Added Paths:
-----------
branches/cloth/blender/source/blender/blenlib/BLI_fnmatch.h
branches/cloth/blender/source/blender/blenlib/intern/fnmatch.c
Removed Paths:
-------------
branches/cloth/blender/intern/elbeem/intern/paraloop.h
branches/cloth/blender/intern/elbeem/intern/paraloopstart.h
Modified: branches/cloth/blender/CMakeLists.txt
===================================================================
--- branches/cloth/blender/CMakeLists.txt 2007-11-22 20:25:59 UTC (rev 12654)
+++ branches/cloth/blender/CMakeLists.txt 2007-11-22 20:28:24 UTC (rev 12655)
@@ -65,8 +65,9 @@
OPTION(WITH_QUICKTIME "Enable Quicktime Support" OFF)
OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" OFF)
OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
-OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
-OPTION(YESIAMSTUPID "Enable execution on 64-bit platforms" OFF)
+OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
+OPTION(YESIAMSTUPID "Enable execution on 64-bit platforms" OFF)
+OPTION(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" OFF)
IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
@@ -186,6 +187,12 @@
SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -DXP_UNIX -Wno-char-subscripts")
+ IF(WITH_OPENMP)
+ SET(LLIBS ${LLIBS} gomp)
+ SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-fopenmp")
+ SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-fopenmp")
+ ENDIF(WITH_OPENMP)
+
SET(PLATFORM_LINKFLAGS "-pthread")
INCLUDE_DIRECTORIES(/usr/include /usr/local/include)
@@ -270,6 +277,11 @@
SET(CMAKE_C_FLAGS_MINSIZEREL "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
+ IF(WITH_OPENMP)
+ SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "/openmp")
+ SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "/openmp")
+ ENDIF(WITH_OPENMP)
+
SET(SDL ${LIBDIR}/sdl)
SET(SDL_INC ${SDL}/include)
SET(SDL_LIB SDL)
@@ -347,6 +359,12 @@
SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
SET(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
+ IF(WITH_OPENMP)
+ SET(LLIBS ${LLIBS} gomp)
+ SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-fopenmp")
+ SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-fopenmp")
+ ENDIF(WITH_OPENMP)
+
SET(SDL ${LIBDIR}/sdl)
SET(SDL_INC ${SDL}/include)
SET(SDL_LIB SDL)
Modified: branches/cloth/blender/intern/elbeem/CMakeLists.txt
===================================================================
--- branches/cloth/blender/intern/elbeem/CMakeLists.txt 2007-11-22 20:25:59 UTC (rev 12654)
+++ branches/cloth/blender/intern/elbeem/CMakeLists.txt 2007-11-22 20:28:24 UTC (rev 12655)
@@ -36,5 +36,9 @@
ADD_DEFINITIONS(-DUSE_MSVC6FIXES)
ENDIF(WINDOWS)
+IF(WITH_OPENMP)
+ ADD_DEFINITIONS(-DPARALLEL)
+ENDIF(WITH_OPENMP)
+
BLENDERLIB_NOLIST(bf_elbeem "${SRC}" "${INC}")
#, libtype='blender', priority=0 )
Modified: branches/cloth/blender/intern/elbeem/extern/elbeem.h
===================================================================
--- branches/cloth/blender/intern/elbeem/extern/elbeem.h 2007-11-22 20:25:59 UTC (rev 12654)
+++ branches/cloth/blender/intern/elbeem/extern/elbeem.h 2007-11-22 20:28:24 UTC (rev 12655)
@@ -154,7 +154,7 @@
short volumeInitType;
/* name of the mesh, mostly for debugging */
- char *name;
+ const char *name;
} elbeemMesh;
// API functions
Modified: branches/cloth/blender/intern/elbeem/intern/attributes.cpp
===================================================================
--- branches/cloth/blender/intern/elbeem/intern/attributes.cpp 2007-11-22 20:25:59 UTC (rev 12654)
+++ branches/cloth/blender/intern/elbeem/intern/attributes.cpp 2007-11-22 20:28:24 UTC (rev 12655)
@@ -103,7 +103,7 @@
// set that a parameter can be given, and will be ignored...
bool AttributeList::ignoreParameter(string name, string source) {
- name=source=(""); // remove warning
+ name = source = ("");
return false;
}
Modified: branches/cloth/blender/intern/elbeem/intern/loop_tools.h
===================================================================
--- branches/cloth/blender/intern/elbeem/intern/loop_tools.h 2007-11-22 20:25:59 UTC (rev 12654)
+++ branches/cloth/blender/intern/elbeem/intern/loop_tools.h 2007-11-22 20:28:24 UTC (rev 12655)
@@ -54,16 +54,85 @@
-#define unused_GRID_REGION_END() \
- } /* main_region */ \
- // end unusedGRID_REGION_END
-
// -----------------------------------------------------------------------------------
#else // PARALLEL==1
-#include "paraloop.h"
+//#include "paraloop.h"
+#define PERFORM_USQRMAXCHECK USQRMAXCHECK(usqr,ux,uy,uz, calcMaxVlen, calcMxvx,calcMxvy,calcMxvz);
+#define LIST_EMPTY(x) calcListEmpty.push_back( x );
+#define LIST_FULL(x) calcListFull.push_back( x );
+#define FSGR_ADDPART(x) calcListParts.push_back( x );
+
+// parallel region
+//was: # pragma omp parallel default(shared)
+#if COMPRESSGRIDS!=1
+ // requires compressed grids...!
+ ERROR!
+#endif
+
+// loop start
+#define GRID_REGION_START() \
+ { \
+ \
+ \
+ if(mSizez<2) { \
+ mPanic = 1; \
+ errFatal("ParaLoop::2D","Not valid...!", SIMWORLD_GENERICERROR); \
+ } \
+ \
+ \
+ vector<LbmPoint> calcListFull; \
+ vector<LbmPoint> calcListEmpty; \
+ vector<ParticleObject> calcListParts; \
+ LbmFloat calcMxvx, calcMxvy, calcMxvz, calcMaxVlen; \
+ calcMxvx = calcMxvy = calcMxvz = calcMaxVlen = 0.0; \
+ calcListEmpty.reserve(mListEmpty.capacity() / omp_get_num_threads() ); \
+ calcListFull.reserve( mListFull.capacity() / omp_get_num_threads() ); \
+ calcListParts.reserve(mSizex); \
+ \
+ \
+ const int id = omp_get_thread_num(); \
+ const int Nthrds = omp_get_num_threads(); \
+ \
+ \
+ \
+ \
+ \
+ int kdir = 1; \
+ \
+ int kstart=getForZMinBnd(), kend=getForZMaxBnd(mMaxRefine); \
+ if(gridLoopBound>0){ kstart=getForZMin1(); kend=getForZMax1(mMaxRefine); } \
+ LbmFloat *ccel = NULL, *tcel = NULL; \
+ CellFlagType *pFlagSrc=NULL, *pFlagDst=NULL; \
+ \
+ \
+ if(mLevel[mMaxRefine].setCurr==1) { \
+ kdir = -1; \
+ int temp = kend; \
+ kend = kstart-1; \
+ kstart = temp-1; \
+ } \
+ \
+ const int Nj = mLevel[mMaxRefine].lSizey; \
+ int jstart = 0+( id * (Nj / Nthrds) ); \
+ int jend = 0+( (id+1) * (Nj / Nthrds) ); \
+ if( ((Nj/Nthrds) *Nthrds) != Nj) { \
+ errMsg("LbmFsgrSolver","Invalid domain size Nj="<<Nj<<" Nthrds="<<Nthrds); \
+ } \
+ \
+ if(jstart<gridLoopBound) jstart = gridLoopBound; \
+ if(jend>mLevel[mMaxRefine].lSizey-gridLoopBound) jend = mLevel[mMaxRefine].lSizey-gridLoopBound; \
+ \
+ debMsgStd("ParaLoop::OMP",DM_MSG,"Thread:"<<id<<" i:"<<istart<<"-"<<iend<<" j:"<<jstart<<"-"<<jend<<", k:"<<kstart<<"-"<<kend<<" ", 1); \
+ \
+
+
+
+
+// para GRID LOOP END is parainc3
+
#endif // PARALLEL==1
@@ -101,9 +170,11 @@
+
// old loop for COMPRESSGRIDS==0
#define old__GRID_LOOP_START() \
for(int k=kstart;k<kend;++k) { \
for(int j=1;j<mLevel[lev].lSizey-1;++j) { \
for(int i=0;i<mLevel[lev].lSizex-2; ) {
+
Modified: branches/cloth/blender/intern/elbeem/intern/ntl_vector3dim.h
===================================================================
--- branches/cloth/blender/intern/elbeem/intern/ntl_vector3dim.h 2007-11-22 20:25:59 UTC (rev 12654)
+++ branches/cloth/blender/intern/elbeem/intern/ntl_vector3dim.h 2007-11-22 20:28:24 UTC (rev 12655)
@@ -22,6 +22,7 @@
#include <math.h>
#include <string.h>
#include <stdio.h>
+#include <stdlib.h>
// hack for MSVC6.0 compiler
#ifdef _MSC_VER
Deleted: branches/cloth/blender/intern/elbeem/intern/paraloop.h
===================================================================
--- branches/cloth/blender/intern/elbeem/intern/paraloop.h 2007-11-22 20:25:59 UTC (rev 12654)
+++ branches/cloth/blender/intern/elbeem/intern/paraloop.h 2007-11-22 20:28:24 UTC (rev 12655)
@@ -1,50 +0,0 @@
-
-#define PERFORM_USQRMAXCHECK \
-_Pragma("omp critical") {\
-USQRMAXCHECK(usqr,ux,uy,uz, mMaxVlen, mMxvx,mMxvy,mMxvz); \
-} \
-
-
-#define LIST_EMPTY(x) \
-_Pragma("omp critical") {\
-mListEmpty.push_back( x ); }
-
-#define LIST_FULL(x) \
-_Pragma("omp critical") {\
-mListFull.push_back( x ); }
-
-#define FSGR_ADDPART(x) \
-_Pragma("omp critical") { \
-mpParticles->addFullParticle( x ); } \
-
-
-#define MAX_THREADS 2
-
-#define GRID_REGION_START() \
-{ /* main_region */ \
- int kstart=getForZMinBnd(), kend=getForZMaxBnd(mMaxRefine); \
- if(gridLoopBound>0){ kstart=getForZMin1(), kend=getForZMax1(mMaxRefine); } \
- int kdir = 1; \
- const int id=omp_get_thread_num(); \
- int jstart = (id*((mLevel[mMaxRefine].lSizey-gridLoopBound) / MAX_THREADS))+gridLoopBound; \
- int jend = (id+1)*((mLevel[mMaxRefine].lSizey-gridLoopBound)/ MAX_THREADS); \
- if(id+1 == MAX_THREADS) \
- { \
- jend = mLevel[mMaxRefine].lSizey-gridLoopBound; \
- } \
- LbmFloat *ccel = NULL, *tcel = NULL; \
- CellFlagType *pFlagSrc=NULL, *pFlagDst=NULL; \
- if(mLevel[mMaxRefine].setCurr==1) { \
- kdir = -1; \
- int temp = kend; \
- kend = kstart-1; \
- kstart = temp-1; \
- temp = id; /* dummy remove warning */ \
-} \
-
-// if(jstart<1) jstart = 1;
-
-#define unused_GRID_REGION_END() \
-} /* main_region */ \
- // end unusedGRID_REGION_END
-
Modified: branches/cloth/blender/intern/elbeem/intern/paraloopend.h
===================================================================
--- branches/cloth/blender/intern/elbeem/intern/paraloopend.h 2007-11-22 20:25:59 UTC (rev 12654)
+++ branches/cloth/blender/intern/elbeem/intern/paraloopend.h 2007-11-22 20:28:24 UTC (rev 12655)
@@ -7,7 +7,7 @@
/* COMPRESSGRIDS!=1 */
/* int i=0; */
/* ADVANCE_POINTERS(mLevel[lev].lSizex*2); */
-} /* all cell loop k,j,i */
+} /* all cell loop k,j,i */
if(doReduce) { } /* dummy remove warning */
} /* main_region */
Deleted: branches/cloth/blender/intern/elbeem/intern/paraloopstart.h
===================================================================
--- branches/cloth/blender/intern/elbeem/intern/paraloopstart.h 2007-11-22 20:25:59 UTC (rev 12654)
+++ branches/cloth/blender/intern/elbeem/intern/paraloopstart.h 2007-11-22 20:28:24 UTC (rev 12655)
@@ -1,3 +0,0 @@
-
-#pragma omp parallel num_threads(MAX_THREADS) \
-reduction(+: calcCurrentMass, calcCurrentVolume, calcCellsFilled, calcCellsEmptied, calcNumUsedCells)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list