mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   GPU Computing (https://www.mersenneforum.org/forumdisplay.php?f=92)
-   -   mfaktc: a CUDA program for Mersenne prefactoring (https://www.mersenneforum.org/showthread.php?t=12827)

science_man_88 2011-07-28 01:30

[QUOTE=firejuggler;267720]MM2,MM3,MM7, MM127 etc[/QUOTE]


three of those examples are also triple mersenne numbers as well.

Christenson 2011-07-28 01:46

meaning 2^(2^2-1)-1, 2^(2^3-1)-1, 2^(2^7-1) -1 .... 2^(2^127-1)-1, right....with that last number having 10^40 or so digits....just a wee bit bigger than the 10^9 digits some of us play with right now....
with 127 bits as the minimum factor length, too...

Yes, I think you'd destroy mfaktc if you tried to make it do more than the first few double mersennes....but it wouldn't be a bad place to start if you wanted to do that job....I'm simply not up to it right now. I could see building a separate version for each double-mersenne exponent.

davieddy 2011-07-28 09:37

[QUOTE=James Heinrich;267694]
I figured that there's already a limited chance of there being multiple factors per bit-level, around (1 / <bitlevel>)^<factors in bitlevel> --- am I mistaken on this? That for 2^70 TF, you'd have about 1:70 chance of 1 factor, 1:4900 chance of 2 factors, 1:343000 chance of 3 factors, etc? :unsure:[/QUOTE]

Between 2[SUP]69[/SUP] and 2[SUP]70[/SUP]

Expected number of factors E = ln(70/69) ~ 1/69.50
[CODE]
[U]factors[/U] [U]probability[/U]

0 69/70
1 69/70 * E
2 69/70 * E[SUP]2[/SUP]/2!
3 69/70 * E[SUP]3[/SUP]/3!
4 69/70 * E[SUP]4[/SUP]/4!
........
[/CODE]

Note that the sum of the probabilities is 69/70 * e[SUP]E[/SUP] = 1

David

TheJudger 2011-07-29 20:38

[QUOTE=ixfd64;267716]Would it be hard to extend mfaktc to larger exponents? It could be very useful for people who wish to search for factors of double Mersenne numbers.[/QUOTE]

Not really "hard" but alot of work. The exponent is represented in a single 32bit unsigned integer in mfaktc. Main task in the host code: extend the per class sieve initializations for bigger exponents. This part is not really performance critical as long as the job is "big enough" (runtime per class > than a few seconds). Simple approach: use libgmp. The GPU code "just needs bigger numbers", too. The bad news are that you have to rewrite the complete set of functions (add, sub, mul, div, mod, ...) for bigger numbers.

[QUOTE=James Heinrich;267255]Would it be worth a few extra lines of code to try and factor the found factor to break it down into prime factors on the chance that it happens to be a composite factor?[/QUOTE]

Simple approach: use libgmp on the CPU to check if factors are composite or prime. Cons:[LIST][*]mfaktc depends on (another) external library[*]makes it even harder (imposible?) to release a closed source version of mfaktc (with automated primenet support)[/LIST]
Currently I say: no fix planned.

Oliver

xilman 2011-07-30 09:00

[QUOTE=TheJudger;267892][LIST][*]mfaktc depends on (another) external library[*]makes it even harder (imposible?) to release a closed source version of mfaktc (with automated primenet support)[/LIST][/QUOTE]Certainly not impossible; possibly harder.

GMP is licensed under the LGPL, meaning that you don't have to release your source code. What you must do is release the compiled version of your code in such a way that it can be linked with GMP by those to whom you distribute it. So, for instance, you could ship a library containing all your secret material, a copy of the GMP library and a trivial C program source which reads something like:
[code]
/* my_source.c */

main (int argc, char **argv)
{
my_main (argc, argv);
}
[/CODE]
and a Makefile which reads something like:
[code]
all:
gcc -o mfaktc source.c mfaktc.a -lgmp
[/code]

Paul

LaurV 2011-08-01 11:27

[QUOTE=science_man_88]
[QUOTE= firejuggler]
[I]MM2,MM3,MM7, MM127 etc[/I]
[/QUOTE]
three of those examples are also triple mersenne numbers as well.
[/QUOTE]

That's the Catalan sequence. MM5, MM13, MM17, MM19, MM31, etc, are also DMN, in the strict way (mersenne with prime exponents). MM9, MM11, MM15, MM23, etc, are also DMN, but they can't be prime, as their exponents are not prime. As the OP is asking about "finding factors" of such numbers, I assume he is not talking about "prime" DMN.

kjaget 2011-08-01 19:50

[QUOTE=xilman;267937]Certainly not impossible; possibly harder.

GMP is licensed under the LGPL, meaning that you don't have to release your source code. What you must do is release the compiled version of your code in such a way that it can be linked with GMP by those to whom you distribute it.[/QUOTE]

I think it's even simpler - just dynamically link to libgmp.so and ship a mfaktc binary. The binary isn't under any restrictions at all at that point.

I'd worry more about Windows compatibility and cost/effort considerations.

Dubslow 2011-08-11 03:48

I'm trying to compile the source in Ubuntu. When I run make in the src folder, I get an error saying that it doesn't support gcc versions > 4.5 , and I have 4.5.2 . Is there a way to get around this? Do I have old code?

TheJudger 2011-08-11 08:17

Hi!

This is not a matter of the mfaktc version.
Nvidia doesn't support gcc >= 4.5.0 in their toolkit. You could try to install an older gcc or try to fool the nvcc... :sad:

Oliver

xilman 2011-08-11 08:39

[QUOTE=Dubslow;268875]I'm trying to compile the source in Ubuntu. When I run make in the src folder, I get an error saying that it doesn't support gcc versions > 4.5 , and I have 4.5.2 . Is there a way to get around this? Do I have old code?[/QUOTE]I've just started looking into exactly the same problem but to build under Fedora 15.

There is a lot of chat on the CUDA and Linux fora about this issue. The summary seems to be that the dependency of gcc is for some debugging structures generated by old gcc and understood by Nvidia's tools. Somewhere in the code (perhaps scripts or Makefiles) there is a #error statement (or statements) which can be safely removed and everything then builds.

Sorry not to be more precise but the material above should give you enough to start looking for the details. Alternatively, you can wait until I've managed to get CUDA reinstalled on my system after its upgrade.


Paul

Ralf Recker 2011-08-11 09:27

It's possible to download, compile and install gcc 4.4.6 quite easily. You might need to install a few additional libraries (MPFR, etc) to compile the compiler.

Download and unpack the gcc 4.4.6 source archive into a directory. Create a second directory gcc-4.4.6-bin. cd into it.

../gcc-4.4.6/configure --enable-languages=c,c++ --prefix=/opt/gcc-4.4.6

If the configure script complains about missing libraries install them with "sudo apt-get install libXYZ-dev".

make
sudo make install

Add the following option to the list of options for nvcc:

Either --compiler-bindir /opt/gcc-4.4.6/bin or -ccbin /opt/gcc-4.4.6/bin

Note: Replace /opt/gcc-4.4.6 with a target directory of your choice. I usually use /opt/gcc-x.y.z for this purpose. This makes it quite easy to "uninstall" the compiler via rm -rf /opt/gcc-x.y.z


All times are UTC. The time now is 23:14.

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