mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   GPU Computing (https://www.mersenneforum.org/forumdisplay.php?f=92)
-   -   genefer/CUDA (https://www.mersenneforum.org/showthread.php?t=14297)

prime7989 2013-03-17 09:28

Extend GeneferCUDA pseudo-primality checks
 
1 Attachment(s)
[QUOTE=axn;333686]There are many versions of G/CUDA out there. If you can post the one you want to look at (as a forum attachment), I can tell you. FWIW, the change is easy and localised to "check" function.[/QUOTE]


Thank you axn,
I would also like to make the change to GeneferCUDA,cu such that the input instead of:
n=b^N+1
is as follows: n=b^N+c where c is an non-zero integer such that |c|<Log(n).
Thank you,
Prime7989

axn 2013-03-17 15:57

[QUOTE=prime7989;333689]Thank you axn,
I would also like to make the change to GeneferCUDA,cu such that the input instead of:
n=b^N+1
is as follows: n=b^N+c where c is an non-zero integer such that |c|<Log(n).
Thank you,
Prime7989[/QUOTE]

For changing the base used for test, you need to modify the two lines in check() function from:
[CODE]const double t1 = 1.0,t2 = 2.0,t3 = 2.0 / m;
<snip>
z = FFTinitGFN(m, 2.0, &n1,&SHIFT);
[/CODE]
to:
[CODE]const double t1 = 1.0,t2 = prp_base,t3 = 2.0 / m;
<snip>
z = FFTinitGFN(m, prp_base, &n1,&SHIFT);[/CODE]

As far as testing b^N+c, that is "above my paygrade", so to speak. :sad:

prime7989 2013-03-31 04:36

c=-1?
 
Dear axn,
How about c=-1 that is change the code in geneferCuda from so that c=-1 i.e
Input from: b^m+1 to b^m-1
prime7989

Batalov 2013-03-31 18:09

This is easy to do.
The whole code will become:
[CODE]//...some headers
// skip to page 10
j = m;
while (j > 0)
{
if (j > 1 && j & 1)
{
fprintf(stderr, "Cannot test. m is not a power of 2.\n");
return;
}
j >>= 1;
}
printf("Testing %d^%u-1...\r", b, m);

printf("\r%d^%u-1 is composite.", b, m);
//... some footer
[/CODE]

prime7989 2013-04-01 03:43

2^p-1
 
Dear Batalov,axn,
Ofcourse looking at the code i know my just previous post was incomplete.
What i meant was the following mods to geneferCUDA:
1) Specify the base p-PRP as a #define macro or as a run time input by the user(easy to do)
Give the user a chance to run a version option:
2a) Option A):Make it such that it is base 2,3,5-PRP for b^m+1 where m is a power of 2.
2b)Option B:)Make it such that it is base 3-PRP for b^q-1 where b=2 and q = a prime so as to accomodate Mersenne numbers. As well as GFNs.
Does anyone have recent code of geneferCUDA.cu > ver 1.061 or is willing to modify the code with these improvements? And wiilling to post it?
prime7989

Batalov 2013-04-02 17:33

GeNeFer (and geneferCUDA which is its CUDA port) are written specifically to test Generalized Fermat Numbers. That is, m must be a power of two. Your question about changing the PRP test's base was already addressed, even though it was somewhat moot, because test prp_base=2 is fine for any b>2, while for b=2 the (true Fermat) candidates are already searched to death by many people before you.

For other applications, there are other programs, e.g. CUDALucas (prime m and c=-1). Why would someone bother to modify a program so that it would become another, already written, specialized program?

If you want a universal program that does everything that other programs can do, then that's easy - make a script that would call the appropriate binary. That would be much more robust than keeping up with all disparate sources, putting them together and then recompiling when any component had changed.

prime7989 2013-06-07 07:00

[QUOTE=Batalov;335856]GeNeFer (and geneferCUDA which is its CUDA port) are written specifically to test Generalized Fermat Numbers. That is, m must be a power of two. Your question about changing the PRP test's base was already addressed, even though it was somewhat moot, because test prp_base=2 is fine for any b>2, while for b=2 the (true Fermat) candidates are already searched to death by many people before you.

For other applications, there are other programs, e.g. CUDALucas (prime m and c=-1). Why would someone bother to modify a program so that it would become another, already written, specialized program?

If you want a universal program that does everything that other programs can do, then that's easy - make a script that would call the appropriate binary. That would be much more robust than keeping up with all disparate sources, putting them together and then recompiling when any component had changed.[/QUOTE]



GeneferCUDA is a base-2 Pepin's test as far as I can ascertain(please correct if I am wrong, please). To allow for Fermat number testing with the GTX-TITAN we can make it base 3 or 5 deterministic Pepin's Test. To allow test's for Mersenne numbers with a Pepin's test GenfeferCuda should be run in Base 3 with the modification for Fermat to Mersenne numbers in the c=+/-1 for Fermat and Mersenne numbers.
Furthermore CudaLucas is a Lucas-Lehmer test for Mersenne numbers only and not a Pepin's test.
Al

msft 2013-07-24 17:32

1 Attachment(s)
Hi,
I ported genefer to RADEON.
[CODE]
+ time ./GeneferCUDA -t
GeneferCUDA 2.2.1 (CUDA) based on Genefer v2.2.1
Copyright (C) 2001-2003, Yves Gallot (v1.3)
Copyright (C) 2009, 2011 Mark Rodenkirch, David Underbakke (v2.2.1)
Copyright (C) 2010, 2011, Shoichiro Yamada (CUDA)
A program for finding large probable generalized Fermat primes.

Platform :Advanced Micro Devices, Inc.
Device 0 : Capeverde

Build Options are : -D KHR_DP_EXTENSION
2030234^8192+1 is a probable prime.
(51672 digits) (err = 0.1719) (time = 0:03:01) 00:52:08
[/CODE]

msft 2013-07-25 18:51

1 Attachment(s)
Hi, New Version.
HW:Celeron+RADEON7750(Low end)
1) install ubuntu Desktop 64bit 12.04 LTS
2) install amd-driver-installer-catalyst-13-4-linux-x86.x86_64.zip
3) install AMD-APP-SDK-v2.8-lnx64.tgz
4) install clAmdFft-1.10.321.tar.gz
5) install g++
6) install libglu1-mesa-dev
[CODE]
$ pwd
/opt/AMDAPP/samples/opencl/genefer/0.05
$ tar -xvf 0.04.tar.bz2
0.04/
0.04/clFFTPlans.cpp
0.04/Makefile
0.04/MatrixMulDouble_Kernels.cl
0.04/run.sh
0.04/clFFTPlans.h
0.04/GeneferCUDA.c
0.04/MatrixMulDouble.hpp
$ cd 0.04
0.04$ sh -x ./run.sh
g++ -Wpointer-arith -Wfloat-equal -g -O3 -I /opt/AMDAPP/include/ -I /opt/clAmdFft-1.10.321/include/ -g3 -ffor-scope -I ../../../../../samples/opencl/SDKUtil/include -I ../../../../../samples/bolt/BoltUtil/include -I ../../../../../samples/C++Amp/AmpUtil/include -I "/opt/AMDAPP/include" -I ../../../../../include -o build/debug/x86_64//GeneferCUDA.o -c GeneferCUDA.c
g++ -Wpointer-arith -Wfloat-equal -g -O3 -I /opt/AMDAPP/include/ -I /opt/clAmdFft-1.10.321/include/ -g3 -ffor-scope -I ../../../../../samples/opencl/SDKUtil/include -I ../../../../../samples/bolt/BoltUtil/include -I ../../../../../samples/C++Amp/AmpUtil/include -I "/opt/AMDAPP/include" -I ../../../../../include -o build/debug/x86_64//clFFTPlans.o -c clFFTPlans.cpp
g++ -o build/debug/x86_64/GeneferCUDA build/debug/x86_64//GeneferCUDA.o build/debug/x86_64//clFFTPlans.o -lpthread -ldl -L/usr/X11R6/lib -g /opt/clAmdFft-1.10.321/lib64/libclAmdFft.Runtime.so -lOpenCL -lgmp -lSDKUtil -lOpenCL -L../../../../../lib/x86_64 -L../../../../../TempSDKUtil/lib/x86_64 -L"/opt/AMDAPP/lib/x86_64"
+ export LD_LIBRARY_PATH=:/opt/clAmdFft-1.10.321/lib64/
+ time ./GeneferCUDA -t
GeneferCUDA 2.2.1 (GPU) based on Genefer v2.2.1
Copyright (C) 2001-2003, Yves Gallot (v1.3)
Copyright (C) 2009, 2011 Mark Rodenkirch, David Underbakke (v2.2.1)
Copyright (C) 2010, 2011, Shoichiro Yamada (CUDA)
A program for finding large probable generalized Fermat primes.
Platform :Advanced Micro Devices, Inc.
Device 0 : Capeverde
Build Options are : -D KHR_DP_EXTENSION
2030234^8192+1 is a probable prime.
(51672 digits) (err = 0.1738) (time = 0:01:47) 02:41:09
Platform :Advanced Micro Devices, Inc.
Device 0 : Capeverde

Build Options are : -D KHR_DP_EXTENSION
572186^131072+1 is a probable prime.
(754652 digits) (err = 0.0801) (time = 1:02:35) 03:43:44
[/CODE]

LaurV 2013-07-26 04:51

[bitchy]Who wants to find Fermat primes which are "large probable" or "probable generalized"? (or both)
Wouldn't "large, generalized Fermat (probable) primes" (native speakers can help here!) sound better?
[/bitchy]

All in all, well done msft! kutgw! (you spoiled us already)

msft 2013-07-26 09:40

1 Attachment(s)
Hi, New Version.
HD7750:
[CODE]
0.10$ ./GeneferCUDA -b
874718^131072+1 Time: 1.66 ms/mul. Err: 3.47e-01 778813 digits
710492^262144+1 Time: 2.99 ms/mul. Err: 5.00e-01 1533952 digits
577098^524288+1 Time: 4.88 ms/mul. Err: 5.00e-01 3020555 digits
468750^1048576+1 Time: 9.83 ms/mul. Err: 5.00e-01 5946413 digits
380742^2097152+1 Time: 18.9 ms/mul. Err: 5.00e-01 11703432 digits
309258^4194304+1 Time: 40 ms/mul. Err: 5.00e-01 23028076 digits
251196^8388608+1 Time: 80.4 ms/mul. Err: 5.00e-01 45298590 digits
0.10$ ./GeneferCUDA -t
572186^131072+1 is a probable prime.
(754652 digits) (err = 0.0762) (time = 1:10:03) 18:36:25
[/CODE]
PS. clAmdFft have this issue.
[url]http://devgurus.amd.com/message/1298209#1298209[/url]


All times are UTC. The time now is 05:55.

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