mersenneforum.org  

Go Back   mersenneforum.org > Fun Stuff > Puzzles

Reply
 
Thread Tools
Old 2016-05-25, 18:30   #133
J F
 
J F's Avatar
 
Sep 2013

23×7 Posts
Default

No disagreement here. I do not really want or need a --start_string=<huge>.
In the absence of an offset I tried it as (non working) workaround.
So waiting for --lmin it is.
J F is offline   Reply With Quote
Old 2016-05-25, 19:02   #134
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

22×5×17×19 Posts
Default

Hopefully I can get around to testing tonight, but I had to make a number of changes to the asm code, which I probably broke because I'm not an x86 asm expert. All I can say is that it compiles right now. My first attempt to test will be to make sure that I didn't break what it does right now. Then I get to test the harder stuff.

Last fiddled with by rogue on 2016-05-25 at 19:03
rogue is online now   Reply With Quote
Old 2016-05-26, 00:27   #135
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

22·5·17·19 Posts
Default

Here is the latest, with source. I know this doesn't work because it crashes somewhere in the asm code. I do not know how easy the problem is to fix. Maybe someone with more asm experience than me can point out what I'm doing wrong.
Attached Files
File Type: 7z pixsieve.7z (37.5 KB, 120 views)
rogue is online now   Reply With Quote
Old 2016-05-27, 22:26   #136
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

11001001111002 Posts
Default

I believe that I have found and fixed the bug. You can find the latest executable and source here. Although only a Windows build is included, it should build and run on Linux and OS X. Unfortunately it crashes on OS X and I don't know why yet, so I'm still investigating.

I have added the -l parameter and I have added a -N parameter to start a new sieve. Previously it used the existence of the index file to determine if a new sieve would be started. An example of the usage would be:

Code:
pixsieve -l40000 -L50000 -S20 -P1e9 -spi.txt -iterms.txt -Rterms.pfgw -N
This will search for the string "20" in the decimal representation of the number in pi.txt. It will then sieve all numbers from 40000 to 50000 decimal digits that start with that "20" up to 1e9. The terms.txt file is only used for sieving more deeply after a sieve has completed, although I haven't tested that out. -R is the file that you need to input to pfgw. There is a -f option to output factors that can be validated with pfgw 3.8. You can also run with multiple threads, but I haven't tested that either. This will also output a compressed decimal representation of numbers with a factor.

Why pfgw 3.8? Previous versions of pfgw had a limit of 5000 characters for input strings. This means that it could not verify factors of numbers longer than that. I upped that limit to 5000000 characters.
rogue is online now   Reply With Quote
Old 2016-05-28, 00:41   #137
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

193C16 Posts
Default

Quote:
Originally Posted by rogue View Post
Unfortunately it crashes on OS X and I don't know why yet, so I'm still investigating.
The bug will affect linux too. It is no longer crashing as I found the cause, but the OS X build is missing factors where as the Windows build does not (based upon the testing I have done).
rogue is online now   Reply With Quote
Old 2016-05-28, 10:06   #138
J F
 
J F's Avatar
 
Sep 2013

1110002 Posts
Default

Did some quick tests, found some bugs, unfortunately not
only cosmetic ones. pixs1 is old version (v0.1), pixs2 new one (v1.1),
result file were deleted between runs.
-repeated runs with same input produce different results, multi-threaded both
versions, single-threaded v1.1 too, not sure if v0.1 single-threaded too
-sometime there are lines like
p=30523395, 598.5K p/sec, 496 terms left, 61.0% done
p=36397059, 1.573M p/sec, 490 terms left, 72.8% done
Shouldn't p be prime?
-writing intermediate file, v0.1 to _idx (-i), v1.1 to _NoF (-R)
-v1.1 incorrect updates '...terms left', probably same bug as the one above
-v1.1 crashes without -N, if there are no other files to continue from

Sample outputs:
Code:
t:\test>pixs1 -sPi1M.txt -S10 -i_idx -R_NoF -f_fac -L20000 -P1e8 -m1e9 -r20
pixsieve version 0.1.0 (testing)
Compiled May 14 2016 with GCC 4.9.2
Starting with 20000 terms
5285 terms remaining after removing terms divisible by 2, 3, and 5
Primes in X sieve initialized: n <= 20000
Sieve started: 3 <= p < 100000000
Thread 0 starting
p=2019331, 100.9K p/sec, 1128 terms left, 2.0% done
p=7032835, 250.5K p/sec, 1043 terms left, 7.0% done
...
Wrote 899 terms to output file `_idx'
p=85895171, 316.4K p/sec, 899 terms left, 85.9% done
p=92274691, 318.7K p/sec, 895 terms left, 92.3% done
p=98678787, 320.0K p/sec, 892 terms left, 98.7% done
Thread 0 completed
Waiting for threads to exit
Wrote 890 terms to output file `_idx'
Sieve complete: 3 <= p < 100000000
Found factors for 19110 terms, 890 remain
count=5761454,sum=0x0000fdf0985fb44a
Elapsed time: 344.53 sec. (0.02 init + 344.51 sieve) at 290272 p/sec.
Processor time: 336.57 sec. (0.02 init + 336.56 sieve) at 297132 p/sec.
Average processor utilization: 1.00 (init), 0.98 (sieve)

t:\test>dir _*
28.05.2016  10:45        43.998.817 _fac
28.05.2016  10:45             5.743 _idx
28.05.2016  10:45         8.889.704 _NoF

t:\test>pixs2 -sPi1M.txt -S10 -i_idx -R_NoF -f_fac -L20000 -P1e8 -m1e9 -r20 -N
pixsieve version 1.1 (testing)
Compiled May 27 2016 with GCC 4.9.2
Starting with 20000 terms
5285 terms remaining after removing ones divisible by 2, 3, and 5
Sieve started: 3 <= p < 100000000
Thread 0 starting
p=1370115, 68.50K p/sec, 949 terms left, 1.4% done
p=5648387, 213.8K p/sec, 943 terms left, 5.6% done
...
Wrote 943 terms to output file `_NoF'
p=67943427, 244.7K p/sec, 943 terms left, 67.9% done
...
p=98286595, 254.8K p/sec, 943 terms left, 98.3% done
Thread 0 completed
Waiting for threads to exit
Wrote 943 terms to output file `_NoF'
Sieve complete: 3 <= p < 100000000
Found factors for 19057 terms, 943 remain
count=5761454,sum=0x0000fdf0985fb44a
Elapsed time: 427.01 sec. (0.01 init + 427.00 sieve) at 234195 p/sec.
Processor time: 378.15 sec. (0.02 init + 378.13 sieve) at 264461 p/sec.
Average processor utilization: 2.23 (init), 0.89 (sieve)

t:\test>dir _*
28.05.2016  10:56        43.249.631 _fac
28.05.2016  11:03             6.095 _idx
28.05.2016  11:03         9.635.005 _NoF

t:\test>pixs2 -sPi1M.txt -S10 -i_idx -R_NoF -f_fac -L20000 -P1e8 -m1e9 -r20 -N -t4
pixsieve version 1.1 (testing)
Compiled May 27 2016 with GCC 4.9.2
Starting with 20000 terms
5285 terms remaining after removing ones divisible by 2, 3, and 5
Sieve started: 3 <= p < 100000000
Thread 3 starting
Thread 2 starting
Thread 1 starting
Thread 0 starting
p=6845443, 342.2K p/sec, 946 terms left, 6.8% done
p=24364035, 875.9K p/sec, 945 terms left, 24.4% done
p=43248643, 944.2K p/sec, 945 terms left, 43.2% done
p=63548419, 1.015M p/sec, 945 terms left, 63.5% done
p=84314115, 1.038M p/sec, 945 terms left, 84.3% done
Thread 3 completed
Thread 0 completed
Waiting for threads to exit
Thread 2 completed
Thread 1 completed
Wrote 945 terms to output file `_NoF'
Sieve complete: 3 <= p < 100000000
Found factors for 19055 terms, 945 remain
count=5761454,sum=0x0000fdf0985fb44a
Elapsed time: 114.96 sec. (0.01 init + 114.95 sieve) at 869931 p/sec.
Processor time: 397.16 sec. (0.02 init + 397.15 sieve) at 251798 p/sec.
Average processor utilization: 1.73 (init), 3.45 (sieve)

t:\test>dir _*
28.05.2016  11:16        43.273.849 _fac
28.05.2016  11:17             6.108 _idx
28.05.2016  11:17         9.611.857 _NoF

t:\test>pixs2 -sPi1M.txt -S10 -i_idx -R_NoF -f_fac -L20000 -P1e8 -m1e9 -r20 -N -t4
pixsieve version 1.1 (testing)
Compiled May 27 2016 with GCC 4.9.2
Starting with 20000 terms
5285 terms remaining after removing ones divisible by 2, 3, and 5
Sieve started: 3 <= p < 100000000
Thread 1 starting
Thread 0 starting
Thread 3 starting
Thread 2 starting
p=5359619, 267.7K p/sec, 943 terms left, 5.4% done
p=22938627, 878.7K p/sec, 943 terms left, 22.9% done
p=41423875, 923.2K p/sec, 943 terms left, 41.4% done
p=60315651, 944.6K p/sec, 943 terms left, 60.3% done
p=79875075, 977.9K p/sec, 943 terms left, 79.9% done
p=99307523, 971.6K p/sec, 943 terms left, 99.3% done
Thread 0 completed
Thread 3 completed
Thread 2 completed
Waiting for threads to exit
Thread 1 completed
Wrote 943 terms to output file `_NoF'
Sieve complete: 3 <= p < 100000000
Found factors for 19057 terms, 943 remain
count=5761454,sum=0x0000fdf0985fb44a
Elapsed time: 120.86 sec. (0.02 init + 120.84 sieve) at 827534 p/sec.
Processor time: 397.05 sec. (0.00 init + 397.05 sieve) at 251857 p/sec.
Average processor utilization: 0.00 (init), 3.29 (sieve)

t:\test>dir _*
28.05.2016  11:46        43.301.860 _fac
28.05.2016  11:48             6.093 _idx
28.05.2016  11:48         9.583.830 _NoF
J F is offline   Reply With Quote
Old 2016-05-28, 13:19   #139
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

22×5×17×19 Posts
Default

Very odd. I don't know how it could be testing p that are not prime, but I see that the original version did as well. I am uncertain how it could be missing factors. Maybe the old one was removing terms incorrectly. I'll have to do some runs. I'm also surprised that it is slower. It should be much faster. It was in the runs I did.
rogue is online now   Reply With Quote
Old 2016-05-28, 14:18   #140
J F
 
J F's Avatar
 
Sep 2013

708 Posts
Default

Quote:
Originally Posted by rogue View Post
... I'm also surprised that it is slower. It should be much faster. It was in the runs I did.
If it is missing factors, and as it seems not the same factors in repeated
runs, I'm not suprised that speed differs.
Also, I guess changing background load (which I had) would mess with timings
to some degree too. (I admit, I don't know how the runtime measurement
works exactly, whether it's counting only that cpu cycles when the threads are
really doing something, or to what extent it includes things like wait cycles
for data from higher lvl cache/RAM etc.)
J F is offline   Reply With Quote
Old 2016-05-28, 14:57   #141
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

193C16 Posts
Default

In doing some testing I found that the older version also misses factors. For that range you tested, there should only be 627 remaining terms. I remember yesterday fixing a bug with the original code that caused that, but the prime sieve issues might be just as big. Is it possible that some primes aren't being tested at all? Probably not, but I wonder how many numbers are being tested as divisors that aren't truly prime.

When I have some time I'm going to replace the prime number sieve with one that I know works. The one in this program originated years ago and was used by the original fpsieve.

That leaves a bug in the new code that was intended to speed up testing of ranges when using the new -l option. That code is likely responsible for the issues on the OS X build. When testing on Windows I ran into a very weird bug with gcc that I was able to work around, but maybe it doesn't work in all cases. Fortunately I have enough good data that I should be able to squash that bug when I have some time.
rogue is online now   Reply With Quote
Old 2016-05-31, 01:46   #142
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

22×5×17×19 Posts
Default

This is odd. I was reviewing the asm code and found that it was making some unnecessary comparisons. On the plus side, removing that code improved the performance of the application. In fact, it seems to be finding all of the factors on OS X right now, although I still have more testing to do. On the minus side, that same code does not behave in the same way on Windows and I don't know why, so it misses factors. Also on the minus side the OS X code crashes when it finishes the run, although I think that I figured that one out.
rogue is online now   Reply With Quote
Old 2016-05-31, 16:53   #143
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

23×1,201 Posts
Default

Incidentally, an interesting entry was added to PRPtop last month.
PIPrime(613373) (613373 digits, ...obviously) -- Adrian Bondrescu 05/2016
Batalov is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mersenne Primes p which are in a set of twin primes is finite? carpetpool Miscellaneous Math 3 2017-08-10 13:47
Distribution of Mersenne primes before and after couples of primes found emily Math 34 2017-07-16 18:44
Conjecture about Mersenne primes and non-primes v2 Mickey1 Miscellaneous Math 1 2013-05-30 12:32
A conjecture about Mersenne primes and non-primes Unregistered Information & Answers 0 2011-01-31 15:41
possible primes (real primes & poss.prime products) troels munkner Miscellaneous Math 4 2006-06-02 08:35

All times are UTC. The time now is 20:34.


Sat Nov 27 20:34:48 UTC 2021 up 127 days, 15:03, 0 users, load averages: 0.85, 1.12, 1.16

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.