CINXE.COM

GMP Pi computation

<!DOCTYPE HTML> <html> <head> <title>GMP Pi computation</title> <link rel="shortcut icon" href="favicon.ico"> <link rel="stylesheet" href="new.css"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> td {padding-left:4pt; padding-right:4pt;}</style> <style type="text/css"> th {padding-left:4pt; padding-right:4pt;}</style> </head> <body> <div id="top"> <table style="width:100%; background-color:#b0b0b0;"> <tr> <td style="text-align:left;"> <svg width="180px" height="60px" version="1.1" viewBox="0 0 1500 500" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="1500" height="540" fill="#b0b0b0" /> <text x="0" y="440" fill="#c00000" font-size="540" font-family="arial" font-weight="bold"> GMP </text> <text x="50" y="500" font-size="70" font-family="Verdana"> &#171;Arithmetic without limitations&#187; </text> </svg> </td> <td style="text-align:center;"> <span style="font-size:200%">Computing billions of &#960; digits using GMP</span> </td> </tr> </table> </div> <div id="container"> <div id="top-spacer"></div> <br><br> <p> While GMP is a general-purpose library for arithmetic on large numbers, it also works very well for such special tasks as computing a silly number of digits of &#960;. <a href="//gmplib.org/download/misc/gmp-chudnovsky.c">This program</a>, written by Hanhong Xue, is all that's needed. </p> <p> How do these numbers compare to other &#960; computing programs out there? Many &#960; programs proclaim themselves as "the fastest", but then they are actually several times slower than <code>gmp-chudnovsky.c</code> with the current GMP release. Compare the numbers! </p> <p> Using GMP, a fast 64-bit computer, and sufficient memory, it should be possible to compute up to 41 billion digits. Unfortunately, the memory requirements are about 8n bytes for computing n digits, which will make most desktop computers unfit for 41 billion digit computations. Memory locality in GMP's FFT multiply code is not good enough for efficient computation with operands on disk. </p> <p> Attempting computations of more than 41 billion digits will cause overflow in the mpz type. A planned future version of GMP will allow the patient and wealthy to compute up to at least 1 quadrillion (10<sup>15</sup>) digits, and unlike current GMP, this future GMP will operate fine with operands on disk. One needs around 250 top-capacity rust swap disks in order to compute 1 quadrillion digits, but hopefully that will qualify for a discount ("buy 250, pay for 249"). </p> <p> Timing results are in seconds. </p> <p> <b> Note: All Intel processors below are affected by the security bugs Meltdown, Spectre, Foreshadow, and MDS. Skylake is further affected by the security bug Jcc. With proper workarounds, the performance of the Intel processors would be considerably lower! </b> </p> <br><br> <h2>GMP devel</h2> <center> <table rules="groups" cellpadding="2"> <colgroup> <thead> <tr> <th> Number of <br>digits <th> AMD <br> K10 Thuban <br> Phenom II <br> 1090T <th> AMD <br> Piledriver <br> FX-8350 <th> AMD <br> Zen1 <br> Ryzen <br> 2700X <th> AMD <br> Zen2 <br> Ryzen <br> 3700X <th> Intel <br> Penryn <br> Xeon <br> E3110 <th> Intel <br> Nehalem <br> Xeon <br> X3470 <th> Intel <br> Sandybridge <br> Xeon <br> E3-1270 <th> Intel <br> Haswell <br> Xeon <br> E3-1271v3 <th> Intel <br> Broadwell <br> Xeon <br> E3-1285Lv4 <th> Intel <br> Skylake <br> Xeon <br> E3-1270v5 <th> IBM <br> POWER7 <br> <th> IBM <br> POWER8 <br> <th> IBM <br> POWER9 <br> 3800 MHz <tbody> <tr> <td align=right> 100,000 <td align=center> 0.024 <!-- k10 --> <td align=center> 0.024 <!-- pile --> <td align=center> 0.015 <!-- piri --> <td align=center> 0.012 <!-- mati --> <td align=center> 0.034 <!-- pnr --> <td align=center> 0.037 <!-- nhm --> <td align=center> 0.026 <!-- sbr --> <td align=center> 0.016 <!-- hwl --> <td align=center> 0.016 <!-- bwl --> <td align=center> 0.016 <!-- sky --> <td align=center> 0.028 <!-- pwr7 --> <td align=center> 0.020 <!-- pwr8 --> <td align=center> 0.014 <!-- pwr9 --> <tr> <td align=right> 1,000,000 <td align=center> 0.46 <!-- k10 --> <td align=center> 0.48 <!-- pile --> <td align=center> 0.25 <!-- piri --> <td align=center> 0.21 <!-- mati --> <td align=center> 0.61 <!-- pnr --> <td align=center> 0.61 <!-- nhm --> <td align=center> 0.37 <!-- sbr --> <td align=center> 0.29 <!-- hwl --> <td align=center> 0.27 <!-- bwl --> <td align=center> 0.27 <!-- sky --> <td align=center> 0.51 <!-- pwr7 --> <td align=center> 0.53 <!-- pwr8 --> <td align=center> 0.31 <!-- pwr9 --> <tr> <td align=right> 10,000,000 <td align=center> 8.24 <!-- k10 --> <td align=center> 8.36 <!-- pile --> <td align=center> 4.33 <!-- piri --> <td align=center> 3.70 <!-- mati --> <td align=center> 11.0 <!-- pnr --> <td align=center> 10.8 <!-- nhm --> <td align=center> 6.25 <!-- sbr --> <td align=center> 4.94 <!-- hwl --> <td align=center> 4.61 <!-- bwl --> <td align=center> 4.38 <!-- sky --> <td align=center> 8.96 <!-- pwr7 --> <td align=center> 9.06 <!-- pwr8 --> <td align=center> 5.17 <!-- pwr9 --> <tr> <td align=right> 100,000,000 <td align=center> 135 <!-- k10 --> <td align=center> 134 <!-- pile --> <td align=center> 69 <!-- piri --> <td align=center> 59 <!-- mati --> <td align=center> 177 <!-- pnr --> <td align=center> 170 <!-- nhm --> <td align=center> 99 <!-- sbr --> <td align=center> 78 <!-- hwl --> <td align=center> 72 <!-- bwl --> <td align=center> 70 <!-- sky --> <td align=center> 144 <!-- pwr7 --> <td align=center> 143 <!-- pwr8 --> <td align=center> 80 <!-- pwr9 --> <tr> <td align=right> 1,000,000,000 <td align=center>2107 <!-- k10 --> <td align=center>2033 <!-- pile --> <td align=center>1057 <!-- piri --> <td align=center>876 <!-- mati --> <td align=center> &nbsp; <!-- pnr --> <td align=center>2540 <!-- nhm --> <td align=center>1489 <!-- sbr --> <td align=center>1179 <!-- hwl --> <td align=center>1107 <!-- bwl --> <td align=center>1079 <!-- sky --> <td align=center>2197 <!-- pwr7 --> <td align=center>2143 <!-- pwr8 --> <td align=center>1228 <!-- pwr9 --> </table> </center> </p> <br><br> <h2>GMP 5.0</h2> <center> <table rules="groups" cellpadding="2"> <colgroup> <thead> <tr> <th> Number of <br>digits <th> AMD <br> Athlon (K8) <br>2.2 GHz <th> AMD <br> K10 Thuban <br>3.2 GHz <th> Intel <br> Pentium 4 <br>3.4 GHz <th> Intel <br> Conroe <br>2.13 GHz <th> Intel <br> Nehalem <br>2.67 GHz <th> Intel <br> Sandybridge <br>3.3 GHz <th> IBM <br> PowerPC 970 <br>1.8 GHz <th> Intel <br> Itanium 2 <br>0.9 GHz <tbody> <tr> <td align=right> 100,000 <td align=center> &nbsp; <td align=center> 0.03 <td align=center> 0.08 <td align=center> 0.04 <td align=center> 0.03 <td align=center> 0.02 <td align=center> 0.13 <td align=center> 0.09 <tr> <td align=right> 1,000,000 <td align=center> &nbsp; <td align=center> 0.48 <td align=center> 1.49 <td align=center> 0.89 <td align=center> 0.69 <td align=center> 0.49 <td align=center> 1.73 <td align=center> 1.67 <tr> <td align=right> 10,000,000 <td align=center> &nbsp; <td align=center> 8.2 <td align=center> 26.3 <td align=center> 16.4 <td align=center> 12.0 <td align=center> 8.22 <td align=center> 30.8 <td align=center> 29.3 <tr> <td align=right> 100,000,000 <td align=center> &nbsp; <td align=center> 134 <td align=center> 430 <td align=center> 269 <td align=center> 191 <td align=center> 131 <td align=center> 497 <td align=center> 494 <tr> <td align=right>1,000,000,000 <td align=center> &nbsp; <td align=center> 2097 <td align=center> 6656 <td align=center> &nbsp; <td align=center> 2896 <td align=center> &nbsp; <td align=center> &nbsp; <td align=center> &nbsp; </table> </center> </p> <br> <br> <h2>GMP 4.3</h2> <center> <table rules="groups" cellpadding="2"> <colgroup> <thead> <tr> <th> Number of <br>digits <th> AMD <br> Athlon (K8) <br>2.2 GHz <th> AMD <br> K10 Thuban <br>3.2 GHz <th> Intel <br> Pentium 4 <br>3.2 GHz <th> Intel <br> Conroe <br>2.13 GHz <th> Intel <br> Nehalem <br>2.67 GHz <th> IBM <br> PowerPC 970 <br>1.6 GHz <tbody> <tr> <td align=right> 100,000 <td align=center> 0.04 <td align=center> 0.03 <td align=center> 0.10 <td align=center> 0.05 <td align=center> 0.04 <td align=center> 0.15 <tr> <td align=right> 1,000,000 <td align=center> 0.90 <td align=center> 0.56 <td align=center> 1.77 <td align=center> 1.08 <td align=center> 0.81 <td align=center> 2.3 <tr> <td align=right> 10,000,000 <td align=center> 16.8 <td align=center> 9.7 <td align=center> 31.0 <td align=center> 19.7 <td align=center> 14.5 <td align=center> 40.4 <tr> <td align=right> 100,000,000 <td align=center> 291 <td align=center> 166 <td align=center> 542 <td align=center> 349 <td align=center> 247 <td align=center> 692 <tr> <td align=right>1,000,000,000 <td align=center> &nbsp; <td align=center> &nbsp; <td align=center> &nbsp; <td align=center> &nbsp; <td align=center>4069 <td align=center> &nbsp; </table> </center> </p> <br> <br> <h2>GMP 4.2</h2> <center> <table rules="groups" cellpadding="2"> <colgroup> <thead> <tr> <th> Number of <br>digits <th> AMD <br> Athlon (K8) <br>2.2 GHz <th> AMD <br> K10 Thuban) <br>3.2 GHz <th> Intel <br> Pentium 4 <br>3.2 GHz <th> Intel <br> Conroe <br>2.13 GHz <th> Intel <br> Nehalem <br>2.67 GHz <th> IBM <br> PowerPC 970 <br>1.6 GHz <tbody> <tr> <td align=right> 100,000 <td align=center> 0.06 <td align=center> &nbsp; <td align=center> 0.15 <td align=center> 0.12 <td align=center> &nbsp; <td align=center> 0.17 <tr> <td align=right> 1,000,000 <td align=center> 1.48 <td align=center> &nbsp; <td align=center> 2.9 <td align=center> 2.35 <td align=center> &nbsp; <td align=center> 2.92 <tr> <td align=right> 10,000,000 <td align=center> 26.8 <td align=center> &nbsp; <td align=center> 52.3 <td align=center> 42.6 <td align=center> &nbsp; <td align=center> 52.5 <tr> <td align=right> 100,000,000 <td align=center> 467 <td align=center> &nbsp; <td align=center> 902 <td align=center> 756 <td align=center> &nbsp; <td align=center> 902 <tr> <td align=right>1,000,000,000 <td align=center> &nbsp; <td align=center> &nbsp; <td align=center>&nbsp; <td align=center> &nbsp; <td align=center> &nbsp; <td align=center> &nbsp; </table> </center> </p> <br><br> <div id="footer-spacer"></div> </div> <div id="footer"> <table style="width:100%; background-color:#b0b0b0;"> <tr> <td style="text-align:center;"> <div style="font-size:80%"> Please send comments about this page to gmp-discuss<div style="display:inline;"> at </div>gmplib.org </div> </td> </tr> <tr> <td style="text-align:center;"> <div style="font-size:80%;"> Copyright 2000&#8211;2016 Free Software Foundation </div> </td> </tr> <tr> <td style="text-align:center;"> <div style="font-size:80%;"> Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. </div> </td> </tr> </table> </div> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10