sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.41k stars 475 forks source link

Update GMP-ECM to 6.3 #5847

Closed 85eec1a4-3d04-4b4d-b711-d4db03337c41 closed 13 years ago

85eec1a4-3d04-4b4d-b711-d4db03337c41 commented 15 years ago
Changes between ecm-6.2.3 and ecm-6.3:
* New assembly code for 64-bit PowerPC (thanks to Philip McLaughlin)
* Allow several processes to write to the same -save file
* More routines in new P+-1 stage 2 use multi-threading in OpenMP build
* Fixed incompatibility with GMP 5.0.0
* Fixed several bugs, and now check return value from malloc() calls
* Fixed linking of GMP which prevented successful builds under Darwin 
  (and presumably other systems)
* Allow use of x86_64 asm code under MinGW

Changes between ecm-6.2.2 and ecm-6.2.3:
* Fixed incompatibility with GMP 4.3.0 when testing version in configure
* SSE2 asm code for Visual C added in stage 2 NTT code
* Small improvement to x86_64 mulredc asm code, slight speedup on Core 2
* Fixed incorrect carry propagation in subquadratic REDC code which
  could lead to incorrect arithmetic in rare cases
* Fixed memory leak with -v parameter when factor was found in ECM stage 1
* Fixed bug which caused only one ECM curve to be run in spite of -c
  parameter if input line did not end in newline
* Assembler mulredc code enabled by default on x86_64

Changes between ecm-6.2.1 and ecm-6.2.2:
* Updated build project files for Visual C by Brian Gladman, also adds
missing NTT_GFP_TWIDDLE_DI[FT]_BREAKOVER defines in VC parameter file
* Fixed uninitialised parameter to P-1 probability computation
* In tune.c : fixed generation of NTT_GFP_TWIDDLE_DI[FT]_BREAKOVER values,
avoid calling cputime() excessively often when timing short functions,
fixed access to uninitialised memory
* Fixed serious split infinitive in configure script (thanks Paul Leyland)
* Removed unnecessary carry propagation in x86_64 mulredc code, slight
speedup (thanks Philip McLaughlin)
* Fixed non-portable PIC code in x86_64/redc.asm
* Fixed problem with pattern matching host type names in configure.in
* Converted binary constants in spv.c and ntt_gfp.c to hexadecimal,
some assembler do not support binary constants

New spkg: http://sage.math.washington.edu/home/leif/Sage/spkgs/ecm-6.3.p2.spkg

md5sum: a19f3d4d0e9881abe076d8a9c0ea7e7f ecm-6.3.p2.spkg

Apply attachment: trac_5847-module_list-fix_execstack-sagelib-rebased_to_4.7.1.alpha4.patch to the Sage library.

(Should be applied after installing the new spkg.)

Note that this patch is only required (i.e., mandatory) on some Fedora and potentially other SELinux-enabled systems, and apparently only in conjunction with more recent versions of GCC (>= 4.6).

I.e., you should be able to use the new GMP-ECM spkg on other systems without installing any patches or other spkgs.

CC: @zimmermann6 @dimpase

Component: packages: standard

Keywords: sd32 MPIR elliptic curves libecm ecm spkg

Author: Mike Hansen, Leif Leonhardy, Jeroen Demeyer

Reviewer: Leif Leonhardy, Dmitrii Pasechnik, Mariah Lenox, Maarten Derickx

Merged: sage-4.7.2.alpha3

Issue created by migration from https://trac.sagemath.org/ticket/5847

williamstein commented 14 years ago
comment:1
I think you may need the latest 6.3

 ./configure --with-gmp=/usr/local/
make -j
make -j check
and it passed
without specifing where gmp/mpir is , it got very confused , , they have their
search paths mixed up.

Jason
- Hide quoted text -

On Wednesday 02 June 2010 02:59:21 Bill Hart wrote:
> There's an open ticket by Michael Abshoff to update to 6.2.2: :-)
>
> https://github.com/sagemath/sage-prod/issues/5847
>
> Bill.
>
> On 2 June 2010 02:54, Jason Moxham <jason@njkfrudils.plus.com> wrote:
> > I had forgotten about this , gmp-ecm-6.2.1 is 2 years old , what is it
> > doing in sage ? :) , they fixed it in a later release , perhaps about a
> > year ago
> >
> > Jason
> >
> > On Wednesday 02 June 2010 02:46:58 Bill Hart wrote:
> >> On 2 June 2010 02:40, William Stein <wstein@gmail.com> wrote:
> >> > Hi,
> >> >
> >> > Building Sage fails with GMP-ECM, as before.   Yes, I know this is
> >> > because of deprecation, etc...
> >>
> >> Sure. We announced a list of deprecated symbols on sage-devel and
> >> mpir-devel. Then we permanently removed mpz_random and mpz_random2
> >> *only* , the worst offenders.
> >>
> >> Bill.
> >>
> >> > ar cru .libs/libecm.a  ecm.o ecm2.o pm1.o pp1.o getprime.o listz.o
> >> > lucas.o stage2.o toomcook.o mpmod.o mul_l
> >> > o.o polyeval.o median.o schoen_strass.o ks-multiply.o rho.o bestd.o
> >> > auxlib.o random.o factor.o sp.o spv.o sp
> >> > m.o mpzspm.o mpzspv.o ntt_gfp.o ecm_ntt.o pm1fs2.o mul_fft.o
> >> > sets_long.o auxarith.otune-tune.o: In function `tune_mpres_mul':
> >> > tune.c:(.text+0xd1): undefined reference to `mpz_random'
> >> > collect2: ld returned 1 exit status
> >> > make[4]: *** [tune] Error 1
> >> > make[4]: *** Waiting for unfinished jobs....
> >> > ranlib .libs/libecm.a
> >> > creating libecm.la
> >> > (cd .libs && rm -f libecm.la && ln -s ../libecm.la libecm.la)
> >> > make[4]: Leaving directory
> >> > `/mnt/usb1/scratch/wstein/build/mpir2/sage-4.4.3.alpha1/spkg/build/ecm
> >> >-6. 2.1.p2/s rc'
> >> > make[3]: *** [all-recursive] Error 1
> >> > make[3]: Leaving directory
> >> > `/mnt/usb1/scratch/wstein/build/mpir2/sage-4.4.3.alpha1/spkg/build/ecm
> >> >-6. 2.1.p2/src' make[2]: *** [all] Error 2make[2]: Leaving directory
> >> > `/mnt/usb1/scratch/wstein/build/mpir2/sage-4.4.3.alpha1/spkg/build/ecm
> >> >-6. 2.1.p2/s rc'
> >> > There was a problem building GMP ECM.
> >> >
> >> > real    0m9.633s
> >> > user    0m8.510s
> >> > sys     0m8.950s
> >> > sage: An error occurred while installing ecm-6.2.1.p2
> >> > Please email sage-devel http://groups.google.com/group/sage-devel
mwhansen commented 14 years ago

Author: Mike Hansen

mwhansen commented 14 years ago
comment:3

There is a 6.3 spkg at http://sage.math.washington.edu/home/mhansen/ecm-6.3.spkg

I've checked that it works with MPIR 2.1.1 and all tests pass.

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 14 years ago
comment:4

Since Sage with MPIR 2.1.1 (#8664) requires updating to this package, I report at that ticket.

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 14 years ago
comment:5

Since MPIR 2.1.1 has a bug (see #9837), I've (successfully) built and tested Sage 4.6.prealpha3 (see #9343 and the NewPARI Wiki page) with GMP 5.0.1 and this new ECM 6.3 spkg on Ubuntu 10.04 x86_64 (Core2, gcc 4.4.3; parallel build from scratch with 32 jobs; native code with O3).

ptestlong passed all tests.

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 14 years ago
comment:6

It also passed ptestlong on the same machine with Sage 4.5.3.alpha2 and MPIR 2.1.1 (because the MPIR bug apparently only shows up in combination with the new PARI package, which isn't included in that Sage version).

Same for Fedora 13 x86 (Pentium 4 Prescott, gcc 4.4.4, parallel build with 6 jobs, rest dito).

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 14 years ago

Attachment: trac_5847-GMP-ECM-6.3_spkg_update-reviewer.patch.gz

Suggested changes - NOT (yet) a Mercurial patch. (Minor fixes, some comments added, some clean-up.)

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 14 years ago
comment:7

I've added a reviewer patch (ordinary context diff) with some changes:

If you're ok with the changes, I can replace the diff with a Mercurial patch. Or simply merge them...

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 13 years ago

Reviewer: Leif Leonhardy

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 13 years ago
comment:8

New spkg: http://spkg-upload.googlecode.com/files/ecm-6.3.p0.spkg

md5sum: b9b1fcd5ebc2e3689fd379c1dba3a372 ecm-6.3.p0.spkg

New spkg based on Mike's with some more changes (than mentioned above).

Should be installed with the MPIR 2.1.3 spkg from #8664. See instructions there.

(Tested with Sage 4.6.1.alpha0 on Ubuntu 9.04 x86 and Ubuntu 10.04 x86_64.)

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 13 years ago

Changed author from Mike Hansen to Mike Hansen, Leif Leonhardy

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 13 years ago

SPKG "reviewer" patch, based on Mike's, i.e. ecm-6.3 vs. ecm-6.3.p0. For reference/review.

jdemeyer commented 13 years ago
comment:9

Attachment: trac_5847-ecm-6.3_vs._ecm-6.3.p0-spkg.patch.gz

Built and tested on sage.math.washington.edu without problems.

jdemeyer commented 13 years ago
comment:11

This fails to compile on my OS X 10.4 powerpc G5 machine, full log attached but here is the interesting part:

****************************************************
Host system
uname -a:
Darwin moufang.ugent.be 8.11.0 Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC Power         Macintosh powerpc
****************************************************
****************************************************
CC Version
gcc -v
Using built-in specs.
Target: powerpc-apple-darwin8
Configured with: /private/var/tmp/gcc/gcc-5367.obj~1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man -- enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-    slibdir=/usr/lib --build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5367)
****************************************************
...
checking build system type... powerpc-apple-darwin8.11.0
checking host system type... powerpc-apple-darwin8.11.0
...
configure: Configuration:
configure: Build for host type powerpc-apple-darwin8.11.0
configure: CC=gcc, CFLAGS=-g -O3  -fPIC
configure: Linking GMP with -lgmp
configure: Using asm redc code from directory powerpc64
configure: Not using SSE2 instructions in NTT code
configure: Assertions disabled
configure: Shell command execution disabled
configure: OpenMP disabled
configure: Memory debugging disabled
make  all-recursive
Making all in powerpc64
m4 -I../ -DOPERATION_mulredc1 `test -f mulredc1.asm || echo './'`mulredc1.asm >mulredc1.s
/bin/sh ../libtool   --mode=compile gcc  -g -O3  -fPIC -c -o mulredc1.lo mulredc1.s
libtool: compile:  gcc -g -O3 -fPIC -c mulredc1.s -o mulredc1.o
mulredc1.s:40:mulld instruction is only for 64-bit implementations (not allowed without -force_cpusubtype_ALL option)
mulredc1.s:41:mulhdu instruction is only for 64-bit implementations (not allowed without -force_cpusubtype_ALL option)
mulredc1.s:42:mulld instruction is only for 64-bit implementations (not allowed without -force_cpusubtype_ALL option)
mulredc1.s:43:mulld instruction is only for 64-bit implementations (not allowed without -force_cpusubtype_ALL option)
mulredc1.s:44:mulhdu instruction is only for 64-bit implementations (not allowed without -force_cpusubtype_ALL option)
mulredc1.s:47:std instruction is only for 64-bit implementations (not allowed without -force_cpusubtype_ALL option)
make[4]: *** [mulredc1.lo] Error 1
rm mulredc1.s
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
Error building GMP-ECM.
jdemeyer commented 13 years ago

Log file for failed build on OS X 10.4 powerpc G5

jdemeyer commented 13 years ago

Description changed:

--- 
+++ 
@@ -16,6 +16,6 @@
 some assembler do not support binary constants

-Cheers, +New spkg: http://spkg-upload.googlecode.com/files/ecm-6.3.p0.spkg

-Michael +Testing distribution (including #8664): http://sage.math.washington.edu/home/jdemeyer/release/sage-4.6.1.alpha0-mpir/sage-4.6.1.alpha0-mpir.tar

jdemeyer commented 13 years ago
comment:12

Attachment: ecm-6.3.p0.log

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 13 years ago
comment:13

Well, I think these are the relevant parts:

...
checking whether we can link against GMP... yes
checking if gmp.h version and libgmp version are the same... (5.0.1/5.0.1) yes
checking for __gmpn_add_nc... yes
checking for __gmpn_mod_34lsub1... yes
checking for __gmpn_redc_1... no
...
configure: Using asm redc code from directory powerpc64
...

So it's probably an upstream problem, either MPIR or ECM.

Or should we pass -force_cpusubtype_ALL? (To the assembler?) I think rather not.

What happens on other PPCs?

Can you try installing it with GMP 5.0.1?

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 13 years ago
comment:14

Paul, perhaps you have an idea what's going wrong there (ECM trying to use "64-bit" instructions on MacOS X 10.4 PPC [G5], with MPIR 2.1.3).

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 13 years ago
comment:15

Jeroen, can you try configuring with --disable-asm-redc?

(The 64-bit PPC asm code is new in 6.3 btw.)

kiwifb commented 13 years ago
comment:16

Replying to @nexttime:

Well, I think these are the relevant parts:

...
checking whether we can link against GMP... yes
checking if gmp.h version and libgmp version are the same... (5.0.1/5.0.1) yes
checking for __gmpn_add_nc... yes
checking for __gmpn_mod_34lsub1... yes
checking for __gmpn_redc_1... no
...
configure: Using asm redc code from directory powerpc64
...

So it's probably an upstream problem, either MPIR or ECM.

Or should we pass -force_cpusubtype_ALL? (To the assembler?) I think rather not.

What happens on other PPCs?

Can you try installing it with GMP 5.0.1?

A remark about installing with GMP 5. On Gentoo I had to apply the following for it to compile

    # fixes for gmp-5
    sed -i "s:__GMP_BITS_PER_MP_LIMB:GMP_LIMB_BITS:g" bestd.c mpmod.c \
        schoen_strass.c sp.h || die "failed to patch files for gmp-5"

This is backward compatible with GMP 4.3. I am a bit surprised that with the stuff that mpir has deprecated, they didn't deprecate that as well.

zimmermann6 commented 13 years ago
comment:17

Replying to @nexttime:

Paul, perhaps you have an idea what's going wrong there (ECM trying to use "64-bit" instructions on MacOS X 10.4 PPC [G5], with MPIR 2.1.3).

is this a 32-bit machine? What does ECM config.guess return? Can you try the svn version of GMP-ECM using svn checkout svn://scm.gforge.inria.fr/svn/ecm?

Paul

zimmermann6 commented 13 years ago
comment:18

Replying to @nexttime:

Jeroen, can you try configuring with --disable-asm-redc?

(The 64-bit PPC asm code is new in 6.3 btw.)

it should work with --disable-asm-redc.

Paul

jdemeyer commented 13 years ago
comment:19

Thanks for all the suggestions, I will try them but probably not today.

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 13 years ago
comment:20

Replying to @kiwifb:

Replying to @nexttime:

Can you try installing it with GMP 5.0.1?

A remark about installing with GMP 5. On Gentoo I had to apply the following for it to compile

    # fixes for gmp-5
    sed -i "s:__GMP_BITS_PER_MP_LIMB:GMP_LIMB_BITS:g" bestd.c mpmod.c \
        schoen_strass.c sp.h || die "failed to patch files for gmp-5"

This is backward compatible with GMP 4.3. I am a bit surprised that with the stuff that mpir has deprecated, they didn't deprecate that as well.

Worked for me without patching with both MPIR 2.1.1 and [vanilla] GMP 5.0.1 on Ubuntu (see above).

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 13 years ago
comment:21

Replying to @zimmermann6:

Replying to @nexttime:

Jeroen, can you try configuring with --disable-asm-redc?

(The 64-bit PPC asm code is new in 6.3 btw.)

it should work with --disable-asm-redc.

Thanks!

Replying to @jdemeyer:

Thanks for all the suggestions, I will try them but probably not today.

Should I update the spkg / spkg patch to enable --disable-asm-redc (on MacOS X PPC 10.4 and perhaps 10.5, or simply PPC)?

IIRC we don't support 64-bit builds (SAGE64=yes) on PowerPC (and MacOS X < 10.6) anyway, and Apple doesn't support MacOS X 10.6 on PPCs.

Setting ABI=32 would perhaps also work.

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 13 years ago
comment:22

Any objections to enable (also) building a shared library?

(And also enabling the build of a static MPIR library, which is better for ECM?)

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 13 years ago
comment:23

I wonder how the GNU assembler (Linux PPC) behaves...

François, would you like to test this?

zimmermann6 commented 13 years ago
comment:24

in fact this bug is already fixed upstream (in revision 1516), see https://gforge.inria.fr/tracker/index.php?func=detail&aid=10646&group_id=135&atid=623

The patch is the following:

--- configure.in        (revision 1515)
+++ configure.in        (revision 1516)
@@ -195,7 +195,7 @@
 # asm_redc enabled by default for x86_64 and 64 bit PowerPC
 if test "x$enable_asm_redc" = x; then
   case $host in
-    x86_64* | powerpc-apple-darwin* | powerpc64-*-linux*) enable_asm_redc=yes;;
+    x86_64*-*-* | powerpc-apple-darwin* | powerpc64-*-linux*) enable_asm_redc=yes;;
     *) enable_asm_redc=no;;
   esac
 fi
@@ -203,8 +203,18 @@
 if test "x$enable_asm_redc" = xyes; then
   case $host in
     pentium4-*-* | pentium3-*-* | viac7-*-* | i786-*-*) ASMPATH=pentium4;;
-    x86_64-*-*)  ASMPATH=x86_64;; 
-    powerpc-apple-darwin*) ASMPATH=powerpc64;;
+    x86_64*-*-*)  ASMPATH=x86_64;; 
+# warning: with powerpc-apple-darwin* we can have ABI=32
+# see bug #10646 on the bug tracker, where config.guess says
+# powerpc-apple-darwin8.11.0 (this a 64-bit machine, but most applications
+# are compiled in 32 bits). It works with --disable-asm-redc.
+    powerpc-apple-darwin*)
+AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
+#if defined(__ppc__)
+#error
+#endif])], [], [AC_MSG_NOTICE([32-bit PowerPC, disabling asm-redc])
+                enable_asm_redc=no])
+                          ASMPATH=powerpc64;;
     powerpc64-*-linux*)
                          ECM_INCLUDE([<"$srcdir"/powerpc64/powerpc-defs.m4>])
                          ASMPATH=powerpc64;;
@@ -213,7 +223,9 @@
                          ASMPATH=athlon;;
     *) AC_MSG_ERROR([[asm redc not available on this machine $host]]);;
   esac
+fi

+if test "x$enable_asm_redc" = xyes; then
 # do the necessary definitions and includes
   AC_DEFINE([NATIVE_REDC],1,[Define to 1 to use asm redc])
   test "x$CCAS" != x || CCAS="$CC -c"

Please can you check it works correctly with this patch?

Paul

dimpase commented 13 years ago
comment:25

Replying to @nexttime:

the required MPIR spkg does not build on PPC (see my comment on #8664)

jdemeyer commented 13 years ago
comment:26

Replying to @nexttime:

Jeroen, can you try configuring with --disable-asm-redc?

The build (outside of Sage) works.

Replying to @zimmermann6:

is this a 32-bit machine?

Well, technically the processor is 64-bit capable (I believe) but it runs a 32-bit system and gcc produces 32-bit code by default.

What does ECM config.guess return?

powerpc-apple-darwin8.11.0

Can you try the svn version of

GMP-ECM using svn checkout svn://scm.gforge.inria.fr/svn/ecm?

This works.

Replying to @zimmermann6:

in fact this bug is already fixed upstream (in revision 1516)

Please can you check it works correctly with this patch?

This works.

Replying to @nexttime:

Setting ABI=32 would perhaps also work.

No, it does not.

jdemeyer commented 13 years ago

Work Issues: include patch for 32-bit ppc

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 13 years ago
comment:27

Replying to @jdemeyer:

Replying to @nexttime:

Jeroen, can you try configuring with --disable-asm-redc?

The build (outside of Sage) works.

Well, I'm a bit unsure what to do now. I can of course include the patch, but that does not what we actually want (it's just a work-around).

I think passing -Wa,-force_cpusubtype_ALL on MacOS PPCs should also work (which does not disable the assembly code, but avoids the odd assembler error, such that we get better performance).

Note that this worked on Dima's G4 with MPIR, so I expect it to work with a G5, too.

Don't know if G3s run into the same problem, or support these instructions. We then might have to really disable the code on PPCs < G4.

We could of course just test this in spkg-install, i.e. feed some extended instruction set assembly code to the assembler with -force_cpusubtype_ALL and see if we get an error before we disable the redc asm code. (I'd have to look what option gas takes on Linux PPC.)

Objections against adding yet another environment variable (ECM_EXTRA_OPTS, to add to ECM's configure, analoguous to PARI_EXTRA_OPTS), to ease working around potential problems showing up later?

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 13 years ago
comment:28

From my gas manpage (relevant for Linux PPC only):

...
       Target PowerPC options:
          [-mpwrx|-mpwr2|-mpwr|-m601|-mppc|-mppc32|-m603|-m604|
           -m403|-m405|-mppc64|-m620|-mppc64bridge|-mbooke]
          [-mcom|-many|-maltivec|-mvsx] [-memb]
          [-mregnames|-mno-regnames]
          [-mrelocatable|-mrelocatable-lib]
          [-mlittle|-mlittle-endian|-mbig|-mbig-endian]
          [-msolaris|-mno-solaris]
...

The options for other architectures in addition have more detailed descriptions, but unfortunately not the ones for PPC as the target. But it seems gas enables instruction set extensions by default.


P.S.: That the build works with -force_cpusubtype_ALL (without SAGE_CHECK=yes) doesn't necessarily mean we couldn't get illegal instruction exceptions when actually running the code.

kiwifb commented 13 years ago
comment:29

Replying to @nexttime:

I wonder how the GNU assembler (Linux PPC) behaves...

François, would you like to test this?

I know that gmp-ecm-6.3 builds on my linux ppc system but I don't believe I have the assembler enabled. I will try that as soon as I have access to the machine next week. I will also have a look at mpir. Note that my test machine is a G4.

I am a bit surprised that no changes where needed to build it against GMP 5.0.1 I add a bug report specifically on that in Gentoo and I could reproduce it on one of my machine which has GMP 5.0.1.

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 13 years ago
comment:30

Replying to @kiwifb:

Replying to @nexttime:

I wonder how the GNU assembler (Linux PPC) behaves...

François, would you like to test this?

I know that gmp-ecm-6.3 builds on my linux ppc system but I don't believe I have the assembler enabled. I will try that as soon as I have access to the machine next week. I will also have a look at mpir. Note that my test machine is a G4.

Ok.

I am a bit surprised that no changes where needed to build it against GMP 5.0.1

Hmmm, we have to upgrade ECM because of the upgrade of MPIR / GMP:

Changes between ecm-6.2.3 and ecm-6.3:

I add a bug report specifically on that in Gentoo and I could reproduce it on one of my machine which has GMP 5.0.1.

kiwifb commented 13 years ago
comment:31

Replying to @nexttime:

Replying to @kiwifb:

Replying to @nexttime:

I wonder how the GNU assembler (Linux PPC) behaves...

François, would you like to test this?

I know that gmp-ecm-6.3 builds on my linux ppc system but I don't believe I have the assembler enabled. I will try that as soon as I have access to the machine next week. I will also have a look at mpir. Note that my test machine is a G4.

Ok.

I am a bit surprised that no changes where needed to build it against GMP 5.0.1

Hmmm, we have to upgrade ECM because of the upgrade of MPIR / GMP:

Changes between ecm-6.2.3 and ecm-6.3:

  • New assembly code for 64-bit PowerPC (thanks to Philip McLaughlin)
  • Allow several processes to write to the same -save file
  • More routines in new P+-1 stage 2 use multi-threading in OpenMP build
  • Fixed incompatibility with GMP 5.0.0
  • Fixed several bugs, and now check return value from malloc() calls
  • Fixed linking of GMP which prevented successful builds under Darwin (and presumably other systems)
  • Allow use of x86_64 asm code under MinGW

I remember adding 6.3 to the sage-on-gentoo tree for GMP-5 {{{# ChangeLog for sci-mathematics/ecm # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 # $Header: $

08 Sep 2010; François Bissey f.r.bissey@massey.ac.nz metadata.xml: fix metadata

03 Aug 2010; Christopher Schwan cschwan@students.uni-mainz.de -ecm-6.2.3.ebuild, -ecm-6.3.ebuild: Removed old versions

*ecm-6.3-r1 (23 Jul 2010)

23 Jul 2010; Christopher Schwan cschwan@students.uni-mainz.de +ecm-6.3-r1.ebuild: Migrated to autotools-utils.eclass

08 Jul 2010; François Bissey f.r.bissey@massey.ac.nz ecm-6.3.ebuild: Hopefully fixed for gmp-5

*ecm-6.3 (07 Jul 2010)

07 Jul 2010; François Bissey f.r.bissey@massey.ac.nz +ecm-6.3.ebuild: Version bump. Hopefully helpfull with gmp-5. }}} I'll have to check my inbox for the details. I imported it on the 7th of July because it said it was compatible with GMP-5 and one of our user was using that. The user then reported that he still couldn't get ECM to build and I introduced the fix above the next day which solved the problem. A possibility is interference with by a patch to GMP Gentoo side.

On a positive note ECM 6.3 is the default in sage-on-gentoo since the 3rd of August so it has been extensively tested on x86, amd64 and ppc. However assembler code is at the user's discretion.

dimpase commented 13 years ago
comment:32

on MacOSX 10.5 PPC (G4) I get

checking what assembly label suffix to use... :
checking if globals are prefixed by underscore... configure: error: Test program links neither with nor without underscore.
Error configuring GMP-ECM.

$ gcc -v

Using built-in specs. Target: powerpc-apple-darwin9 Configured with: /var/tmp/gcc_42/gcc_42-5577~1/src/configure --disable-checking --prefix=/usr --mandir=/usr/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/[cg][.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin9 --with-gxx-include-dir=/usr/include/c++/4.0.0 --program-prefix= --host=powerpc-apple-darwin9 --target=powerpc-apple-darwin9 Thread model: posix gcc version 4.2.1 (Apple Inc. build 5577)

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 13 years ago
comment:33

Replying to @dimpase:

on MacOSX 10.5 PPC (G4) I get

checking what assembly label suffix to use... :
checking if globals are prefixed by underscore... configure: error: Test program links neither with nor without underscore.
Error configuring GMP-ECM.

Can you attach the config.log?

(Maybe weird CFLAGS etc. settings in your environment?)

dimpase commented 13 years ago

macosx 10.5 ppc G4 failure of ./configure

dimpase commented 13 years ago
comment:35

Attachment: config.log

Replying to @nexttime:

Replying to @dimpase:

on MacOSX 10.5 PPC (G4) I get

 checking what assembly label suffix to use... :
 checking if globals are prefixed by underscore... configure: error: Test program links neither with nor without underscore.
 Error configuring GMP-ECM.

Can you attach the config.log?

done

(Maybe weird CFLAGS etc. settings in your environment?)

no, it's rather prosaic

$ gcc -g conftes1.o conftes2.o 
collect2: ld terminated with signal 10 [Bus error]
ld warning: can't find atom for stabs FUN at 00000000 in conftes2.o
dimpase commented 13 years ago
comment:36

Replying to @dimpase:

$ gcc -g conftes1.o conftes2.o 
collect2: ld terminated with signal 10 [Bus error]
ld warning: can't find atom for stabs FUN at 00000000 in conftes2.o

more details - it looks like "-g" flag does not work here:


$ cat conftes1.c
#ifdef __cplusplus
extern "C" { void underscore_test(); }
#endif
main () { underscore_test(); }
$
$ cat conftes2.s
        .text
    .globl _underscore_test
_underscore_test:
$
$ gcc -g -o x conftes1.c conftes2.s
collect2: ld terminated with signal 10 [Bus error]
ld warning: can't find atom for stabs FUN at 00000000 in /var/folders/wg/wghOV5z8H7Ox9E0VSGnzm++++TM/-Tmp-//cc5M42pV.o
$ gcc -o x conftes1.c conftes2.s
$ ./x
$ 

could it be due to "empty" conftes2.s ?

dimpase commented 13 years ago
comment:37

Replying to @dimpase:

more details - it looks like "-g" flag does not work here:


 $ cat conftes1.c
 #ifdef __cplusplus
 extern "C" { void underscore_test(); }
 #endif
 main () { underscore_test(); }
 $
 $ cat conftes2.s
        .text
    .globl _underscore_test
 _underscore_test:
 $
 $ gcc -g -o x conftes1.c conftes2.s
 collect2: ld terminated with signal 10 [Bus error]
ld warning: can't find atom for stabs FUN at 00000000 in /var/folders/wg/wghOV5z8H7Ox9E0VSGnzm++++TM/-Tmp-//cc5M42pV.o
$ gcc -o x conftes1.c conftes2.s
$ ./x
$ 

could it be due to "empty" conftes2.s ?

Indeed:

$ cat c2.s
.text
.globl _underscore_test
_underscore_test:
    mflr r0
$ gcc -g -o x conftes1.c c2.s
$ ./x
$ gcc -g -O2 -o x conftes1.c c2.s
$ ./x
$ gcc -o x conftes1.c c2.s
$ ./x
$  

So, one (not me :-( )needs to explain this to the autoconf, I suppose

dimpase commented 13 years ago
comment:38

Replying to @dimpase:

So, one (not me :-( )needs to explain this to the autoconf, I suppose

I went ahead and tweaked configure with the extra asm command in conftes2.s above. It passes, but then I get it misconfigured to ppc64, and then make does not work, as it wants to build ppc64-specific asm code. The following does it better:

$ ./configure --disable-asm-redc

with this, both make and make check work OK. This is all so far out of Sage tree. I'll attach config.log, just in case.

dimpase commented 13 years ago

Attachment: c.log

macosx 10.5 ppc G4 with tweaked ./configure --disable-asm-redc (adding extra command in conftes2.s)

jdemeyer commented 13 years ago
comment:39

Replying to @dimpase:

no, it's rather prosaic

$ gcc -g conftes1.o conftes2.o 
collect2: ld terminated with signal 10 [Bus error]
ld warning: can't find atom for stabs FUN at 00000000 in conftes2.o

Please do $ /usr/libexec/gcc/powerpc-apple-darwin9/4.2.1/ld --version $ which ld $ ld --version

jdemeyer commented 13 years ago
comment:40

Again, with proper formatting:

$ /usr/libexec/gcc/powerpc-apple-darwin9/4.2.1/ld --version
$ which ld
$ ld --version 
zimmermann6 commented 13 years ago
comment:41

[I write here as a developer of GMP-ECM]

the configure error reported in comment 32 seems to be a ld problem. User "dimpase", do you manage to configure GMP successfully?

Also, which version of GMP-ECM did you use in comment 32? The svn version (see comment 24) should fix the fact that 64-bit assembly is used on 32-bit machines. If not, please report the problem upstream on http://ecm.gforge.inria.fr/.

Paul Zimmermann

dimpase commented 13 years ago
comment:42

Replying to @jdemeyer:

$ /usr/libexec/gcc/powerpc-apple-darwin9/4.2.1/ld -v
@(#)PROGRAM:ld  PROJECT:ld64-85.2.1
$ ld -v
@(#)PROGRAM:ld  PROJECT:ld64-85.2.1
$ which ld
/usr/bin/ld

I think it's the latest ld available under Xcode for ppc. (Same for gcc-4.0.1)

dimpase commented 13 years ago
comment:43

Replying to @zimmermann6:

[I write here as a developer of GMP-ECM]

the configure error reported in comment 32 seems to be a ld problem. User "dimpase", do you manage to configure GMP successfully?

Yes, I do. MPIR, to be more precise. The version on #8664.

Also, which version of GMP-ECM did you use in comment 32?

the one packed in the spkg on this ticket.

Subsequent experiments were made on the same version (without whatever patches in the spkg, however).

I then packaged the configure fix and the extra config flag into Sage spkg and am building Sage using it and the MPIR spkg on #8664. (it's not done yet, this machine is slooooow...)

The svn version (see comment 24) should fix the fact that 64-bit assembly is used on 32-bit machines. If not, please report the problem upstream on http://ecm.gforge.inria.fr/.

do you want me to test the svn version on this machine?

Paul Zimmermann

Dima Pasechnik