mersenneforum.org Error with large number on 32-bit machines
 Register FAQ Search Today's Posts Mark Forums Read

 2013-01-13, 18:02 #1 EdH     "Ed Hall" Dec 2009 Adirondack Mtns 52·11·19 Posts Error with large number on 32-bit machines How disappointing! On my 32-bit machines (both antiX and Ubuntu), on which I compiled GMP and ECM, I am receiving the following error: Code: $ecm -c 10 -v 43000000 < ecmIn GMP-ECM 6.4.3 [configured with GMP 5.0.5] [ECM] Running on math03 Input number is 16314315482963226490821946080971549450706222359508882207070502298741881754665051765380282665291356409074285196429704092132126707585162244439000837928127809542351956738323750370087594623357586179416038045807359853 (212 digits) Using MODMULN [mulredc:4, sqrredc:4] ecm: symbol lookup error: ecm: undefined symbol: __gmpn_add_nc They work with a smaller input number: Code: $ ecm -c 10 -v 43000000 < ecmIn GMP-ECM 6.4.3 [configured with GMP 5.0.5] [ECM] Running on math02 Input number is 326286309659264529816438921619430989014124447190177644141410045974837635093301035307605653305827 (96 digits) Using MODMULN [mulredc:0, sqrredc:0] Using B1=43000000, B2=240490660426, polynomial Dickson(12), sigma=3200203337 dF=65536, k=5, d=690690, d2=17, i0=46 Expected number of curves to find a factor of n digits: 35 40 45 50 55 60 65 70 75 80 55 246 1286 7557 49831 361851 2844041 2.4e+07 2.2e+08 2.2e+09 Step 1 took 542085ms ********** Factor found in step 1: 86635039 Found composite factor of 8 digits: 86635039 Composite cofactor 3766216457284269587694638443221927666173549563360589520152579904475343227966931893544893 has 88 digits A 32-bit Ubuntu machine using a repository version seems to be OK with the larger number: Code: $ecm -c 10 -v 43000000 < ecmIn GMP-ECM 6.3 [configured with GMP 5.0.2] [ECM] Running on math01 Input number is 16314315482963226490821946080971549450706222359508882207070502298741881754665051765380282665291356409074285196429704092132126707585162244439000837928127809542351956738323750370087594623357586179416038045807359853 (212 digits) Using MODMULN Using B1=43000000, B2=240490660426, polynomial Dickson(12), sigma=3523070894 dF=65536, k=5, d=690690, d2=17, i0=46 Expected number of curves to find a factor of n digits: 35 40 45 50 55 60 65 70 75 80 55 246 1286 7557 49831 361851 2844041 2.4e+07 2.2e+08 2.2e+09 Any thoughts are welcome... 2013-01-13, 18:35 #2 xilman Bamboozled! "๐บ๐๐ท๐ท๐ญ" May 2003 Down not across 61·191 Posts Quote:  Originally Posted by EdH How disappointing! On my 32-bit machines (both antiX and Ubuntu), on which I compiled GMP and ECM, I am receiving the following error: Code: $ ecm -c 10 -v 43000000 < ecmIn GMP-ECM 6.4.3 [configured with GMP 5.0.5] [ECM] Running on math03 Input number is 16314315482963226490821946080971549450706222359508882207070502298741881754665051765380282665291356409074285196429704092132126707585162244439000837928127809542351956738323750370087594623357586179416038045807359853 (212 digits) Using MODMULN [mulredc:4, sqrredc:4] ecm: symbol lookup error: ecm: undefined symbol: __gmpn_add_nc They work with a smaller input number: Code: $ecm -c 10 -v 43000000 < ecmIn GMP-ECM 6.4.3 [configured with GMP 5.0.5] [ECM] Running on math02 Input number is 326286309659264529816438921619430989014124447190177644141410045974837635093301035307605653305827 (96 digits) Using MODMULN [mulredc:0, sqrredc:0] Using B1=43000000, B2=240490660426, polynomial Dickson(12), sigma=3200203337 dF=65536, k=5, d=690690, d2=17, i0=46 Expected number of curves to find a factor of n digits: 35 40 45 50 55 60 65 70 75 80 55 246 1286 7557 49831 361851 2844041 2.4e+07 2.2e+08 2.2e+09 Step 1 took 542085ms ********** Factor found in step 1: 86635039 Found composite factor of 8 digits: 86635039 Composite cofactor 3766216457284269587694638443221927666173549563360589520152579904475343227966931893544893 has 88 digits A 32-bit Ubuntu machine using a repository version seems to be OK with the larger number: Code: $ ecm -c 10 -v 43000000 < ecmIn GMP-ECM 6.3 [configured with GMP 5.0.2] [ECM] Running on math01 Input number is 16314315482963226490821946080971549450706222359508882207070502298741881754665051765380282665291356409074285196429704092132126707585162244439000837928127809542351956738323750370087594623357586179416038045807359853 (212 digits) Using MODMULN Using B1=43000000, B2=240490660426, polynomial Dickson(12), sigma=3523070894 dF=65536, k=5, d=690690, d2=17, i0=46 Expected number of curves to find a factor of n digits: 35 40 45 50 55 60 65 70 75 80 55 246 1286 7557 49831 361851 2844041 2.4e+07 2.2e+08 2.2e+09 Any thoughts are welcome...
When you installed GMP and ECM did you run "make check" as recommended?

2013-01-13, 19:19   #3
WraithX

Mar 2006

22·7·19 Posts

Quote:
 Originally Posted by EdH On my 32-bit machines (both antiX and Ubuntu), on which I compiled GMP and ECM, I am receiving the following error: Code: $ecm -c 10 -v 43000000 < ecmIn ecm: symbol lookup error: ecm: undefined symbol: __gmpn_add_nc Any thoughts are welcome... Can you give us the output of "ecm -printconfig". I'm curious to see if you have the following line: HAVE___GMPN_ADD_NC = 1 Also, if you could post a zipped up copy of your config.log, that might help us track this down. Now, I'm not sure what would cause this problem, but, since you are building these things yourself, could you try the following as a temporary work-around: 1) In your ecm directory run "make clean" 2) Then run your "./configure" again 3) Then, go into the config.h and if you find the following line: #define HAVE___GMPN_ADD_NC 1 replace it with: /* #define HAVE___GMPN_ADD_NC 1 */ 4) Then run "make" and "make check" to be sure those complete successfully 5) Then try your number again and let us know the results Hopefully we can figure this out. 2013-01-13, 20:15 #4 ET_ Banned "Luigi" Aug 2002 Team Italia 3·1,619 Posts Quote:  Originally Posted by WraithX Can you give us the output of "ecm -printconfig". I'm curious to see if you have the following line: HAVE___GMPN_ADD_NC = 1 Also, if you could post a zipped up copy of your config.log, that might help us track this down. Now, I'm not sure what would cause this problem, but, since you are building these things yourself, could you try the following as a temporary work-around: 1) In your ecm directory run "make clean" 2) Then run your "./configure" again 3) Then, go into the config.h and if you find the following line: #define HAVE___GMPN_ADD_NC 1 replace it with: /* #define HAVE___GMPN_ADD_NC 1 */ 4) Then run "make" and "make check" to be sure those complete successfully 5) Then try your number again and let us know the results Hopefully we can figure this out. Hey, that workatound resolved MY compile problem with #define HAVE___GMPN_REDC_1 1 Thank you! Luigi 2013-01-13, 22:36 #5 WraithX Mar 2006 22×7×19 Posts Quote:  Originally Posted by ET_ Hey, that workatound resolved MY compile problem with #define HAVE___GMPN_REDC_1 1 Thank you! Luigi Hmmm, if so then that means that ./configure might be missing something or messing something up. Can you post a zipped up copy of your config.log so we can see what might be going wrong? 2013-01-13, 23:22 #6 ET_ Banned "Luigi" Aug 2002 Team Italia 3·1,619 Posts Quote:  Originally Posted by WraithX Hmmm, if so then that means that ./configure might be missing something or messing something up. Can you post a zipped up copy of your config.log so we can see what might be going wrong? Here it is! I can add that all the tests done with make check were ok after the update. Luigi Attached Files  config.log.zip (11.5 KB, 212 views) 2013-01-14, 03:11 #7 EdH "Ed Hall" Dec 2009 Adirondack Mtns 52·11·19 Posts Thanks, everyone! @xilman: Yes! Code: ... NOTE: NEXT TEST WILL FAIL ON 32BIT MACHINES, THIS IS EXPECTED. GMP-ECM 6.4.3 [configured with GMP 5.0.5] [P+1] Input number is 8589934621 (10 digits) Using B1=4294967310-4294967311, B2=1, polynomial x^1 Step 1 took 48ms ********** Factor found in step 1: 8589934621 Found input number N GMP-ECM 6.4.3 [configured with GMP 5.0.5] [P+1] Input number is 6054018161*10^400+417727253109 (410 digits) Using B1=2000, B2=2352760, polynomial x^1, x0=4 ./ecm: symbol lookup error: ./ecm: undefined symbol: __gmpn_add_nc ############### ERROR ############### Expected return code 14 but got 127 make: *** [check] Error 1 I took the NOTE above to mean the error I received. @WraithX: Code: $ ecm -printconfig
Compilation options:
Included GMP header files version 5.0.5
GWNUM_VERSION undefined
HAVE_SSE2 = 1
$HAVE___GMPN_ADD_NC = 1 HAVE___GMPN_MOD_34LSUB1 = 1 HAVE___GMPN_REDC_1 = 1 MEMORY_DEBUG undefined USE_ASM_REDC undefined WANT_ASSERT undefined WANT_SHELLCMD undefined _OPENMP undefined MPZMOD_THRESHOLD = 84 REDC_THRESHOLD = 119 MUL_NTT_THRESHOLD = 4096 NTT_GFP_TWIDDLE_DIF_BREAKOVER = 17 NTT_GFP_TWIDDLE_DIT_BREAKOVER = 17 PREREVERTDIVISION_NTT_THRESHOLD = 64 POLYINVERT_NTT_THRESHOLD = 1024 POLYEVALT_NTT_THRESHOLD = 512 MPZSPV_NORMALISE_STRIDE = 2048 That line has a preceding "$" instead of just the line. The config.log is zipped below.

Here is the result of commenting out the "#define HAVE___GMPN_ADD_NC 1" line:
Code:
...
NOTE: NEXT 3 TESTS WILL FAIL ON SOME 32BIT MACHINES, THIS IS EXPECTED.
GMP-ECM 6.4.3 [configured with GMP 5.0.5] [ECM]
Input number is 10000000000000000000000000000000000000121 (41 digits)
Using B1=2950307, B2=4281751120, polynomial Dickson(6), sigma=61
Step 1 took 20229ms
********** Factor found in step 1: 10000000000000000000000000000000000000121
Found input number N
GMP-ECM 6.4.3 [configured with GMP 5.0.5] [ECM]
Input number is 10000000000000000000000000000000000000121 (41 digits)
Using B1=9405629, B2=23422152400, polynomial Dickson(12), sigma=266
Step 1 took 65384ms
********** Factor found in step 1: 10000000000000000000000000000000000000121
Found input number N
GMP-ECM 6.4.3 [configured with GMP 5.0.5] [ECM]
Input number is 10000000000000000000000000000000000000121 (41 digits)
Using B1=4372759, B2=8561918830, polynomial Dickson(6), sigma=291
Step 1 took 30265ms
********** Factor found in step 1: 10000000000000000000000000000000000000121
Found input number N
All ECM tests are ok.
And, trying the 212 digit number again:
Code:
$ecm -c 10 -v 43000000 < ecmIn GMP-ECM 6.4.3 [configured with GMP 5.0.5] [ECM] Running on math02 Input number is 16314315482963226490821946080971549450706222359508882207070502298741881754665051765380282665291356409074285196429704092132126707585162244439000837928127809542351956738323750370087594623357586179416038045807359853 (212 digits) Using MODMULN [mulredc:4, sqrredc:4] Using B1=43000000, B2=240490660426, polynomial Dickson(12), sigma=2155976667 dF=65536, k=5, d=690690, d2=17, i0=46 Expected number of curves to find a factor of n digits: 35 40 45 50 55 60 65 70 75 80 55 246 1286 7557 49831 361851 2844041 2.4e+07 2.2e+08 2.2e+09 It appears to be working, but I suppose I'll have to wait quite some time for a result to show up. Attached Files  config.log.zip (9.4 KB, 209 views) Last fiddled with by EdH on 2013-01-14 at 03:11 2013-01-15, 03:11 #8 WraithX Mar 2006 22×7×19 Posts Quote:  Originally Posted by EdH That line has a preceding "$" instead of just the line. The config.log is zipped below. It appears to be working, but I suppose I'll have to wait quite some time for a result to show up.
@EdH
Did you put the "$" in front of it? I don't see anything in the code that would print out a "$" in front of that line.

I'm wondering if there might be multiple gmp.h or libgmp.a or libgmp.so* files on your computer? We can try to find out by seeing what all paths are defined in your environment with the following command:
env | grep -i path
(At this point I'm not sure how to search a PATH [or LD_LIBRARY_PATH] variable for a certain file, any linux gurus know???)

Then, we need to find out what library your binary is linking to. Can you run ldd on your ecm binary? Like so:
ldd ecm
We're interested in the line with libgmp.so, it could look like:
libgmp.so.10 => /usr/local/lib/libgmp.so.10
Once you have that, can you try running nm on the lib from above? Like:
nm /usr/local/lib/libgmp.so.10 | grep -i add_nc

Theoretically, that might come up empty. My guess at that point will be that you have another libgmp (.a, .so), perhaps in /usr/lib/. If so, could you try the nm+grep command on that libgmp too? I think one will have the add_nc, and the other won't. Let's see where this gets us.

@ET_
What problem were you running into, specifically? If you're using a recent GMP (5.0+) that you've compiled yourself, it should have mpn_redc_1. Was GMP-ECM not compiling for you? Or were you getting errors while running? What version of GMP are you using? Is it pre-compiled or did you build it yourself? I'd like to fix any problems rather than spread the above "work-around" to too many people.

 2013-01-15, 03:52 #9 Dubslow Basketry That Evening!     "Bunslow the Bold" Jun 2011 40
2013-01-15, 06:07   #10
EdH

"Ed Hall"
Dec 2009

52·11·19 Posts

Quote:
 Originally Posted by WraithX @EdH Did you put the "$" in front of it? I don't see anything in the code that would print out a "$" in front of that line.
Nope! That's how it appeared when I opened it.

Quote:
 Originally Posted by WraithX I'm wondering if there might be multiple gmp.h or libgmp.a or libgmp.so* files on your computer? We can try to find out by seeing what all paths are defined in your environment with the following command: env | grep -i path (At this point I'm not sure how to search a PATH [or LD_LIBRARY_PATH] variable for a certain file, any linux gurus know???)
Code:
$env | grep -i path PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games Quote:  Originally Posted by WraithX Then, we need to find out what library your binary is linking to. Can you run ldd on your ecm binary? Like so: ldd ecm Code: $ ldd ecm
ldd: ./ecm: No such file or directory

Code:
$whereis libecm libecm: /usr/local/lib/libecm.a /usr/local/lib/libecm.la Code: $ whereis libgmp
libgmp: /usr/local/lib/libgmp.so /usr/local/lib/libgmp.la /usr/local/lib/libgmp.a
Quote:
 Originally Posted by WraithX We're interested in the line with libgmp.so, it could look like: libgmp.so.10 => /usr/local/lib/libgmp.so.10 Once you have that, can you try running nm on the lib from above? Like: nm /usr/local/lib/libgmp.so.10 | grep -i add_nc
Code:
$nm /usr/local/lib/libgmp.so | grep -i add_nc 00021340 T __gmpn_add_nc Code: $ nm /usr/local/lib/libgmp.la | grep -i add_nc
nm: /usr/local/lib/libgmp.la: File format not recognized
Code:
$nm /usr/local/lib/libgmp.a | grep -i add_nc 00000000 T __gmpn_add_nc U __gmpn_add_nc U __gmpn_add_nc U __gmpn_add_nc U __gmpn_add_nc Quote:  Originally Posted by WraithX Theoretically, that might come up empty. My guess at that point will be that you have another libgmp (.a, .so), perhaps in /usr/lib/. If so, could you try the nm+grep command on that libgmp too? I think one will have the add_nc, and the other won't. Let's see where this gets us. Here's the locate command, but ldd didn't work (above), so there's nothing to compare: Code: $ locate libgmp
/home/math02/Math/ggnfs/src/lasieve4/libgmp-aux.a
/home/math02/Math/gmp/libgmp.la
/home/math02/Math/gmp/.libs/libgmp.a
/home/math02/Math/gmp/.libs/libgmp.la
/home/math02/Math/gmp/.libs/libgmp.lai
/home/math02/Math/gmp/.libs/libgmp.so
/home/math02/Math/gmp/.libs/libgmp.so.10
/home/math02/Math/gmp/.libs/libgmp.so.10.0.5
/usr/lib/i386-linux-gnu/libgmp.so.10
/usr/lib/i386-linux-gnu/libgmp.so.10.0.5
/usr/lib/i386-linux-gnu/openssl-1.0.0/engines/libgmp.so
/usr/local/lib/libgmp.a
/usr/local/lib/libgmp.la
/usr/local/lib/libgmp.so
/usr/local/lib/libgmp.so.10
/usr/local/lib/libgmp.so.10.0.5
/usr/share/doc/libgmp10
/usr/share/doc/libgmp10/TODO.Debian
/usr/share/doc/libgmp10/changelog.Debian.gz
/var/lib/dpkg/info/libgmp10:i386.list
/var/lib/dpkg/info/libgmp10:i386.md5sums
/var/lib/dpkg/info/libgmp10:i386.postinst
/var/lib/dpkg/info/libgmp10:i386.postrm
/var/lib/dpkg/info/libgmp10:i386.shlibs
Thanks for all the help...

2013-01-15, 07:55   #11
ET_
Banned

"Luigi"
Aug 2002
Team Italia

485710 Posts

Quote:
 Originally Posted by WraithX @ET_ What problem were you running into, specifically? If you're using a recent GMP (5.0+) that you've compiled yourself, it should have mpn_redc_1. Was GMP-ECM not compiling for you? Or were you getting errors while running? What version of GMP are you using? Is it pre-compiled or did you build it yourself? I'd like to fix any problems rather than spread the above "work-around" to too many people.
IIRC, there had been a "duplicate definition" issue between ecm-gmp.h and gmp.h while making the source, after [auto]configurations ran ok.

I was using MPIR 2.5.1 compiled to use GMP 5.0.2 configuration files. Yes I configured and compiled it [by] myself.

Luigi

 Similar Threads Thread Thread Starter Forum Replies Last Post PageFault Data 17 2012-04-10 01:40 T.Rex Software 29 2006-12-13 21:40 MarcGetty Software 3 2006-03-07 07:54 moo Software 10 2004-12-15 13:25 GP2 Data 10 2003-10-05 18:34

All times are UTC. The time now is 18:47.

Sun Jan 29 18:47:43 UTC 2023 up 164 days, 16:16, 0 users, load averages: 1.00, 1.06, 1.03