mersenneforum.org  

Go Back   mersenneforum.org > Factoring Projects > Factoring

Reply
 
Thread Tools
Old 2005-07-18, 13:09   #12
R.D. Silverman
 
R.D. Silverman's Avatar
 
Nov 2003

746010 Posts
Default

Quote:
Originally Posted by Prime95
Mr. Silverman was kind enough to send his source code for me to look at. Although I'm at somewhat of a disadvantage because I don't understand NFS, I do like computer optimization problems.

After looking at the amounts of data involved, I think my pie-in-the-sky no-sieve-array approach probably isn't best. Some kind of bucket sort looked most promising.

I've just emailed R.D. Silverman an updated source that cuts the sieving time by two-thirds. Whether this puts it on a par with Franke's siever, I do not know.

Unfortunately, I do not know NFS terminology so I cannot describe what I did. Mr. Silverman can fill y'all in later after he looks at what I've done.

I'm still learning how the code works and if I can find any further improvements I'll report them here.

Hi,

I just got the code. I will look at it ASAP. You seem to have implemented
some kind of bucket sieve. However, I need to look closely at what you
did. I tried a bucket sieve before and it was ineffective.

I believe your claims of speed improvement. If it truly reduces sieve time by 2/3, then I can turn to optimizing some other things that were not worth
doing before.

Thanks for the help. If you have any further comments on the code, let
me know.

I suspect that the code that does the resieving will need to be modified
in a different way from the primary sieve. Instead of adding a logarithm
to sieve[d][c], it instead checks to see

if (sieve[d][c] == GOOD)

then stores the prime, along with d and c. This storage does not happen too
often as most points are not successful candidates.

However, I expect that fetching sieve[d][c] to see if it is GOOD (i.e. a
potential candidate) is causing cache misses.
R.D. Silverman is offline   Reply With Quote
Old 2005-07-18, 13:18   #13
Chris Card
 
Chris Card's Avatar
 
Aug 2004

8216 Posts
Default

Quote:
Originally Posted by R.D. Silverman
Hi,
if (sieve[d][c] == GOOD)

then stores the prime, along with d and c. This storage does not happen too
often as most points are not successful candidates.

However, I expect that fetching sieve[d][c] to see if it is GOOD (i.e. a
potential candidate) is causing cache misses.
I do something very similar in my code, and this is where it spends most of its time according to gprof. On the other hand, it must be faster than not checking and simply updating the the sieve points, surely?

[I have had a go at your example with my siever, but there are a few problems, e.g. I haven't tried it with such a large factor base before, and my code only allows special q primes for the non-linear polynomial at the moment, so it's not been a very successful test so far.]

Chris
Chris Card is offline   Reply With Quote
Old 2005-07-18, 15:06   #14
R.D. Silverman
 
R.D. Silverman's Avatar
 
Nov 2003

22×5×373 Posts
Default

Quote:
Originally Posted by Chris Card
I do something very similar in my code, and this is where it spends most of its time according to gprof. On the other hand, it must be faster than not checking and simply updating the the sieve points, surely?

[I have had a go at your example with my siever, but there are a few problems, e.g. I haven't tried it with such a large factor base before, and my code only allows special q primes for the non-linear polynomial at the moment, so it's not been a very successful test so far.]

Chris
Hi,

I chose to do special q's for the linear polynomial, because for most
factorizations the linear norm is larger.

BTW, George Woltman got my code, got it running, and modified it in less
than 2 days. Kudos to George!! I was astonished at how fast he did this!
R.D. Silverman is offline   Reply With Quote
Old 2005-07-22, 15:28   #15
Prime95
P90 years forever!
 
Prime95's Avatar
 
Aug 2002
Yeehaw, FL

2·53·71 Posts
Default

Quote:
Originally Posted by Prime95
I've just emailed R.D. Silverman an updated source that cuts the sieving time by two-thirds.
This claim did not hold up. When benchmarked on a much larger factor base the savings were constant. That is, my small initial test case went from 3 seconds to 1 second, but the larger test case went from 8 seconds to 6 seconds.

The bucket sorting of vectors worked for dense smaller primes but not for the larger primes.

The good news is we can make these larger primes cache-friendly too. I allocate 128MB to hold the pending sieve updates. As I accumulate these I sort every 256KB while it is still in the L2 cache. When were done accumulating, we reread the 128MB from the beginning of each sorted chunk to insure that we update the sieve array in a cache-friendly way.

The improvements are significant. Source code is available for those that want to try something similar with their programs.
Prime95 is online now   Reply With Quote
Old 2005-07-24, 10:16   #16
ET_
Banned
 
ET_'s Avatar
 
"Luigi"
Aug 2002
Team Italia

10010110011112 Posts
Default

Quote:
Originally Posted by Prime95
The good news is we can make these larger primes cache-friendly too. I allocate 128MB to hold the pending sieve updates. As I accumulate these I sort every 256KB while it is still in the L2 cache. When were done accumulating, we reread the 128MB from the beginning of each sorted chunk to insure that we update the sieve array in a cache-friendly way.

The improvements are significant. Source code is available for those that want to try something similar with their programs.
I'd be interested. May you mail the code at mc5225 at mclink dot it?

Thank you

Luigi
ET_ is offline   Reply With Quote
Old 2006-01-12, 22:53   #17
R. Gerbicz
 
R. Gerbicz's Avatar
 
"Robert Gerbicz"
Oct 2005
Hungary

5CC16 Posts
Default

Mr. Silverman can you send me the old and the new code, only the sieving part. To
robert ( DOT ) gerbicz ( AT ) gmail ( DOT ) com
Can you post some timings for the new code ( if it is possible for the same input numbers) ?
To see exactly what has been done Mr. Woltman and what is in while loop, I can't figure out. And also to speed up the code if I can, not very probable, but say.
For an average p prime there are about area/p sieve updates, is it correct?

Last fiddled with by R. Gerbicz on 2006-01-12 at 23:02
R. Gerbicz is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
I'm getting an error when yafu wants to start lattice sieving Hailstone YAFU 30 2018-05-23 19:33
Lattice Sieving Parameters paul0 Factoring 6 2015-11-20 21:12
Lattice Sieving - where do I start? paul0 Factoring 3 2015-03-09 13:54
Line sieving vs. lattice sieving JHansen NFSNET Discussion 9 2010-06-09 19:25
A question on lattice sieving joral Factoring 5 2008-04-03 08:01

All times are UTC. The time now is 00:17.


Sat Jul 17 00:17:40 UTC 2021 up 49 days, 22:04, 1 user, load averages: 1.52, 1.62, 1.59

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.