Whether or not you realize it, pi is everywhere you look. It’s the ratio of the circumference of a circle to its diameter, so the next time you check your watch or see the turning wheels of a vehicle go by, you’re looking at pi. And since pi is an irrational number, there’s no end to how many of its digits can be calculated. You might know it as 3.14, but math and science pros are constantly working to calculate more and more digits of pi, so they can test supercomputers (and have a bit of healthy competition, too).
While I’ve been busy thinking about which flavor of pie I’m going to enjoy later today, Googler Emma Haruka Iwao has been busy using Google Compute Engine, powered by Google Cloud, to calculate the most accurate value of pi—ever. That’s 31,415,926,535,897 digits, to be exact. Emma used the power of the cloud for the task, making this the first time the cloud has been used for a pi calculation of this magnitude.
Here’s Emma’s recipe for what started out as a pie-in-the-sky idea to break a Guinness World Records title:
Step 1: Find inspiration for your calculation.
When Emma was 12 years old, she became fascinated with pi. “Pi seems simple—it starts with 3.14. When I was a kid, I downloaded a program to calculate pi on my computer,” she says. “At the time, the world record holders were Yasumasa Kanada and Daisuke Takahashi, who are Japanese, so it was really relatable for me growing up in Japan.”
Later on, when Emma was in college, one of her professors was Dr. Daisuke Takahashi, then the record holder for calculating the most accurate value of pi using a supercomputer. “When I told him I was going to start this project, he shared his advice and some technical strategies with me.”
Step 2: Combine your ingredients.
To calculate pi, Emma used an application called y-cruncher on 25 Google Cloud virtual machines. “The biggest challenge with pi is that it requires a lot of storage and memory to calculate,” Emma says. Her calculation required 170 terabytes of data to complete—that’s roughly equivalent to the amount of data in the entire Library of Congress print collections.
Step 3: Bake for four months.
Emma’s calculation took the virtual machines about 121 days to complete. During that whole time, the Google Cloud infrastructure kept the servers going. If there’d been any failures or interruptions, it would’ve disrupted the calculation. When Emma checked to see if her end result was correct, she felt relieved when the number checked out. “I started to realize it was an exciting accomplishment for my team,” she says.
Step 4: Share a slice of your achievement.
Emma thinks there are a lot of mathematical problems out there to solve, and we’re just at the beginning of exploring how cloud computing can play a role. “When I was a kid, I didn’t have access to supercomputers. But even if you don’t work for Google, you can apply for various scholarships and programs to access computing resources,” she says. “I was very fortunate that there were Japanese world record holders that I could relate to. I’m really happy to be one of the few women in computer science holding the record, and I hope I can show more people who want to work in the industry what’s possible.”
At Google, Emma is a Cloud Developer Advocate, focused on high-performance computing and programming language communities. Her job is to work directly with developers, helping them to do more with the cloud and share information about how products work. And now, she’s also sharing her calculations: Google Cloud has published the computed digits entirely as disk snapshots, so they’re available to anyone who wants to access them. This means anyone can copy the snapshots, work on the results and use the computation resources in less than an hour. Without the cloud, the only way someone could access such a large dataset would be to ship physical hard drives.
Today, though, Emma and her team are taking a moment to celebrate the new world record. And maybe a piece of pie, too. Emma’s favorite flavor? “I like apple pie—not too sweet.”
For the technical details on how Emma used Google Compute Engine to calculate pi, head over to the Google Cloud Platform blog.