<div>
Jason, Cino,<br><br>I've done the same as you
did, Cino (I also added a gmp_version printf at the beginning of
"main") - I'm using GMP 4.2.2, program compiled using GCC 4.1.3.<br>System was a Dell Inspiron 510m laptop (Pentium M 1.60GHz, 1GB RAM) running Ubuntu 7.10 (Gutsy Gibbon).<br><br><span style="font-family: Courier New,Courier,mono;">jdo@BlackHole:~/code/gmp-chudnovsky$ ./gmp-chudnovsky 10000000 1</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">GNU MP version 4.2.2</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">#terms=705136, depth=21</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">sieve time = 0.400</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">...................................................</span><br style="font-family: Courier New,Courier,mono;"><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">bs time = 74.180</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">gcd time = 13.660</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">div time = 10.090</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">sqrt time = 5.560</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">mul time = 3.820</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">total time = 94.090</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;"> P size=14561191 digits (1.456119)</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;"> Q size=14561184 digits (1.456118)</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">pi(0,705136)=</span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">Time to save to zpi.txt = 55.130</span><br style="font-family: Courier New,Courier,mono;"><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">jdo@BlackHole:~/code/gmp-chudnovsky$ ls -alrt zpi.txt </span><br style="font-family: Courier New,Courier,mono;"><span style="font-family: Courier New,Courier,mono;">-rw-r--r-- 1 jdo jdo 10000006 2007-11-11 14:09 zpi.txt</span><br style="font-family: Courier New,Courier,mono;"><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;">----- Original Message -----<br>
From: "cino hilliard" <hillcino368@hotmail.com><br>
To: gmp-discuss@swox.com<br>
Subject: RE: Chudnovski to file Windows xp<br>
Date: Sat, 10 Nov 2007 20:16:36 -0600<br>
<br>
<br>
<br>
Hi,<br>
Here is a re-send in Plain text.<br>
Cino Hilliard<br>
<br>
<br>
________________________________<br>
<br>
From: hillcino368@hotmail.com<br>
To: gmp-discuss@swox.com<br>
Subject: RE: Chudnovski to file Windows xp<br>
Date: Sat, 10 Nov 2007 17:11:16 -0600<br>
<br>
<br>
<br>
<br>
> Today's Topics:<br>
><br>
> 1. Re: Low efficiency of the mpf_out_str function ! (Jason Lin)<br>
><br>
><br>
> ----------------------------------------------------------------------<br>
><br>
> Message: 1<br>
> Date: Fri, 9 Nov 2007 21:21:01 +0800 (CST)<br>
> From: Jason Lin Subject: Re: Low efficiency of the mpf_out_str function !<br>
> To: Jan Doornaert Cc: gmp-discuss@swox.com<br>
> Message-ID: Content-Type: text/plain; charset=big5<br>
><br>
>> Jason,<br>
>><br>
>> Have you tried running the program with output NOT<br>
>> to stdout, but to<br>
>> file?<br>
><br>
> yes, both to stdout and to file are the same !<br>
><br>
><br>
>> I don't think the "conversion" from GMP-internal<br>
>> format to decimal takes<br>
>> *that* much time, but the actual formatted output<br>
>> on-screen (think<br>
>> "printf") might slow things down (especially for the<br>
>> number of characters<br>
>> you're outputting)...<br>
><br>
> 1. I don't think either ! but I must emphasis that the<br>
> code was compiles on DJGPP 2.03 with GMP 4.1.2 . I am<br>
> not sure if the GMP 4.2.2 have the same problem.<br>
><br>
> 2. I don't think the bottleneck is the printf<br>
> function.<br>
> because the output screen ceased there for a long time<br>
> before the mess digits bursting out. It is the<br>
> mpf_out_str cause the ceasing ! (and the printf give<br>
> the bursting out digits almost in second)<br>
><br>
> 3. Today I tried to compile the code with DEV-CPP<br>
> 4.9.9.2 with GMP4.1.? (pre compiled. download from<br>
> http://old.devpaks.org/list.php?category=Mathematics)<br>
> but the results is more worse, try to calculate more<br>
> than 500000 digits will get a runtime error.(general<br>
> protection error for OP code I think !)<br>
><br>
> 4.The program Chudnovsky.c can be download from<br>
> http://gmplib.org/pi-with-gmp.html<br>
> Can some one give it a try ?? (with GMP 4.1.2)<br>
<br>
<br>
Hi,<br>
System: p4 2.53 ghz 2 gig ram windows xp pro<br>
<br>
I am running mingw gcc 4.1.2 GMP 4.2.2 built (dynamic) with instructions from<br>
http://cs.nyu.edu/exact/core/gmp/<br>
<br>
For chudnovski.c. I renamed this to chudpi.c and modified it a little <br>
for output and timing.<br>
<br>
Add the following in main<br>
<br>
FILE *fptr1;<br>
char fil[] = "zpi.txt";<br>
fptr1=fopen(fil,"w");<br>
<br>
Modify the output if statement<br>
<br>
if (out&1) {<br>
begin = clock();<br>
printf("pi(0,%ld)=\n", terms);<br>
//mpf_out_str(stdout, 10, d+2, qi);<br>
mpf_out_str(fptr1, 10, d+2, qi);<br>
end = clock();<br>
printf("Time to save to %s = %6.3f\n",fil, <br>
(double)(end-begin)/CLOCKS_PER_SEC);<br>
printf("\n");<br>
}<br>
<br>
Run for 10 million<br>
f:\GmpGcc>chudpi 10000000 1<br>
#terms=705136, depth=21<br>
sieve time = 0.296<br>
...................................................<br>
bs time = 64.391<br>
gcd time = 11.306<br>
div time = 9.031<br>
sqrt time = 5.172<br>
mul time = 3.484<br>
total time = 82.437<br>
P size=14561191 digits (1.456119)<br>
Q size=14561184 digits (1.456118)<br>
pi(0,705136)=<br>
Time to save to zpi.txt = 48.563<br>
<br>
f:\GmpGcc>dir zpi.txt<br>
Volume in drive F is New Volume<br>
Volume Serial Number is 186E-0843<br>
Directory of f:\GmpGcc<br>
11/10/2007 04:45 PM 10,000,006 zpi.txt<br>
1 File(s) 10,000,006 bytes<br>
0 Dir(s) 451,460,153,344 bytes free<br>
<br>
For gmp 4.1. I get an error for over 500,000 also<br>
<br>
Cino Hilliard<br>
<br>
_______________________________________________<br>
gmp-discuss mailing list<br>
gmp-discuss@swox.com<br>
https://gmplib.org/mailman/listinfo/gmp-discuss<br>
</hillcino368@hotmail.com></blockquote>
</div>
<BR>
--
<div> Want an e-mail address like mine? </b><br>
Get a <b>free e-mail </b>account today at <a href="http://www.mail.com/Product.aspx" target="_blank">www.mail.com</a>!</div>