![]() |
![]() |
#199 | |
Sep 2002
Database er0rr
2·33·83 Posts |
![]() Quote:
Code:
GP/PARI CALCULATOR Version 2.13.4 (released) amd64 running linux (x86-64/GMP-6.2.1 kernel) 64-bit version compiled: Apr 5 2022, gcc version 11.2.0 (Debian 11.2.0-19) threading engine: pthread (readline v8.1 disabled, extended help enabled) Last fiddled with by paulunderwood on 2022-11-04 at 15:27 |
|
![]() |
![]() |
![]() |
#200 | |
Aug 2022
China
2016 Posts |
![]() Quote:
|
|
![]() |
![]() |
![]() |
#201 |
"Robert Gerbicz"
Oct 2005
Hungary
32·179 Posts |
![]()
I could have a decent speedup on the cm's code using pure gmp if my timings is correct.
I mean functions work in my gmp-6.1.2 folder, with #include "gmp.h" and #include "gmp-impl.h", and with the -lgmp switch. But when I've added these functions to say pari.c on the cm's lib folder, throwing into the folder also gmp-impl.h; after many compiler errors added also gmp-mparam.h fib_table.h fac_table.h mp_bases.h it is still giving errors for TMP_DECL, TMP_FREE and for their friends. (The directory of gmp-6.1.2 is /home/gerbicz/gmp-6.1.2 ) Clearly missing something, likely would I need to do some changes on makefile, configure file ? |
![]() |
![]() |
![]() |
#202 |
Sep 2002
Database er0rr
2·33·83 Posts |
![]()
For GMP have you either installed libgmp-dev (debian based systems) or ./configure && make && make check && sudo make install in the GMP directory? With either of these ways compiling with #include "gmp.h" should work.
On my system gmp.h is in: /usr/include/x86_64-linux-gnu/gmp.h /usr/local/include/gmp.h If that does not work, please post the error messages that you are getting. I am looking forward to any speed ups of CM. Last fiddled with by paulunderwood on 2022-11-21 at 22:56 |
![]() |
![]() |
![]() |
#203 | |
"Robert Gerbicz"
Oct 2005
Hungary
32×179 Posts |
![]() Quote:
Code:
---------------------------------------------------------------------- Libraries have been installed in: /usr/local/lib If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the '-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the 'LD_RUN_PATH' environment variable during linking - use the '-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to '/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- /bin/mkdir -p '/usr/local/include' /usr/bin/install -c -m 644 gmp.h '/usr/local/include' /bin/mkdir -p '/usr/local/lib/pkgconfig' /usr/bin/install -c -m 644 gmp.pc '/usr/local/lib/pkgconfig' make install-data-hook make[4]: Entering directory '/home/gerbicz/gmp-6.2.1' (+usual caution) Code:
... make[1]: Entering directory '/home/gerbicz/cmexptry/cm-0.4.1dev/lib' /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -std=c99 -g -O2 -MT pari.lo -MD -MP -MF .deps/pari.Tpo -c -o pari.lo pari.c libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -std=c99 -g -O2 -MT pari.lo -MD -MP -MF .deps/pari.Tpo -c pari.c -fPIC -DPIC -o .libs/pari.o ... pari.c:482:5: error: 'TMP_DECL' undeclared (first use in this function); did you mean 'TMP_MAX'? TMP_DECL; ^~~~~~~~ TMP_MAX pari.c:482:5: note: each undeclared identifier is reported only once for each function it appears in pari.c:483:5: error: 'TMP_MARK' undeclared (first use in this function); did you mean 'TMP_MAX'? TMP_MARK; ^~~~~~~~ TMP_MAX In file included from pari.c:465:0: ./gmp-impl.h:483:43: warning: implicit declaration of function 'TMP_ALLOC'; did you mean 'ALLOC'? [-Wimplicit-function-declaration] etc. Last fiddled with by R. Gerbicz on 2022-11-21 at 23:46 |
|
![]() |
![]() |
![]() |
#204 |
Sep 2002
Database er0rr
2·33·83 Posts |
![]()
It should be #include <gmp.h> and not #include "gmp.h". Does this change fix your problem?
Last fiddled with by paulunderwood on 2022-11-22 at 02:42 |
![]() |
![]() |
![]() |
#205 | |
Sep 2002
Database er0rr
448210 Posts |
![]() Quote:
Interestingly instead of something like RG's: Code:
-------------------------------------------------------------------------- -- Time for 84 bits (discriminant -7, invariant w, parameters 7_1_24): 6.8 -- Timings after job 2: CM 13.5, roots 0.0, point 0.0 -------------------------------------------------------------------------- Code:
-------------------------------------------------------------------------- -------------------------------------------------------------------------- Last fiddled with by paulunderwood on 2022-11-24 at 04:34 |
|
![]() |
![]() |
![]() |
#206 |
"Ed Hall"
Dec 2009
Adirondack Mtns
3×1,741 Posts |
![]()
I'm playing with Ubuntu (20.04) and have working copies of ecpp on two machines, fully installed and (I thought) operating fine. However, a test case has proven to cause an error on two separate but same OS machines. The candidates are only 500 digits. Both machines error with the following input:
Code:
$ bash ecpp -n '(3^1079*986+1)/1291691481549752369' -v -f testcert GMP: include 6.2.0, lib 6.2.0 MPFR: include 4.0.2, lib 4.0.2 MPC: include 1.1.0, lib 1.1.0 MPFRCX: include 0.6.3, lib 0.6.3 PARI: include 2.11.2, lib 2.11.2 -- Time for class numbers up to Dmax=688900: 0.1 (0.1) -- Time for primorial of B=541059: 0.0 (0.0) -- hmaxprime: 29 -- Size [0]: 1660 bits ***** Error: cm_nt_next_prime called with an argument that is too large for the precomputed list. Code:
$ bash ecpp -n '(3^1071*798+1)/140401818061117' -v -f testcert GMP: include 6.2.0, lib 6.2.0 MPFR: include 4.0.2, lib 4.0.2 MPC: include 1.1.0, lib 1.1.0 MPFRCX: include 0.6.3, lib 0.6.3 PARI: include 2.11.2, lib 2.11.2 -- Time for class numbers up to Dmax=689728: 0.1 (0.1) -- Time for primorial of B=541059: 0.0 (0.0) -- hmaxprime: 29 -- Size [0]: 1661 bits Time for discriminant -4472: 0.3 ( 0.3) . . . -- Time for 79 bits (discriminant -7, invariant w, parameters 7_1_24): 0.0 --- Time for second ECPP step: 7.7 (7.7) Writing to 'testcert'. --- Total time for ECPP: 14.2 (14.2) |
![]() |
![]() |
![]() |
#207 |
Sep 2002
Database er0rr
2×33×83 Posts |
![]()
Looking at the source for lib/nt.c I see:
Code:
unsigned long int cm_nt_next_prime (const unsigned long int n) /* returns the prime following n */ { static bool init = true; #ifdef WITH_MPI static unsigned long int P [664579]; /* primes up to 10^7 */ #else static unsigned long int P [9592]; /* primes up to 10^5 */ #endif ![]() Last fiddled with by paulunderwood on 2022-11-25 at 20:49 |
![]() |
![]() |
![]() |
#208 |
"Ed Hall"
Dec 2009
Adirondack Mtns
3×1,741 Posts |
![]()
It took a lot longer to get to the same error and add all the mpi error additions:
Code:
$ mpirun bash ecpp-mpi -n '(3^1079*986+1)/1291691481549752369' -v -f testcert1 MPI with 1 workers initialised, of which 1 are local. GMP: include 6.2.0, lib 6.2.0 MPFR: include 4.0.2, lib 4.0.2 MPC: include 1.1.0, lib 1.1.0 MPFRCX: include 0.6.3, lib 0.6.3 PARI: include 2.11.2, lib 2.11.2 -- Time for class numbers up to Dmax=688900: 0.1 (0.1) -- Time for primorial of B=541059: 0.0 (0.0) -- hmaxprime: 29 -- Size [0]: 1660 bits ***** Error: cm_nt_next_prime called with an argument that is too large for the precomputed list. -------------------------------------------------------------------------- Primary job terminated normally, but 1 process returned a non-zero exit code. Per user-direction, the job has been aborted. -------------------------------------------------------------------------- -------------------------------------------------------------------------- mpirun detected that one or more processes exited with non-zero status, thus causing the job to be terminated. The first process to do so was: Process name: [[39755,1],0] Exit code: 1 ------------------------------------------------------------------------- BTW, in my testing with these smaller PRPs, mpi takes significantly longer than non-mpi. I'm guessing that's because of the mpi overhead? In fact, using thread count for nodes takes longer than core count, which ecpp defaults to without a hostfile. |
![]() |
![]() |
![]() |
#209 |
"Robert Gerbicz"
Oct 2005
Hungary
32·179 Posts |
![]()
See https://github.com/gerbicz/CM/blob/main/corn.c .
The original code for Cornacchia just called Pari-Gp. At 8k digits my Cornacchia code is 5.8 times faster, and for larger N it could be even faster. Original code on approx 8k digits input (N=10^8007+21) using 4 physical cores, without gwnum library: Code:
-- Size [0]: 26599 bits Time for discriminant -1642404: 470.9 (159.5) largest prime of d: 97 largest prime of h: 5 discriminants: 1.9 (1.9) 54 qroot: 86.3 (29.3) 57684 Cornacchia: 184.4 (62.4) 1644 trial div: 46.0 (11.5) 90 is_prime: 152.4 (54.4) -- Size [1]: 26529 bits Time for discriminant -6487771: 1707.2 (575.7) largest prime of d: 907 largest prime of h: 13 discriminants: 2.0 (2.0) 156 qroot: 255.6 (86.5) 150518 Cornacchia: 479.9 (161.7) 3236 trial div: 90.8 (22.8) 816 is_prime: 1349.8 (462.3) Code:
-- Size [0]: 26599 bits Time for discriminant -1642404: 319.8 (108.5) largest prime of d: 97 largest prime of h: 5 discriminants: 1.9 (1.9) 54 qroot: 86.4 (29.3) 57684 Cornacchia: 32.9 (11.2) 1644 trial div: 46.1 (11.6) 90 is_prime: 152.5 (54.6) -- Size [1]: 26529 bits Time for discriminant -6487771: 1459.2 (493.8) largest prime of d: 907 largest prime of h: 13 discriminants: 2.0 (2.0) 156 qroot: 254.5 (86.2) 150518 Cornacchia: 81.7 (27.7) 3236 trial div: 91.0 (22.9) 816 is_prime: 1349.8 (463.5) then do several mod tricks/quadratic residue tests to decrease the further computations. More in the code, probably this time I have over commented. Used my own Legendre symbol code, it is also faster than the built-in kronecker. (calling it only for (k/n), when n is prime, so Legendre=kronecker). Pointless to test it below 2^512, since it falls back to the original code. Also it is worth to see the so called second step in the ecpp [I had code that failed in that part, since not saved V in the 1st step]. To compile: maybe it would work without any problem, for me the process: On lib folder's pari.c replace the bool cm_pari_cornacchia function() with my code. ./configure --enable-mpi On lib folder's makefile at the 263th line add to that line -I/home/gerbicz/gmp-6.2.1 -L/home/gerbicz/gmp-6.2.1 use your installed gmp's folder name. (this line was for the CFLAGS). make install Last fiddled with by R. Gerbicz on 2022-11-27 at 19:30 Reason: small correction |
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
what is the best primality software? | bbb120 | Proth Prime Search | 75 | 2022-10-08 11:45 |
Fastest software for Mersenne primality test? | JonathanM | Information & Answers | 25 | 2020-06-16 02:47 |
APR-CL as primality proof | f1pokerspeed | FactorDB | 14 | 2014-01-09 21:06 |
Proof of Primality Test for Fermat Numbers | princeps | Math | 15 | 2012-04-02 21:49 |
PRIMALITY PROOF for Wagstaff numbers! | AntonVrba | Math | 96 | 2009-02-25 10:37 |