This post in reply to the Post, faster GMP on x86-64

Maple uses the LGPL licensed GMP as a support library for doing large integer and high precision float computations. There exists is a later version of GMP than was bundled and shipped in Maple 14.x. A natural question is whether it would improve Maple's performance. Another question is whether it can be used within Maple 14.

On an Intel i5 running 64bit Linux (ubuntu 10.04) I just built a shared-library version of GMP 5.0.1. Then I pointed 64bit Maple 14.01 at it (some details below).

Here an example of a performance difference,

(Original Maple 14.01)
> restart: kernelopts(printbytes=false): Digits:=100:
> CodeTools:-Usage(proc() local i;
> for i from 1 to 20000 do 1.0/(i!); end do;
> NULL; end proc()):
memory used=1.18GiB, alloc change=33.99MiB, cpu time=18.16s, real time=18.22s

(Altered Maple 14.01)
> restart: kernelopts(printbytes=false): Digits:=100:
> CodeTools:-Usage(proc() local i;
> for i from 1 to 20000 do 1.0/(i!); end do;
> NULL; end proc()):
memory used=1.16GiB, alloc change=34.49MiB, cpu time=7.38s, real time=7.41s

I ran a few other examples, and obtained correct results. Often with a 2x to 4x speedup and only a small and expected (cf. their docs) memory allocation increase. Of course, that does not comprise rigourous or exhautive testing! But it looks like enough to warrant an investigation into whether gmp 5.0.x could get into somce future major release of Maple.

It is interesting to see such performance improvements right off -- merely by dropping in a replacement. There are also some new or improved functions in GMP 5.0.x, but such simple drop-in replacement wouldn't see use of all of them. Perhaps some changes in Maple's engine (kernel) would be necessary to see full benefits. See the descriptions of the 5.0.x changes.

I just did a simple build. Nothing fancy on my part, related to compiler options relating to the architecture. I wouldn't mind knowing what flags were used to build the older GMP bundled with Maple 14, though. (It's a local machine, non-networked Maple installation, so only my own host would ever run it, anyway.)

  ./configure --enable-shared --disable-static 

It configured itself for ABI="64" automatically. I changed the sym-links libgmp.so and libgmp.so.3 under my Maple's bin.X86_64_LINUX directory to point instead at the newly built libgmp.so.10.0.1 shared object. If this doesn't all make sense to you, then such unofficially recommended (or should that be officially unrecommended?!) customization is likely not for you.

I may try a similar thing on 64bit Windows 7, using mingw and/or cygwin to build. If anyone's curious.

acer


This has been branched into the following page(s):
Please Wait...