Including The GNU Multiple Precision Library [GNU MP] with Solaris
Stefan Teleman <Stefan.Teleman at Sun.COM>
5 November 2007
1. Summary and motivation
The GNU MP Bignum Library [1] is described as "[...] a portable
library written in C for arbitrary precision arithmetic on integers,
rational numbers, and floating-point numbers. It aims to provide
the fastest possible arithmetic for all applications that need
higher precision than is directly supported by the basic C types.
Many applications use just a few hundred bits of precision; but some
applications may need thousands or even millions of bits. GMP is
designed to give good performance for both, by choosing algorithms
based on the sizes of the operands, and by carefully keeping the
overhead at a minimum."
The inclusion of the GNU MP Library in Solaris will provide
Solaris software developers with a recognized and widely used
multiple precision math library.
The GNU MP Library borrows ideas from Richard P. Brent's
"MP, A Fortran Multiple-Precision Arithmetic Package" [3],
and implements extensions to the IEEE 754-1985 [4] Standard for
floating-point arithmetic. Several other MP Libraries have been
developed on top of GNU MP, most notably MPFR [5].
The code of the GNU MP Library emphasizes speed over simplicity
and elegance.
This case seeks Mirco/Patch relase Binding.
2. Technical issues
2.1. Key objects
/usr/lib/libgmp.so.3.4.2
/usr/lib/libgmp.so.3 -> /usr/lib/libgmp.so.3.4.2
/usr/lib/libgmp.so -> /usr/lib/libgmp.so.3.4.2
/usr/lib/libgmpxx.so.4.0.2
/usr/lib/libgmpxx.so.4 -> /usr/lib/libgmpxx.so.4.0.2
/usr/lib/libgmpxx.so -> /usr/lib/libgmpxx.so.4.0.2
/usr/lib/libmp.so.3.1.11
/usr/lib/libmp.so.3 -> /usr/lib/libmp.so.3.1.11
/usr/lib/libmp.so -> /usr/lib/libmp.so.3.1.11
/usr/lib/${MACH64}/libgmp.so.3.4.2
/usr/lib/${MACH64}/libgmp.so.3 -> /usr/lib/${MACH64}/libgmp.so.3.4.2
/usr/lib/${MACH64}/libgmp.so -> /usr/lib/${MACH64}/libgmp.so.3.4.2
/usr/lib/${MACH64}/libgmpxx.so.4.0.2
/usr/lib/${MACH64}/libgmpxx.so.4 -> /usr/lib/${MACH64}/libgmpxx.so.4.0.2
/usr/lib/${MACH64}/libgmpxx.so -> /usr/lib/${MACH64}/libgmpxx.so.4.0.2
/usr/lib/${MACH64}/libmp.so.3.1.11
/usr/lib/${MACH64}/libmp.so.3 -> /usr/lib/${MACH64}/libmp.so.3.1.11
/usr/lib/${MACH64}/libmp.so -> /usr/lib/${MACH64}/libmp.so.3.1.11
/usr/include/gmp/gmp.h
/usr/include/gmp/gmpxx.h
/usr/include/gmp/mp.h
/usr/share/doc/gmp/html/index.html
/usr/share/doc/gmp/html/Algorithms.html
/usr/share/doc/gmp/html/BSD-Compatible-Functions.html
/usr/share/doc/gmp/html/C_002b_002b-Class-Interface.html
/usr/share/doc/gmp/html/Concept-Index.html
/usr/share/doc/gmp/html/Contributors.html
/usr/share/doc/gmp/html/Copying.html
/usr/share/doc/gmp/html/Custom-Allocation.html
/usr/share/doc/gmp/html/Floating_002dpoint-Functions.html
/usr/share/doc/gmp/html/Formatted-Input.html
/usr/share/doc/gmp/html/Formatted-Output.html
/usr/share/doc/gmp/html/Function-Index.html
/usr/share/doc/gmp/html/GMP-Basics.html
/usr/share/doc/gmp/html/GNU-Free-Documentation-License.html
/usr/share/doc/gmp/html/Installing-GMP.html
/usr/share/doc/gmp/html/Integer-Functions.html
/usr/share/doc/gmp/html/Internals.html
/usr/share/doc/gmp/html/Introduction-to-GMP.html
/usr/share/doc/gmp/html/Language-Bindings.html
/usr/share/doc/gmp/html/Low_002dlevel-Functions.html
/usr/share/doc/gmp/html/Random-Number-Functions.html
/usr/share/doc/gmp/html/Rational-Number-Functions.html
/usr/share/doc/gmp/html/References.html
/usr/share/doc/gmp/html/Reporting-Bugs.html
/usr/share/info/gmp.info
/usr/share/info/gmp.info-1
/usr/share/info/gmp.info-2
/usr/share/man/man3/gmp.3
This case proposes the integration of GNU MP Version 4.2.2.
The version of GNU MP [4.2.2] proposed for Integration is 64-bit
clean and largefile aware. The 64-bit GNU MP libraries will be
delivered with this Integration.
By default, GNU MP installs its header files under /usr/include.
We propose changing this default installation location to a more
suitable /usr/include/gmp, for the purpose of avoiding namespace
pollution in /usr/include.
GNU MP does not provide documentation in UNIX man format. A wrapper
man page, to be delivered in Section 3 of the Manual, will provide
pointers to the HTML and Texinfo documentation delivered by GNU MP.
2.2. Programmatic Facilities
GNU MP provides a large set of arithmetic and mathematical functions.
The documentation provided by GNU MP[2] categorizes several high-level
subsets for these functions:
- Integer Functions
- Rational Number Functions
- Floating-point Functions
- Low-level Functions
- Random Number Functions
- Formatted Output
- Formatted Input
- C++ Class Interface
- Berkeley MP Compatible Functions
- Custom Allocation
- Language Bindings
- Algorithms
- Internals
Key aspects of GNU MP's functionality are discussed below.
libgmp.so.3.4.2 is the C implementation of the GNU MP Bignum
Library. This shared object delivers the API's implementing
the functions contained in the subclassing enumerated above.
libmp.so.3.1.11 is the C wrapper providing the BSD MP
Compatibility API Layer. This library does not implement any
new functionality in GNU MP; its purpose is restricted to API
compatibility.
libgmpxx.so.4.0.2 is the C++ Library in GNU MP. It provides
iostream operator overloading, as well as a class hierarchy
interface to GNU MP's fundamental types [mpz_t, mpq_t and mpf_t].
Its purpose is to provide a native C++ language binding.
2.3. Build and ABI Considerations
Several aspects of the build system configuration for GNU MP,
affecting GNU MP's ABI, are discussed below.
GNU MP's build system is based on the auto*tools/configure shell
script. In addition to the standard ./configure arguments, GNU MP
provides specific options for handling temporary memory allocations:
--enable-alloca=<value>
The allowed options are:
--enable-alloca=alloca
--enable-alloca=malloc-reentrant
--enable-alloca=malloc-notreentrant
This option is particularily relevant when the consumer of the
GNU MP interfaces must allocate very large temporary objects.
For the purposes of this Integration, GNU MP will be built with
the --enable-alloca=malloc-reentrant option.
In addition to the memory allocation options, GNU MP provides
specific options for enabling FFT [Fast Fourier Transform]
multiplications. By default, multiplications in GNU MP are done
using either Karatsuba, 3-way Toom, or Fermat FFT. The Fermat
FFT option is used on large to very large operands. This integration
will enable the use of Fermat FFT:
--enable-fft
This Integration of GNU MP will also enable the BSD MP
compatibility layer library [libmp.so.3.1.11]:
--enable-mpbsd
2.4. Language Bindings
The GNU MP Library is written in ANSI C and ISA-specific assembler.
Additionally, the GNU MP distribution provides a C++ Library.
The C++ GNU MP Library will be included with this Integration:
--enable-cxx
2.5. Documentation
GNU MP provides documentation in texinfo and html formats. UNIX
man pages are not provided, by default, by GNU MP. For the purposes
of this Integration, a generic man page will be provided, in
Section 3 of the manual [gmp.3]. This man page will only include
pointers to the installed documentation [in texinfo and html
formats]. [6]
3. Interfaces
3.1. Interface Stability
The development and release schedules of the GNU MP Library are
controlled by a group of developers external to SMI
[http://gmplib.org/] [1]. Although GNU MP attempts to maintain
API and ABI compatibility between releases, ABI and API breakage
between releases may occur, especially within the C++ library and
the experimental features of GNU MP.
3.2. Imported Interfaces
GNU MP imports interfaces from the Standard C Library and the
Standard Math Library. In addition, the C++ GNU MP Library
imports interfaces from the C++ run-time Library [libCrun.so.1]
and from the Standard C++ Library [libCstd.so.1].
3.3. Exported Interfaces
NAME STABILITY NOTES
SUNWgnu-mp Uncommitted Package Name
/usr/lib/libgmp.so.3.4.2 Uncommitted Shared Library
/usr/lib/libgmp.so.3 Uncommitted Symbolic Link
/usr/lib/libgmp.so Uncommitted Symbolic Link
/usr/lib/libgmpxx.so.4.0.2 Uncommitted Shared Library
/usr/lib/libgmpxx.so.4 Uncommitted Symbolic Link
/usr/lib/libgmpxx.so Uncommitted Symbolic Link
/usr/lib/libmp.so.3.1.11 Uncommitted Shared Library
/usr/lib/libmp.so.3 Uncommitted Symbolic Link
/usr/lib/libmp.so Uncommitted Symbolic Link
/usr/lib/${MACH64}/libgmp.so.3.4.2 Uncommitted Shared Library
/usr/lib/${MACH64}/libgmp.so.3 Uncommitted Symbolic Link
/usr/lib/${MACH64}/libgmp.so Uncommitted Symbolic Link
/usr/lib/${MACH64}/libgmpxx.so.4.0.2 Uncommitted Shared Library
/usr/lib/${MACH64}/libgmpxx.so.4 Uncommitted Symbolic Link
/usr/lib/${MACH64}/libgmpxx.so Uncommitted Symbolic Link
/usr/lib/${MACH64}/libmp.so.3.1.11 Uncommitted Shared Library
/usr/lib/${MACH64}/libmp.so.3 Uncommitted Symbolic Link
/usr/lib/${MACH64}/libmp.so Uncommitted Symbolic Link
/usr/include/gmp/gmp.h Uncommitted Header file
/usr/include/gmp/gmpxx.h Uncommitted Header file
/usr/include/gmp/mp.h Uncommitted Header file
/usr/share/man/man3/gmp.3 Uncommitted Manual Page
/usr/share/info/gmp.info Uncommitted Texinfo Page
/usr/share/info/gmp.info-1 Uncommitted Texinfo Page
/usr/share/info/gmp.info-2 Uncommitted Texinfo Page
/usr/share/doc/gmp/html/index.html Uncommitted HTML Doc
/usr/share/doc/gmp/html/Algorithms.html Uncommitted HTML Doc
/usr/share/doc/gmp/html/BSD-Compatible-Functions.html Uncommitted
HTML Doc
/usr/share/doc/gmp/html/C_002b_002b-Class-Interface.html
Uncommitted HTML Doc
/usr/share/doc/gmp/html/Concept-Index.html Uncommitted HTML Doc
/usr/share/doc/gmp/html/Contributors.html Uncommitted HTML Doc
/usr/share/doc/gmp/html/Copying.html Uncommitted HTML Doc
/usr/share/doc/gmp/html/Custom-Allocation.html Uncommitted HTML Doc
/usr/share/doc/gmp/html/Floating_002dpoint-Functions.html
Uncommitted HTML Doc
/usr/share/doc/gmp/html/Formatted-Input.html Uncommitted HTML Doc
/usr/share/doc/gmp/html/Formatted-Output.html Uncommitted HTML Doc
/usr/share/doc/gmp/html/Function-Index.html Uncommitted HTML Doc
/usr/share/doc/gmp/html/GMP-Basics.html Uncommitted HTML Doc
/usr/share/doc/gmp/html/GNU-Free-Documentation-License.html
Uncommitted HTML Doc
/usr/share/doc/gmp/html/Installing-GMP.html Uncommitted HTML Doc
/usr/share/doc/gmp/html/Integer-Functions.html Uncommitted HTML Doc
/usr/share/doc/gmp/html/Internals.html Uncommitted HTML Doc
/usr/share/doc/gmp/html/Introduction-to-GMP.html Uncommitted
HTML Doc
/usr/share/doc/gmp/html/Language-Bindings.html Uncommitted HTML Doc
/usr/share/doc/gmp/html/Low_002dlevel-Functions.html Uncommitted
HTML Doc
/usr/share/doc/gmp/html/Random-Number-Functions.html Uncommitted
HTML Doc
/usr/share/doc/gmp/html/Rational-Number-Functions.html Uncommitted
HTML Doc
/usr/share/doc/gmp/html/References.html Uncommitted HTML Doc
/usr/share/doc/gmp/html/Reporting-Bugs.html Uncommitted HTML Doc
4. References
[1] http://www.gmplib.org/
[2] http://gmplib.org/gmp-man-4.2.2.pdf
[3] http://portal.acm.org/citation.cfm?id=355776
[4] http://grouper.ieee.org/groups/754/
http://www.psc.edu/general/software/packages/ieee/ieee.html
[5] http://www.loria.fr/~hanrot/Papers/toms.pdf
[6] /shared/sac/PSARC/2007/166
--
Stefan Teleman
Sun Microsystems, Inc.
Stefan.Teleman at Sun.COM