[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gmp-discuss
Subject:    Expand gmp number and calculate pi 121 billion digits
From:       cents2823 () yahoo ! co ! jp
Date:       2021-04-21 7:06:55
Message-ID: 1248631847.445644.1618988815270.JavaMail.yahoo () mail ! yahoo ! co ! jp
[Download RAW message or body]

Hi GMP users,
I am making a program that calculates pi with gmp, but the number of pi calculation \
digits is limited by the limit of the number of gmp.There seems to be no release of \
gmp number expansion for the time being. limit on the digits of gmp number: \
(2^31-1)*64*log(2) = 41,373,247,548 digitsExpand gmp number:  (2^63-1)*64*log(2)   = \
177,696,745,232,747,428,213 digits I changed the base struct of gmp to expand the \
number of gmp, gmp edits are shown in Section 2.However, this change alone will cause \
gcc to cause some errors. (gcc error: internal compiler error: Segmentation fault) \
The cause was taught by the gcc developer that GCC uses GMP,MPFR (which uses GMP \
internally) and MPC (which uses MPFR).(I am not MPFR user, and MPC user, so I have \
not confirmed the effect of gmp base struct change on MPFR and MPC.) The problem was \
solved by source installing gcc that supports gmp struct change. The procedure for \
gmp number expansion is shown in Section 1.I haven't done enough confirmation, if you \
try please take measures such as backup for safety. Disadvantage of doing this I \
think:a. Be careful when upgrading gcc or gmp.b. About 900GB of memory + swap is \
required to calculate pi in 50 million digits  using "Parallel GMP-Chudnovsky using \
OpenMP"(2008/10 gmp-discus Archive) program.c. I don't think there is a need to \
revert to the original gmp,  but I'm not familiar with unix and I don't know how to \
revert safely  so ubuntu clear install which destroys all data programs when \
reverting. I used this gmp to calculate pi in 121 billion digits with my pi calculate \
program(calculate and output time: about 86 hours) and "Parallel GMP-Chudnovsky using \
OpenMP"(2008/10 gmp-discus Archive) program. The calculation result was also \
calculated by y-cruncher and the match of the values was confirmed. Thanks to \
gmp.Susumu Tsukamoto test pc:cpu: i9-7940X 14core 28threadsmemory: 128GBos: ubuntu \
20.04.2 LTSgcc: 9.3.0 --> 10.0.1gmp: 6.2.0 1. procedure1.1 gcc source install   \
Please refer to the appropriate web for the gcc source installation method.   I show \
only the addition of steps.   There is a download of related modules needed to build \
gcc    in the gcc source installation procedure.    ./contrib/download_prerequisites  \
(GMP,MPFR,MPC,.:download)   Change section 2  to the download gmp after this \
download.  Please switch to the gcc installed after installing the gcc source.
1.2 Edit gmp and install with new gcc   I refer to the following for gmp installation \
“how I install GMP onto my ubuntu Machines” on the web.   I show only the addition of \
steps.   Change section 2 to the download GMP. 1.3 enable installed gmp  Notes I'm \
not sure if the following command can be applied to your pc  different from my pc \
environment.  ln -nfs /usr/local/lib/libgmp.so.10.4.0 \
/usr/lib/x86_64-linux-gnu/libgmp.so.10  <description> In my pc environment, the \
install gmp execution part is not used, the gmp execution part attached to ubuntu is \
use, so it is necessary to switch to the install gmp. 2.gmp edit(gmp version: 6.2.0)
2.1 gmp-h.in 152,154 line  __mpz_struct   int _mp_alloc  --> long int _mp_alloc  int \
_mp_size  --> long int _mp_size 2.2 gmp-h.in 190,194 line  __mpf_struct  int _mp_prec \
--> long int _mp_prec  int _mp_size  --> long int _mp_size 2.3 mpz/init2.c 43-50 line \
comment out as follows//  if (sizeof (unsigned long) > sizeof (int)) /* param vs \
_mp_size field *///    {//      if (UNLIKELY (new_alloc > INT_MAX))// {//   fprintf \
(stderr, "gmp: overflow in mpz type\n");//   abort ();// }//    } 2.4 mpz/realloc.c \
52-60 line comment out as follows//  else//    {//      if (UNLIKELY (new_alloc > \
INT_MAX))// {//   fprintf (stderr, "gmp: overflow in mpz type\n");//   abort ();// \
}//    } 2.5 mpz/realloc2.c 43-50 line comment out as follows//  if (sizeof (unsigned \
long) > sizeof (int)) /* param vs _mp_size field *///    {//      if (UNLIKELY \
(new_alloc > INT_MAX))// {//   fprintf (stderr, "gmp: overflow in mpz type\n");//   \
abort ();// }//    } _______________________________________________
gmp-discuss mailing list
gmp-discuss@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-discuss


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic