Games consoles reveal the supercomputer within

February 16, 2008

WHEN Todd Martínez broke his son’s Sony PlayStation he didn’t realise this would change the course of his career as a theoretical chemist. Having dutifully bought a PlayStation 2 as a replacement, he was browsing through the games console’s technical specification when he realised it might have another use. “I noticed that the architecture looked a lot like high-performance supercomputers I had seen before,” he says. “That’s when I thought about getting one for myself.”

Six years on and Martínez has persuaded the supercomputing centre at the University of Illinois, Urbana-Champaign, to buy eight computers each driven by two of the specialised chips that are at the heart of Sony’s PlayStation 3 console. Together with his student Benjamin Levine he is using them to simulate the interactions between the electrons in atoms. Scaled up over entire molecules, the results could pave the way to predicting how a protein will interact with a drug.

Martínez and Levine are not the only researchers who have turned to gaming hardware to do their number crunching. That’s because the kinds of calculations required to produce the mouth-wateringly realistic graphics now seen in high-end video games are similar to those used by chemists and physicists as they simulate the interactions between particles in systems ranging in scale from the molecular to the astronomical. Rotating, enlarging or reflecting an object from one frame to the next in a game, for example, requires a technique called matrix multiplication. Modelling the interactions between thousands of electrons in a molecule calls for similar techniques.

Such simulations are usually carried out on a supercomputer, but time on these machines is expensive and in short supply. By comparison, games consoles are cheap and easily available, and they come with the added bonus of some innovative hardware. For example, the Wii, made by Nintendo, has a motion-tracking remote control unit that is far cheaper than a comparable device would be if researchers had to build it from scratch.

One key advance is the ease with which scientists can now program games consoles for their own purposes. Although consoles do a great job of rendering images, games programs don’t require software to save data once it has been used to render the image. Scientists, by contrast, need to be able to store the results of the calculations they have fed into their machines.

Things started to get easier in 2002, when demand from computer enthusiasts who wanted to use their PlayStations as fully fledged desktop machines prompted Sony to release software that allowed the PlayStation 2 to run the Linux operating system. That allowed scientists to reprogram the consoles to run their calculations. Then in 2006 came the big breakthrough, with the launch by IBM, Sony and Toshiba of the Cell chip that now drives Sony’s PlayStation 3 (see Timeline). With one central processor and eight “servant” processors (New Scientist, 19 February 2005, p 23), it is vastly more powerful than the PS2 chip, and was designed from day 1 to run Linux.

The release of the Cell has accelerated  research into black holes by Gaurav Khanna, an astrophysicist at the University of Massachusetts, Dartmouth. He has strung together 16 PS3 consoles to calculate the properties of the gravity waves that are expected to be produced when two black holes merge. Meanwhile, a collaboration between IBM and the Mayo Clinic in Rochester, Minnesota, is using the Cell’s ability to render high-resolution video graphics to do the same with data gathered by MRI and other medical scanning techniques. The aim is to make diagnosis easier and faster – by using the images to determine whether a tumour has grown or shrunk, for example.

Other researchers are pushing for even more speed. One of Martínez’s students, Ivan Ufimtsev, is experimenting with the NVIDIA GeForce 8800 GTX graphical processing unit (GPU) for PCs, which was released in November 2006. The GPU has 128 processors – compared to the Cell’s eight – and when slotted into a PC, helps turn it into a high-quality gaming engine. To start with, these cards were hard to program, just like the PS2 without the Linux add-on, but NVIDIA soon cottoned on to the sales opportunities that scientists like Martínez could offer for its product. In February 2007 it released the Compute Unified Device Architecture, a software package that allows the C programming language to be used to program the GPUs.

The results were staggering. When Martínez used it to simulate the repulsion between two electrons in an atom, he found that the calculation ran 130 times faster than it did on an ordinary desktop computer (Journal of Chemical Theory and Computation, DOI: 10.1021/ct700268q). He is now calculating the energy of the electrons in 1000 atoms, which add up to the size of a small protein. “We can now do the things we were killing ourselves to do,” he says.

Martínez predicts that it will soon be possible to use the GPU to predict more accurately which drug molecules will most strongly interact with a protein and how they will react, which could revolutionise pharmaceutical research. Similarly, Koji Yasuda at Nagoya University in Japan reported in a paper published this month (Journal of Computational Chemistry, vol 29, p 334) that he used the same GPU to map the electron energies in two molecules: the anti-cancer drug paclitaxel and the cyclic peptide valinomycin.

Games hardware still isn’t perfect for science. The Cell’s eight processors and the NVIDIA GPUs are forced to round decimal numbers to seven decimal places. As numbers are repeatedly multiplied together, this small error becomes magnified. In a game, the result might be nothing more serious than a car appearing slightly closer to a wall than it should, but in research such inaccuracies can be show-stoppers.

It’s not just the chips that researchers can usefully borrow from gaming hardware. Take the Wii’s hand-held remote control, which contains an accelerometer that can sense in which direction it is being moved, and how vigorously. It transmits this information via a Bluetooth link to the console, where it is used to adjust the graphics to respond to the player’s movements in real time.
Monitoring Parkinson’s

The device recently grabbed attention as a tool for surgeons to improve their technique (New Scientist, 19 January, p 24). Meanwhile, neurologist Thomas Davis at the Vanderbilt Medical Center in Nashville, Tennessee, is using it to measure movement deficiencies in Parkinson’s patients. By attaching up to four Wii remotes to different limbs, Davis captures data for tremor, speed and smoothness of movement, and gait. This data is then sent via the Bluetooth link to a laptop running software that allows Davis to assess quantitatively how well a patient can move. Davis hopes this can be used in clinical trials for Parkinson’s drugs to replace the scoring scales now used, which are based on a doctor observing a patient’s condition.

Others are using the console to assess the progress of patients who have had a stroke or a head injury by monitoring their performance as they play Wii games. Johnny Chung Lee at Carnegie Mellon University in Pittsburgh, Pennsylvania, is using the Wii remote as a virtual reality research tool. As the wearer’s head moves, the Wii tracks it and displays images dependent on where the wearer is looking. Meanwhile, a team at the University of Valladolid in Spain hopes to use the Wii remote to rotate and manipulate ultrasound images more intuitively.

Computer gamers have always hankered after the latest console or PC hardware to run ever more realistic-looking games. Now scientists are lining up right beside them.

From issue 2643 of New Scientist magazine, 16 February 2008, page 26-27

And not an xbox360 in sight….

Advertisements

Rock, paper or scissors

December 20, 2007

[spoiler]

  • 22 December 2007
  • NewScientist.com news service
  • Michael Brooks

YOU know the score: paper wraps rock, rock blunts scissors, scissors cut paper… It’s just a trivial way of making decisions about whose round it is at the bar, who gets the TV remote, that kind of thing. It’s something like tossing a coin, right?

You couldn’t be more wrong. Rock, paper, scissors (RPS) – also known as RoShamBo – is a startling game of strategy that reveals both the fickleness and the limitations of the human mind. There are RPS world championships worth big money, fiercely contested tournaments to find the best RPS computer programs, and heated arguments over which is the optimal RPS strategy. When millions of dollars have been made on the throw of a hand, it is hard to argue this is an insignificant debate. So, how do you win at RPS?

From a mathematical perspective, RPS is a function known as an intransitive relation, which means it creates a loop of preferences that has no beginning and no end, defying standard notions of hierarchy. Though each item is better than some other item, it is impossible to define what is “best”, and this makes it interesting to mathematicians. “It makes you think precisely about what you mean by ‘is better than’,” says John Haigh, a mathematician at the University of Sussex in the UK. “Context is everything.”

Given the interest among mathematicians, it was almost inevitable that computer programmers would get involved and try to produce the ultimate player. According to game theory, the optimal strategy is straightforward: make your throws random. If no one can guess what you’re going to play, they can’t devise a winning strategy against you. That may sound like a simple thing to do, but it isn’t – not even for computers – as David Bolton, a programmer for a finance company based in London, has demonstrated.
Bolton, an RPS enthusiast, has been running a computer RPS league on www.cplus.about.com. The competitors supplying their game-playing code come from as far afield as the Philippines, South Africa, Sweden and China, and their programs, or bots, use a wide range of strategies. Surprisingly, the least successful bots are those that seem to make their choice based on nothing more than random numbers. “These all tend to be at the bottom of the league,” Bolton says.

The explanation must be that these poor performers are not truly random. If there are any patterns at all, well-programmed bots will pick them out – and work out how to exploit them. Iliatsi, currently the leader in Bolton’s league, has 10 strategies to deploy against its opponents, analysing their previous moves, for instance, to find a pattern and thus work out the most likely next move. Iliatsi, created by a Greek programmer, looks set to win when the championship winds up this month.

Though competitions between programs are a challenge for the programmers, they are of limited interest to everyone else, says Perry Friedman, who created RoShamBot, one of the first RPS bots. Computer RPS players are simply too good. “It’s much more interesting to find games that play well against people,” Friedman says. So when Friedman created RoShamBot, he deliberately refrained from making it invincible. While the program is powerful, its charm, he says, is that it doesn’t just mash you into a pulp. You can play against RoShamBot at http://zonker.stanford.edu/cgi-bin/roshambot.

Since graduating from Stanford, Friedman has worked as a programmer for IBM and Oracle and as a professional poker player. In the latter pursuit, playing RPS against other humans has been a big help, Friedman says, because live-action RPS teaches you about the peculiarities of human thought. In RPS, the golden rule is to be unpredictable, but without extensive training humans are hopeless at this. “People tend to fall into patterns,” Friedman says. “They tell themselves things like, ‘I just went rock twice, so I shouldn’t do rock a third time, because that’s not random’.”

Worse, people tend to project patterns on their opponents. “They see patterns where there are none,” Friedman says. This, he adds, is a major source of complaints in online gaming: when players lose because of something they perceive as a too-lucky dice throw, say, they think the computer they are playing against must be rigged. “What are the odds double-six came up right when he needed it?” players ask. The thing is, as Friedman points out, “They don’t notice all the times it didn’t come up.”

If you are going to win at RPS, Friedman’s advice is to think – but not too much. Of course you want to randomise your throws, but once the game is under way you should look for patterns. If your opponent is human, the chances are he or she works – consciously or unconsciously – with a sequence in their head. Spot it, and they are toast.

Another tip is don’t throw rock in your first game. This strategy won the auction house Christie’s millions of dollars in 2005 when a wealthy Japanese art collector couldn’t decide which firm of auctioneers should sell his corporation’s collection of Impressionist paintings. He suggested they play RPS for it. Christie’s asked for suggestions from their employees, one of whom turned out to have daughters who played RPS in the schoolyard. “Everybody expects you to choose rock,” the girls said, so their advice was: go for scissors. Christie’s acted on this expert tip, while rival auction house Sotheby’s went for paper – and lost the business.

Scissors is still a good starting throw even if you are playing against someone experienced: they won’t go for rock because that’s seen as a rookie move, so the worst you are likely to do is tie. Once things are under way, different techniques come in. You could try the double bluff, where you tell your opponent what you’re going to throw – then do it: no one believes you’ll do it, so they won’t play the throw that beats the throw you are playing. Then, if your mind goes blank, play the throw that would have been beaten by your opponent’s previous throw: some kind of subconscious activity seems to encourage players – especially those who are not feeling at the top of their game – to aim to beat their own preceding throw.

When all else fails, the rule is “go with paper”, because rock comes up more often than it would by chance. In 1998, Mitsui Yoshizawa, a mathematician at Tokyo University of Science, studied throws from 725 people and found that they threw rock 35 per cent of the time. Paper came in at 33 per cent and scissors at 31 per cent. Facebook has an online game called Roshambull which has logged 10 million throws in over 1.6 million games. Here the statistics are 36 per cent rock, 30 per cent paper and 34 per cent scissors. “Players clearly have a slight preference for rock, and that affects the distribution of all the plays,” says Graham Walker of the World RPS Society. This pleases him, since it shows how winning something like the world RPS championship involves skill, not luck. “Given people’s preference for rock, it is impossible to claim that RPS is a game of chance,” he says.

So there you go: if arguments over which TV channel to watch are a regular feature of your holidays, now you know how to get your own way more often than not. Do a little study, practise against an online trainer, then, wide-eyed, make what looks like an innocent suggestion: shall we settle this with rock, paper, scissors?

From issue 2635 of New Scientist magazine, 22 December 2007, page 66-67

 

[/spoiler]

 

The science behind everything….

I love these articles that are about nothing really, but are still so interesting you read them.

Maybe I’m just sadder than i originally thought.