GPU vs CPU: Why are GPUs used to analyze financial data?



    An interesting and very extensive article by a German researcher on the use of GPU computing in economics and statistical physics, including for analyzing information on the stock market , was published in the European Physical Journal . We present to your attention the main points of this material.

    Note: The article in the magazine is dated 2011, since then new models of GPU devices have appeared, however, the general approaches to using this tool in the infrastructure for online trading have remained unchanged

    Requirements for computing power are growing in various fields. One of them is financial analysis, which is necessary for successful trading in the stock market, especially with HFT. In order to make a decision on the purchase or sale of shares, the algorithm must analyze a serious amount of input data - information about transactions and their parameters, current quotes and price trends, etc.

    The time that elapses from the creation of an application for a purchase or sale to the receipt of an answer about its successful completion from the exchange server is called a round trip (round-trip, RTT). Market participants are doing their best to reduce this time, in particular, they use direct access technologies to the exchange, and servers with trading software are located on a colocation next to the exchange trading engine.

    However, the technological possibilities for reducing the round trip are limited, and after they are exhausted, the question arises for traders about how else to speed up trading operations. For this, new approaches are being taken to build the infrastructure for online trading. In particular, FPGA and GPU are used. We wrote about the acceleration of HFT trading using “programmable hardware” earlier, today we will talk about how you can use GPUs for this.

    What is a GPU?


    The architecture of modern graphics cards is based on a scalable array of streaming multiprocessors. One such multiprocessor contains eight scalar processor cores, a multi-threaded instruction module, and a shared memory located on the chip (on-chip).

    When a C program using the CUDA extensions calls the GPU kernel, copies of that kernel or threads are numbered and distributed to available multiprocessors, where they are already running. For such numbering and distribution, the core network is divided into blocks, each of which is divided into different threads. Threads in such blocks are executed simultaneously on available multiprocessors. To control a large number of threads, the SIMT (single-instruction multiple-thread) module is used. This module groups them into "bundles" of 32 threads. Such groups are executed on the same multiprocessor.



    GPU financial data analysis


    In financial analysis, many measures and indicators are used, the calculation of which requires serious computing power. Below we list some of them and compare the processing speed shown by the “regular” processor Intel Core 2 Quad CPU (Q6700) with a clock frequency of 2.66 GHz and a cache size of 4096 kilobytes, as well as popular graphics cards.

    Exhibitor Hurst

    A measure called exponential Hurst is used in time series analysis. This value decreases if the delay between two identical pairs of values ​​in the time series increases. Initially, this concept was used in hydrology to determine the size of the dam on the Nile River in the conditions of unpredictable rains and droughts.

    Subsequently, the Hurst indicator began to be applied in the economy, in particular, in technical analysis to predict trends in the movement of price series. Below is a comparison of the performance of calculating the Hurst exponent on the CPU and GPU (acceleration rate β = total calculation time on the CPU / total calculation time on the GeForce 8800 GT GPU):



    Ising Model and Monte Carlo Method

    Another tool that migrated to the field of finance this time from physics is the Ising model . This mathematical model of statistical physics is designed to describe the magnetization of material.

    Each vertex of the crystal lattice (not only three-dimensional, but also one- and two-dimensional variations are considered) is associated with a number called the spin and equal to +1 or −1 (“field up” / “field down”). Each of the 2 ^ N possible spin arrangements (where N is the number of lattice atoms) is assigned an energy obtained from the pairwise interaction of the spins of neighboring atoms. Next, for a given temperature, the Gibbs distribution is considered - its behavior is considered for a large number of atoms N.

    In some models (for example, with dimension> 1), a second-order phase transition is observed. The temperature at which the magnetic properties of the material disappear is called critical ( Curie point ). In its vicinity, a number of thermodynamic characteristics diverge.

    Initially, the Ising model was used to understand the nature of ferromagnetism, but later became more widespread. In particular, it is used for generalizations in socio-economic systems. For example, a generalization of the Ising model determines the interaction of financial market participants. Each of them has a behavior strategy, the rationality of which can be limited. Decisions about whether to sell or buy shares and at what price depend on the person’s previous decisions and their outcome, as well as on the actions of other market participants.

    The Ising model is used to model the interaction between market participants. To implement the Ising model and simulation, the Monte Carlo method is used, which allows you to build a mathematical model for a project with undefined parameter values.

    The following is a comparison of the simulation performance on the CPU and GPU (NVIDIA GeForce GTX 280):



    There are implementations of the Ising model using various spins during the analysis. Multi-spin implementation allows you to load multiple spins in parallel.

    Multiple GPU Acceleration


    Clusters of GPU devices are also used to speed up data processing - in this case, researchers assembled a cluster of two Tesla C1060 GPU cards, the communication between which was carried out through the Double Data Rate InfiniBand.

    In the case of simulation of the Ising model by the Monte Carlo method, the results indicate that the performance increases almost linearly with the addition of more GPUs.



    Conclusion


    Experiments show that the use of graphics processors can lead to a substantial increase in the performance of financial analysis. At the same time, the speed gain compared to using an architecture with a CPU can reach several tens of times. At the same time, you can achieve even greater productivity gains by creating GPU clusters - in which case it grows almost linearly.

    Other materials about hardware and online trading:



    Also popular now: