hermann on Sun, 03 Dec 2023 17:16:25 +0100


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

Re: PARI/GP pthread questions


On 2023-12-03 13:15, Bill Allombert wrote:
Not sure I understand:

?
parforeach([1..8],v,my(t0=getabstime());factor(2^128+1);print(getabstime()-t0,"ms"))
32ms
35ms
35ms
35ms
35ms
36ms
35ms
32ms

Obviously if you do foursquares(2^p-1); for increasing p, this will take longer
and longer.

Thanks for bringing me back on track.

I changed the order of foursquare() computations, now from 23040 down to 23409:

readvec("foursquares.gp");
{
  export(foursquares);
  export(isfact);
  export(foursquares_fact);
  export(isthreesquares);
  export(threesquares_fact);
  parforeach([0..31],p,
    my(t0=getabstime());
    foursquares(2^(23440-p)-1);
    getabstime()-t0,
    t,
    print(p," ",t));
}


Mostly times reported are ever increasing.
But now that I output the p value as well, it is easy to see
that the reported times to compute for 2^(23440-p)-1 are OK.

Because I restricted with taskset, running below took 1600% CPU
until no more new jobs were available.

Only three times are lower than preceding time, which can happen
when a new job was started on a core (with "<" appended manually).

hermann@7950x:~$ taskset -c 0-15 gp -q < Mp.gp
26 2768
3 2858
22 5657
8 9710
4 11650
18 15284
31 26124
16 27896
6 27770   <
17 28474
10 28360  <
23 29847
1 34135
27 37177
19 45562
5 53377
21 52925   <
15 58213
2 72438
9 81265
7 82687
24 121605
11 122284
12 123877
13 131669
30 167992
14 186550
20 212513
0 226580
28 255568
29 266322
25 295941
hermann@7950x:~$