This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's General Open Topic subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Open Topic & United-TI Talk => General Open Topic
United-TI Archives -> Open Topic & United-TI Talk
 
    » Goto page 1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
» View previous topic :: View next topic  
Author Message
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 04 Aug 2009 08:09:10 pm    Post subject:

OK, guys, here we go. If you're just tuning in: factoring the "0A" key will enable us to load third-party OSes on the TI-84+ (BE/SE), without the use of additional (potentially risky) software.

Here's how it works:

- First of all, you will need to have libgmp (including devel files: libgmp3-dev on Debian/Ubuntu) installed. You will also need Perl. In addition, you will need some disk space (a few gigabytes at minimum) and a bit of spare RAM (maybe 100-150 megabytes per thread.)

- Next, download and compile GGNFS. There are some Windows binaries available, but I have not tested them. For other platforms, download the latest code, and compile it by running 'make <your-cpu-model>' (run simply 'make' for a list of supported targets.)

For x86-64 systems, I recommend using the "experimental" siever, which can be found in the src/experimental/lasieve4_64 subdirectory (instructions for compiling are in the INSTALL file.)

- Download [attachment=2730:factMsieveQ.pl.txt]
(Rename it to factMsieveQ.pl because the forum is silly.) Open it in your favorite text editor. Change the 'GGNFS_BIN_PATH' to the name of the directory containing your GGNFS executables, and change the 'NUM_CPUS' to the number of CPU cores you have.

- Choose a range of q values to work on. (See below.) Post in this thread, or email me privately, to reserve a range.

- Download [attachment=2729:k0A.txt]
Open it in your favorite text editor, and replace <STARTING VALUE HERE> and <ENDING VALUE HERE> with the values you chose. Save the result as k0A.poly.

- Run './factMsieveQ.pl k0A.poly'. This will take a long time. I suggest running it inside a 'screen' session, so you can run it in the background without keeping the terminal window open.

On most Unix-like systems, you should be able to pause the job by pressing Ctrl+Z, then resume it by typing 'fg'. If you need to stop the job for a long period of time, or reboot, or whatever, then press Ctrl+C to stop the job completely. You can then pick up where you left off by running './factMsieveQ.pl k0A.poly' again. (Note that when you do this, you may miss a few relations and/or get some duplicates. This isn't anything to worry about too much, it just means we may take a bit longer to finish.)

- Once you've finished your region, report your results here.

Now, about selecting your q values:
- The "best" q-values are going to be between 13 million and 27 million. As we move to smaller and larger q values, the number of relations per q-value will decrease. So let's start out by sieving the 13M-27M region, then move upwards and downwards as necessary. We're going to need somewhere in the neighborhood of 50 million total relations to finish the job.
- Start out by reserving small ranges until you have an idea of how long they'll take. :)

Reserved ranges so far:
(I will update this list as we go, but check the thread as well):
1M-2M limx (done, 847375 relations)
2M-6M BOINC clients
6M-8M Skittle (done, 2582020 relations)
8M-10M Skittle (done, 2606379 relations)
10M-13M fullmetalcoder (done, 4054840 relations)
13M-15M FloppusMaximus (done, 2745936 relations)
15M-17M Taricorp (done, 2764376 relations)
17M-20M fullmetalcoder (done, 4161960 relations)
20M-22M FloppusMaximus (done, 2765854 relations)
22M-25M Skittle (done, 4128280 relations)
25M-34M BOINC clients (done)
34M-35M FloppusMaximus (done, 1255021 relations)
35M-36M FloppusMaximus (done, 1254880 relations)
36M-44M BOINC clients
44M-45M FloppusMaximus (done, 1156504 relations)
45M-46M limx (done, 1153281 relations)
46M-50M BOINC clients


Last edited by Guest on 21 Aug 2009 05:10:11 pm; edited 1 time in total
Back to top
Taricorp


Member


Joined: 09 Mar 2006
Posts: 188

Posted: 04 Aug 2009 11:34:46 pm    Post subject:

I've got two threads working on the 15M-17M range now.

The windows binaries are working just fine with ActivePerl for me, but you'll need to invoke perl explicitly from a command prompt:

Code:
perl factMsieveQ.pl k0A.poly
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 04 Aug 2009 11:58:40 pm    Post subject:

Cool! And thanks for the tip.
Back to top
Graphmastur


Advanced Member


Joined: 25 Mar 2009
Posts: 360

Posted: 05 Aug 2009 03:43:55 pm    Post subject:

Hey, I have a quick question. The number in the .pub file needs to be factored into to prime numbers, correct?
Back to top
fullmetalcoder


Member


Joined: 01 Aug 2009
Posts: 139

Posted: 05 Aug 2009 04:06:54 pm    Post subject:

I'll be sieving shortly on the 17M-20M range (it's gonna be a bit of a hassle but even a broken gfx driver won't stop me, actually it'll even make it faster as my laptop won't be doing anything but sieving).
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 05 Aug 2009 05:55:17 pm    Post subject:

Graphmastur: That's correct. The .pub files that are included with Rabbitsign contain the public keys (stored in the same little-endian, length-prefixed form that's used by TI's official key files.) I posted a script over in the other thread, which you can use to convert that into a decimal integer. It is possible that I made a mistake somewhere, so you may want to verify that the key actually does what it claims, before you start trying to factor it. Smile
Back to top
Graphmastur


Advanced Member


Joined: 25 Mar 2009
Posts: 360

Posted: 05 Aug 2009 07:00:04 pm    Post subject:

FloppusMaximus wrote:
Graphmastur: That's correct. The .pub files that are included with Rabbitsign contain the public keys (stored in the same little-endian, length-prefixed form that's used by TI's official key files.) I posted a script over in the other thread, which you can use to convert that into a decimal integer. It is possible that I made a mistake somewhere, so you may want to verify that the key actually does what it claims, before you start trying to factor it. Smile

Thanks, so I am doing it right.

I actually created a small java program that converts it to an integer, and does a brute force attack. The good part is that if a main server program was to run on one computer, You could have it connect, and test certain sections for numbers, essentially, making it be able to be span across multiple computers, while having a server deal with dividing up the sections to do, and have the client program take care of doing the actual tests, and responding back with the results for the original one, and possibly ask for another section to work on.

It could span multiple computers, with a few tweaks to the main program. Right now, it is working on the 08 key. The pseudo code is this:

  1. Have the server program on some ip address, listening for connections on some port, say 120, since that's the first port off the top of my head.
  2. When it sees a client program try to access it, it gives it a key (without the 0x40 size byte), and then gives it a start and a finish to work on.
  3. The client program then works on the key, until it is done.
  4. When it is done, it sends all the the numbers that it thinks are prime, and all of the factors, and sends them, to say part 121.
  5. The server program puts it into a text file, in the correct order. (Not necessarily have to, it would be better to sort later)
  6. The client program, then has the ability to send another request on port 120, and it starts over at step 2.
  7. The server, once it has finished all of the sections, would then, and go through each 2 numbers, and make sure that they are prime. (The first prime test is not quite accurate, because there, I chose speed over accuracy.)
  8. It then goes through, and rates them by their bit length, to (I'm not exactly sure how you know exactly. Any Ideas?)

That's the basic idea, anyway. Steps 7 and 8 would be the same process for doing it on a single computer. (Which I will release after getting all of the bugs out.)

These next few paragraphs are not to be worried about until I actually release the single computer one: (You can read it if you want, to see my progress.)
EDIT: I just checked, and it had checked about 3 billion in less than an hour.
The current program checks every odd number, because an even number is never prime. Anything else I can use to narrow it down? Right now, I am using the BigInteger class, because it is 64 bytes, so a long var is out of the question. It does mod of a number, and if the result is 0, it checks if it is prime. If either one is prime, it stores it in a file. It only shows every 10000 as the increment. (I feel like I'm forgetting something. I hope not.)
EDIT2: Oh yeah! Okay so it is slow, but the good news is that you can specify starting/ending points. Which is useful, if you want to be able to type in a few "at" commands on the cmd line, so you can turn your computer on in the morning, have it do a start value, at a certain time, have it run, say 10 billion results, and have it shut down 30 minutes before you come home, just in case your computer is on burning up you cpu, and to preserve ram.

A few more quick things. When I originally ran this, it showed about 1.15 gb of memory being used, and 108.3 on my cpu on my mac. I have no data on my windows, due to the fact that while running this, at full cpu speed (AboveNormal or high, but not realtime. You will regret it if you put it on realtime, trust me.), the only thing that could stop it was a ctrl-c. If you break out of the program, do the second to last result as the start parameter, not the last.

The first argument is the key, without the size byte. (I am not sure if BigInteger uses big endian, or not. I don't know how to check that.) The second arg is optional, which is the start byte. If excluded, it is assumed 0. The third arg is optional, but if the second arg is used, 0 or otherwise, it can be used to tell it on what number to end.


Last edited by Guest on 05 Aug 2009 07:24:10 pm; edited 1 time in total
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 05 Aug 2009 07:26:52 pm    Post subject:

Um... I'm not quite sure what you're saying. By a "brute force attack", are you talking about trial division? Because that will not work. The only way anyone can factor a number of this size is using the GNFS, or possibly (with many CPU-years of work) the quadratic sieve.

With regard to creating a server for assigning GNFS work, it's certainly possible, but realize that it doesn't just involve asking the clients "hey, have you found any factors yet?" Factoring with the GNFS requires collecting a huge amount of data from all of the sievers at once, and combining that together to perform the actual factorization.

Anyway, I created this thread to discuss the factorization of the 0A key in particular, so let's not go too far off topic.
Back to top
thornahawk
μολών λαβέ


Active Member


Joined: 27 Mar 2005
Posts: 569

Posted: 05 Aug 2009 08:37:28 pm    Post subject:

Indeed, trial division (dividing a candidate composite with all primes less and equal to the square root of that number) is impractical for numbers that most likely are the product of two huge primes. You'd be better off using the Pollard or CF factorizations, but they too are still slower than GNFS. That's why Floppus and others are using that and not the other algorithms.

Anyway, enough off-topicry.

thornahawk
Back to top
fullmetalcoder


Member


Joined: 01 Aug 2009
Posts: 139

Posted: 06 Aug 2009 10:19:17 am    Post subject:

I'm having some trouble. I ran the siever for a couple of hours and everything goes fine until the end of a "step" (100000 by default I think). At that point I get some console output that looks like a summary and a segfault. Anyone knows what might go wrong? My guess is something about threading since I get two similar ouputs (running two threads) and the segfault occurs at the end of the second but it might as well be something else after completion of the two jobs. So far my investigation of the factMsieve script did not lead me anywhere and I have no idea how to debug a perl script...

By the way it looks like the script will restart from the beginning in this case (step finished but not "validated"), anyone knows I may trick it into resuming properly, or "validating" the step by hand?
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 06 Aug 2009 09:08:06 pm    Post subject:

That's bad. At what point exactly does the segfault occur? Is perl crashing, or the siever, or something else?

The factMsieve script determines where to start sieving by reading the 'q0' value from the job file (if there isn't a job file, it will use the q0 value from the poly file, and if that isn't defined I believe it defaults to alim/2.) You can manually update the job file if you want, I guess, but if I were you, I'd try to figure out why it's crashing. Smile
Back to top
fullmetalcoder


Member


Joined: 01 Aug 2009
Posts: 139

Posted: 07 Aug 2009 04:12:49 am    Post subject:

Did a bit of debugging and it looks like the segfault occurs in perl, more precisely in the Math::BigInt::GMP module upon exit of a function, apparently because of a double free. So my guess is that each thread is given a reference to the same BigInt and destroys it upon completion instead of letting the caller take care of it. Embarassing but I suppose just disabling GMP would do as none of you have faced a similar issue.

The only question left is : how can I properly resume sieving without loosing the data collected thus far? (or is that data already suitable for sharing?)

edit :
* I disabled GMP in the perl script and the segfault is gone
* I fiddled with the setup and makeJobFile functions to prevent overwriting of some files upon start and it apparently worked so I'm back to sieving.

Side note : I got ~140k relations for a 100k window. Is that an average value to expect (or high, or low) ?


Last edited by Guest on 07 Aug 2009 04:41:31 am; edited 1 time in total
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 07 Aug 2009 12:57:51 pm    Post subject:

140k relations is about what I'm getting for each interval. It's about the same yield as what I got for the 04 key, although it seems to be a bit slower to find them.

If you want to know exactly how far you got with your previous attempt, I believe the current q value is always the last hex number on each line of the output.
Back to top
DigiTan
Unregistered HyperCam 2


Super Elite (Last Title)


Joined: 10 Nov 2003
Posts: 4468

Posted: 07 Aug 2009 04:22:51 pm    Post subject:

All this talk of PERL and makefiles makes me wish I knew how to compile instead of just using repositories. Razz
Back to top
fullmetalcoder


Member


Joined: 01 Aug 2009
Posts: 139

Posted: 08 Aug 2009 12:48:21 pm    Post subject:

about 25% done (went beyond 1M relations). If everything goes well I should be done with my segment within 5 days and be able to pick another 2M segment.
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 08 Aug 2009 04:54:49 pm    Post subject:

13M-15M finished last night, with 2745936 relations. I'm starting on 20M-22M now.
Back to top
squalyl


Advanced Newbie


Joined: 04 Aug 2009
Posts: 57

Posted: 10 Aug 2009 04:29:15 am    Post subject:

what about using BOINC for these calculations?

This could allow anyone to join the factorization effort, share the computing power, and manage the whole set of keys at once.

I've set up a project on my server [1], it works, what remains to be done is:

- generating workunits
- writing a cruncher (I believe this will be a recompilation of the lattive siever using the BOINC api)
- result gathering.

The first concept is not yet clear for me, so if anyone has time and experience in this domain this would be appreciated. I'm mistaken in the differences between workunits, workunits names, input files, and database entries, and how to get the whole thing going. I can do this with time, but I'm short on this one.

Writing a cruncher does not seem too difficult. note: it should be statically linked to avoid any gmp/etc dependencies.

What do you think?

[1] http://boinc.unsads.com/rsals/user


Last edited by Guest on 10 Aug 2009 04:30:33 am; edited 1 time in total
Back to top
Taricorp


Member


Joined: 09 Mar 2006
Posts: 188

Posted: 10 Aug 2009 11:42:09 am    Post subject:

Results for 15-17M are in. Grab them here. (5528752 relations, best I can tell [grep -o "," k0A.[range].rels | wc -l])

Additional note for Windows users- unless you set COMPRESS_RELATIONS to 0 before running, it'll abort and note it can't find gzip.exe once it finishes the entire set. You can either get a copy of gzip.exe and put it in that directory (meh), or just compress k0A.[range].rels yourself once it finishes.
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 10 Aug 2009 08:45:01 pm    Post subject:

Excellent. Thank you very much! I doubt you got 5.5 million relations, though... and a simple "wc -l" will suffice.

squalyl: Using BOINC is certainly an interesting idea. Adapting the GGNFS siever, though, could be quite challenging. I don't know much of anything about how BOINC works internally, and I don't really have time to work on it right now, but I may be able to help out a little with the mathematical side of things. Smile
Back to top
fullmetalcoder


Member


Joined: 01 Aug 2009
Posts: 139

Posted: 11 Aug 2009 03:07:27 am    Post subject:

66% done (2.7M rels so far). Estimated time remaining : 45-50hours
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    » Goto page 1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
» View previous topic :: View next topic  
Page 1 of 10 » All times are UTC - 5 Hours

 

Advertisement