About memory-usage of mpz_mul

paul zimmermann Paul.Zimmermann at inria.fr
Wed Jun 22 09:07:44 UTC 2016


       Dear Akira,

for large inputs, mpz_mul uses FFT (see section "FFT Multiplication"
in the GMP manual). Fast multiplication algorithms like FFT imply a
larger memory usage. Very roughly for a n x n product, you need two
buffers of size about 4n, thus the extra memory usage is 8n (in
addition to the space needed for the inputs and outputs).

In your case 8 * 2.9 GB = 23.2 GB, which is very near from your 23.7 GB of
swap-area.

Paul Zimmermann

> From: Akira Wada <a-wada at mars.dti.ne.jp>
> Date: Wed, 22 Jun 2016 17:17:48 +0900
> 
> Dear Sir.
> 
>  I tried to compute 1,000,000,000 digits of PI with S.Lyster's 2terms arctan_formula i.e.
> 
>  PI/4 = 22 * arctan (1/28) + arctan (1744507482180328366854565127/98646395734210062276153190241239)
> 
> using my program to compute PI using ARCTAN formuae. It taked time about 2 hours 53 minuts, but
> 
> for 100,000,000 digits only 15 minuts. At last stage of the binary-splitting, mpz_mul (a, b, c) is called
> 
> i.e.  a = b * c  here length of a : 2.9 GB, b : 1.6 GB , c : 1.3 GB and my PC has 7.8 GB RAM available,
> 
> and the other large DATA is written out to FILEs. Looking by the system-moniteor, for over 2 hours,
> 
> " max 23.7 GB of swap-area is in work, and all CPU-usage is holded under 5 % "   WHY ???
> 
> 
> Thanks advance.
> 
>   Regard,   A.Wada
> 
> PS. Using GMP version is 6.1.0
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-discuss
> 


More information about the gmp-discuss mailing list