Pi Day


22 posts
by bryanandaimee » Fri Mar 14, 2014 3:49 am
I figured I ought to do something with the Pi for Pi day (3/14) so i installed Pi on my Pi,

sudo apt-get install pi

then i calculated Pi on the Pi to 3.141593 (rounded) million decimal places.

pi 3141593 > pimil.txt

The calculation took 132 seconds on my old Pi (256 MB version B) running at 1100 Mhz arm, 500 ram, and 500 core.

If you were to run a heavily overclocked Pi all day (on Pi day) calculating Pi, I think you could probably get close to calculating Pi-billion decimal places of Pi but I'm not sure if Pi would calculate that many digits of Pi on the Pi due to memory size constraints.

Bryan
Posts: 30
Joined: Fri Sep 14, 2012 4:32 pm
by Douglas6 » Fri Mar 14, 2014 4:06 am
Makes me think of that distributed SETI project. With 2.5 million Pis, we should have found ET by now.
If they weren't busy mining bitcoins, I guess.
User avatar
Posts: 2752
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL
by bryanandaimee » Fri Mar 14, 2014 2:14 pm
How many digits per day could a beowulf cluster of 314 Pi's calculate? The world may never know.

Turns out that my Pi runs out of memory after only 20 minutes or so and kills the process. So the max number of digits I can calculate is something like 20 million. The 512 MB Pi's could probably do quite a bit better.

Bryan
Posts: 30
Joined: Fri Sep 14, 2012 4:32 pm
by lazarus78 » Fri Mar 14, 2014 6:25 pm
Douglas6 wrote:Makes me think of that distributed SETI project. With 2.5 million Pis, we should have found ET by now.
If they weren't busy mining bitcoins, I guess.

The Pis are actually very very VERY terrible for mining any type of cryptocoin, let alone bitcoin. It is literally a waste of power to even attempt it.

If you are talking about people who spend thousands of dollars on 6 GPU systems for mining, then yes, that is indeed also a waste of effort.
Posts: 236
Joined: Thu Jul 25, 2013 5:16 pm
by pluggy » Fri Mar 14, 2014 6:34 pm
Its getting to be a waste of money using dedicated ASICs to mine Bitcoin nowadays. It a lot cheaper to just buy it....

Ebay is awash with S/H Bitcoin ASICs at knock down rates.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......
User avatar
Posts: 3634
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by DougieLawson » Fri Mar 14, 2014 6:37 pm
pluggy wrote:Its getting to be a waste of money using dedicated ASICs to mine Bitcoin nowadays. It a lot cheaper to just buy it....

Ebay is awash with S/H Bitcoin ASICs at knock down rates.

Is it?

http://www.raspberrypi.org/archives/6437
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
RPi owner since '12.
Twitter: @DougieLawson

2B, B+, A+, 5Bs, zero, 3B

Please post ALL technical questions on the forum.Do not send private messages.
User avatar
Posts: 21607
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
by pluggy » Fri Mar 14, 2014 6:44 pm
Cheap power, if you watch the video. Its not viable at consumer power prices.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......
User avatar
Posts: 3634
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by bryanandaimee » Sat Jul 26, 2014 12:26 am
Just found a post on Mathematica about calculating pi and it looks like that speeds things up quite a bit.
Code below:

(*Clear Cache*)
ClearSystemCache[]

(*Calculate pi to 1 million decimal places and store the result*)
AbsoluteTiming[pi = N[Pi, 1000000];]


On the same setup as before I got:
pi million decimal places 38.4 seconds
2pi million decimal places 93.8 seconds
4pi million dp 241.4 seconds

Same memory limits seem to apply. Limit is somewhere around 20 million dp
Posts: 30
Joined: Fri Sep 14, 2012 4:32 pm
by bryanandaimee » Sat Mar 14, 2015 8:56 pm
In honor of the special once a century pi day I repeated the above calc on a B+ with maximum memory allocated to the CPU. I got clear up to 5.654866 x 10^7 decimal places of pi. Calculation took 1662 seconds using a standard turbo mode at 900 Mhz. No other overclocking features were used.

Maybe next year I'll try with a B2

Gotta go make some pie

Bryan
Posts: 30
Joined: Fri Sep 14, 2012 4:32 pm
by adlambert » Sat Mar 14, 2015 10:06 pm
lazarus78 wrote:The Pis are actually very very VERY terrible for mining any type of cryptocoin, let alone bitcoin. It is literally a waste of power to even attempt it.


For doing the actual crypto work you are correct. However, because low power Pis make ideal controller interfaces to the ASICs and run CGMiner very well and extremely stable. My CGMiner host is an old 256MB Model B. So, many thousands of Pis are in fact employed in crypto-coin mining supporting roles and are very good at it.

pluggy wrote:Its getting to be a waste of money using dedicated ASICs to mine Bitcoin nowadays. It a lot cheaper to just buy it....


Bitcoin prices over the last 2 weeks recovered to around £200, and this has caused a lot of ASICs to switch on, and pools have become very well populated again.
by solar3000 » Sun Mar 15, 2015 11:19 pm
so did anything actually happen on pi day?
User avatar
Posts: 788
Joined: Sat May 18, 2013 12:14 am
by DougieLawson » Mon Mar 16, 2015 12:18 am
solar3000 wrote:so did anything actually happen on pi day?


Yep. A bunch of silly people who write their dates backwards (compared to EUR, JIS & ISO standards) fussed about the day of the month and the month of the year and got ever more silly at 9:26:53 on that same day.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
RPi owner since '12.
Twitter: @DougieLawson

2B, B+, A+, 5Bs, zero, 3B

Please post ALL technical questions on the forum.Do not send private messages.
User avatar
Posts: 21607
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
by solar3000 » Mon Mar 16, 2015 2:17 pm
DougieLawson wrote:
solar3000 wrote:so did anything actually happen on pi day?


Yep. A bunch of silly people who write their dates backwards (compared to EUR, JIS & ISO standards) fussed about the day of the month and the month of the year and got ever more silly at 9:26:53 on that same day.


There was no mention this Saturday in the new at all (USA).

As for dates, I use this format to name my files: YYYY-MM-DD. Sorts out just fine.

We should use this date: The date and time now is: 1426515396
User avatar
Posts: 788
Joined: Sat May 18, 2013 12:14 am
by bertwert » Mon Mar 16, 2015 2:31 pm
DougieLawson wrote:
solar3000 wrote:so did anything actually happen on pi day?


Yep. A bunch of silly people who write their dates backwards (compared to EUR, JIS & ISO standards) fussed about the day of the month and the month of the year and got ever more silly at 9:26:53 on that same day.

I do not like that date format, it makes no sense. :x
Their argument:
It is like saying March 14 2015 and you wouldn't say 14th of March 2015.

Uh yes I would....

Unfortunately 2015 doesn't have 14 months...
Please correct me if I am wrong ;-)

Please post your code with these tags:
[code]Your Code Goes Here[/code]

BERTWERT
User avatar
Posts: 584
Joined: Tue Aug 13, 2013 8:15 pm
Location: Golden, BC, Canada
by DougieLawson » Mon Mar 16, 2015 2:36 pm
bertwert wrote:I do not like that date format, it makes no sense. :x
Their argument:
It is like saying March 14 2015 and you wouldn't say 14th of March 2015.

Uh yes I would....

Unfortunately 2015 doesn't have 14 months...

Here in Rightpondia we really do say "Saturday, 14th of March" it comes from the mouthful "The fourteenth day of March in the year of our Lord two thousand and fifteen" (from when we were just a bit more religious).

We can have our own Pi approximation day on 22nd July.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
RPi owner since '12.
Twitter: @DougieLawson

2B, B+, A+, 5Bs, zero, 3B

Please post ALL technical questions on the forum.Do not send private messages.
User avatar
Posts: 21607
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
by pluggy » Mon Mar 16, 2015 2:41 pm
Goddamned parochial yanks......

It really was the 14th of March, like today is the 16th of March.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......
User avatar
Posts: 3634
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by bryanandaimee » Tue Mar 15, 2016 5:40 am
Pi day again. Gotta calculate pi. I ran the mathematica calculation on a B2 this year with 16MB video memory to maximize the CPU memory. The calculation only took 25% CPU so it is obviously not multi-threaded. No big deal since the calculation is still very much memory limited.

On a B2 this year. I got
pi million DP took 20.5 seconds
2pi million DP took 53.3 seconds
4pi million DP took 116 seconds
and 35pi million DP took 1527 seconds.

Looks like 35pi million decimal places (~110 million DP) is close to the memory limit on the B2. I haven't crashed the calculation yet though.

Finally, it is interesting to note that this thread is now in its third year. Three, as we all know, is a pretty good approximation for pi. Maybe we should just have a pi month in march so that the date formatting pedants can all breath a sigh of relief and live in harmony with the rest of us. In honor of that suggestion I think I'll go eat a small slice of pie (about 4.5%) such that the remaining pie will have a circumference equal to three times the diameter.
Posts: 30
Joined: Fri Sep 14, 2012 4:32 pm
by Heater » Tue Mar 15, 2016 8:39 am
100 million digits of Pi? On a Pi 2B?

Easy.

Took about 56 minutes. You can check the results here:
http://devserv.rsmtech.fi/pi.txt.gz

I used gmp-chudnovsky, see attachment. Had to add a swap file. It was 1GB about a third of which got used. Probably not wise, or fast, to have a swap file on SD card.

Clustering a bunch of Pi, or any other machines, won't help. So far the best methods of calculating massive numbers of digits of Pi do not parallellize well. The current world record for calculating the digits of Pi stands at 13,300,000,000,000 digits. It was not done on a super computer, or cluster. No it was done on basically an off the shelf PC:
https://en.wikipedia.org/wiki/Chronolog ... _of_%CF%80

Super computers and clusters have not been able to touch this problem since 2009.

We have discussed this extensively here before. I think it was here: https://www.raspberrypi.org/forums/view ... 63&t=43867
Attachments
gmp-chudnovsky.c.gz
(5.18 KiB) Downloaded 4 times
Posts: 4673
Joined: Tue Jul 17, 2012 3:02 pm
by bryanandaimee » Tue Mar 15, 2016 7:07 pm
Perhaps I was being too cute with the reporting format. The final calculation in the list (35pi million DP) comes to about 109.96 million decimal places. This calculated on Mathematica in 1527 second or 25.5 minutes. The calculation was done without swap. I doubt you would be able to get much further without a swap file. Perhaps next year I'll get around to doing a longer calc with swap. And then again, maybe not. The thread really isn't about calculating pi as much as it is about having some geeky fun on pi day.
Posts: 30
Joined: Fri Sep 14, 2012 4:32 pm
by Heater » Tue Mar 15, 2016 7:33 pm
bryanandaimee,

Damn, you beat me :)
The thread really isn't about calculating pi as much as it is about having some geeky fun on pi day.

What more fun could a geek have on Pi day than setting his latest machine to calculating the digits of Pi ?

Aside from eating pie and drinking beer whilst he waits.

Except...this geek has the source code of the Pi algorithm and was curious how gmp works. Sadly the maths involved in the Chudnovsky algorithm goes way over my head.

Edit: Wait a minute how can you have .96 of a decimal place? Did you actually get an output from your calculation? Like in a file?
Posts: 4673
Joined: Tue Jul 17, 2012 3:02 pm
by davidcoton » Tue Mar 15, 2016 11:05 pm
Heater wrote:Edit: Wait a minute how can you have .96 of a decimal place?

You can't, in a normal world. But you can easily have 0.96 of a million decimal places. Obviously your slower process led to too much drinking of beer while you waited :lol:
"If it ain't broke, fix it until it is."
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”
Posts: 803
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
by Heater » Tue Mar 15, 2016 11:45 pm
david,

Ah yes.

Sadly it can't be the beer that did it. My few remaining neurons are getting old and lonely.
Posts: 4673
Joined: Tue Jul 17, 2012 3:02 pm