3 ms·
That's useful and info that the article did not have, but so I know where the start and end of each popcount count region is At which point you know the width o
by Retric 15y ago
That's useful and info that the article did not have, but so I know where the start and end of each popcount count region is At which point you know the width of each row and can keep a running total for the progress bar as the row finishes. Again this is only important because randomly assigning threads significantly degrades performance.
"The code I came up with has one single-threaded code, of O(N) time, and after the final barricade. I don't see how any other solution has less contention."
//I will assume your O(N) code is basically N=numer of fingerprints, B = number of OS level threads.
for (x=0, x < N, x++) {for (y=0, y < B, y++) { total[x]+= arraylist[y][x];}}
It's easy to turn this into multi threaded code because each x can be calculated independently. The other optimization where worker threads that run out of job add up their totals to each other which is then added to the end result is the other multi threaded speedup. With it's own set of tradeoffs.
PS: You can always optimize more, but it's midnight and I am not staying up to think about this any more. Anyway, thanks for sharing.