K line calculation method based on DPU, DPU, equipment and storage medium
Through DPU-based software and hardware collaborative design, the problem of improving the K-line computing speed in the existing technology is solved, and efficient and flexible K-line computing is realized to adapt to different application scenarios.
Patent Information
- Application Number
- CN202510250926.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-04
- Publication Date
- 2025-06-03
AI Technical Summary
The existing technology has problems such as long R&D cycle, lack of universality and difficulty in adapting to different application scenarios in terms of improving K-line computing speed.
Through DPU-based software and hardware collaborative design, the SDK interface is called to obtain and convert configuration information and market data, and issuanced to the DPU for K-line calculations, achieving hardware acceleration and avoiding additional hardware upgrades.
It improves the K-line calculation speed, has strong adaptability and high flexibility, reduces hardware overhead and resource consumption, and ensures the accuracy of calculation results.
Smart Images

Figure CN120088070A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a K-line calculation method based on DPU, a DPU, a device, and a storage medium. Background Art
[0002] K-line (Kline) calculation refers to using a K-line chart to analyze and display the price changes of products such as stocks and futures in the financial market. A K-line chart is a chart that records market price changes and shows the opening price, highest price, lowest price, and closing price in the form of a bar chart to help investors understand market fluctuations and trends. Due to the complexity of Kline calculation, its calculation speed has always been a challenge.
[0003] Existing technologies mainly improve the calculation speed by improving algorithms or upgrading hardware configurations, such as parallel processing, increasing the main frequency of the processor, or using dedicated hardware accelerators. However, the research and development cycle of existing solutions is relatively long, especially at the hardware level, where design, verification, and production require a lot of time. At the same time, these technologies often lack generality and are difficult to adapt to different application scenarios. Summary of the Invention
[0004] To solve the above technical problems or at least partially solve the above technical problems, this application provides a K-line calculation method based on DPU, a DPU, a device, and a storage medium, which improves the K-line calculation speed through a software-hardware collaboration method, has strong scene adaptability and high flexibility.
[0005] To achieve the above object, the technical solutions provided by the embodiments of this application are as follows:
[0006] In a first aspect, this application provides a K-line calculation method based on DPU, and the method includes: calling an SDK interface to obtain and convert configuration information and market data; calling a software-hardware interaction interface to send the converted configuration information and market data to the DPU so that the DPU performs K-line calculation on the market data based on the configuration information to obtain a K-line result; calling a software-hardware interaction interface to obtain the K-line result.
[0007] As an optional implementation manner in the embodiments of this application, the SDK interface includes a configuration interface and a first service interface; calling the SDK interface to obtain and convert configuration information and market data includes: enabling a first thread through a first process to perform a read operation on the configuration information; calling the configuration interface to convert the configuration information into corresponding structure data; enabling a second thread through a second process to perform a data format conversion operation to convert the market data into corresponding structure data; calling the first service interface to convert the structure data corresponding to the market data into a corresponding hardware protocol.
[0008] As an alternative implementation in the embodiments of the present application, the software-hardware interaction interface includes a register interface and a distribution interface; invoking the software-hardware interaction interface to send the converted configuration information and market data to the DPU includes: invoking the register interface to send the structure data corresponding to the configuration information to the DPU; invoking the distribution interface to send the hardware protocol corresponding to the market data to the DPU.
[0009] As an alternative implementation in the embodiments of the present application, the SDK interface further includes a second service interface; after invoking the software-hardware interaction interface to obtain the K-line result, the method further includes: enabling a third thread through a third process to perform a data format conversion operation to convert the K-line result into corresponding format data; polling the second service interface to parse the format data corresponding to the K-line result and convert the parsed format data corresponding to the K-line result into corresponding structure data.
[0010] As an alternative implementation in the embodiments of the present application, the method further includes: obtaining the DPU status information through the software-hardware interaction interface; enabling a fourth thread through a fourth process to perform a data format conversion operation to convert the DPU status information into corresponding format data; polling the second service interface to parse the format data corresponding to the DPU status information and convert the parsed format data corresponding to the DPU status information into corresponding structure data.
[0011] As an alternative implementation in the embodiments of the present application, the SDK interface further includes a pointer interface and an initialization interface; before invoking the SDK interface to obtain and convert the configuration information and market data, the method further includes: obtaining the pointer interface to invoke the SDK interface; destroying the pointer interface to release the memory space occupied by the pointer interface; invoking the initialization interface to initialize the internal variables of the SDK.
[0012] As an alternative implementation in the embodiments of the present application, the configuration information includes: K-line calculation period, K-line calculation target, and large order threshold; the market data includes: tick-by-tick market data and sliced market data; the K-line result includes: standard K-line result and large order K-line result.
[0013] In a second aspect, the present application provides a DPU, which includes:
[0014] A receiving module, configured to poll and receive configuration information and market data;
[0015] A calculation module, configured to allocate resource space according to the configuration information, perform K-line calculation based on the market data to obtain a K-line result, and transmit the K-line result to the reporting module;
[0016] A reporting module, configured to upload the K-line result to the CPU side.
[0017] In a third aspect, the present application provides an electronic device, including: a processor, a memory, and a computer program stored on the memory and executable on the processor, where when the computer program is executed by the processor, it implements the DPU-based K-line calculation method as described in the first aspect or any optional implementation manner thereof.
[0018] In a fourth aspect, the present application provides a computer-readable storage medium, including: a computer program stored on the computer-readable storage medium, where when the computer program is executed by a processor, it implements the DPU-based K-line calculation method as described in the first aspect or any optional implementation manner thereof.
[0019] In a fifth aspect, the present application provides a computer program product, including: the computer program product includes a computer program, and when the computer program runs on a computer, it causes the computer to implement the DPU-based K-line calculation method as described in the first aspect or any optional implementation manner thereof.
[0020] The technical solution provided by the embodiments of the present application has the following advantages compared with the prior art:
[0021] The present application provides a DPU-based K-line calculation method, DPU, device, and storage medium. The method first calls the SDK interface to obtain conversion configuration information and market data; calls the software and hardware interaction interface to send the converted configuration information and market data to the DPU, so that the DPU performs K-line calculation on the market data based on the configuration information to obtain a K-line result; calls the software and hardware interaction interface to obtain the K-line result.
[0022] In this way, through the combination of the SDK interface and the software and hardware co-design of the DPU, the present application can adapt to different application scenarios, has high flexibility, and relies on the DPU to perform hardware acceleration on K-line calculation, avoiding additional hardware upgrades, thereby reducing unnecessary hardware overhead and resource consumption. High-efficiency data transmission with low latency is achieved through the software and hardware interaction interface, which is beneficial to improving the K-line calculation speed, thereby shortening the calculation time, improving the calculation efficiency and system stability while ensuring the accuracy of the K-line calculation result. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The drawings here are incorporated into the description and form a part of this description, showing embodiments consistent with the present application and used together with the description to explain the principles of the present application.
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.
[0025] Figure 1 It is a schematic flowchart of a K-line calculation method based on DPU provided by an embodiment of the present application;
[0026] Figure 2 It is a schematic diagram of calling the SDK interface provided by an embodiment of the present application;
[0027] Figure 3 It is a schematic architecture diagram of an SDK interface provided by an embodiment of the present application;
[0028] Figure 4 It is a schematic structure diagram of a DPU provided by an embodiment of the present application;
[0029] Figure 5 It is a schematic architecture diagram of an adaptation layer provided by an embodiment of the present application;
[0030] Figure 6 It is a schematic diagram of a software and hardware collaborative architecture provided by an embodiment of the present application;
[0031] Figure 7 It is a schematic structure diagram of an electronic device described in an embodiment of the present application. Detailed implementation manners
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the technical terms required in the description of the embodiments or the prior art:
[0033] DPU is the abbreviation of "Data Processing Unit". It is widely used in the field of information technology, especially in scenarios that require high-speed data processing and calculation. The DPU has powerful network processing capabilities as well as security, storage, and network offloading functions, and can release the computing power of the Central Processing Unit (CPU) to complete tasks such as data encryption and decryption, and data compression that the CPU is not good at. The DPU is also responsible for processing tasks that "the CPU can't do well and the GPU can't do", achieving cost reduction and efficiency improvement in the data center. The emergence of the DPU offloads the operations of the infrastructure from the CPU to the DPU, realizing the combination of software definition and hardware acceleration in aspects such as security, communication, storage, and virtualization, and releasing the computing resources of the CPU to better support the needs of applications.
[0034] SDK is the abbreviation of Software Development Kit, which means "Software Development Kit". It is a combination of a series of files, including library files (lib, dll), header files (.h), documentation, sample code, etc. It is a collection of relevant documents, examples, and tools for assisting in the development of a certain type of software. The role of the SDK is to provide software engineers with the tools and interfaces required to create application software, and to promote the creation of application programs.
[0035] JavaScript Object Notation (JSON) is a lightweight data interchange format. It is designed based on a subset of ECMAScript and uses a text format that is completely independent of programming languages to represent data. JSON is easy for humans to read and write, and is also convenient for machines to parse and generate. Data in JSON format organizes data through key-value pairs. The key is a string, and the value can be a string, number, boolean, array, object, or null. The basic structure of JSON includes objects and arrays. An object is an unordered collection of name / value pairs, and an array is an ordered collection of values.
[0036] The tree structure is a hierarchical data organization method, in which data elements are organized in the form of nodes. Each node can have zero or more child nodes, forming a directed acyclic graph.
[0037] Application Programming Interface (API) is a set of predefined functions, aiming to provide the ability for application programs and developers to access a set of routines based on a certain software or hardware, without the need to access the source code or understand the details of the internal working mechanism.
[0038] Existing technologies mainly improve the speed of K-line calculation by improving algorithms or upgrading hardware configurations. These improvements include: (1) Algorithm improvement: optimizing algorithm complexity or using more efficient implementation methods, such as parallel processing, etc. (2) Hardware design optimization: increasing the processor clock frequency or using dedicated hardware accelerators, etc. And the above two improvements usually lead to an increase in calculation accuracy, system cost, or power consumption, especially at the hardware level, where design, verification, and production require a lot of time. At the same time, these technologies often lack generality and are difficult to adapt to different application scenarios.
[0039] To solve some or all of the technical problems existing in the related art, an embodiment of the present application provides a K-line calculation method based on DPU, a DPU, a device, and a storage medium. The method first calls the SDK interface to obtain conversion configuration information and market data; calls the software and hardware interaction interface to send the converted configuration information and market data to the DPU, so that the DPU performs K-line calculation on the market data based on the configuration information to obtain a K-line result; calls the software and hardware interaction interface to obtain the K-line result.
[0040] In this way, through the combination of the SDK interface and the software and hardware co-design of the DPU in this application, it can adapt to different application scenarios, with high flexibility, and rely on the DPU to perform hardware acceleration on K-line calculation, avoiding additional hardware upgrades, thereby reducing unnecessary hardware overhead and resource consumption. Through the software and hardware interaction interface, low-latency and efficient data transmission is achieved, which is beneficial to improving the K-line calculation speed, thereby shortening the calculation time, improving the calculation efficiency and system stability while ensuring the accuracy of the K-line calculation result.
[0041] In order to be able to more clearly understand the above objects, features, and advantages of the present application, the solution of the present application will be further described below. It should be noted that, without conflict, the embodiments of the present application and the features in the embodiments can be combined with each other.
[0042] Many specific details are set forth in the following description in order to fully understand the present application, but the present application can also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only a part of the embodiments of the present application, rather than all of the embodiments.
[0043] A K-line calculation method based on DPU provided in an embodiment of the present application can be implemented through a K-line calculation device or an electronic device based on DPU. The electronic device includes, but is not limited to, a server, a personal computer, a laptop computer, a tablet computer, a smart phone, etc. The operating system of the electronic device can include Android, iOS developed by Apple Inc., Windows developed by Microsoft Corporation in the United States, etc., and the embodiments of the present application do not limit this. The electronic device can run alone to implement the present application, or can be connected to the network and implement the present application through interaction with other computer devices in the network. Among them, the network where the electronic device is located includes, but is not limited to, the Internet, a wide area network, a metropolitan area network, a local area network, a Virtual Private Network (VPN) network, etc.
[0044] It should be noted that the protection scope of the K-line calculation method based on DPU described in the embodiments of the present application is not limited to the execution order of the steps listed in this embodiment. Any solution achieved by adding or reducing steps of the prior art and replacing steps according to the principle of the present application is included in the protection scope of the present application.
[0045] As Figure 1 shown, Figure 1 FIG. is a schematic flow chart of a K-line calculation method based on DPU provided by an embodiment of the present application. The method mainly includes the following steps S101 to S103:
[0046] S101. Call the SDK interface to obtain and convert configuration information and market data.
[0047] In the present application, the SDK interface is a packaged interface defined based on the K-line algorithm.
[0048] The configuration information includes the K-line calculation period, the K-line calculation target, and the large order threshold. The K-line calculation target is the opening price, closing price, highest price, and lowest price of the K-line calculation. The large order threshold refers to a certain quantity limit set in stock trading to determine whether a transaction belongs to a large order transaction. The setting of the large order threshold refers to the parameter setting for monitoring and screening block trades or large orders in stock trading. By adjusting the large order threshold, it can help investors better grasp the market trend. Reasonably setting the large order threshold can help investors better formulate trading strategies and conduct risk control.
[0049] The market data is the most basic and important part of the trading process, which records all transactions and related events in the financial market. The market data includes tick-by-tick market data and sliced market data. The tick-by-tick market data (Tick market data) records every transaction data in the market, including new orders, new trades, order cancellations, etc. This kind of data is the most detailed and complete, and can reflect every detail of the market; the sliced market data, also known as snapshot market data, is the data obtained by slicing and statistically analyzing the Tick market data at a specific time point, such as the market data snapshot every 3 seconds or every 500 milliseconds, which includes information such as the highest price, lowest price, and trading volume within that time period.
[0050] In some embodiments, the SDK interface includes a configuration interface and a first service interface. The configuration interface is used to convert the configuration information into corresponding structure data; the first service interface is used to convert the market data into corresponding hardware protocols; specifically, convert the structure data corresponding to the sliced market data into the hardware protocol corresponding to the sliced market data, and convert the structure data corresponding to the tick-by-tick market data into the hardware protocol corresponding to the tick-by-tick market data. The structure can be a tree structure.
[0051] Based on the above embodiments, step S101 (invoking the SDK interface to obtain and convert configuration information and market data) may include the following steps S1011 to S1014:
[0052] S1011. Enable the first thread through the first process to perform the read operation of the configuration information;
[0053] Read the configuration information through the first thread enabled by the first process: K-line calculation period, K-line calculation target, and large order threshold.
[0054] S1012. Invoke the configuration interface to convert the configuration information into corresponding structure data;
[0055] Optionally, the configuration interface includes: K-line calculation period interface and large order threshold interface. Invoke the K-line calculation period interface to convert the K-line calculation period into corresponding structure data; invoke the large order threshold interface to convert the K-line calculation target and large order threshold into corresponding structure data respectively. Accelerate the search by converting the configuration information.
[0056] As Figure 2 shown, Figure 2 is a schematic diagram of invoking the SDK interface provided by the embodiment of the present application. The first thread (main thread) is enabled through the first process (thread 1) to read the configuration information, and then the configuration interface is invoked to convert the configuration information into corresponding structure data.
[0057] S1013. Enable the second thread through the second process to perform the data format conversion operation to convert the market data into corresponding structure data;
[0058] The second thread is used to convert the market data in json format into corresponding structure data.
[0059] S1014. Invoke the first service interface to convert the structure data corresponding to the market data into the corresponding hardware protocol.
[0060] The first service interface is the sdk api, which is used to convert the structure data corresponding to the market data into the corresponding hardware protocol.
[0061] As Figure 2 shown, the second thread (processing sending thread) is enabled through the second process (such as process 2) to convert the sliced market data into corresponding structure data, and then the first service interface sdk api is invoked to convert the structure data corresponding to the sliced market data into the corresponding hardware protocol; at the same time, the second thread (processing sending thread) can be enabled through the second process (such as process 4) to convert the tick-by-tick market data into corresponding structure data, and then the first service interface sdk api is invoked to convert the structure data corresponding to the tick-by-tick market data into the corresponding hardware protocol.
[0062] In the above embodiments, the acquisition and conversion of configuration information and market data are realized through multi-threaded concurrency, which is beneficial to improving the efficiency of K-line calculation.
[0063] It can be understood that the first service interface converts the structure data corresponding to the market data into an instruction, which is used to instruct the DPU to perform K-line calculation.
[0064] The first service interface includes a sliced market data conversion interface (send_snapshot) and a tick-by-tick market data conversion interface (send_tick). Calling send_snapshot converts the sliced market data into an instruction, and calling send_tick converts the tick-by-tick market data into an instruction.
[0065] Such as Figure 3 shown, Figure 3 is a schematic diagram of the architecture of an SDK interface provided by an embodiment of the present application. Calling send_snapshot and send_tick respectively processes the sliced market data and the tick-by-tick market data, converts them into instructions, and then transmits them to the software and hardware interaction interface (ndpp sdk communication encapsulation interface) to be sent to the DPU.
[0066] In some embodiments, the SDK also includes a pointer interface, a version number interface, an initialization interface, a log reporting interface, etc. Among them, the pointer interface is used to construct a C++ class pointer to use the SDK interface; the version number interface is used to display the SDK version number information; the initialization interface is used to initialize the internal variables of the SDK; the log reporting interface is used to configure the pointer according to the callback interface function of the logger (LOGGER) defined by the SDK, so that the internal log of the SDK can be written to disk through the user log after the user is compromised.
[0067] Based on the above embodiments, before performing step S101 (calling the SDK interface to obtain and convert configuration information and market data), the method provided by the embodiment of the present application further includes: obtaining the pointer interface to call the SDK interface; destroying the pointer interface to release the memory space occupied by the pointer interface; calling the initialization interface to initialize the internal variables of the SDK interface.
[0068] Specifically, obtain the SDK pointer interface, construct a C++ class pointer to call the SDK service interface, and then destroy the SDK pointer interface to destruct the memory occupied by the SDK pointer interface to avoid memory leakage. Furthermore, initialize the internal variables of the SDK service interface. The internal variables of the SDK service interface include: functions, classes, methods, etc.; functions are used to provide specific function implementations, such as data processing, server operations, etc. Classes are used to define the behaviors and attributes of objects to help developers create and manage data. Methods are used to define the operations that objects can perform, such as uploading, resume from breakpoint, etc.
[0069] In the above embodiments, after destroying the SDK pointer interface and before initializing the internal variables of the SDK service interface, it further includes obtaining a version number interface to display the SDK version number information, which is used to represent the release time of the SDK service interface, as well as the new functions, fixed vulnerabilities, and supported operating systems or platforms of this version, so that developers can clearly know whether the current SDK version meets the development requirements.
[0070] S102. Call the software and hardware interaction interface to send the converted configuration information and market data to the DPU, so that the DPU calculates the K-line results based on the configuration information for the market data.
[0071] In the embodiments of the present application, the software and hardware interaction interface is an efficient data interaction interface based on an ultra-low latency computing platform (Nano-latency Data Processing Platform, NDPP), including a register interface and a sending interface. The register interface is used to send the structure data corresponding to the configuration information; the sending interface is used to send the hardware protocol corresponding to the market data.
[0072] In the embodiments of the present application, the DPU can be a DPU board based on the architecture of a domain-specific core processor (KPU). The KPU improves the computing efficiency through a software-defined architecture, has high flexibility and configuration capabilities, and can cover the computing modes of the entire application field. The structure and functions of each module of the DPU will be described later and will not be elaborated here.
[0073] The K-line results include standard K-line results and large order K-line results. The standard K-line result refers to a chart drawn based on the opening price, highest price, lowest price, and closing price of each trading day. The standard K-line result includes an upper shadow line, a lower shadow line, and an entity. The upper shadow line represents the resistance encountered when the price rises, the lower shadow line represents the support encountered when the price falls, and the entity part represents the range of price changes; the large order K-line refers to a K-line chart drawn through large order trading data.
[0074] In some embodiments, step S102 includes the following steps S1021 and S1022:
[0075] S1021. Call the register interface to send the structure data corresponding to the configuration information to the DPU.
[0076] As Figure 2 shown, after process 1 calls the configuration interface to convert the configuration information into the corresponding structure data, it calls the register interface (such as the ndpp register interface) to send the structure data corresponding to the configuration information to the DPU.
[0077] S1022. Call the distribution interface to distribute the hardware protocol corresponding to the market data to the DPU.
[0078] As Figure 2 shown, after Process 2 calls the first service interface sdk api to convert the structure data corresponding to the sliced market data into the corresponding hardware protocol, it calls the distribution interface (ndpp distribution interface) to distribute the hardware protocol corresponding to the sliced market data to the DPU; after Process 4 calls the first service interface sdk api to convert the structure data corresponding to the tick-by-tick market data into the corresponding hardware protocol, it calls the distribution interface (ndpp distribution interface) to distribute the hardware protocol corresponding to the tick-by-tick market data to the DPU.
[0079] S103. Call the software and hardware interaction interface to obtain the K-line result.
[0080] The software and hardware interaction interface also includes a receiving interface (ndpp receiving interface). Call the receiving interface to obtain the K-line result uploaded by the DPU.
[0081] In some embodiments, the SDK interface includes a second service interface, sdk result api, which is used to convert the K-line result calculated by the DPU into the corresponding structure data.
[0082] The second service interface sdk result api includes a standard K-line result receiving interface kline_rev and a large order K-line result receiving interface big_kline_rev. As Figure 3 shown, after calling the software and hardware interaction interface to obtain the K-line result uploaded by the DPU, first convert the K-line result into json format, and then call kline_rev to parse and convert the standard K-line result in json format to obtain the structure data corresponding to the standard K-line result, and call big_kline_rev to parse and convert the large order K-line result in json format to obtain the structure data corresponding to the large order K-line result.
[0083] After step S103, the following steps S104 - S105 are also included:
[0084] S104. Enable the third thread through the third process to execute the data format conversion operation to convert the K-line result into the corresponding format data;
[0085] Convert the K-line result uploaded by the DPU into json format.
[0086] S105. Poll the second service interface to parse the format data corresponding to the K-line result and convert the parsed format data corresponding to the K-line result into the corresponding structure data.
[0087] Different types of K-line results apply different processes. Exemplarily, as Figure 2 shown, the third thread (processing receipt thread) is enabled through the third process (Process 3) to perform a data format conversion operation to convert the standard K-line result into the corresponding json data, and then poll the second service interface sdk result api to parse the json data corresponding to the standard K-line result and convert it into a structure data. The third thread (processing receipt thread) is enabled through the third process (Process 5) to perform a data format conversion operation to convert the large order K-line result into the corresponding json data, and then poll the second service interface sdkresult api to parse the json data corresponding to the large order K-line result and convert it into a structure data.
[0088] In some embodiments, the method provided by the embodiments of the present application further includes the following steps S201 to S203:
[0089] S201. Obtain DPU status information through the software and hardware interaction interface;
[0090] The software and hardware interaction interface includes a DPU status query interface. Step S201 is specifically to obtain DPU status information through the DPU status query interface. The DPU status information includes any one of the following indications: the DPU is in the master control state, the DPU is in the tracking state, the DPU is in the initialization state, and the DPU is in the fault state.
[0091] S202. Enable the fourth thread through the fourth process to perform a data format conversion operation to convert the DPU status information into the corresponding format data;
[0092] S203. Poll the second service interface to parse the format data corresponding to the DPU status information and convert the parsed format data corresponding to the DPU status information into the corresponding structure data.
[0093] As Figure 2 shown, obtain DPU status information through the software and hardware interaction interface, enable the fourth thread (processing receipt thread) through the fourth process (Process 6), convert the DPU status information into the corresponding format data, then poll the second service interface sdk result api, parse the format data corresponding to the DPU status information, and convert it into the corresponding structure data.
[0094] The above embodiments obtain the status information of the DPU board by calling the software and hardware interaction interface to clarify the current state of the DPU, which is beneficial to the normal and orderly progress of K-line calculation.
[0095] In summary, the embodiment of the present application provides a K-line calculation method based on DPU. First, the SDK interface is called to obtain the conversion configuration information and market data; the software and hardware interaction interface is called to send the converted configuration information and market data to the DPU, so that the DPU calculates the K-line based on the configuration information for the market data to obtain the K-line result; the software and hardware interaction interface is called to obtain the K-line result.
[0096] In this way, through the combination of the SDK interface and the software and hardware co-design of the DPU in the present application, it can adapt to different application scenarios, with high flexibility, and rely on the DPU to perform hardware acceleration on K-line calculation, avoiding additional hardware upgrades, thereby reducing unnecessary hardware overhead and resource consumption. The low-latency and efficient data transmission is achieved through the software and hardware interaction interface, which is beneficial to improving the K-line calculation speed, thereby shortening the calculation time, improving the calculation efficiency and system stability while ensuring the accuracy of the K-line calculation result.
[0097] The above description is for the CPU side that implements the K-line calculation method based on DPU, and the specific K-line calculation is executed by the DPU. As Figure 4 shown, Figure 4 FIG. is a schematic structural diagram of a DPU provided by an embodiment of the present application. The DPU includes:
[0098] A receiving module 401, configured to poll and receive configuration information and market data;
[0099] A calculation module 402, configured to allocate resource space according to the configuration information, calculate the K-line based on the market data to obtain the K-line result, and transmit the K-line result to the reporting module;
[0100] A reporting module 403, configured to upload the K-line result to the CPU side.
[0101] It should be noted that the CPU side and the DPU side need to be docked through an adaptation layer. The adaptation layer is responsible for transmitting market data between the CPU side and the DPU side, collecting the initialization information of the DPU, and calling the SDK interface to send the configuration information and market data.
[0102] As Figure 5 shown, Figure 5 FIG. is a schematic architecture diagram of the adaptation layer provided by an embodiment of the present application. In the adaptation layer (KlineAdapter), the consumer provides sliced market data and tick-by-tick market data, and the protocol layer (protocol) ensures the effective data exchange and functional collaboration between the consumer and the producer for the sliced market data and tick-by-tick market data. The adaptation layer further includes a service management module, which is used to manage logs, configuration information, large order thresholds, initialization information, and K-line calculation cycles, etc. The hierarchical design of the SDK interface and the Kline Adapter facilitates developers to use and perform secondary development.
[0103] Based on the above embodiments, as Figure 6 shown, Figure 6 This is a schematic diagram of the software and hardware collaborative architecture provided by the embodiments of this application. The communication layer is used to establish a communication link between consumers and producers. The interface layer is used to obtain slice market data and tick-by-tick market data, and upload K-line results. The conversion layer is used to convert slice market data, tick-by-tick market data, and K-line results. The component layer includes log management, device management, performance statistics, configuration management, receiving module, clock calibration, and sending module. The platform layer includes NDPP SDK, drivers, and Direct Memory Access (DMA). The hardware layer is a DPU, including a receiving module, a computing module, and a reporting module.
[0104] Among them, the platform layer is used for software and hardware coordination. The NDPP SDK is used to implement low-latency zero-copy (kernel bypass) of the data reported by the DPU to the CPU memory, and perform low-latency data exchange. The application driver enables the Linux kernel to recognize the DPU and provides standard kernel functions.
[0105] In one embodiment, this application provides an electronic device, which can be a terminal, and its internal structure diagram can be as Figure 7 shown. The electronic device includes: a processor 701, a memory 702, and a computer program stored on the memory 702 and executable on the processor 701. When the computer program is executed by the processor 701, it implements each process of the DPU-based K-line calculation method in the above method embodiments. And it can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0106] Those skilled in the art can understand that Figure 7 the structure shown in
[0107] is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the electronic device to which the solution of this application is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0108] Among them, the computer-readable storage medium can be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disc, etc.
[0109] An embodiment of the present application provides a computer program product. The computer program product stores a computer program. When the computer program is executed by a processor, it implements each process of the structural safety intelligent monitoring method for the multi-stage construction process of a building in the above method embodiment, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0110] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.
[0111] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions, and operations of devices, methods, and computer program products according to multiple embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code. A module, a program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order from that marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, as well as the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0112] In the present application, the processor may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor, or the processor may also be any conventional processor, etc.
[0113] In this application, the memory may include non-permanent memory in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory such as read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0114] In this application, the computer-readable medium includes permanent and non-permanent, removable and non-removable storage media. The storage media can implement information storage by any method or technology, and the information can be computer-readable instructions, data structures, program modules, or other data. Examples of the computer's storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information accessible by a computing device. As defined herein, the computer-readable medium does not include transitory computer-readable media, such as modulated data signals and carrier waves.
[0115] It should be noted that in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.
[0116] The above are only specific embodiments of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application will not be limited to these embodiments herein, but rather to the broadest scope consistent with the principles and novel features disclosed herein.
Claims
1. A K-line calculation method based on DPU, characterized in that: Applied to the CPU side, including: Call the SDK interface to obtain and convert configuration information and market data; Calling the software and hardware interaction interface to send the converted configuration information and the market data to the DPU, so that the DPU performs K-line calculation on the market data based on the configuration information to obtain a K-line result; The software and hardware interaction interface is called to obtain the K-line result.
2. The method according to claim 1, characterized in that The SDK interface includes a configuration interface and a first service interface; The calling of the SDK interface to obtain and convert configuration information and market data includes: Enable the first thread through the first process to execute the reading operation of the configuration information; Calling the configuration interface to convert the configuration information into corresponding structure data; Initiate a second thread through a second process to perform a data format conversion operation to convert the market data into corresponding structure data; The first business interface is called to convert the structure data corresponding to the market data into the corresponding hardware protocol.
3. The method according to claim 2, characterized in that The software and hardware interaction interface includes a register interface and a sending interface; The calling of the software and hardware interaction interface to send the converted configuration information and the market data to the DPU includes: Calling the register interface to send the structure data corresponding to the configuration information to the DPU; The sending interface is called to send the hardware protocol corresponding to the market data to the DPU.
4. The method according to claim 2, characterized in that: The SDK interface also includes a second service interface; After calling the software and hardware interaction interface to obtain the K-line result, the method further includes: Initiate a third thread through a third process to perform a data format conversion operation to convert the K-line result into corresponding format data; The second business interface is polled to parse the format data corresponding to the K-line result, and the parsed format data corresponding to the K-line result is converted into corresponding structure data.
5. The method according to claim 4, characterized in that The method further comprises: Acquire DPU status information through the software and hardware interaction interface; Initiate a fourth thread through a fourth process to perform a data format conversion operation to convert the DPU state information into corresponding format data; The second service interface is polled to parse the format data corresponding to the DPU status information, and the format data corresponding to the parsed DPU status information is converted into corresponding structure data.
6. The method according to claim 1, characterized in that The SDK interface also includes a pointer interface and an initialization interface; Before calling the SDK interface to obtain and convert configuration information and market data, the method further includes: Obtain the pointer interface to call the SDK interface; Destroying the pointer interface to release the memory space occupied by the pointer interface; Call the initialization interface to initialize the internal variables of the SDK.
7. The method according to claim 1, characterized in that The configuration information includes: K-line calculation period, K-line calculation target and large order threshold; The market data includes: transaction-by-transaction market data and slice market data; The K-line results include: standard K-line results and large order K-line results.
8. A DPU, characterized in that: include: Receiving module, used for polling and receiving configuration information and market data; A calculation module, used to allocate resource space according to the configuration information, perform K-line calculation according to the market data to obtain K-line results, and transmit the K-line results to a reporting module; The reporting module is used to upload the K-line results to the CPU end.
9. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the DPU-based K-line calculation method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: include: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the DPU-based K-line calculation method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Data processing method and device
CN115099978A
Market snapshot data calculation method and device, electronic equipment and storage medium
CN115222538A
Data processing method and device, equipment, storage medium and program product
CN116579858A
Acceleration method and device for reading column storage file based on data processing unit
CN117573699A