Chudnovski to file Windows xp

Jan Doornaert jan.doornaert at programmer.net
Tue Nov 13 20:20:57 CET 2007


 Jason, Cino,

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.
System was a Dell Inspiron 510m laptop (Pentium M 1.60GHz, 1GB RAM)
running Ubuntu 7.10 (Gutsy Gibbon).

jdo at BlackHole:~/code/gmp-chudnovsky$ ./gmp-chudnovsky 10000000 1
GNU MP version 4.2.2
#terms=705136, depth=21
sieve   time =  0.400
...................................................

bs      time = 74.180
gcd     time = 13.660
div     time = 10.090
sqrt    time =  5.560
mul     time =  3.820
total   time = 94.090
P size=14561191 digits (1.456119)
Q size=14561184 digits (1.456118)
pi(0,705136)=
Time to save to zpi.txt = 55.130

jdo at BlackHole:~/code/gmp-chudnovsky$ ls -alrt zpi.txt
-rw-r--r-- 1 jdo jdo 10000006 2007-11-11 14:09 zpi.txt

  ----- Original Message -----
  From: "cino hilliard"
  To: gmp-discuss at swox.com
  Subject: RE: Chudnovski to file Windows xp
  Date: Sat, 10 Nov 2007 20:16:36 -0600



  Hi,
  Here is a re-send in Plain text.
  Cino Hilliard


  ________________________________

  From: hillcino368 at hotmail.com
  To: gmp-discuss at swox.com
  Subject: RE: Chudnovski to file Windows xp
  Date: Sat, 10 Nov 2007 17:11:16 -0600




  > Today's Topics:
  >
  > 1. Re: Low efficiency of the mpf_out_str function ! (Jason Lin)
  >
  >
  >
  ----------------------------------------------------------------------
  >
  > Message: 1
  > Date: Fri, 9 Nov 2007 21:21:01 +0800 (CST)
  > From: Jason Lin Subject: Re: Low efficiency of the mpf_out_str
  function !
  > To: Jan Doornaert Cc: gmp-discuss at swox.com
  > Message-ID: Content-Type: text/plain; charset=big5
  >
  >> Jason,
  >>
  >> Have you tried running the program with output NOT
  >> to stdout, but to
  >> file?
  >
  > yes, both to stdout and to file are the same !
  >
  >
  >> I don't think the "conversion" from GMP-internal
  >> format to decimal takes
  >> *that* much time, but the actual formatted output
  >> on-screen (think
  >> "printf") might slow things down (especially for the
  >> number of characters
  >> you're outputting)...
  >
  > 1. I don't think either ! but I must emphasis that the
  > code was compiles on DJGPP 2.03 with GMP 4.1.2 . I am
  > not sure if the GMP 4.2.2 have the same problem.
  >
  > 2. I don't think the bottleneck is the printf
  > function.
  > because the output screen ceased there for a long time
  > before the mess digits bursting out. It is the
  > mpf_out_str cause the ceasing ! (and the printf give
  > the bursting out digits almost in second)
  >
  > 3. Today I tried to compile the code with DEV-CPP
  > 4.9.9.2 with GMP4.1.? (pre compiled. download from
  > http://old.devpaks.org/list.php?category=Mathematics)
  > but the results is more worse, try to calculate more
  > than 500000 digits will get a runtime error.(general
  > protection error for OP code I think !)
  >
  > 4.The program Chudnovsky.c can be download from
  > http://gmplib.org/pi-with-gmp.html
  > Can some one give it a try ?? (with GMP 4.1.2)


  Hi,
  System: p4 2.53 ghz 2 gig ram windows xp pro

  I am running mingw gcc 4.1.2 GMP 4.2.2 built (dynamic) with
  instructions from
  http://cs.nyu.edu/exact/core/gmp/

  For chudnovski.c. I renamed this to chudpi.c and modified it a little
  for output and timing.

  Add the following in main

  FILE *fptr1;
  char fil[] = "zpi.txt";
  fptr1=fopen(fil,"w");

  Modify the output if statement

  if (out&1) {
  begin = clock();
  printf("pi(0,%ld)=\n", terms);
  //mpf_out_str(stdout, 10, d+2, qi);
  mpf_out_str(fptr1, 10, d+2, qi);
  end = clock();
  printf("Time to save to %s = %6.3f\n",fil,
  (double)(end-begin)/CLOCKS_PER_SEC);
  printf("\n");
  }

  Run for 10 million
  f:\GmpGcc>chudpi 10000000 1
  #terms=705136, depth=21
  sieve time = 0.296
  ...................................................
  bs time = 64.391
  gcd time = 11.306
  div time = 9.031
  sqrt time = 5.172
  mul time = 3.484
  total time = 82.437
  P size=14561191 digits (1.456119)
  Q size=14561184 digits (1.456118)
  pi(0,705136)=
  Time to save to zpi.txt = 48.563

  f:\GmpGcc>dir zpi.txt
  Volume in drive F is New Volume
  Volume Serial Number is 186E-0843
  Directory of f:\GmpGcc
  11/10/2007 04:45 PM 10,000,006 zpi.txt
  1 File(s) 10,000,006 bytes
  0 Dir(s) 451,460,153,344 bytes free

  For gmp 4.1. I get an error for over 500,000 also

  Cino Hilliard

  _______________________________________________
  gmp-discuss mailing list
  gmp-discuss at swox.com
  https://gmplib.org/mailman/listinfo/gmp-discuss

-- 
Want an e-mail address like mine?
Get a free e-mail account today at www.mail.com!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gmplib.org/list-archives/gmp-discuss/attachments/20071113/f3a5acc0/attachment.html 


More information about the gmp-discuss mailing list