Ruud H.G. van Tol on Tue, 10 Feb 2026 14:51:37 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Is short-circuit evaluation possible with parfor() ?



On 2026-02-10 14:18, hermann@stamm-wilbrandt.de wrote:
On 2026-02-10 10:26, Ruud H.G. van Tol wrote:

I expect it to be related to your nbthreads setting.

Mine is at 10. I hardly ever go over 12, to avoid overhead.
That is the reason why nbthreads is 16 on my 16C/32T AMD 7950X system.
And why nbthreads is 192 on my 192C/384T 8-socket server.
One gp thread per really existing core.

Sure, but cleaning up for 192 threads, just takes a bit more time than for half of that, etc. So also test with half the number, and then half again, to find out how much that matters.
Imagine how it has to set up return value lists, etc.


Now with return real time gets reduced to 17 seconds (and CPU time down to 50min from 1:37h)!

Yes. Also see that return or break doesn't matter, performance is the same.
The "&& break" leaves the for-loop, etc.

Proving BIG numbers prime can earn you 150,000 USD price money ;-)
https://www.eff.org/awards/coop

Good luck!

-- Ruud