pdeclib pilib modules for Pine, Rock, Pinebook, Sopine
#4
Greetings;  well, you knew this was coming !   Wink

In 1973, one year before I graduated from high school, Jean Guilloud and Martin Bouyer calculated 1,000,000+ digits of PI on a CDC 7600 in 23.3 hours !  For those of you who need reminding, this was the Seymour Cray-designed supercomputer which was Control Data´s competition against the IBM 360 model 195.  This occurred a mere 44 years ago at the end of the Apollo era;  most of you were probably not even alive then.

I have replicated Guilloud and Bouyerś work on both the Rock64 and PineA64 supercomputers in less than 1/2 hour!  

To accomplish this we need to make some adjustments to our Python script which is listed below;  very short and sweet :

pi-fast-calc.py

Code:
import sys
digits = int(sys.argv[1]) if len(sys.argv) > 1 else 100000

def mpz(n): return n
#from gmpy2 import mpz

def atan(pp, qq):
   def bs(a, b):
       if b == a + 1:
           if a == 0: return (1, 1, 1)
           p = mpz(1-2*a)
           q = mpz((2*a+1) * qq * qq)
           return (p, q, p)
       m = (a+b) // 2
       (Pa, Qa, Ta) = bs(a, m)
       (Pb, Qb, Tb) = bs(m, b)
       return (Pa*Pb, Qa*Qb, Pa*Tb + Qb*Ta)
   from math import log10
   (p, q, t) = bs(0, int((digits+9) / log10(qq*qq)))
   return 4 * pp * mpz(10) ** (digits+9) * t // q // qq

pi = atan(44, 57)
pi += atan(7, 239)
pi += atan(-12, 682)
pi += atan(24, 12943)
print(pi // 10**9)

To run the codes above use:

time python pi-fast-calc.py 1000100 >PI_1000_K.txt

I scrubbed the output slightly by removing the first digit ¨3¨ and truncating the number at precisely 1,000,000 digits after the decimal point.  The file size is therefore 1000001 including the line end or file end marker.  The signature for the millionth digit after the decimal point is 779458151 

The times as well the md5 and sha checksums have been included;  and I have appended the one million digits obtained from the Rock64 & PineA64.

Code:
user    21m34.615s  
rock64   PI_1000_K.txt  f776c92eb9b3865128f39e2a096497e9  md5

user    24m50.170s  
pineA64  PI-1000-K.txt  51ecf7f4a842bbcef9c5f3a7bbc9022482ef4d89  sha

The Rock64 runs slightly faster, as well the Rock64´s LPDDR3 memory is also slightly faster;  consequently the Rock64 beat the PineA64 by about 3 minutes sixteen seconds. You can compare your digits with the appended file, or you can run md5sum or shasum against the actual digits to see if your calculation is similar.

To get the digits run tar against the tarball appended below:  first rename the file from PI_1000_K.bmp  to  PI_1000_K.tar.xz  !  (this trick is needed because the forum hates tarballs)

tar  -xzvf  PI_1000_K.tar.xz

To get the md5sum , or shasum , run :

md5sum PI_1000_K.txt

shasum  PI_1000_K.txt 



Hint:  To download the attachment right click and select ¨save link as...¨


Attached Files
.bmp   PI_1000_K.bmp (Size: 459.56 KB / Downloads: 470)
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )


Messages In This Thread
RE: pdeclib pilib modules for Pine, Rock, Pinebook, Sopine - by MarkHaysHarris777 - 08-09-2017, 06:28 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  PINE A64 SBC: Clone of a functional 32GB SD card doesn't boot burningkrome 3 2,351 05-19-2023, 07:43 AM
Last Post: crocspot
  PINE A64 Ubuntu 18 or 20 IMG with touchscreen? burningkrome 0 910 04-29-2023, 05:13 AM
Last Post: burningkrome
  Pine A64 does only boot with Android 5.1 Dude 6 4,866 07-03-2022, 02:18 PM
Last Post: Dude
  Pine A64+ vs LCD do not boot DDS 3 6,709 02-23-2021, 05:33 PM
Last Post: thedu
  Autodetect if Pine unit is a Pine A64+ or PineA64-LTS pkfpeters 1 3,809 02-09-2021, 12:17 AM
Last Post: tllim
  Pine 64 | 2GB x2 & Acrylic Cases x2 for Sale | Canada - GTA ViperVi 1 4,969 01-18-2021, 03:45 PM
Last Post: squidius
  sd format?for pine 64 angegardien 3 8,636 12-06-2020, 03:53 PM
Last Post: junkyj753
  Node Red on the Pine DonFL 0 3,080 12-16-2019, 04:21 PM
Last Post: DonFL
Photo Pine A64+ from Kick starter running Pi-Hole netHolio 0 3,507 12-02-2019, 09:36 PM
Last Post: netHolio
  UK power supply (Pinebook Pro 64) skobi 0 2,520 11-17-2019, 04:55 AM
Last Post: skobi

Forum Jump:


Users browsing this thread: 2 Guest(s)