fix for TPasMP.ParallelFor #7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
For my last Issue ;)
However, this did not resolve my problem
I have FOR i:= 0 to 1023 do someting
Version with pasmp
GlobalPasMP.Invoke(GlobalPasMP.ParallelFor(self,0,1023,myProcedure,12,4));
or
GlobalPasMP.Invoke(GlobalPasMP.ParallelFor(self,0,1023,myMethod,12,4));
sometimes not all CPU are used and I see Index list [slow version]
FromIndex..ToIndex
0..11 from thread #4
517..528 from thread #10
264..275 from thread #11
776..1023 from thread #6
137..263 from thread #7
529..775 from thread #1
276..516 from thread #9
12..136 from thread #8
sometimes alle CPU are used and I see Index list [fast version]
992..1003 from thread #0
15..26 from thread #6
47..58 from thread #7
7..14 from thread #4
27..31 from thread #8
79..90 from thread #9
64..70 from thread #5
0..6 from thread #2
39..46 from thread #1
32..38 from thread #3
71..78 from thread #10
111..122 from thread #11
103..110 from thread #8
59..63 from thread #2
and more and more ...... ;)
Can you provide a complete prepared test Delphi or FreePascal/Lazarus project for it? Because that would increase the chance that I will debug it later alongside my other activities in the moment.
I found where is problem
I called TPasMP.CreateGlobalInstance; and GlobalPasMP.Invoke(GlobalPasMP.ParallelFor
inside Thread1
After finish ParallelFor I free Thread1
Then I call new GlobalPasMP.Invoke(GlobalPasMP.ParallelFor but inside new Thread2
Then function CanSpread() always return FALSE :)
My solution is use
TPasMP.CreateGlobalInstance;
GlobalPasMP.Invoke(GlobalPasMP.ParallelFor ....
TPasMP.DestroyGlobalInstance;
Pull request closed