mersenneforum.org  

Go Back   mersenneforum.org > Prime Search Projects > And now for something completely different

Reply
 
Thread Tools
Old 2022-11-04, 15:19   #199
paulunderwood
 
paulunderwood's Avatar
 
Sep 2002
Database er0rr

104058 Posts
Default

Quote:
Originally Posted by SuikaPredator View Post
I tried to install cm-0.4.0 or 0.4.1 on linux vm, but after './configure' and 'make', it popped out with the following errors.
Code:
/usr/bin/ld: pari_mainstack: TLS definition in /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libpari.so section .tbss mismatches non-TLS reference in .libs/pari.o
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libpari.so: error adding symbols: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:456: libcm.la] Error 1
make[2]: Leaving directory '/home/oscar/Downloads/cm-0.4.0/lib'
make[1]: *** [Makefile:406: all-recursive] Error 1
make[1]: Leaving directory '/home/oscar/Downloads/cm-0.4.0'
make: *** [Makefile:338: all] Error 2
I have no idea about what was happening, so I searched about similar error messages on google, but none of the solutions help. Can someone help me to find the problem?

Some OS/prerequisite software versions are: ubuntu20.04.5-LTS, GMP6.2.1, MPFR4.0.2-1, MPC1.1.0-1, MPFRCX0.6.3, and PARI2.11.0
It could be due to using a Pari/GP that is too old. Download the latest, configure, compile, check and install. I am using version:

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
paulunderwood is online now   Reply With Quote
Old 2022-11-04, 20:34   #200
SuikaPredator
 
Aug 2022
China

22·7 Posts
Default

Quote:
Originally Posted by paulunderwood View Post
It could be due to using a Pari/GP that is too old. Download the latest, configure, compile, check and install. I am using version:

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)
Thanks, I finally succeeded.
SuikaPredator is online now   Reply With Quote
Old 2022-11-21, 21:32   #201
R. Gerbicz
 
R. Gerbicz's Avatar
 
"Robert Gerbicz"
Oct 2005
Hungary

22×3×7×19 Posts
Default

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 ?
R. Gerbicz is offline   Reply With Quote
Old 2022-11-21, 22:35   #202
paulunderwood
 
paulunderwood's Avatar
 
Sep 2002
Database er0rr

104058 Posts
Default

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
paulunderwood is online now   Reply With Quote
Old 2022-11-21, 23:35   #203
R. Gerbicz
 
R. Gerbicz's Avatar
 
"Robert Gerbicz"
Oct 2005
Hungary

159610 Posts
Default

Quote:
Originally Posted by paulunderwood View Post
./configure && make && make check && sudo make install in the GMP directory?
Using your long configure line and with the newer 6.2.1 gmp library's install, it says at the end:
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)
But still no success with cm:
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
R. Gerbicz is offline   Reply With Quote
Old 2022-11-22, 02:39   #204
paulunderwood
 
paulunderwood's Avatar
 
Sep 2002
Database er0rr

110516 Posts
Default

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
paulunderwood is online now   Reply With Quote
Old 2022-11-24, 00:42   #205
paulunderwood
 
paulunderwood's Avatar
 
Sep 2002
Database er0rr

435710 Posts
Default

Quote:
Originally Posted by R. Gerbicz View Post
You could not make a certificate, that would violate the ecpp method's proof.
To hack the initial prp test is not that hard: use my super prp prime, see https://www.mersenneforum.org/showpo...postcount=1546
Running on the original non modifed code, but on gmp-6.1.2.
Code:
gerbicz@gerbicz-MS-7972:~/cmexp000/cm/cm-0.4.1dev/src$ mpirun ecpp-mpi -v -g -n '1396981702787004809899378463251' -c -f 
8< --- snip ----

*** No suitable curve found!
--------------------------------------------------------------------------
Primary job  terminated normally, but 1 process returned
a non-zero exit code. Per user-direction, the job has been aborted.
--------------------------------------------------------------------------
-- 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
--------------------------------------------------------------------------
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: [[30251,1],3]
  Exit code:    1
--------------------------------------------------------------------------
gerbicz@gerbicz-MS-7972:~/cmexp000/cm/cm-0.4.1dev/src$
What is so interesting that it is caught only in the 2nd phase.
I could catch most of these on the Tonelli-Shanks part of the algorithm, using a single mulmod (per core), what is ultra cheap.
I have had a dreaded "*** No suitable curve found!" at about 20k digits of a 52k digit number. Re-running after reboot to see if it happens again. What can I do to remedy it?

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
--------------------------------------------------------------------------
I just get:
Code:
--------------------------------------------------------------------------
--------------------------------------------------------------------------
EDIT The reboot seems to have made the issue go away.

Last fiddled with by paulunderwood on 2022-11-24 at 04:34
paulunderwood is online now   Reply With Quote
Old 2022-11-25, 19:14   #206
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

13D416 Posts
Default

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.
Yet, both work for a similar candidate:
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)
Any ideas?
EdH is online now   Reply With Quote
Old 2022-11-25, 20:45   #207
paulunderwood
 
paulunderwood's Avatar
 
Sep 2002
Database er0rr

110516 Posts
Default

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
Hence try your number with ecpp-mpi or alter the #else clause.

FOSS.

Last fiddled with by paulunderwood on 2022-11-25 at 20:49
paulunderwood is online now   Reply With Quote
Old 2022-11-25, 21:30   #208
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

22·33·47 Posts
Default

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
 -------------------------------------------------------------------------
Just on the off-chance it might not be a prime, I tried Primo and it flew through successfully. If it works for one 500 digit, shouldn't it mean other 500 digit candidates should run fine?

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.
EdH is online now   Reply With Quote
Old 2022-11-27, 17:14   #209
R. Gerbicz
 
R. Gerbicz's Avatar
 
"Robert Gerbicz"
Oct 2005
Hungary

22×3×7×19 Posts
Default

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)
Using my own code:
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)
Use gmp's half gcd code, do constant number of Euclidean algorithm's steps on the top limbs in constant time(!),
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
R. Gerbicz is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
For which types of primes is GPU primality test software available? bur GPU Computing 6 2020-08-28 06:20
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

All times are UTC. The time now is 21:04.


Mon Nov 28 21:04:47 UTC 2022 up 102 days, 18:33, 0 users, load averages: 1.60, 1.31, 1.22

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, 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.

≠ ± ∓ ÷ × · − √ ‰ ⊗ ⊕ ⊖ ⊘ ⊙ ≤ ≥ ≦ ≧ ≨ ≩ ≺ ≻ ≼ ≽ ⊏ ⊐ ⊑ ⊒ ² ³ °
∠ ∟ ° ≅ ~ ‖ ⟂ ⫛
≡ ≜ ≈ ∝ ∞ ≪ ≫ ⌊⌋ ⌈⌉ ∘ ∏ ∐ ∑ ∧ ∨ ∩ ∪ ⨀ ⊕ ⊗ 𝖕 𝖖 𝖗 ⊲ ⊳
∅ ∖ ∁ ↦ ↣ ∩ ∪ ⊆ ⊂ ⊄ ⊊ ⊇ ⊃ ⊅ ⊋ ⊖ ∈ ∉ ∋ ∌ ℕ ℤ ℚ ℝ ℂ ℵ ℶ ℷ ℸ 𝓟
¬ ∨ ∧ ⊕ → ← ⇒ ⇐ ⇔ ∀ ∃ ∄ ∴ ∵ ⊤ ⊥ ⊢ ⊨ ⫤ ⊣ … ⋯ ⋮ ⋰ ⋱
∫ ∬ ∭ ∮ ∯ ∰ ∇ ∆ δ ∂ ℱ ℒ ℓ
𝛢𝛼 𝛣𝛽 𝛤𝛾 𝛥𝛿 𝛦𝜀𝜖 𝛧𝜁 𝛨𝜂 𝛩𝜃𝜗 𝛪𝜄 𝛫𝜅 𝛬𝜆 𝛭𝜇 𝛮𝜈 𝛯𝜉 𝛰𝜊 𝛱𝜋 𝛲𝜌 𝛴𝜎𝜍 𝛵𝜏 𝛶𝜐 𝛷𝜙𝜑 𝛸𝜒 𝛹𝜓 𝛺𝜔