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

  1. pricing options with Monte Carlo simulations
  2. FIX trading
  3. 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.

About these ads
Comments
4 Responses to “FPGAs: The software in the hardware”
  1. Reblogged this on Carpet Bomberz Inc. and commented:
    Great posting by Lucas Szyrmer @ softwaretrading.co.uk, it’s a nice summary of the story from a few months ago about JP Morgan Chase’s use of FPGAs to speed up some of their analysis for risk.

  2. OxUUUU says:

    Hi, while you mention miliseconds, for fix and hft the scale drops just to few microseconds. The exact value depends on the depth of the book and the number of products that you are interested in. Moreover, significant portion of this time is consumed by communication that delivers data to fpga and to host computer. There are cases that time spent in fpga is just 1/8 of total time.

    If you are interested in fpgas you should definitively have a look on “FPGA prototyping by examples” by Pong P. Chu and get yourself starter kit – if you like hands on approach.

  3. Mitch says:

    This is the 4th blog, of your blog I actually read.
    Nonetheless I like this one, “FPGAs: The software in the hardware �
    Software Trading” the very best. Regards -Mitch

Trackbacks
Check out what others are saying...
  1. […] FPGA is able to achieve this because it reorganizes calculations. FPGAs work on a massively parallel basis, and by using FPGAs, you don’t compete with your OS or applications and don’t have any protocol stack communication delays. […]



What do you think? Leave a comment.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 849 other followers