mersenneforum.org  

Go Back   mersenneforum.org > Factoring Projects > GMP-ECM

Reply
 
Thread Tools
Old 2012-01-12, 13:25   #1
ATH
Einyen
 
ATH's Avatar
 
Dec 2003
Denmark

22×3×5×72 Posts
Default compiling GMP-ECM

I am wondering what "make ecm-params; make" actually does?

I did it twice right after each other on 2 versions of GMP-ECM compiled with exact same options and nothing else was running on the machine, but the values in ecm-params.h is still quite different, like MUL_NTT_THRESHOLD and POLYEVALT_NTT_THRESHOLD:

Code:
#define TUNE_MULREDC_THRESH 20
#define TUNE_SQRREDC_THRESH 1
#define MPZMOD_THRESHOLD 60
#define REDC_THRESHOLD 511
#define MPN_MUL_LO_THRESHOLD_TABLE {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 13, 13, 13, 14, 1, 1, 18, 18, 18, 18, 20}
#define NTT_GFP_TWIDDLE_DIF_BREAKOVER 17
#define NTT_GFP_TWIDDLE_DIT_BREAKOVER 17
#define MUL_NTT_THRESHOLD 512
#define PREREVERTDIVISION_NTT_THRESHOLD 32
#define POLYINVERT_NTT_THRESHOLD 512
#define POLYEVALT_NTT_THRESHOLD 4096
#define MPZSPV_NORMALISE_STRIDE 128
Code:
#define TUNE_MULREDC_THRESH 20
#define TUNE_SQRREDC_THRESH 16
#define MPZMOD_THRESHOLD 54
#define REDC_THRESHOLD 512
#define MPN_MUL_LO_THRESHOLD_TABLE {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 13, 1, 15, 1, 1, 15, 18, 20}
#define NTT_GFP_TWIDDLE_DIF_BREAKOVER 17
#define NTT_GFP_TWIDDLE_DIT_BREAKOVER 17
#define MUL_NTT_THRESHOLD 32768
#define PREREVERTDIVISION_NTT_THRESHOLD 32
#define POLYINVERT_NTT_THRESHOLD 512
#define POLYEVALT_NTT_THRESHOLD 256
#define MPZSPV_NORMALISE_STRIDE 64

Last fiddled with by ATH on 2012-01-12 at 13:26
ATH is offline   Reply With Quote
Old 2012-01-12, 17:44   #2
akruppa
 
akruppa's Avatar
 
"Nancy"
Aug 2002
Alexandria

1001101000112 Posts
Default

The non-NTT and NTT variants of the convolution product have essentially the same asymptotic complexity, so the graphs of their time as function of input size intersect at a very acute angle. Hence small variations in the timings can disturb the resulting threshold a lot.
akruppa is offline   Reply With Quote
Old 2012-01-12, 18:13   #3
ATH
Einyen
 
ATH's Avatar
 
Dec 2003
Denmark

22·3·5·72 Posts
Default

So these "large" variations will not affect performance of GMP-ECM ? Like one of the versions being slower.
ATH is offline   Reply With Quote
Old 2012-04-06, 00:32   #4
RichD
 
RichD's Avatar
 
Sep 2008
Kansas

309710 Posts
Default

I thought ECM 6.4.2 addressed the speed regression problem? Appears to still be around for -powerpc64.

For ECM 6.3 I get.
Code:
GMP-ECM 6.3 [configured with GMP 5.0.2 and --enable-asm-redc] [ECM]
Input number is 1369...9 (114 digits)
Using B1=11000000, B2=35133391030, polynomial Dickson(12), sigma=3266242007
Step 1 took 71183ms
Step 2 took 44681ms
Same ./configure for my G5 for ECM 6.4.2 I get.
Code:
GMP-ECM 6.4.2 [configured with GMP 5.0.2, --enable-asm-redc] [ECM]
Input number is 1369...9 (114 digits)
Using B1=11000000, B2=35133391030, polynomial Dickson(12), sigma=2279026585
Step 1 took 75026ms
Step 2 took 61388ms
RichD is offline   Reply With Quote
Old 2012-04-06, 00:38   #5
akruppa
 
akruppa's Avatar
 
"Nancy"
Aug 2002
Alexandria

2,467 Posts
Default

I'm not very familiar with the changes that went into 6.4. I'll forward this to Paul, maybe they have a G5 system somewhere to test where the speed regression entered the code.
akruppa is offline   Reply With Quote
Old 2013-02-27, 22:28   #6
RichD
 
RichD's Avatar
 
Sep 2008
Kansas

19×163 Posts
Default

Quote:
Originally Posted by RichD View Post
I thought ECM 6.4.2 addressed the speed regression problem? Appears to still be around for -powerpc64.
I guess it is addressed in 6.4.4 but I had to use --disable-asm-redc. Else "make" errors out with:

Code:
m4 -I../ -DOPERATION_mulredc1 `test -f mulredc1.asm || echo './'`mulredc1.asm >mulredc1.s
/bin/sh ../libtool   --mode=compile gcc-4.2  -m64 -c -o mulredc1.lo mulredc1.s
libtool: compile:  gcc-4.2 -m64 -c mulredc1.s -o mulredc1.o
mulredc1.s:40:Invalid mnemonic 'tocbase,'
mulredc1.s:41:Unknown pseudo-op: .size
mulredc1.s:41:Rest of line ignored. 1st junk character valued 95 (_).
mulredc1.s:58:Unknown pseudo-op: .size
mulredc1.s:58:Rest of line ignored. 1st junk character valued 46 (.).
make[2]: *** [mulredc1.lo] Error 1
Now for the comparative timings:
Code:
GMP-ECM 6.4.2 [configured with GMP 5.1.1, --enable-asm-redc] [ECM]
Input number is 15556590125084447640042979376106655611645478466484332304839633936078668267149399297288829856548038837496970338619173620375749 (125 digits)
Using B1=11000000, B2=35133391030, polynomial Dickson(12), sigma=3074875970
Step 1 took 86990ms
Step 2 took 64229ms
Code:
GMP-ECM 6.4.4 [configured with GMP 5.1.1] [ECM]
Input number is 15556590125084447640042979376106655611645478466484332304839633936078668267149399297288829856548038837496970338619173620375749 (125 digits)
Using B1=11000000, B2=35133391030, polynomial Dickson(12), sigma=1609157141
Step 1 took 93428ms
Step 2 took 48039ms
RichD is offline   Reply With Quote
Old 2013-03-01, 01:18   #7
RichD
 
RichD's Avatar
 
Sep 2008
Kansas

19·163 Posts
Default

As a followup, 6.3 is still the fastest on a G5 (powerpc64).

Code:
GMP-ECM 6.3 [configured with GMP 5.1.1 and --enable-asm-redc] [ECM]
Input number is 15556590125084447640042979376106655611645478466484332304839633936078668267149399297288829856548038837496970338619173620375749 (125 digits)
Using B1=11000000, B2=35133391030, polynomial Dickson(12), sigma=4239757077
Step 1 took 82115ms
Step 2 took 46385ms
RichD is offline   Reply With Quote
Old 2013-03-08, 15:39   #8
akruppa
 
akruppa's Avatar
 
"Nancy"
Aug 2002
Alexandria

9A316 Posts
Default

RichD,

can you try compiling the asm code with a newer version of gcc than 4.2? It works on, e.g., gcc110.fsffrance.org with 4.7.2.
The speed regression may be due to not using the asm mulredc; or maybe the distributed parameters are non-optimal. Getting the asm to work would be the first step, though.

Alex
akruppa is offline   Reply With Quote
Old 2013-03-08, 19:43   #9
leif
 
Mar 2013

112 Posts
Default

Quote:
Originally Posted by RichD View Post
I guess it is addressed in 6.4.4 but I had to use --disable-asm-redc. Else "make" errors out with:

Code:
m4 -I../ -DOPERATION_mulredc1 `test -f mulredc1.asm || echo './'`mulredc1.asm >mulredc1.s
/bin/sh ../libtool   --mode=compile gcc-4.2  -m64 -c -o mulredc1.lo mulredc1.s
libtool: compile:  gcc-4.2 -m64 -c mulredc1.s -o mulredc1.o
mulredc1.s:40:Invalid mnemonic 'tocbase,'
mulredc1.s:41:Unknown pseudo-op: .size
mulredc1.s:41:Rest of line ignored. 1st junk character valued 95 (_).
mulredc1.s:58:Unknown pseudo-op: .size
mulredc1.s:58:Rest of line ignored. 1st junk character valued 46 (.).
make[2]: *** [mulredc1.lo] Error 1
Looks like you're feeding an Apple assembler (on MacOS X 10.5?) with assembly code for the 64-bit PowerPC ELF ABI (which e.g. Linux uses).

We certainly need more details to fix this, but you may just try configuring with --disable-shared (which should be slightly faster anyway), but still --enable-asm-redc.


What does ./config.guess (and uname -a) give?

Can you upload the output of a ./configure run, and (afterwards) the file config.log?


(Btw., isn't MacOS X on PowerPC 32-bit only? AFAIK you may use some advanced features of 64-bit PowerPC CPUs on it, but the OS and the applications are still 32-bit.)
leif is offline   Reply With Quote
Old 2013-03-09, 00:22   #10
RichD
 
RichD's Avatar
 
Sep 2008
Kansas

19·163 Posts
Default

Quote:
Originally Posted by akruppa View Post
can you try compiling the asm code with a newer version of gcc than 4.2? It works on, e.g., gcc110.fsffrance.org with 4.7.2.
The speed regression may be due to not using the asm mulredc; or maybe the distributed parameters are non-optimal. Getting the asm to work would be the first step, though.
Alex,

I'll look around for a later Xcode (gcc) version that supports Apple PPC. It is a sunset system.

I hope I'm not consuming too many resources on a dying system but I thought this problem might bleed over to other powerpc64 systems.

BTW, the --enable-asm-redc was active in ECM 6.4.2.

Oh, I see leif has a followup for me.
RichD is offline   Reply With Quote
Old 2013-03-09, 01:47   #11
leif
 
Mar 2013

3 Posts
Default

Quote:
Originally Posted by RichD View Post
I'll look around for a later Xcode (gcc) version that supports Apple PPC.
Have fun... B)

Even if Apple would change their mind and decided to provide such, it wouldn't help here (at least not with the assembler errors). AFAIK the latest Apple GCC for PPC is version 4.2.1 (Apple Inc. build 5577).


And I'm pretty sure now --disable-shared --enable-asm-redc won't work for you either (with 6.4.4) on Darwin, as the PowerPC64 assembly code is ELF-only now, assuming Darwin on PowerPC was always 32-bit, hence not using it; sorry.
leif is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help needed compiling GMP-ECM M0CZY GMP-ECM 76 2009-09-29 15:48
Compiling my first program by using GMP Raman Programming 3 2009-02-14 02:17
Compiling Phrot rogue Sierpinski/Riesel Base 5 142 2009-01-09 03:42
Compiling 24.14 CBoland Software 6 2007-08-01 00:11
Compiling new version of GMP-ECM M0CZY GMP-ECM 3 2006-05-27 09:54

All times are UTC. The time now is 07:11.

Mon Sep 28 07:11:49 UTC 2020 up 18 days, 4:22, 0 users, load averages: 1.24, 1.45, 1.55

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