📜 ⬆️ ⬇️

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



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

Note: The article in the journal 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 funds. 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 quotations and price change trends, etc.

The time from the creation of an order to buy or sell to receive a response on its successful execution from the exchange server is called round-trip (RTT). Market participants do their best to reduce this time; in particular, direct access to the exchange is used for this, and servers with trading software are located on a colocation next to the trading engine of the exchanges.

However, the technological capabilities to reduce the round-trip are limited, and after they are exhausted, traders are faced with the question of how to accelerate trading operations. To do this, apply new approaches to building infrastructure for online trading. In particular, FPGA and GPU are used. About the acceleration of HFT trading using the "programmable hardware" we wrote earlier, today we will discuss how to do this, you can use graphics processors.

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 on-chip shared memory.

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



Analysis of financial data on the GPU


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

Exhibitor Hurst

The measure, called the Hurst exponential, is used in the analysis of time series. This value decreases if the delay between two identical pairs of values ​​in a time series increases. Initially, this concept was used in hydrology to determine the size of a dam on the Nile River in 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 speed of calculation of the Hurst index on the CPU and GPU (“acceleration” indicator β = total computing time on the CPU / total computing time on the GeForce 8800 GT GPU):



Ising model and Monte Carlo method

Another tool that moved into the sphere of finance, this time from physics, is the Ising model . This mathematical model of statistical physics is intended to describe the magnetization of the material.

Each vertex of the crystal lattice (not only three-dimensional but also one- and two-dimensional variations are considered) is assigned a number, called a spin, 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 attributed to the energy resulting from the pairwise interaction of the spins of neighboring atoms. Next, for a given temperature, the Gibbs distribution is considered — its behavior is considered with a large number of atoms N.

In some models (for example, with dimensions> 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 widely used. 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 may be limited. Decisions about whether to sell or buy stocks and at what price depend on previous decisions of a person and their result, as well as on the actions of other market participants.

The Ising model is used to model interactions 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.

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



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

Acceleration with multiple GPUs


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

In the case of a Monte Carlo simulation of the Ising model, the results show 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. In this case, the gain in speed compared to using the architecture with the CPU can reach several dozen times. At the same time, it is possible to achieve even greater performance improvement by creating clusters of GPUs - in this case, it grows almost linearly.

Other materials about hardware and online trading:


Source: https://habr.com/ru/post/276943/


All Articles