Re: Mersenne: Factoring on a P4 - CORRECTION

2001-06-23 Thread Brian J. Beesley


--- Forwarded message follows ---
From:   Brian J. Beesley [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Date sent:  Fri, 22 Jun 2001 18:46:43 -
Subject:Re: Mersenne: Factoring on a P4
Copies to:  [EMAIL PROTECTED]

On 22 Jun 2001, at 13:12, [EMAIL PROTECTED] wrote:

 For some reason, I am at a loss to explain, a v21  P4 1.4 GHz
 factors significantely slower that a P3 v20 700MHz.  Is there a
 reason, and solution, for this?

Good question.

AFAIK George has done nothing to the factoring code. You will see a
big speed loss if you compare factoring under 2^64 with factoring
over 2^64 on _any_ system - that's simply explained by triple-
precision integer arithmetic being much slower than double-precision
integer arithmetic.

Intel's development for the P4 was very much geared towards making
SSE2 work well. Unfortunately this left less room in the silicon for
some of the ordinary integer stuff on which the factoring code (but
not the LL testing code) in Prime95 depends. If memory serves me
right, the 32 bit by 32 bit integer multiply instruction was badly 
hit
by this. Consequently the factoring throughput of a P4 would be
expected to be considerably less than that of a PIII running at the
same clock speed. I would expect that a PIII-700 and a P4-1400 would
probably run factoring at about the same speed.
Earlier I wrote:

For now, those who are lucky enough to have P4 systems are probably
best advised to stick to LL testing (and trial factoring - which will
not be affected by any inefficiency in the P4 integer instructions),
leaving trial factoring to those with slower systems.

Slip of the brain, I'm afraid. I meant LL testing (and P-1 
factoring...

Incidentally ECM ought to run pretty well on the P4, though there may 
be some more optimization to come for the very small run lengths 
typically used by ECM.


Regards
Brian Beesley
_
Unsubscribe  list info -- http://www.scruz.net/~luke/signup.htm
Mersenne Prime FAQ  -- http://www.tasam.com/~lrwiman/FAQ-mers



Re: Mersenne: Proth observations

2001-06-23 Thread Brian J. Beesley

On 22 Jun 2001, at 13:42, Gordon Bower wrote:

 After seeing a post on this list a few weeks ago I decided to branch
 out and try a few ranges from Michael Hartley's page looking for
 k*2^n-1 primes. I must say there is a bit of a thrill in actually
 discovering a new prime every day I run the program instead of proving
 two numbers a month composite. :)

Yes, it does make a change.
 
 Anyway, a few curious observations I made, which surprised me:
 
 I have 2 computers, a P2-350 and P3-500. The program executes nearly 2
 1/2 times as fast on the latter as on the former with nothing else
 running. Apparently the Proth code takes advantage of a lot of P3
 features?

Yes, Proth 6.6 has prefetch code for PIII and Athlon CPUs.
 
 With the same version of prime95 and the same version of proth on each
 computer, if you run them both at the same time, under Win2000 proth
 gets a higher priority and all the processing power, while under NT4,
 it's the other way round, and prime95 has to be  stopped or have its
 priority reduced in the ini file to not smother proth. Curious. (Why
 run them both at once, you ask? If the computer is going to be on all
 night anyway, it'd be idle when proth finished a range unless prime95
 was ready to take over as soon as proth was done.)

There is a marked difference in the process timeslot allocation 
algorithm between NT4  W2K. (IMHO neither is as effective as the 
equivalent function in linux 2.2, further improved in linux 2.4, but 
that's a different story!) Also between Win95 and Win98. '95 behaves 
like NT4, and '98 behaves like W2K. Well, only on uniprocessor 
systems, since '9x/ME don't support SMP at all, but I think you get 
the drift?

My strategy is:

(1) run Proth at medium priority in factoring only mode to eliminate 
candidates with small factors;
(2) on the same system, run PRP at low priority to check the 
survivors from stage 1 for probable primes;
(3) on a different system (normally running Prime95), run Proth at 
medium priority to verify the probable primes. (If you don't have a 
spare system it would be best to do this in a seperate directory so 
as to save keep changing the Proth setup!)

(1) takes a lot less time than (2) so even if (2) stops temporarily 
that's not a problem. Not much survives (2) so run (3) takes little 
time, even though it's much slower per candidate than the others! BTW 
so far _every_ probable prime I've found using PRP has been accepted 
as a genuine prime by Proth, though this is certainly not guaranteed.
 
 I assumed that one value of k was pretty much the same as any other as
 far as execution time and the chance of finding primes. To my surprise
 this turned out not to be so: On the P3-500, for most 650k750, it
 takes about 5 hours for 16000n32000 and 12 hours for 32000n48000
 -- but for k=701 it took less than 2 and just over 6 hours,
 respectively. The phenomenon is reproducible, doesn't seem to be an
 artifact of other programs or reboots or suchlike. Any number
 theorists care to explain what is special about k=701 that makes it
 easy to check for primality?

If you break the run down as above you will see that some values of k 
yield a much smaller proportion of candidates for psuedo-prime 
testing than others. Or, to put it another way, some values of k give 
a much higher percentage of k.2^p-1 with small factors than others.

Conversely the slower values of k tend to yield a lot more primes 
than the faster ones. In fact, if your trial factoring strategy is 
reasonable, your average rate of discovery of primes will not depend 
much on the value of k - though it certainly will depend on the 
average value of n!

k.2^p+1 behaves similarly. In fact there are some values of k for 
which it is _proved_ (mathematically) that there are _no_ k.2^p+1 
primes, even though the lowest value of k for which this is true is 
still uncertain. (Or at least there was still work in progress last 
time I checked.) You may care to look up the Sierpinski Problem if 
you're interested in this.
 
 A fun project. Now if Michael would just put a stop to that pesky
 server error I could submit a half dozen more primes to him... :)

Yeah, I finished up my raft of blocks a couple of days ago, can't get 
any more  can't report results. No response to mail messages either. 
He may have gone on vacation.


Regards
Brian Beesley
_
Unsubscribe  list info -- http://www.scruz.net/~luke/signup.htm
Mersenne Prime FAQ  -- http://www.tasam.com/~lrwiman/FAQ-mers



RE: Mersenne: Proth observations

2001-06-23 Thread Hoogendoorn, Sander

Brian J. Beesley Wrote:

 My strategy is:

 (1) run Proth at medium priority in factoring only mode to eliminate 
 candidates with small factors;

For step 1 i use Newpgen. I think this is better configurable then proth in
how far or long you want to factor. Don't know which is the fastest of the
two.

 (2) on the same system, run PRP at low priority to check the 
 survivors from stage 1 for probable primes;
 (3) on a different system (normally running Prime95), run Proth at 
 medium priority to verify the probable primes. (If you don't have a 
 spare system it would be best to do this in a seperate directory so 
 as to save keep changing the Proth setup!)

 BTW so far _every_ probable prime I've found using PRP has been 
 accepted as a genuine prime by Proth, though this is certainly not 
 guaranteed.

Same here
 
 If you break the run down as above you will see that some values of k 
 yield a much smaller proportion of candidates for psuedo-prime 
 testing than others. Or, to put it another way, some values of k give 
 a much higher percentage of k.2^p-1 with small factors than others.

For some k's you have to test more the twice as many candidates in the same
range of n's

Sander
_
Unsubscribe  list info -- http://www.scruz.net/~luke/signup.htm
Mersenne Prime FAQ  -- http://www.tasam.com/~lrwiman/FAQ-mers