FPGAs: The software in the hardware
Lately, I’ve been exploring a little known corner of high performance computing (HPC) known as FPGAs. Turns out, it’s time to get electrical on yowass (Pulp Fiction reference intentional). You can program these chips in the field, thus speeding up processing speeds dramatically, relative to generic CPUs. It’s possible to customize functionality to very specific needs.
Why this works
The main benefit of FPGAs comes from reorganizing calculations. FPGAs work on a massively parallel basis. You get rid of bottlenecks in typical CPU design. While these bottlenecks are good for general purpose applications, like watching Pulp Fiction, they significantly slow down the amount of calculations that you do per second. In addition to being massively multi-parallel, FPGAs also are faster, according to FPGAdeveloper, because:
- you aren’t competing with your operating system or applications like anti-virus for CPU cycle time
- you run at a lower level than the OS, so you doing have any protocol stack communication delays
Show me the money
The net result of removing these bottlenecks, you ask? 100-300x faster calculations of portfolio risk.
Now I put that up as an example, just so that I can watch it a few times, so that eventually some of that smartness starts sinking in. :) The good stuff starts around 21:50, where the mastermind behind the application of FPGAs to credit trading explains how it worked.
Why It’s Worth Caring
It’s not hard to imagine why this much speed would be a competitive advantage. Turning an overnight risk calculation into something you can run in 4 minutes, gives you a better sense of what you are doing, especially compared to competitors. Maxeler, the company who helped JP Morgan get this system going, implies that the speed up was around 30x faster in production.
According to the case studies at WallStreetFPGA.com, FPGAs can also be used for
- pricing options with Monte Carlo simulations
- FIX trading
- speeding up open source software like QuantLib
If you want to hear more check out, the discussion with Wall Street FPGA at the VIShots podcast.
Where I Got More Information
When you are fighting for milliseconds, and all of a sudden a technology speeds up calculations by an order or two of magnitude, it’s hard to completely dismiss it as a fad. The problem is: (wait for it) coding these things is really time-consuming. You’re really getting down to the level of creating circuits in a chip, except you are doing it with code. In this situation, the weapon of choice historically has been VHDL or Verilog, although customized variants of C like SystemC are available to code them, for example at SCLive. There is apparently even an open source hardware movement, centered around opencores.org. Interestingly enough, FPGAs have been around for decades, but only recently have they been seriously considered an option in finance, in addition to other chip level approaches e.g. GPUs.
Personally, I’m interested in playing around with this in a Windows environment for the time being. If you have any specific recommendations on books or chips to buy please include them in the comments, particularly for someone coming at this from a Windows C++ background. So far, I took the plunge and bought FPGAs: Instant Access. It’s a good intro for an electrical engineer, so I am going to dig into Hardware-Software interfaces first. Interestingly enough, all of my low-level C++ started looking a lot easier to understand since I started researching FPGAs.