1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
How to compile GNU MPFR with mini-gmp
=====================================
To build and test MPFR against mini-gmp:
./configure --with-mini-gmp=DIR [other configure options]
make
make check
where DIR is the directory that contains mini-gmp
(for example .../gmp-6.2.0/mini-gmp).
"make" will build mini-gmp with the same compiler as for MPFR.
For "make check", tests that use features not supported by mini-gmp
(mpq_t, mpf_t, and the gmp_*printf functions) are skipped.
Note: To use this version of the MPFR library, you need to define
the MPFR_USE_MINI_GMP macro before including mpfr.h (alternatively,
you can modify mpfr.h to define this macro at the beginning, though
this is discouraged). And since mini-gmp currently does not provide
random functions, you also need to define the gmp_randstate_t type
with
typedef long int gmp_randstate_t[1];
before including mpfr.h (or you may want to modify mini-gmp.h).
Remark: The random functions provided by MPFR configured with mini-gmp
use the standard rand() function, thus one should avoid mini-gmp if one
needs some really serious random functions. Another consequence is that
these functions may not be thread-safe.
The build with mini-gmp may require ISO C99+ features, such as "long long".
This was tested with MPFR svn r13974 and GMP 6.2.0 on x86_64 GNU/Linux:
============================================================================
Testsuite summary for MPFR 4.1.0-dev
============================================================================
# TOTAL: 183
# PASS: 172
# SKIP: 11
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
============================================================================
How to use mini-gmp with reduced limb size
==========================================
Following the idea of Micro-GMP [1], the GMP developers have adapted mini-gmp
so that it can be used with a reduced limb size. For that, you need GMP 6.2.0
(or later) and define the MINI_GMP_LIMB_TYPE macro with the associated base
type, e.g.
-DMINI_GMP_LIMB_TYPE=char (in practice, 8 bits)
-DMINI_GMP_LIMB_TYPE=short (in practice, 16 bits)
-DMINI_GMP_LIMB_TYPE=int (in practice, 32 bits)
For example:
./configure --with-mini-gmp=DIR CFLAGS="-DMINI_GMP_LIMB_TYPE=int"
This was tested with MPFR svn r13974 and GMP 6.2.0 on x86_64 GNU/Linux:
============================================================================
Testsuite summary for MPFR 4.1.0-dev
============================================================================
# TOTAL: 183
# PASS: 172
# SKIP: 11
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
============================================================================
[1] https://members.loria.fr/PZimmermann/talks/microgmp.pdf
|