hermann on Thu, 21 Mar 2024 00:16:01 +0100


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

Re: How to efficiently count Proth primes with GP parfor?


On 2024-03-20 23:59, Bill Allombert wrote:
On Wed, Mar 20, 2024 at 11:20:50PM +0100, hermann@stamm-wilbrandt.de wrote:
>
While using Karim's isProth2() I improved Bill's parallel work distribution
scheme.

Instead of blocks of size B=n\nbt now block are of size B=n\nbt\if(l,l,1). Since distribution of primes as well as distribution of Proth primes is not
the same for lower half ad higher half, making each of the 32 hardware
threaas work l smaller but more evenly distributed work areas.

Something else you can try is to increase nbt, to have smaller blocks.

Cheers,
Bill.

Hi,

the environment variable "l" does exactly that, create smaller blocks:
https://gist.github.com/Hermann-SW/558728c025a1f2d3dace008292bac897#file-proth-gp-L13-L14

...
doit(n,l)={
  my(c=0,B=n\nbt\if(l,l,1));
...

See 1st gist comment for effects for your (l=1 (or undefined)) and L=2/4/8:
https://gist.github.com/Hermann-SW/558728c025a1f2d3dace008292bac897?permalink_comment_id=4995469#gistcomment-4995469

Regards,

Hermann.