Difference between revisions of "Building the gmp"

From ApCoCoAWiki
m (remove spam)
(add info about gmp vs. Windows and C# bindings for the gmp)
Line 7: Line 7:
 
in order to use malloc and thereby using the heap instead of the stack. This entails a small (roughly 2% or so) performance penalty but at least your computation finishes instead of segfaulting for mysterious reasons.
 
in order to use malloc and thereby using the heap instead of the stack. This entails a small (roughly 2% or so) performance penalty but at least your computation finishes instead of segfaulting for mysterious reasons.
  
{{stub}}
+
=The gmp vs. Windows=
 +
 
 +
The standard gmp release (4.1.4 at the moment) does not compile on Windows when using the Microsoft Visual Studio compiler. While it is technically possible the build the non-optimized C version of the gmp it is only a stop gap measure since one looses lots of performace when going this route. The main culprit the gas style assembly syntax in the gmp. One way around this is to use nasm style assembly syntax. A complete Visual Studio project to build an optimized gmp can be found on [http://fp.gladman.plus.com/computing/gmp4win.htm Building GMP and MPFR with Microsoft Visual Studio 2005] provided by Brian Gladman. Another possible source for a prebuild optimized gmp library can be found at [ftp://deltatrinity.dyndns.org/gmp-4.1.4_DLL_SharedLibs/ deltatrinity.dyndns.org].
 +
 
 +
The easiest way around this whole mess is to use the MinGW tools which compile the gmp out of the box just fine.
 +
 
 +
=gmp binding for scripting languages=
 +
If you like to use the CoCoA Library from your fourite scripting language, i.e. if you need to write bindings, you also need access to the buildin native gmp data structures. To make things easy for you we provide links for certain scripting languages:
 +
# [http://cvs.savannah.gnu.org/viewcvs/dotgnu-libs/GMP-Sharp/ C# bindings] from the DOTGnu project.

Revision as of 18:39, 25 January 2006

Build Options for the GMP

There are many different possible configurations when building the gmp. One that is very important to CoCoA is how to allocate memory in the gmp since large numbers can overflow the stack quite easily. For a general overview for the gmp 4.1 have a look at http://www.gnu.org/software/gmp/manual/html_node/Build-Options.html.

So when configuring the gmp make sure that you choose

--enable-alloca=no

in order to use malloc and thereby using the heap instead of the stack. This entails a small (roughly 2% or so) performance penalty but at least your computation finishes instead of segfaulting for mysterious reasons.

The gmp vs. Windows

The standard gmp release (4.1.4 at the moment) does not compile on Windows when using the Microsoft Visual Studio compiler. While it is technically possible the build the non-optimized C version of the gmp it is only a stop gap measure since one looses lots of performace when going this route. The main culprit the gas style assembly syntax in the gmp. One way around this is to use nasm style assembly syntax. A complete Visual Studio project to build an optimized gmp can be found on Building GMP and MPFR with Microsoft Visual Studio 2005 provided by Brian Gladman. Another possible source for a prebuild optimized gmp library can be found at deltatrinity.dyndns.org.

The easiest way around this whole mess is to use the MinGW tools which compile the gmp out of the box just fine.

gmp binding for scripting languages

If you like to use the CoCoA Library from your fourite scripting language, i.e. if you need to write bindings, you also need access to the buildin native gmp data structures. To make things easy for you we provide links for certain scripting languages:

  1. C# bindings from the DOTGnu project.