Emma Haruka Iwao is one of Google’s Cloud Developer Advocates, and she’s saved a very special announcement for “Pi Day.”
Using Google Compute Engine (powered by Google Cloud), Iwao set up 25 virtual machines to begin calculating Pi to more decimal places than anyone had ever calculated it before. And after 121 days, the calculation was finally complete, returning over 31 trillion digits. Specifically, 31,415,926,535,897 digits — a number which, astute observers will notice, also happens to be the first 14 digits of pi.
The previous record, set in 2016, was 22,459,157,718,361 digits.
It was midnight in Tokyo Wednesday when Iwao picked up the phone to explain all the details of her record-breaking achievement — and to give us a glimpse into the future of the cloud.
First, can you tell me what the very last digit was that you calculated? I want to know how it ends!
Sure. The 31,415,926,535,897th decimal place is zero… The last seven digits are 4739940.
So could anybody go into Google’s Compute Engine, and set aside some space in Google Cloud, and try to do the same thing?
I only used publicly available products, so anyone can run the program in the same configuration.
Are you worried that someone might?
Not worried. That’d be exciting…! I definitely hope more people get interested in these calculations…
Are you going to go back and set aside more space, and try to get an even bigger number at some point in the future? Are you going to do this every year for Pi Day?
We haven’t planned — we really focused on this record, and haven’t planned a lot for next year. But yes, I hope Google Cloud gets even better, and we hope to calculate more digits, even faster, in the future.
What can we do now with this extra-large version of pi?
One thing is you can use the published disk, the actual digits, and build experiments, or analyze the digits themselves. We also have a public API for the digits, so you can build interesting experiments on top of the digits…
I heard many people in academia, in the academic world, are interested in analyzing the digits, in a scholarly way, so that they can study the features of pi in more detail. They might find interesting sequences, they might find some statistical features like distributions or randomness of the sequence. They check for any repetition or weird sequences in pi as well.
I heard Google’s publishing all your pi digits as disk snapshots?
Yes, they will be available online. Anyone can copy the disk snapshots into their Google Cloud Platform project, and use them for as low as $40 a day. That’s what we charge for 30 terabyte of disk space a day… So there might be new findings with these digits… We put exact steps to copy the disks in the blog post.
I think this is a great milestone for public cloud, entirely. This is the very first time the pi world record calculation was done on the cloud. So, only pi, but I really hope the cloud will be used for other mathematical calculations… People might want to calculate other constants like the golden ratio or e, and there are a couple other interesting constants you could calculate on Cloud.
And constants aside, like e and the golden ratio, on the cloud one could run — I think a weather forecast is one thing… For the broader science community, they have more ideas, like a lot of the serious sciences, quantum physics, or big data analysis, liquid simulations and such… Anything, from weather forecasts, manufacturing and engineering simulations, etcetera. I think you can do anything.
When I was in school they said you could get pretty close to Pi by dividing 22 by 7 — but I’m gonna guess that what you did wasn’t that simple.
That’s what I did — when I was 12. I wrote a program to repeatedly divide 22 by 7, and it kept going. But that was the division — not the accurate calculation. I had no idea how I could actually calculate an accurate pi when I was a kid.
And more than 20 years later, I was able to actually hit the record.
Why did you stop? Once you got to 31,415,926,535,897 digits and you’d set the record, why not just keep going?
That’s a really good question. We have to decide how many digits we’ll calculate before starting. So we have to allocate a certain amount of storage, and set the parameters for the program, before running. We can’t just keep going and get more digits!
What programming language were you using — or was it assembly language?
For this record, or for my childhood trial?
Maybe I want to hear about both! What language were you using when you were 12?
I used C. So that’s the first programming language I learned. And for y-cruncher, I believe it’s a mix of C++ and some parts of assembly language.
I read that it involved 25 virtual machines. Why 25? Why not 30 — or 20? Why is 25 exactly the right number of virtual machines?
I ran a small benchmark, which is part of the program, to determine the best number of disks, and I tested on 12 disks, 16 disks, 24 disks — so different parameters, and 24 seems to work the best. So I chose that number.
So what happens next? Will people be able to take your number and start up where you left off?
No, unfortunately. The program converts the final product to actual decimal digits — that is a fixed point. And if people want to calculate more digits, they would need to start over. That’s exactly what we did for this record!
I’ve heard Google employees sometimes get one day a week to work on their own projects. Is that what this was — or is this part of your official duties as the developer advocate?
That’s a really good point. I think it’s a little bit of both!
This was my dream. This — calculating pi and breaking the world record, has been always my dream since my childhood. And I asked my manager if I could do that on cloud, and he was totally fine with that, so I started it. And as a developer advocate, my job is to demonstrate what we can do on cloud. So these two parts of my job actually matched pretty well!
You were 12 years old when you got the idea?
That’s when I learned about pi and circles in math classes, in primary school. I had no idea how I would do this when I was a kid, but I was able to download the program to calculate pi. And I learned of world records then…
When I was a high school student, or I’d got a little bit more mature and learned more about computers, I thought, “Okay, I would need a supercomputer to do this.” But I had no idea how I could get a supercomputer, because I knew those would be more expensive than my own computer. I went to college, but I wasn’t able to use the entire supercomputer to just calculate pi.
And then in 2018, we had the cloud, and the cloud became fast — so fast that we actually can perform these computations there. So I think it’s — I had no idea how I would actually do this until very recently. But I think I gathered some hints and learning from other people doing the same calculations.
And I also learned a lot from one of my professors, Dr. Takahashi, in college.
I read that Dr. Takahashi had actually set his own record for calculating pi out to 4,294,960,000 back in 1995. So what was he able to tell you?
We discussed more general mathematical computation techniques and distributed algorithms… I told him that I would use y-cruncher, the program, to calculate pi, and he confirmed that that strategy was heading in the right direction, especially on public cloud.
And he also confirmed that calculating pi in a distributed manner is extremely hard — it’d be difficult to calculate pi on, for example, hundreds of thousands of nodes, distributedly, with the algorithm that we used for this calculation. There are some other algorithms that are less efficient but easier to distribute. So there are tradeoffs.
Obviously, Alexander Yee, the developer of y-cruncher, worked closely with me, and he gave us some advice, and he also helped us verify the final results. Besides that, thanks to Cloud, I mostly did the calculation by myself.
So how long have you been dreaming this dream?
I’m 34 now…
Google’s press release says you and your team are going to celebrate on Pi Day. But will you be away in Japan on Pi Day?
Yes. Unfortunately, I’ll be in Japan…
So are you going to have to remotely dial-in to the celebration?
The celebration in our office takes place when it’s 4 a.m. in Japan, so I’m not sure if I can join remotely… I hope there is something in Japan as well, but I’m not exactly sure!
The New Stack is a wholly owned subsidiary of Insight Partners. TNS owner Insight Partners is an investor in the following companies: Bit.