Opened 7 years ago

Closed 7 years ago

Last modified 4 years ago

#14151 closed enhancement (fixed)

Update GMP-ECM to 6.4.4

Reported by: zimmerma Owned by: tbd
Priority: major Milestone: sage-5.10
Component: packages: standard Keywords: spkg
Cc: leif Merged in: sage-5.10.beta0
Authors: Jeroen Demeyer Reviewers: François Bissey, Paul Zimmermann
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by jdemeyer)

GMP-ECM 6.4.4 is available at https://gforge.inria.fr/frs/download.php/32159/ecm-6.4.4.tar.gz.

With respect to 6.3 currently used in Sage:

Changes between GMP-ECM 6.4.3 and GMP-ECM 6.4.4:
* Fixed PowerPC64 assembly code with --enable-shared (thanks Leif Leonhardy)
* Fix to deal with change of semantics of internal GMP functions in GMP 5.1
* Fixed small memory leak in non-NTT P-1 stage 2
* Fixed segfaults with large non-NTT P+-1 stage 2
* Removed defunct -t command line option

Changes between GMP-ECM 6.4.2 and GMP-ECM 6.4.3:
* Fixed bug reported by user "lorgix" on mersenneforum
  (http://www.mersenneforum.org/showpost.php?p=286385&postcount=280)
* Use 64-bit value for random seed under Windows

Changes between GMP-ECM 6.4.1 and GMP-ECM 6.4.2:
* Corrected the copyright headers
* Reduced memory usage in stage 1 with -batch={1,2} mode.
* Fixed bug in modular reduction (could occur only for numbers larger than
  386 digits on 64-bit computers and 193 digits on 32-bit computers).
* Speedup in stage 2 with the NTT default mode

Changes between GMP-ECM 6.4 and GMP-ECM 6.4.1:
* GMP-ECM is now distributed under the GPL version 3 or later for the binary,
  and under the LGPL version 3 or later for the library
* Fixed a speed regression with respect to GMP-ECM 6.3
  http://lists.gforge.inria.fr/pipermail/ecm-discuss/2012-February/004103.html
* Fixed a bug with the -treefile option which had been present for a long time
* Several fixes for the Visual Studio 2010 build
* New experimental option -batch=2, and speedup for -batch (i.e., -batch=1)
* New tuning mechanism, now --enable-asm-redc is always recommended
* New configure option --enable-mulredc-svoboda, for input numbers whose low
  limbs is congruent to -1
* New tuning parameters for Intel Core i5
* New ecmbench utility

Changes between GMP-ECM 6.3 and GMP-ECM 6.4:
* Fixed configure problem with SSE2
  (http://trac.sagemath.org/sage_trac/ticket/10252)
* Fixed configure bug on 32-bit PowerPC (tried to use 64-bit assembly)
  https://gforge.inria.fr/tracker/index.php?func=detail&aid=10646
* Fixed dependencies from build directory
  https://gforge.inria.fr/tracker/index.php?func=detail&aid=10648
* Patch from David Cleaver to allow B1 >= 2^32 on machines where
  "unsigned long" has 32 bits only
* Patch from David Cleaver to use GWNUM 26.6 on Windows x64 with MingW64/Msys
* Improved conversion from mpz_t to residue number system in NTT code
* Better asm code for AMD cpus
* Use of GMP's mpn_mullo_n and mpn_redc_2 when available
* New option -batch with faster Stage 1 (but smaller success probability)
* Added Visual Studio 2010 build

spkg: http://boxen.math.washington.edu/home/jdemeyer/spkg/ecm-6.4.4.spkg (diff)

Attachments (1)

ecm-6.4.4.diff (9.6 KB) - added by jdemeyer 7 years ago.

Download all attachments as: .zip

Change History (53)

comment:1 Changed 7 years ago by leif

  • Cc leif added
  • Component changed from basic arithmetic to packages
  • Keywords spkg added
  • Owner changed from AlexGhitza to tbd

comment:2 Changed 7 years ago by leif

Hi Paul,

I noticed a while ago that it is still necessary to explicitly --disable-sse2 (export ECM_CONFIGURE="--disable-sse2" when building Sage) on a Pentium III (which doesn't have SSE2). (In Sage, SSE2 also gets disabled if one uses SAGE_FAT_BINARY=yes for 32-bit builds IIRC, but vanilla GMP-ECM tries to use SSE2 even when configured for pentium3-*-*, implicitly or explicitly.)

Unfortunately my Pentium III meanwhile died, and I haven't tried to revive it yet, but this was true for the latest GMP-ECM 6.4.x at that time as well. I vaguely remember the problem in the configure test was that it only tries to compile with SSE2 instructions, but doesn't try to run the resulting program (if appropriate, i.e., when not cross-compiling). Alternatively, or in addition, SSE2 should simply get disabled if the target is pentium-*-*|pentium2-*-*|pentium3-*-* etc.

comment:3 follow-ups: Changed 7 years ago by zimmerma

Hi Leif,

I wonder how sse2 can be enabled on a Pentium3, since configure.in only enables it (when not requested by the user) for pentium4-*-* | viac7-*-* | i686-*-* | i786-*-*.

Unless we have a concrete example of a computer where it fails, I'm reluctant to add a patch one could not test.

Paul

comment:4 in reply to: ↑ 3 Changed 7 years ago by leif

Replying to zimmerma:

I wonder how sse2 can be enabled on a Pentium3, since configure.in only enables it (when not requested by the user) for pentium4-*-* | viac7-*-* | i686-*-* | i786-*-*.

Hmmm, it seems somehow pentium3-* gets mapped to i686-*, which then triggers the use of SSE2 (if "supported"; the test apparently doesn't try to run a program with SSE2 instructions, as mentioned).

Just tried configuring GMP-ECM 6.4.4-rc2 on a Pentium4 (i.e., a 32-bit machine) with --target=pentium3-linux-gnu, which results in

...
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
...
checking for SSE2 support... yes
...
config.status: linking ../../src/ecm-6.4.4-rc2/ecm-params.h.pentium4 to ecm-params.h
config.status: linking ../../src/ecm-6.4.4-rc2/mul_fft-params.h.default to mul_fft-params.h
config.status: executing depfiles commands
config.status: executing libtool commands
configure: Configuration:
configure: Build for host type i686-pc-linux-gnu
configure: CC=gcc-4.7.2, CFLAGS=-g -O2
configure: Linking GMP with -lgmp
configure: Not using asm redc code
configure: Using SSE2 instructions in NTT code
configure: Assertions disabled
configure: Shell command execution disabled
configure: OpenMP disabled
configure: Memory debugging disabled

(Similar for --build=pentium3-linux-gnu, and configure ... pentium3-linux-gnu.)

Unless we have a concrete example of a computer where it fails, I'm reluctant to add a patch one could not test.

Well, it's a minor issue, and we could probably also work around that in Sage's spkg-install, at least for the moment...

(I guess not many people will use a "stand-alone" GMP-ECM on such old processors. ;-) )

comment:5 follow-up: Changed 7 years ago by zimmerma

Leif, configure --target=... is not valid, see configure --help, you should use either --build=... or --host=...

Note that your run did choose Pentium4 as target and not Pentium3:

config.status: linking ../../src/ecm-6.4.4-rc2/ecm-params.h.pentium4 to ecm...

Paul

comment:6 Changed 7 years ago by leif

P.S.:

The GCC default target also matters, but doesn't really make a difference; with (Ubuntu) GCC 4.4.3 I get:

...
checking for SSE2 support... yes, with -msse2
...
config.status: linking ../../src/ecm-6.4.4-rc2/ecm-params.h.pentium4 to ecm-params.h
config.status: linking ../../src/ecm-6.4.4-rc2/mul_fft-params.h.default to mul_fft-params.h
config.status: executing depfiles commands
config.status: executing libtool commands
configure: Configuration:
configure: Build for host type i686-pc-linux-gnu
configure: CC=gcc-4.4.3, CFLAGS=-g -O2 -msse2
configure: Linking GMP with -lgmp
configure: Not using asm redc code
configure: Using SSE2 instructions in NTT code
configure: Assertions disabled
configure: Shell command execution disabled
configure: OpenMP disabled
configure: Memory debugging disabled

comment:7 in reply to: ↑ 5 ; follow-up: Changed 7 years ago by leif

Replying to zimmerma:

Leif, configure --target=... is not valid, see configure --help, you should use either --build=... or --host=...

That doesn't really matter, i.e., same with --host=... or just the (deprecated) pentium3-pc-linux-gnu parameter. (It always gets mapped to "checking host system type... i686-pc-linux-gnu", although configure is also "checking for pentium3-pc-linux-gnu-gcc... gcc-4.4.3".)

Note that your run did choose Pentium4 as target and not Pentium3:

config.status: linking ../../src/ecm-6.4.4-rc2/ecm-params.h.pentium4 to ecm...

Yes, noticed that, which is also wrong (but only affects tuning parameters, so pretty harmless, right?).

comment:8 in reply to: ↑ 7 Changed 7 years ago by leif

Replying to leif:

Note that your run did choose Pentium4 as target and not Pentium3:

config.status: linking ../../src/ecm-6.4.4-rc2/ecm-params.h.pentium4 to ecm...

Yes, noticed that, which is also wrong (but only affects tuning parameters, so pretty harmless, right?).

Found some old logs from the native build attempts (with GMP-ECM 6.3, 6.4.2 and 6.4.3b), there it was

...
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
...
checking for SSE2 support... yes
...
config.status: linking ../ecm-6.4.3b/ecm-params.h.default to ecm-params.h
config.status: linking ../ecm-6.4.3b/mul_fft-params.h.default to mul_fft-params.h
...
configure: Build for host type i686-pc-linux-gnu
configure: CC=gcc, CFLAGS=-march=native -mtune=native -O3 -fomit-frame-pointer -DHONORS_CFLAGS
configure: Linking GMP with /scratch/local/coppermine//lib/libgmp.a
configure: Not using asm redc code
configure: Using SSE2 instructions in NTT code
...

comment:9 Changed 7 years ago by leif

P.S.: There I used --build=... in the second attempt, which still led to SSE2 getting enabled.

comment:10 follow-up: Changed 7 years ago by fbissey

There is a patch to configure in the current ecm spkg, is it still needed? I am preparing a proper spkg so I can test this on power7.

comment:11 in reply to: ↑ 10 ; follow-up: Changed 7 years ago by leif

Replying to fbissey:

There is a patch to configure in the current ecm spkg, is it still needed?

Haven't looked at it, but that's presumably the PPC64 patch that went upstream so isn't needed anymore.

I am preparing a proper spkg so I can test this on power7.

comment:12 in reply to: ↑ 11 Changed 7 years ago by leif

Replying to leif:

Replying to fbissey:

There is a patch to configure in the current ecm spkg, is it still needed?

Haven't looked at it, but that's presumably the PPC64 patch that went upstream so isn't needed anymore.

Nope, but the patches are all from upstream, so should no longer be necessary.

comment:13 follow-up: Changed 7 years ago by fbissey

ppc64 is kind of the main point of the upgrade. I have asked Paul if the patch was added in a later release upstream and he said he would prepare a release.

comment:14 in reply to: ↑ 13 Changed 7 years ago by leif

Replying to fbissey:

ppc64 is kind of the main point of the upgrade. I have asked Paul if the patch was added in a later release upstream and he said he would prepare a release.

Yes, that's 6.4.4[-rc2]; cf. the upstream changelog in the ticket's description.

comment:15 in reply to: ↑ 3 Changed 7 years ago by leif

Replying to zimmerma:

I wonder how sse2 can be enabled on a Pentium3, since configure.in only enables it (when not requested by the user) for pentium4-*-* | viac7-*-* | i686-*-* | i786-*-*.

Actually, GMP-ECM's config.sub "canonicalizes" pentium3-* (as well as pentium2-* and similar) to i686-*, so i686 is not sufficient to assume SSE2 support. (pentium4-* gets i786-*.)

(i686 then apparently triggers the SSE2 configure test, which doesn't try to execute SSE2 instructions.)

comment:16 follow-up: Changed 7 years ago by zimmerma

to answer all questions:

1) ecm-6.4.4-rc2 should include all bug fixes reported upstream, including the one for powerpc64

2) for the sse2 issue, as said above we (upstream) won't change anything that we can't test on a real machine

Paul

comment:17 Changed 7 years ago by fbissey

I started a build with checks but never had time to go back to it because I have been litteraly buried in paperwork after starting. I will check how it did now.

comment:18 Changed 7 years ago by fbissey

OK, ecm test suite passed on power7 as well as the sage/libs/libecm.pyx doctests. Something I have just noticed looking at the build log:

checking for cblas_dgemm in -lgslcblas... yes
checking for gsl_blas_dgemm in -lgsl... yes

Is ecm depending on gsl and specifically for generic cblas functions that could be provided by atlas or openblas?

Francois

comment:19 follow-up: Changed 7 years ago by zimmerma

Is ecm depending on gsl and specifically for generic cblas functions that could be provided by atlas or openblas?

this is not a mandatory dependency. GSL is only used to compute some probability of success, of some macro is defined...

Paul

comment:20 in reply to: ↑ 19 Changed 7 years ago by fbissey

Replying to zimmerma:

Is ecm depending on gsl and specifically for generic cblas functions that could be provided by atlas or openblas?

this is not a mandatory dependency. GSL is only used to compute some probability of success, of some macro is defined...

<entering packager mode> Quick check on configure --help..... This is automagic detection, as a Gentoo packager of ecm I object. Furthermore the test is for a generic cblas function (I know generic detection of blas into autoconf is not trivial). It would be better to provide a --with-cblas switch on which you could pass appropriate linking flags for cblas.

I am done with the packaging rant.

comment:21 in reply to: ↑ 16 Changed 7 years ago by leif

Replying to zimmerma:

2) for the sse2 issue, as said above we (upstream) won't change anything that we can't test on a real machine

FWIW, GMP-ECM's config.guess/config.sub and configure[.in] are currently at least inconsistent (which can be seen without having access to a Pentium III ;-) ).

  • config.guess on my Pentium 4 yields i686-..., not pentium4-....
  • config.sub canonicalizes {pentium2,pentiumii,pentium3,pentiumiii}-* to i686-* (and pentium4-* to i786-*, as mentioned).
  • configure[.in] uses $host (rather than $host_alias), which in the relevant checks is -- as is -- always the canonicalized name (which especially means i686-* on Pentium II and III machines), such that any test for (e.g.) pentium3-* or pentium4-* can never match.
  • The SSE2 test doesn't try to execute SSE2 instructions, even when not cross-compiling.

comment:22 follow-up: Changed 7 years ago by zimmerma

Leif, does the config.guess file shipped with GMP 5.1.1 give better results?

Does $host_alias give pentium4-... on your Pentium 4?

Paul

comment:23 in reply to: ↑ 22 Changed 7 years ago by leif

Replying to zimmerma:

Leif, does the config.guess file shipped with GMP 5.1.1 give better results?

leif@restless:~/src$ gmp-5.1.1/config.guess 
pentium4-pc-linux-gnu
leif@restless:~/src$ ecm-6.4.4-rc2/config.guess 
i686-pc-linux-gnu
leif@restless:~/src$ gmp-5.1.1/config.sub pentium3-linux-gnu
pentium3-pc-linux-gnu
leif@restless:~/src$ ecm-6.4.4-rc2/config.sub pentium3-linux-gnu
i686-pc-linux-gnu
leif@restless:~/src$ gmp-5.1.1/config.sub pentium4-linux-gnu
pentium4-pc-linux-gnu
leif@restless:~/src$ ecm-6.4.4-rc2/config.sub pentium4-linux-gnu
i786-pc-linux-gnu

So yes, you could probably take both from GMP 5.1.1.


Does $host_alias give pentium4-... on your Pentium 4?

host_alias contains the name specified on the command line, so it contains pentium4-* (only) if I explicitly configure with [--host=]pentium4-linux-gnu. (It's otherwise empty.)

comment:24 Changed 7 years ago by zimmerma

Francois, I've removed the GSL/BLAS dependency in the development version.

Paul

comment:25 Changed 7 years ago by zimmerma

GMP-ECM 6.4.4 has been released.

Paul

comment:26 Changed 7 years ago by leif

  • Description modified (diff)

comment:27 follow-up: Changed 7 years ago by fbissey

I will give it a spin when I have time.

comment:28 in reply to: ↑ 27 ; follow-up: Changed 7 years ago by leif

Replying to fbissey:

I will give it a spin when I have time.

I was just going to ask whether you're going to provide an spkg with the final version...

comment:29 in reply to: ↑ 28 Changed 7 years ago by fbissey

Replying to leif:

Replying to fbissey:

I will give it a spin when I have time.

I was just going to ask whether you're going to provide an spkg with the final version...

I'd rather leave that to someone else. I have a number of things to do. Chase the cvxopt bug on power7 bump the sage-on-gentoo overlay so there is a 5.8.beta to test and official paid work that's supposed to come first :)

comment:30 Changed 7 years ago by leif

Just revisited #12472 ... (disabling asm redc when compiling with clang).

comment:31 Changed 7 years ago by jdemeyer

  • Authors set to Jeroen Demeyer
  • Description modified (diff)

I created a spkg by essentially just putting the new upstream sources in.

Changed 7 years ago by jdemeyer

comment:32 Changed 7 years ago by jdemeyer

  • Status changed from new to needs_review

comment:33 Changed 7 years ago by jdemeyer

Seems to work fine on the buildbot.

comment:34 Changed 7 years ago by fbissey

  • Reviewers set to François Bissey
  • Status changed from needs_review to positive_review

Compile fine and tests pass on power7 as well. The diff for spkg looks ok to me. I am putting this to positive review.

comment:35 follow-ups: Changed 7 years ago by zimmerma

sorry Francois was quicker than myself. Here are my 2 cents.

In SPKG.txt:

 * We currently work around a linker bug on MacOS X 10.5 PPC (with
   GCC 4.2.1) which breaks 'configure' if debug symbols are enabled.
   This *might* get fixed in later upstream releases.

Is that still true, since there is no patch any more?

I notice you don't run "make check". It is highly recommended (maybe in a future revision of the spkg), especially since spkg-install uses different values of CC/CFLAGS than the upstream package would choose.

Paul

comment:36 in reply to: ↑ 35 ; follow-up: Changed 7 years ago by fbissey

  • Status changed from positive_review to needs_work
  • Work issues set to SPKG,txt clean up

Replying to zimmerma:

sorry Francois was quicker than myself. Here are my 2 cents.

In SPKG.txt:

 * We currently work around a linker bug on MacOS X 10.5 PPC (with
   GCC 4.2.1) which breaks 'configure' if debug symbols are enabled.
   This *might* get fixed in later upstream releases.

Is that still true, since there is no patch any more?

I believe it is fixed as from the description of the patch:

* configure.patch: 
 	   - Disable "asm-redc" on 32-bit Darwin PPCs (upstream revision 1516 / bug 
 	     #10646). 
 	     (Note that this upstream patch is likely to slow down GMP-ECM on 64-bit 
 	     PPC CPUs running (32-bit) MacOS X, since the extended instruction set of 
 	     the CPU is no longer exploitet.  A proper fix would just pass an option 
 	     to Apple's assembler to allow the use of the extended instruction set.)   
	 	   - Fix compilation error on x86 CPUs supporting SSE2. (Sage trac #10252, 
 	     upstream revision 1546). 

So there is mention of two revisions in gmp-ecm taking care of the problem from that patch. But good spotting, SPKG.txt needs cleaning to remove that statement.

I notice you don't run "make check". It is highly recommended (maybe in a future revision of the spkg), especially since spkg-install uses different values of CC/CFLAGS than the upstream package would choose.

In this case checks are run if SAGE_CHECK is set during building. There are few spkg where the test suite is systematically run. I guess there would be a call for it if the packge was troublesome on a regular basis.

comment:37 in reply to: ↑ 35 Changed 7 years ago by jdemeyer

Replying to zimmerma:

In SPKG.txt:

 * We currently work around a linker bug on MacOS X 10.5 PPC (with
   GCC 4.2.1) which breaks 'configure' if debug symbols are enabled.
   This *might* get fixed in later upstream releases.

Is that still true, since there is no patch any more?

OK, removed that comment.

comment:38 Changed 7 years ago by zimmerma

it is now fine for me. Jeroen, please can you modify to "needs review"?

Paul

comment:39 Changed 7 years ago by jdemeyer

  • Reviewers changed from François Bissey to François Bissey, Paul Zimmermann
  • Status changed from needs_work to positive_review

I would say positive review then, given that François already gave positive review and you (Paul) agreed with the further changes.

comment:40 Changed 7 years ago by zimmerma

I would say positive review then...

yes please!

Paul

comment:41 Changed 7 years ago by jdemeyer

  • Milestone changed from sage-5.9 to sage-5.10
  • Work issues SPKG,txt clean up deleted

comment:42 Changed 7 years ago by jdemeyer

  • Merged in set to sage-5.10.beta0
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:43 in reply to: ↑ 36 Changed 7 years ago by leif

Replying to fbissey:

Replying to zimmerma:

sorry Francois was quicker than myself. Here are my 2 cents.

In SPKG.txt:

 * We currently work around a linker bug on MacOS X 10.5 PPC (with
   GCC 4.2.1) which breaks 'configure' if debug symbols are enabled.
   This *might* get fixed in later upstream releases.

Is that still true, since there is no patch any more?

"We work around ..." != "We patch ...", and the comment was in "Special Update/Build Instructions", not its "Patches" subsection.


I believe it is fixed as from the description of the patch:

* configure.patch: 
 	   - Disable "asm-redc" on 32-bit Darwin PPCs (upstream revision 1516 / bug 
 	     #10646). 
 	     (Note that this upstream patch is likely to slow down GMP-ECM on 64-bit 
 	     PPC CPUs running (32-bit) MacOS X, since the extended instruction set of 
 	     the CPU is no longer exploitet.  A proper fix would just pass an option 
 	     to Apple's assembler to allow the use of the extended instruction set.)   
	 	   - Fix compilation error on x86 CPUs supporting SSE2. (Sage trac #10252, 
 	     upstream revision 1546). 

So there is mention of two revisions in gmp-ecm taking care of the problem from that patch. But good spotting, SPKG.txt needs cleaning to remove that statement.


The comment referred to the following part of spkg-install (which is still in, and presumably still necessary -- perhaps ask Dima, so should have been kept):

    case "`uname -srm | tr ' ' '-'`" in
        Darwin-9*-[Pp]ower*)
            # Don't add debug symbols because configure otherwise
            # fails due to a bus error in Apple's 'ld' when trying
            # to determine if global symbols are prefixed with an
            # underscore (cf. http://trac.sagemath.org/sage_trac/ticket/5847#comment:35 ff.):
            echo >&2 "Warning: Disabling debug symbols on MacOS X 10.5" \
                "PowerPC because of a linker (?) bug."
            echo >&2 "See http://trac.sagemath.org/sage_trac/ticket/5847#comment:35" \
                "ff. for details."
            echo >&2
            CFLAGS="-O3 $CFLAGS"
            ;;
        *)
            CFLAGS="-g -O3 $CFLAGS"
    esac

By the way, the attached diff doesn't reflect the latest spkg version.

comment:44 Changed 4 years ago by zimmerma

a release candidate for GMP-ECM is available. See https://lists.gforge.inria.fr/pipermail/ecm-discuss/2016-February/004328.html. It would be nice if someone could try it within Sage.

Paul

comment:45 follow-up: Changed 4 years ago by fbissey

I am looking at it. Remarks so far:

  • parallel make works :)
  • properly link without adding extra -lgmp flags :)
  • still issues when assembly is enabled if you don't add -Wl,-z,noexecstack to LDFLAGS :(
     * QA Notice: The following files contain writable and executable sections
     *  Files with such sections will not work properly (or at all!) on some
     *  architectures/operating systems.  A bug should be filed at
     *  http://bugs.gentoo.org/ to make sure the issue is fixed.
     *  For more information, see:
     * 
     *    https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart
     * 
     *  Please include the following list of files in your report:
     *  Note: Bugs should be filed for the respective maintainers
     *  of the package in question and not hardened@g.o.
     * RWX --- --- usr/lib64/libecm.so.0.0.0
    
  • testsuite fails here (log on request) with or without asm-redc :(

Now I will test drive sage with it.

comment:46 Changed 4 years ago by fbissey

May be we should take the conversation to a new ticket. Anyway first victim:

File "/usr/lib64/python2.7/site-packages/sage/rings/integer.pyx", line 3500, in sage.rings.integer.Integer.?
Failed example:
    n.factor(algorithm='ecm')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python2.7/site-packages/sage/doctest/forker.py", line 499, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/lib64/python2.7/site-packages/sage/doctest/forker.py", line 861, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.rings.integer.Integer.?[18]>", line 1, in <module>
        n.factor(algorithm='ecm')
      File "sage/rings/integer.pyx", line 3584, in sage.rings.integer.Integer.factor (/scratch2/portage/sci-mathematics/sage-9999/work/sage-9999/src-python2_7/build/cythonized/sage/rings/integer.c:23897)
        res = [(p, 1) for p in ecm.factor(n, proof=proof)]
      File "/usr/lib64/python2.7/site-packages/sage/interfaces/ecm.py", line 651, in factor
        n_factorization = self.find_factor(n)
      File "/usr/lib64/python2.7/site-packages/sage/interfaces/ecm.py", line 555, in find_factor
        factors = self._find_factor(n, factor_digits, B1, **kwds)
      File "/usr/lib64/python2.7/site-packages/sage/interfaces/ecm.py", line 505, in _find_factor
        out = self._run_ecm(cmd, n)
      File "/usr/lib64/python2.7/site-packages/sage/interfaces/ecm.py", line 214, in _run_ecm
        raise ValueError(err)
    ValueError: Unknown option: -cofdec

with corresponding offending code in sage/interfaces/ecm.py

    def _find_factor(self, n, factor_digits, B1, **kwds):
        """
        Helper for :meth:`find_factor`.

        INPUT:

        See :meth:`find_factor`.

        OUTPUT:

        List of pairs ``(integer, bool)`` consisting of factors of the
        ECM input and whether they are probable prime. Note that ECM
        is not a good primality test and there is a sizeable chance
        that a "probable prime" is actually composite.

        EXAMPLES::

            sage: f = ECM()
            sage: n = 508021860739623467191080372196682785441177798407961
            sage: f._find_factor(n, None, 2000)
            [(79792266297612017, True), 
             (6366805760909027985741435139224233, True)]
        """
        n = self._validate(n)
        kwds.setdefault('c', 1000000000)
        kwds.setdefault('I', 1)
        if factor_digits is not None:
            B1 = self.recommended_B1(factor_digits)
        kwds['one'] = True
        kwds['cofdec'] = True
        cmd = self._make_cmd(B1, None, kwds)
        out = self._run_ecm(cmd, n)
        return self._parse_output(n, out)

Also mentioned at line 143

        - ``cofdec`` -- boolean. Force cofactor output in decimal
          (even if expressions are used )

the doctest for sage/interface/ecm.py hangs:

sage -t --long /usr/lib64/python2.7/site-packages/sage/interfaces/ecm.py
Trying (line 207):    ecm._run_ecm(['cat'], 1234)
Expecting:
    '1234'
ok [0.01 s]
Trying (line 209):    sig_on_count() # check sig_on/off pairings (virtual doctest)
Expecting:
    0
ok [0.00 s]
Trying (line 231):    print(ecm(3))    # random output
Expecting:
    GMP-ECM 6.4.4 [configured with MPIR 2.6.0, --enable-asm-redc] [ECM]
    Input number is 3 (1 digits)
    ********** Factor found in step 1: 3
    Found input number N

strangely ps ux reports that ecm 10 is running not ecm 3 as you would expect.

comment:47 Changed 4 years ago by fbissey

Oh and please increase the version number of the .so file. If it was the same interface as with 6.4.4 we could install ecm-7.0 and not have to recompile sage/libs/libecm.pyx. Using the new library without recompile just explodes in your face when trying to load sage/libs/libecm.so.

Recompiling sage against the new libecm works however so the change must not be that big.

comment:48 Changed 4 years ago by fbissey

You probably quoted the wrong message. I was testing 7.0-rc1 while you posted rc2 there: http://lists.gforge.inria.fr/pipermail/ecm-discuss/2016-March/004333.html

comment:49 Changed 4 years ago by zimmerma

May be we should take the conversation to a new ticket.

yes feel free to create a new ticket. I used that one to have the usual suspects informed of the new release candidate.

Paul

comment:50 in reply to: ↑ 45 Changed 4 years ago by zimmerma

  • still issues when assembly is enabled if you don't add -Wl,-z,noexecstack to LDFLAGS :(

please could you submit a patch for this?

testsuite fails here (log on request) with or without asm-redc :(

yes please send the log on the ecm-discuss list.

Paul

comment:51 Changed 4 years ago by zimmerma

the -cofdec option was removed in GMP-ECM 7.0, thus it should be disabled in the Sage interface.

And my comment 44 was before the rc2 was out.

I have increased the version info to 1.0.0.

Paul

comment:52 Changed 4 years ago by zimmerma

I've created a new ticket #20385 for the update to 7.0.

Note: See TracTickets for help on using tickets.