nav search
Data Center Software Security Transformation DevOps Business Personal Tech Science Emergent Tech Bootnotes BOFH

Scan your branes LIVE IN REAL-TIME, thanks to GPU-surfin' boffins

3D MRI videos bashed out by monster box and open-source code

By Dan Olds, 27 Mar 2013

GTC 2013 Let’s say you’re at a gathering – maybe a cocktail party or a crowded club – and some buff athlete shows up on crutches. He immediately becomes the center of attention as he recounts the story of his injury.

“Dude, it was gnarly," he bellows so that everyone can hear. "A totally sick shred. Now I’m waitin’ on the MRI results. The docs think I might never shred again, but I’m stoked to get back out there."

Is there any way that you, a computer geek, can get the conversational focus back where it belongs – on you? Sure you can: just say this:

Really? You’re waiting? They can do MRIs in real time now, and not just an image, but a whole movie. Like better than YouTube. Here’s how it works.

At last week’s GPU Technology Conference in San Jose, researchers from Cal Berkeley and the Max Planck Institutes showed how MRI images can now be processed so quickly and accurately that they can be shown as full-motion, real-time videos instead of static, printed output. First, a little background.

MRI machines use magnets arranged in coils to create strong magnetic fields around a patient's body. These fields cause the protons in the hydrogen atoms in the water in the body to align themselves. When they’re aligned, the protons absorb energy from short bursts of radio waves also directed at the patient and release this energy in the form of returned radio signals.

These signals are detected by the machine and, after processing the data to determine the distribution of detected protons in the patient, the information is used to create a full 3D MRI picture.

A typical MRI machine has four coils located around the circumference of the machine; each coil establishes its own unique field and detects the returned radio waves. Reconstructing this output into an accurate and useful image is a difficult problem.

Each coil sees a different picture due to its location and its unique properties. Reconciling these differences into a clear and accurate picture of slimy internal body parts requires a lot of long mathematical formulas that utilise operators I’ve never seen before.

While it’s a complex computation, it’s highly parallel in nature, which makes it a great candidate for using accelerators such as graphics processor chips to speed up the number crunching. What does it take to turn MRIs into a real movie? You have to parallelise the problem so that all the maths can be run very quickly and concurrently.

But for this to become a truly useful invention, it has to be performed with computing equipment that is readily available and doesn’t require the budget of a national lab to procure. The boffins presenting the real-time MRI tech at GTC 2013 found that a 12.7 Teraflop-per-second, two-socket Xeon system with 96GB RAM and four Nvidia GTX 580 (total of 8 GPUs) will do the trick.

Their first implementation revealed that they could push about four frames per second (FPS) with a single GPU, with speed-up of 1.7x using dual GPUs. However, adding a fourth GPU only yielded a 2.2x speed-up, meaning they were topping out at roughly 8 to 10FPS on reasonably complicated scans.

Clearly not a Reg hack's MRI scan.
There's a heart and a working liver.

The bottleneck was rooted in one of their algorithms, but it was also due to the speed of inter-GPU communication. When data was transferred between GPU0 or GPU1 to GPU2 or GPU3, the data had to pass through the CPU, slowing it to a relatively pokey 2.5GB/s.

By changing the way the algorithm transferred memory to and from the GPU, and also the amount of memory it needed to actually transfer, the team decreased overall transfer times by 3.5x compared to its previous best result. While the scientists didn’t actually use the term RDMA (Remote Direct Memory Access) in their slides or accompanying dialog, I believe that’s what they were doing. But given the complexity of the problem, just using RDMA wasn’t enough to provide the real-time performance the researchers needed.

In working through multi-GPU optimisation, they realized that they needed a multi-GPU programming library. So they built one, and now it’s available to the world. It allows users to write identical code to run on one, two, four or more GPUs – and according to the researchers, “it just works”. (You can find the open-source library here.)

Full motion, real-time MRI has a huge range of medical benefits because doctors can get a much better view of exactly what’s happening in the body at any given point in time and space. They’ll get that information faster and more clearly than ever before. And, as outlined above, there are advantages even for those of us who aren’t patients or doctors; we can use this conversation about real-time MRIs to steal back the spotlight from that snowboarding dude with the cast on his leg. ®

The Register - Independent news and views for the tech community. Part of Situation Publishing