← Back to team overview

kicad-developers team mailing list archive

Re: Zone filling (was: MacOS + OpenMP)

 

Hi,

you implemented multiple workers yourself now?
I’ll have to check in detail.

I thought of just using OpenMP for the for loop again like this.
<<<
diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp
index 6fe40555a..408c5e7aa 100644
--- a/pcbnew/zone_filler.cpp
+++ b/pcbnew/zone_filler.cpp
@@ -118,6 +118,9 @@ void ZONE_FILLER::Fill( std::vector<ZONE_CONTAINER*> aZones )
     m_count_done = 0;
     std::thread fillWorker( [ this, toFill ]()
     {
+        #ifdef USE_OPENMP
+            #pragma omp for schedule(dynamic)
+        #endif
         for( unsigned i = 0; i < toFill.size(); i++ )
         {
             SHAPE_POLY_SET rawPolys, finalPolys;
>>>

Currently compiling, but my (test) clang with OpenMP is pretty picky about other OpenMP stuff… :(


Regards,
Bernhard

> On 3. Mar 2018, at 18:50, Jeff Young <jeff@xxxxxxxxx> wrote:
> 
> Hi Tomasz & Bernhard,
> 
> If you have a chance could you guys please take a look at https://git.launchpad.net/kicad/commit/?id=c77d13292b63a3ef7c28f004ee93f3ed93cca9f3 <https://git.launchpad.net/kicad/commit/?id=c77d13292b63a3ef7c28f004ee93f3ed93cca9f3> ?
> 
> It reinstates multi-threading (with thread pooling) to the zone filler.
> 
> Bernard is still looking for ways to make this a bit more elegant; this version just uses brute force for now.
> 
> Cheers,
> Jeff.
> 
> 
>> On 1 Mar 2018, at 14:58, Tomasz Wlostowski <tomasz.wlostowski@xxxxxxx <mailto:tomasz.wlostowski@xxxxxxx>> wrote:
>> 
>> On 01/03/18 15:43, Jeff Young wrote:
>>> The purpose is it works on Mac.
>>> 
>>> But it does appear I misread the std::max( omp_get_num_procs(), 2 ) part.
>>> 
>> 
>> Thanks Jeff!
>> 
>> Be aware that neither std::thread nor std::async have any concept of
>> thread pooling - we need to look for a suitable library or write or own.
>> 
>> Cheers,
>> Tom
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


Follow ups

References