June 7, 2009

The Keynote

As I write, Melissa & I are at Chicago O'Hare airport waiting on our (delayed) flight to San Francisco. I am attending Apple's Worldwide Developer Conference (WWDC) this week. Melissa is along for the ride.

Since I started working full time as the primary Mac OS X developer of Mathematica at Wolfram Research in 2001 I have attended this conference every year except 2006. That year the conference was scheduled (Apple has been really bad lately at waiting until the last minute to schedule this huge conference) during the week Melissa & I were moving to Nicaragua, so I missed out. The conference is exciting every year, but none was more exciting for me than 2005 when I (along with my boss Theo Gray) participated on stage during Steve Jobs' keynote address.

Note: some of this information was confidential at the time, but is now mostly publicly known. I can't imagine any of the details I mention below would still be considered sensitive information.

On Wednesday night the week before WWDC I got a call at 9:30 pm from Theo. I was almost ready to go to bed. He asked if I would be able (and willing... but more able :) ) to fly to California at 6 am the following morning. I suppose I could, but why? Theo went on to tell me that Apple had a super secret project and they wanted our help, but he wouldn't tell me what the project was.

I have since learned that he actually knew what the project was at the time of that call, but he couldn't tell me. Stephen Wolfram, the founder and president of Wolfram Research wouldn't sign off on the idea until he knew what was going on. Steve Jobs told Stephen Wolfram & Theo what the project was and they agreed to take part... but they couldn't tell anyone else.

I spent the next two hours packing (including the Dahon, my folding bike at the time) before going to bed. Early the next morning I arrived at the Champaign airport. Apple purchased my one-way ticket to San Jose (by way of Chicago). An Apple limo picked me up at the San Jose airport and drove me straight to Apple's campus in neighboring Cupertino. Luggage still in hand I entered 3 Infinite Loop (I think). A few minutes later I was in a meeting with Ron Okamoto, Vice President of Worldwide Developer Relations.

Ron told me what the secret was, that Apple was building a Mac which used an Intel x86 processor. They had ported all of Mac OS X to this new architecture (Darwin, the open source core of Mac OS X, already ran on x86). They intended to demonstrate this new x86 version of Mac OS X on Monday's WWDC keynote. They wanted do demo a 3rd party application running on the x86 Mac. They chose Mathematica to be that 3rd party application. He asked me if I thought it would be possible to get Mathematica up and running on Mac OS X Intel by Monday.

Uhhhh.

That's a potentially huge task. Our code is fairly portable (at the time Mathematica ran on several Unix platforms in addition to Mac and Windows), but supporting new platforms usually takes a fair amount of time. Ron told me Apple was prepared to provide significant resources to make this happen, including a small team of Apple developers and immediate access to any other relevant Apple developers. I was cautiously optimistic.

(Now 30,000 feet over Iowa)

We travelled across De Anza Blvd (luggage still in hand) to a different Apple building where I was ushered into a conference room with a single desktop computer sitting on the conference table. It was in the same metal case as Apple's high end desktop computers at the time, the PowerMac G5. I think the case even said "G5" on the side. From the outside you couldn't tell the difference between this machine and a G5 unless you carefully peeked through the holes on the front and noticed it didn't have the huge heat sink the G5's had.

I was greeted by the team of Apple engineers (Matt, Eric, & Ronnie) who would be providing technical assistance in the porting process. This place was not only hidden from the public, but it was hidden from the rest of Apple. Very few people at Apple were even aware this project existed. The four of us got busy.

I sat down at the Macintel and immediately began working. The experience wasn't just familiar it was identical to any other Mac I had used. I was blown away by how seamless Apple had made the transition. The whole OS was there it all its glory, including every bundled application (even Xcode). I could just work exactly like I do on any other Mac.

But wait, sometimes I use BBEdit to edit text. I guess I won't be able to do that since it (or any other 3rd party application) hasn't been ported yet. "Why don't you just go ahead and try it?" Matt said to me as he tried to hold back a smile. It hit me immediately. "You're kidding, right?" I downloaded BBEdit, double clicked the icon, and it ran. I ran just like it does on any other Mac. Apple had incorporated (with technology licensed from another company) a PowerPC translation layer into the OS. This meant that nearly all existing Mac applications would run on the new Intel machine, with a slight performance penalty. This was amazing news, as it meant the new machines could be adopted immediately by users rather than waiting until all their applications were ported. Very exciting.

Back to work. We started with MathLink. This is a low level library used by both the Mathematica user interface (FrontEnd) and the computation engine (Kernel). With one set of flags MathLink builds for Mac OS X PowerPC and with different flags it builds for x86 Linux (or Windows, etc.). It only took a few minutes of experimentation with the Makefile and headers to find the right set of flags to treat the OS as Mac OS X and the architecture as x86. The elapsed time from entering the conference room to having a built, fully functional MathLink library was probably around 20-25 minutes. As we progressed our excitement grew.

Xcode target architecture

Next was the Mathematica FrontEnd. I normally spend all my time working on the FrontEnd, so this part didn't worry me much. The FrontEnd is built with Xcode, which had a new "architectures" setting checkbox. We checked the checkbox for the Intel architecture (actually, we didn't because Intel was the default target architecture when building on Intel... but we did verify the checkbox was properly set). Within 4-5 minutes the FrontEnd built with only a couple of minor build errors which were easily fixable. After 10 minutes working on the FE we had it built and running. It wasn't running flawlessly, but it was a very good start. I had only been at the secret Intel machine for around a half hour. This was getting really exciting.

The next step was the one which caused me the most concern, the Mathematica Kernel. The reason for my concern was that I don't often work with the Kernel. I knew how to build it (the build system is somewhat complicated) and I knew roughly how the code was organized, but there are all sorts of minor details which could really slow down the process. It relies on many external libraries (open source and commercial) and custom build tools. Fortunately, the Kernel, like MathLink, already ran on Mac OS X PowerPC and Intel Linux & Windows. It took a while longer to figure out some of the proper build flags, and some of the build errors weren't entirely obvious.

This is where Matt, Eric, & Ronnie really came through. They had each spent a lot of time porting open source applications to Mac OS X Intel to learn what types of issues developers might run into along the way. Each time we encountered some sort of problem in an open source library one of them would go off on their own for a few minutes to resolve the problem while the rest of us kept hammering away. Every few minutes we would get further and further along in the build process with new issues popping up all the time. It was like an assembly line. In parallel.

After about 90 minutes (2 hours from when I entered the room) we had the Kernel running, the FrontEnd running, and the two processes were able to talk to each other through MathLink. Again, it wasn't perfect, but nearly everything just worked.

News spread up the ranks. Within minutes we had high level executives stopping by to see the first 3rd party commercial application running on Mac OS X Intel. By early evening Theo (who took a later flight) arrived frantically asking what he can do to help. He was a bit shocked, and very pleasantly surprised, that it was mostly done.

Friday we worked to fix bugs and showed off the software to an ever growing number of people. Since Mathematica already ran on Intel processors on other platforms, most of our cross platform code was byte order agnostic. There were a few cases where Mac specific code was assuming big endian byte order, particularly related to Quartz (bitmap drawing) and OpenGL. There were also some issues with Quickdraw PICT drawing.

Friday evening some of the Mac rumors sites (original CNET article appears to have been removed) reported that Apple would be announcing the switch to Intel processors at Monday's keynote. Rumors like this had been published for years, so it wasn't that out of the ordinary, but this report was different. It contained many specific (correct) details rather than just wild speculation (like every previous report like this). It was clear someone in the know had blabbed. The conference room was silent for a few moments. Oh well. Until Monday, it's still just a rumor.

Saturday morning we drove up to San Francisco to prepare for the WWDC keynote. We had a rehearsal where I met and shook hands with Steve Jobs. I had heard horror stories about his temper, but he was in a great mood when I met him... sitting perfectly relaxed, legs crossed, smile from ear to ear. I could tell he was excited.

Theo practiced his speech, asking Jobs for feedback along the way. The funny thing was that Steve was so happy he kept telling Theo "say whatever you want" or "talk for as long as you want." Meanwhile I set up the demo machine (and backup demo machine) with our freshly built Mathematica for Mac OS X Intel.

Monday morning before the keynote Theo & I hung out in the VIP lounge. Woz (Steve Wozniak, the other co-founder of Apple) was there, Sergey Brin (co-founder of Google and former Wolfram Research intern) was there, along with many other influential people in technology.

Once the keynote started we sat in the front row on the far right side. Midway through the keynote Jobs called us up to the stage. Theo described our experience porting Mathematica to Mac OS X Intel over the previous few days. I drove the demo machine as he talked. It was a big hit. Theo captivated the audience. At one point Theo mentioned my name, which immediately caused 4,000 people to turn their heads to stare at me. It was a little awkward (which is quite evident in the video). Had I known that was going to happen I think I could have played it a little more cool. Anyway the demo was a success. Mission accomplished.

Note that a few minutes of the demo were edited out of this video for some reason.

That wasn't all for that WWDC. On Tuesday I gave a 10 minute presentation during Bud's science session about Mathematica on Mac OS X, detailing how we utilize various OS features. This went more smoothly for me as I had actually been preparing for it for a few weeks. Later that week I spoke about Mathematica for a minute or two in Ernie's 64-bit session. I went from participating in zero sessions my first four WWDC's to three sessions in 2005, back to zero sessions every year since. Perhaps that was my 15 minutes of geek fame (actually, the total time I spent on stage was almost exactly 15 minutes).

Last year I attended a reunion for the non-profit organization where I worked in college, ASP. A guy who I hadn't seen in 8 years came up to me and asked me if I was in a Steve Jobs keynote a few years ago. "I thought that was you..."

Anyway, tomorrow's 2009 WWDC keynote won't be as exciting for me, though I'm sure it will still be exciting. I won't be participating in the keynote. At least, if I am they haven't told me yet. Always with the secrecy.

6 comments:

Melissa said...

that's the first time even i have heard the whole story. what exciting times!

Anonymous said...

and NOW WE KNOW THE REST OF THE STORY!!!!!!! LOVED READING ALL ABOUT IT>>>>> FANTASTIC memories for you!!!!!WHAT AN AMAZING TRIP THAT WAS FOR YOU!!!!!!!!!! Hope this week in S/F, provides fun, entertainment and good eats....... OH, and enjoy the convention,also!!!!!! Hugs, nan HI meli!!!and FIG!!!

Eric Smith said...

This is pretty amazing stuff, Rob. I enjoyed reading the article!

Anonymous said...

Have been totally captivated by this writing, Rob ... and appreciate the privilege of getting to know (and see) what really happened in San Francisco at that gathering. Applause to you and those in your 'geek' field for allowing those of us, who know absolutely nothing about the work/secrets involved, look good when we touch the keyboards. Keep it up! auntie

Aimee said...

Clearly this was a room full of developers, as I think you received more applause than anyone else--they knew your hard work!
Exciting times. hope you're having a good trip.

Scott said...

Neat! So how did they get you out of the first building (@3 Infinite Loop) to your next meeting? Did they have to reboot the Apple Limo or just forcibly interrupt its code execution? Or is that part still confidential? ;-)