mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   GMP-ECM (https://www.mersenneforum.org/forumdisplay.php?f=55)
-   -   compiling GMP-ECM (https://www.mersenneforum.org/showthread.php?t=16444)

ATH 2012-01-12 13:25

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]

[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[/CODE]

akruppa 2012-01-12 17:44

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.

ATH 2012-01-12 18:13

So these "large" variations will not affect performance of GMP-ECM ? Like one of the versions being slower.

RichD 2012-04-06 00:32

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[/CODE]

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[/CODE]

akruppa 2012-04-06 00:38

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.

RichD 2013-02-27 22:28

[QUOTE=RichD;295521]I thought ECM 6.4.2 addressed the speed regression problem? Appears to still be around for -powerpc64.[/QUOTE]

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[/CODE]

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]

[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[/CODE]

RichD 2013-03-01 01:18

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[/CODE]

akruppa 2013-03-08 15:39

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

leif 2013-03-08 19:43

[QUOTE=RichD;331316]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[/CODE]
[/QUOTE]

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 [FONT="Courier New"]--disable-shared[/FONT] (which should be slightly faster anyway), but still [FONT="Courier New"]--enable-asm-redc[/FONT].


What does [FONT="Courier New"]./config.guess[/FONT] (and [FONT="Courier New"]uname -a[/FONT]) give?

Can you upload the output of a [FONT="Courier New"]./configure[/FONT] run, and (afterwards) the file [FONT="Courier New"]config.log[/FONT]?


(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.)

RichD 2013-03-09 00:22

[QUOTE=akruppa;332410]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.[/QUOTE]

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 [B]leif[/B] has a followup for me.

leif 2013-03-09 01:47

[QUOTE=RichD;332449]I'll look around for a later Xcode (gcc) version that supports Apple PPC.
[/QUOTE]

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 [FONT="Courier New"]--disable-shared --enable-asm-redc[/FONT] 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.


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

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