HSBC Real-time Risk Experiment with Xcelerit and GPUs
Traditionally, this kind of calculation takes many hours to run on a bank’s grid facility. Eurico Covas, Head of QRVG Development and Hedge Accounting Systems – Quantitative Risk and Valuation Group (QRVG) – wanted to see whether it was possible to run this calculation on an intra-day rather than an overnight basis.
He put together an experimental facility involving a couple of GPUs from NVIDIA. He turned to Xcelerit for the software part of the picture. “We already had extensive in-house libraries to carry out CVA and other calculations, and we had heard that Xcelerit offered an easy way to get our existing code to drive GPUs at their maximum speeds”, he said.
HSBC assigned just one quant developer to the project who was given some basic tuition introducing the Xcelerit SDK before tackling the task of speeding up the existing code base. The bank make extensive use of an in-house developed quant library and with less than handful of days effort, the developer was able to identify where the hot-spots were in the existing code and insert some carefully chosen lines invoking the Xcelerit API. Once the code is modified in this way, it can be run, without change, on any combination of CPU or GPU hardware that happens to be available.
The effects of the code transformation were dramatic. In one example, a set of 10,000 swap instruments was priced for a set of 1,000 Monte-Carlo scenarios at 26 time steps. This adds up to a staggering 260 million pricings in total. An average is taken over all scenarios to get the expected exposure at all time steps. Speedups of 19x have been achieved on an Nvidia Tesla K20 GPU, compared to an equivalent multi-core CPU implementation on an Intel Xeon E5620 CPU. When run on a system with 3 GPUs, this performance scales almost linearly, achieving a speedup of nearly 57x.
Eurico Covas is very pleased with the outcome. “We are just dipping our toes in the water on this”, he said. “Our quant teams have a voracious appetite for computing power and obviously using GPUs offers a cost-effective solution to that problem”. He is conscious though that any new hardware will require software to drive it. “A major part of HSBCs competitive advantage lies in our extensive in-house code-base and libraries – obviously we are keen to maintain that value – harnessing the power of new hardware without having to maintain multiple versions of our code”. The Xcelerit approach allows small modifications to be made to an existing program or library and then the SDK takes care of mapping that code efficiently onto whatever combination of CPU or GPU hardware is available. “From our point of view, this is a very good outcome”, he said, “We can get the speedups we require, maintain a single codebase and run the executable on any of our in-house facilities”. “This is a very efficient way to cut infrastructure and development costs”, he added.
The trial deployment is also yielding a green dividend. The need for increasingly complicated risk analysis, such as these CVA calculations with a large number of scenarios and steps, drives investment in new hardware, as well as the additional electric power to drive the hardware and to cool the data centers that contain it. Using the Xcelerit SDK with appropriate GPU hardware executes these calculations much more efficiently with a performance-per-watt that is far superior to conventional computing approaches. This is a bonus for companies whose data centers may be space – and power – constrained as well as those who have strong environmental policies in place.