Bill Allombert on Sat, 31 Jan 2026 11:18:24 +0100


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

Re: Question about parallel execution...


On Fri, Jan 30, 2026 at 06:11:31PM -0600, David Cleaver wrote:
> Hello,
> 
> I've created a function, find_n, that performs calculations over a range of
> inputs [a,b].
> 
> For example, I have a 56 physical core computer (dual 28-core processors),
> I've tried Pari64-2-15-4-pthread.exe, Pari64-2-17-1-pthread.exe, and
> gppthread64-2-17-3.exe, they all show the same behavior.

Yes, GP pthread does not quite work on Windows due to poor thread local storage support,
that is why I do not link the -pthread binaries on the Download page.

I suggest you use the Windows subsystem for Linux instead,
see https://pari.math.u-bordeaux.fr/PDF/PARIwithWindows.pdf

This is the result I get on Linux on a 20 physical core system:

? find_n_in_range(1, 10, 1000)
Thread 1 found 334 and 333 : 9999
Thread 1 found 335 and 333 : 9999
Thread 1 found 336 and 333 : 9999
Thread 1 found 337 and 333 : 9999
Thread 1 found 338 and 333 : 9999
Thread 1 found 339 and 333 : 9999
time = 1,552 ms.
? find_n_in_range(2, 10, 1000)
Thread 1 found 334 and 333 : 9999
Thread 1 found 336 and 333 : 9999
Thread 2 found 335 and 333 : 9999
Thread 1 found 338 and 333 : 9999
Thread 2 found 337 and 333 : 9999
Thread 2 found 339 and 333 : 9999
cpu time = 1,614 ms, real time = 815 ms.
? find_n_in_range(5, 10, 1000)
Thread 1 found 335 and 333 : 9999
Thread 2 found 336 and 333 : 9999
Thread 5 found 334 and 333 : 9999
Thread 3 found 337 and 333 : 9999
Thread 5 found 339 and 333 : 9999
Thread 4 found 338 and 333 : 9999
cpu time = 1,618 ms, real time = 326 ms.
? find_n_in_range(10, 10, 1000)
Thread 5 found 334 and 333 : 9999
Thread 6 found 335 and 333 : 9999
Thread 7 found 336 and 333 : 9999
Thread 8 found 337 and 333 : 9999
Thread 9 found 338 and 333 : 9999
Thread 10 found 339 and 333 : 9999
cpu time = 1,617 ms, real time = 166 ms.

So parallelism is perfect for your example.

Cheers,
Bill.