[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55938] trunk/blender: Add a gui control for setting omp threads in fluids

Jens Verwiebe info at jensverwiebe.de
Wed Apr 10 21:52:53 CEST 2013


Hi Brecht, aware of this, but:

> * There should be an "automatic" setting and it should be the default.

Thats what is to avoided, cause fluid sometimes work better with reduced threads or max threads to get, scenedependant.

> * Calling omp_set_num_threads this way will affect all parts of
> Blender that use OpenMP after running the fluid simulation, as the
> original state is not restored.

Aware of this, i think just about it
BTW:: i found same in sculpt, this should be taken care too i guess.( or is it reset there ? )

> * omp_set_num_threads should have an #ifdef arround it so compiling
> without OpenMP works

Right, i forgot this, sorry

Jens





Am 10.04.2013 um 21:38 schrieb Brecht Van Lommel <brechtvanlommel at pandora.be>:

> Hi Jens,
> 
> I think some changes should be made to this implementation:
> 
> * I don't think there should be a threads settings per fluid system.
> The user preferences seem a better place for this? People will forget
> to set this to optimal settings each time.
> * There should be an "automatic" setting and it should be the default.
> * omp_set_num_threads should have an #ifdef arround it so compiling
> without OpenMP works
> * Calling omp_set_num_threads this way will affect all parts of
> Blender that use OpenMP after running the fluid simulation, as the
> original state is not restored.
> 
> Thanks,
> Brecht.
> 
> On Wed, Apr 10, 2013 at 8:35 PM, jens verwiebe <info at jensverwiebe.de> wrote:
>> Revision: 55938
>>          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55938
>> Author:   jensverwiebe
>> Date:     2013-04-10 18:35:18 +0000 (Wed, 10 Apr 2013)
>> Log Message:
>> -----------
>> Add a gui control for setting omp threads in fluids
>> 
>> Modified Paths:
>> --------------
>>    trunk/blender/intern/elbeem/extern/elbeem.h
>>    trunk/blender/intern/elbeem/intern/simulation_object.cpp
>>    trunk/blender/release/scripts/startup/bl_ui/properties_physics_fluid.py
>>    trunk/blender/source/blender/editors/physics/physics_fluid.c
>>    trunk/blender/source/blender/makesdna/DNA_object_fluidsim.h
>>    trunk/blender/source/blender/makesrna/intern/rna_fluidsim.c
>>    trunk/blender/source/blender/modifiers/intern/MOD_fluidsim_util.c
>> 
>> Modified: trunk/blender/intern/elbeem/extern/elbeem.h
>> ===================================================================
>> --- trunk/blender/intern/elbeem/extern/elbeem.h 2013-04-10 16:59:55 UTC (rev 55937)
>> +++ trunk/blender/intern/elbeem/extern/elbeem.h 2013-04-10 18:35:18 UTC (rev 55938)
>> @@ -99,6 +99,8 @@
>>        elbeemRunSimulationCallback runsimCallback;
>>        /* pointer passed to runsimCallback for user data storage */
>>        void* runsimUserData;
>> +       /* simulation threads used by omp */
>> +       int threads;
>> 
>> } elbeemSimulationSettings;
>> 
>> 
>> Modified: trunk/blender/intern/elbeem/intern/simulation_object.cpp
>> ===================================================================
>> --- trunk/blender/intern/elbeem/intern/simulation_object.cpp    2013-04-10 16:59:55 UTC (rev 55937)
>> +++ trunk/blender/intern/elbeem/intern/simulation_object.cpp    2013-04-10 18:35:18 UTC (rev 55938)
>> @@ -19,6 +19,10 @@
>> #include "particletracer.h"
>> #include "elbeem.h"
>> 
>> +#if PARALLEL==1
>> +#include <omp.h>
>> +#endif
>> +
>> #ifdef _WIN32
>> #else
>> #include <sys/time.h>
>> @@ -173,6 +177,7 @@
>>                mpLbm->initDomainTrafo( mpElbeemSettings->surfaceTrafo );
>>                mpLbm->setSmoothing(1.0 * mpElbeemSettings->surfaceSmoothing, 1.0 * mpElbeemSettings->surfaceSmoothing);
>>                mpLbm->setIsoSubdivs(mpElbeemSettings->surfaceSubdivs);
>> +               omp_set_num_threads(mpElbeemSettings->threads);
>>                mpLbm->setSizeX(mpElbeemSettings->resolutionxyz);
>>                mpLbm->setSizeY(mpElbeemSettings->resolutionxyz);
>>                mpLbm->setSizeZ(mpElbeemSettings->resolutionxyz);
>> 
>> Modified: trunk/blender/release/scripts/startup/bl_ui/properties_physics_fluid.py
>> ===================================================================
>> --- trunk/blender/release/scripts/startup/bl_ui/properties_physics_fluid.py     2013-04-10 16:59:55 UTC (rev 55937)
>> +++ trunk/blender/release/scripts/startup/bl_ui/properties_physics_fluid.py     2013-04-10 18:35:18 UTC (rev 55938)
>> @@ -67,6 +67,7 @@
>>             # odd formatting here so translation script can extract string
>>             layout.operator("fluid.bake", text=iface_("Bake (Req. Memory: %s)") % fluid.memory_estimate,
>>                             translate=False, icon='MOD_FLUIDSIM')
>> +            layout.prop(fluid, "threads", text="Simulation Threads")
>>             split = layout.split()
>> 
>>             col = split.column()
>> 
>> Modified: trunk/blender/source/blender/editors/physics/physics_fluid.c
>> ===================================================================
>> --- trunk/blender/source/blender/editors/physics/physics_fluid.c        2013-04-10 16:59:55 UTC (rev 55937)
>> +++ trunk/blender/source/blender/editors/physics/physics_fluid.c        2013-04-10 18:35:18 UTC (rev 55938)
>> @@ -994,7 +994,7 @@
>>        /* ******** export domain to elbeem ******** */
>>        elbeemResetSettings(fsset);
>>        fsset->version = 1;
>> -
>> +       fsset->threads = domainSettings->threads;
>>        // setup global settings
>>        copy_v3_v3(fsset->geoStart, domainSettings->bbStart);
>>        copy_v3_v3(fsset->geoSize, domainSettings->bbSize);
>> 
>> Modified: trunk/blender/source/blender/makesdna/DNA_object_fluidsim.h
>> ===================================================================
>> --- trunk/blender/source/blender/makesdna/DNA_object_fluidsim.h 2013-04-10 16:59:55 UTC (rev 55937)
>> +++ trunk/blender/source/blender/makesdna/DNA_object_fluidsim.h 2013-04-10 18:35:18 UTC (rev 55938)
>> @@ -48,6 +48,9 @@
>> 
>> typedef struct FluidsimSettings {
>>        struct FluidsimModifierData *fmd; /* for fast RNA access */
>> +       /* threadcont the calculation is done with */
>> +       int threads;
>> +       int pad1;
>>        /* domain, fluid or obstacle */
>>        short type;
>>        /* display advanced options in fluid sim tab (on=1, off=0)*/
>> @@ -75,7 +78,7 @@
>>        int bakeStart, bakeEnd;
>>        /* offset for baked frames */
>>        int frameOffset;
>> -       int pad;
>> +       int pad2;
>>        /* g star param (LBM compressibility) */
>>        float gstar;
>>        /* activate refinement? */
>> 
>> Modified: trunk/blender/source/blender/makesrna/intern/rna_fluidsim.c
>> ===================================================================
>> --- trunk/blender/source/blender/makesrna/intern/rna_fluidsim.c 2013-04-10 16:59:55 UTC (rev 55937)
>> +++ trunk/blender/source/blender/makesrna/intern/rna_fluidsim.c 2013-04-10 18:35:18 UTC (rev 55938)
>> @@ -280,6 +280,11 @@
>> 
>>        /* standard settings */
>> 
>> +       prop = RNA_def_property(srna, "threads", PROP_INT, PROP_NONE);
>> +       RNA_def_property_int_sdna(prop, NULL, "threads");
>> +       RNA_def_property_range(prop, 1, 32);
>> +       RNA_def_property_ui_text(prop, "Simulation Threads", "Threads used to calculate the simulation");
>> +
>>        prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
>>        RNA_def_property_int_sdna(prop, NULL, "resolutionxyz");
>>        RNA_def_property_range(prop, 1, 1024);
>> 
>> Modified: trunk/blender/source/blender/modifiers/intern/MOD_fluidsim_util.c
>> ===================================================================
>> --- trunk/blender/source/blender/modifiers/intern/MOD_fluidsim_util.c   2013-04-10 16:59:55 UTC (rev 55937)
>> +++ trunk/blender/source/blender/modifiers/intern/MOD_fluidsim_util.c   2013-04-10 18:35:18 UTC (rev 55938)
>> @@ -75,6 +75,7 @@
>> 
>>                fss->fmd = fluidmd;
>>                fss->type = OB_FLUIDSIM_ENABLE;
>> +               fss->threads = 4;
>>                fss->show_advancedoptions = 0;
>> 
>>                fss->resolutionxyz = 65;
>> 
>> _______________________________________________
>> Bf-blender-cvs mailing list
>> Bf-blender-cvs at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers

_____________________________________

Jens Verwiebe
Allerskehre 44  -  22309 Hamburg

Tel.: +49 40 68 78 50
mobil: +49 172 400 49 07
mailto: info at jensverwiebe.de
web:  http://www.jensverwiebe.de
_____________________________________



More information about the Bf-committers mailing list