Bill Allombert on Wed, 07 Jan 2026 22:14:33 +0100


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

Re: parforstep() available, but parsumstep() is missing


On Wed, Jan 07, 2026 at 08:31:31PM +0100, hermann@stamm-wilbrandt.de wrote:
> I would need parsumstep() to improved already impressive parsum() runtimes.
> 
> 
> I found parforstep() and simulated not yet available functionality. But
> result is poor, although only 20% isprime() tests are done, parforstep
> overhead is unacceptable:
> 
> hermann@7950x:~$ numactl -C 0-15 gp -q
> ? #
>    timer = 1 (on)
> ? parsum(k=1,10^9,isprime(k^2+(k+1)^2))
> cpu time = 6min, 49,486 ms, real time = 25,606 ms.
> 68588950
> ? c=0;parforstep(k=5,10^9,5,isprime(k^2+(k+1)^2),r,c+=r);c
> cpu time = 5min, 40,308 ms, real time = 2min, 39,913 ms.
> 22858489

I suggest:

? parsum(k=1,10^9\5,isprime((5*k)^2+((5*k)+1)^2))
%7 = 22858489
  cpu time 3min, 52,056 ms, real time 14,522 ms.

Cheers,
Bill.