Data processing method, data processing device, accelerator card and storage medium
By sending the first type of data in the pending data to the coprocessor of the accelerator and the second type of data to the accelerator processor, the data handling problem between the data processing device and the accelerator card is solved, and the data processing efficiency is improved .
Patent Information
- Application Number
- CN202110820131.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-20
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2041-07-20
AI Technical Summary
During data processing, when the application frequently calls the acceleration card for acceleration calculation, data is transferred back and forth between the acceleration card and the data processing device, reducing the data processing efficiency.
Data is avoided by sending the first type of data in the pending data to the coprocessor in the accelerator for processing, and sending the second type of data to be accelerated to the accelerator in the accelerator for acceleration calculations Back and forth between the accelerator card and the data processing device.
It effectively improves the data processing efficiency, reduces the workload of data processing equipment, and improves the overall throughput.
Smart Images

Figure CN113721990B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a data processing method, a data processing device, an acceleration card and a storage medium. Background Art
[0002] Common acceleration processors include graphics processors, field programmable gate array chips, tensor processors, neural network processors, etc. These acceleration processors can be integrated on the accelerator card of the data processing device. When the application in the data processing device needs to use hardware acceleration, the accelerator card can be called for accelerated calculation. In actual application scenarios, the processing flow of the application is relatively complex, and the accelerator card may be frequently called for accelerated calculation during the processing process; some algorithms that are not suitable for calling the accelerator card for acceleration can only be calculated using the processor in the data processing device, so that the data needs to be moved back and forth between the processor of the data processing device and the accelerator card, which greatly reduces the data processing efficiency.
[0003] Therefore, how to improve data processing efficiency has become an urgent problem to be solved. Summary of the invention
[0004] The present application provides a data processing method, a data processing device, an acceleration card and a storage medium. By sending the first type of data to be processed that was originally processed by the processor in the data processing device to the coprocessor in the acceleration card for processing, and sending the second type of data to be accelerated to the acceleration processor in the acceleration card for accelerated calculation, the problem of the need to transfer the data to be processed back and forth between the acceleration card and the data processing device when performing accelerated calculation is avoided, thereby effectively improving the data processing efficiency.
[0005] In a first aspect, the present application provides a data processing method, the method comprising:
[0006] Acquire data to be processed, where the data to be processed includes first-category data to be processed in the first category and second-category data to be processed in the second category;
[0007] Sending the data to be processed to an acceleration card, so that the coprocessor in the acceleration card performs a first type of processing on the first type of data, and the acceleration processor in the acceleration card performs a second type of processing on the second type of data, wherein the second type of processing includes accelerated computing;
[0008] A first processing result corresponding to the first category of data is obtained, and a second processing result corresponding to the second category of data is obtained.
[0009] In a second aspect, the present application also provides a data processing method, the method comprising:
[0010] Acquiring first-category data sent by a data processing device, and acquiring second-category data sent by the data processing device;
[0011] Calling a coprocessor in the acceleration card to perform a first type of processing on the first type of data, and calling an acceleration processor in the acceleration card to perform a second type of processing on the second type of data, wherein the second type of processing includes accelerated computing;
[0012] A first processing result corresponding to the first category of data and a second processing result corresponding to the second category of data are returned to the data processing device.
[0013] In a third aspect, the present application further provides a data processing device, the data processing device comprising a memory and a processor;
[0014] The memory is used to store computer programs;
[0015] The processor is used to execute the computer program and implement the data processing method corresponding to the above-mentioned data processing device when executing the computer program.
[0016] In a fourth aspect, the present application further provides an acceleration card, the acceleration card comprising a memory, an acceleration processor and a coprocessor;
[0017] The memory is used to store a computer program, wherein the memory is provided with a shared memory, and the shared memory is used to transfer data between the data processing device and the acceleration card;
[0018] The acceleration processor is used to perform accelerated calculation on the second type of data;
[0019] The processor is used to execute the computer program and implement the data processing method corresponding to the above-mentioned acceleration card when executing the computer program.
[0020] In a fifth aspect, the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor implements a data processing method corresponding to the above-mentioned data processing device or a data processing method corresponding to an acceleration card.
[0021] The present application discloses a data processing method, a data processing device, an acceleration card and a storage medium. By acquiring data to be processed, first-category data to be processed by the first category and second-category data to be processed by the second category can be obtained; by sending the data to be processed to the acceleration card, the first-category data in the data to be processed that is originally processed by the processor in the data processing device can be sent to the coprocessor in the acceleration card for the first category of processing, and the second-category data to be accelerated can be sent to the acceleration processor in the acceleration card for accelerated calculation, thereby avoiding the problem of the data to be processed needing to be transported back and forth between the acceleration card and the data processing device when performing accelerated calculation, and effectively improving the data processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0023] Figure 1 is a structural schematic diagram of a data processing device provided in an embodiment of the present application;
[0024] Figure 2 is a schematic diagram of the structure of an acceleration card provided in an embodiment of the present application;
[0025] Figure 3 is a schematic flow chart of a data processing method provided in an embodiment of the present application;
[0026] Figure 4 is a schematic interaction diagram of starting an operating system in a coprocessor provided in an embodiment of the present application;
[0027] Figure 5 is a schematic flow chart of sub-steps of sending data to be processed to an acceleration card provided in an embodiment of the present application;
[0028] Figure 6 is a schematic flow chart of another data processing method provided in an embodiment of the present application;
[0029] Figure 7 It is a schematic interaction diagram of instruction interaction between a software architecture and a data processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0031] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0032] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0033] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0034] The embodiment of the present application provides a data processing method, a data processing device, an acceleration card and a storage medium. The data processing method can be applied to the data processing device, and the first type of data to be processed, which is originally processed by the processor in the data processing device, is sent to the coprocessor in the acceleration card for processing, and the second type of data to be accelerated is sent to the acceleration processor in the acceleration card for accelerated calculation, thereby avoiding the need to transfer the data to be processed back and forth between the acceleration card and the data processing device when performing accelerated calculation, and effectively improving the data processing efficiency.
[0035] See also Figure 1 , Figure 1 Schematic diagram of a data processing device provided in an embodiment of the present application. Figure 1 As shown, the data processing device 10 may include a processor 11 and a memory 12, wherein the processor 11 and the memory 12 may be connected via a bus, such as an I2C (Inter-integrated Circuit) bus or any other suitable bus.
[0036] The memory 12 may include a non-volatile storage medium and an internal memory. The non-volatile storage medium may store an operating system and a computer program. The computer program includes program instructions, which, when executed, may enable the processor 11 to execute a data processing method corresponding to the data processing device 10.
[0037] The processor 11 is used to provide computing and control capabilities to support the operation of the entire data processing device 10 .
[0038] The processor 11 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0039] In one embodiment, the processor 11 is used to run a computer program stored in the memory 12, and implements the following steps when executing the computer program:
[0040] Acquire data to be processed, wherein the data to be processed includes first-category data to be subjected to first-category processing and second-category data to be subjected to second-category processing; send the data to be processed to an acceleration card, so that a coprocessor in the acceleration card performs first-category processing on the first-category data, and an acceleration processor in the acceleration card performs second-category processing on the second-category data, wherein the second-category processing includes accelerated calculation; obtain a first processing result corresponding to the first-category data, and obtain a second processing result corresponding to the second-category data.
[0041] In one embodiment, before sending the to-be-processed data to the accelerator card, the processor 11 is further configured to implement:
[0042] The acceleration card is controlled to start the operating system in the coprocessor.
[0043] In one embodiment, when the processor 11 sends the to-be-processed data to the accelerator card, it is configured to implement:
[0044] When the operating system is successfully started, a processing instruction corresponding to the first type of data is generated; the first type of data and the processing instruction are sent to the shared memory of the acceleration card, so that the software architecture in the operating system obtains the first type of data and the processing instruction from the shared memory; and the second type of data is sent to the acceleration processor.
[0045] In one embodiment, the processor 11 is used to implement the following when controlling the acceleration card to start the operating system in the coprocessor:
[0046] Obtain an operating system image file; send the operating system image file to the shared memory, and write the startup flag information of the operating system image file into the shared memory, so that when the coprocessor detects the startup flag information in the shared memory, it loads and runs the operating system image file from the shared memory, and the operating system image file is used to start the operating system and load the software architecture.
[0047] In one embodiment, after sending the operating system image file to the shared memory, the processor 11 is further configured to implement:
[0048] When an interrupt notification sent by the coprocessor is received, the shared memory is queried according to the interrupt notification whether startup completion information is stored, the interrupt notification and the startup completion information are generated after the software architecture is loaded, and the interrupt notification is used to notify the data processing device that the software architecture has been loaded; when the startup completion information is queried, it is determined that the operating system has been successfully started.
[0049] See also Figure 2 , Figure 2 Schematic diagram of the structure of an acceleration card provided in an embodiment of the present application. Figure 2 As shown, the acceleration card 20 may include a memory 21, an acceleration processor 22 and a coprocessor 23, wherein the memory 21, the acceleration processor 22 and the coprocessor 23 may be connected via a bus, such as an I2C (Inter-integrated Circuit) bus or any other suitable bus.
[0050] The memory 21 may include a non-volatile storage medium and an internal memory. The non-volatile storage medium may store an operating system and a computer program. The computer program includes program instructions, which, when executed, may enable the coprocessor 23 to execute a data processing method corresponding to the accelerator card 20.
[0051] Exemplarily, the memory 21 is provided with a shared memory, and the shared memory is used to transfer data between the data processing device 10 and the acceleration card 20 .
[0052] The coprocessor 23 is used to provide computing and control capabilities to support the operation of the entire acceleration card 20 .
[0053] The coprocessor 23 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) 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.
[0054] In one embodiment, the coprocessor 23 is used to run the computer program stored in the memory 21, and implements the following steps when executing the computer program:
[0055] Acquire first type of data sent by a data processing device, and acquire second type of data sent by the data processing device; call the coprocessor in the acceleration card to perform first type of processing on the first type of data, and call the acceleration processor in the acceleration card to perform second type of processing on the second type of data, wherein the second type of processing includes accelerated calculation; return a first processing result corresponding to the first type of data and a second processing result corresponding to the second type of data to the data processing device.
[0056] In one embodiment, when acquiring the first type of data sent by the data processing device, the coprocessor 23 is used to implement:
[0057] When the startup flag information in the shared memory is detected, the operating system image file sent by the data processing device is loaded and run from the shared memory, and the operating system image file is used to start the operating system and load the software architecture; if the software architecture is loaded, an interrupt notification and startup completion information are generated, and the startup completion information is written into the shared memory; the interrupt notification is sent to the data processing device, so that when the data processing device inquires that the shared memory contains the startup completion information, it is determined that the operating system is successfully started.
[0058] In one embodiment, the coprocessor 23 is installed with an operating system; when the coprocessor 23 obtains the first type of data sent by the data processing device, it is used to implement:
[0059] Call the software architecture in the operating system to detect whether there is a processing instruction in the shared memory of the acceleration card; when the processing instruction is detected, control the software architecture to obtain the first type of data stored in the shared memory; wherein the first type of data and the processing instruction are sent to the shared memory by the data processing device after determining that the operating system is successfully started.
[0060] In one embodiment, before the coprocessor in the acceleration card is called to perform the first type of processing on the first type of data, the coprocessor 23 is further used to implement:
[0061] The software framework is called to create and start a processing unit.
[0062] In one embodiment, when the coprocessor 23 calls the coprocessor in the acceleration card to perform the first type of processing on the first type of data, it is used to implement:
[0063] The first category of data and the processing instruction are sent to the processing unit, and the processing unit processes the first category of data according to the processing instruction, where the processing instruction includes at least one of address mapping, algorithm module loading, and algorithm execution.
[0064] See also Figure 3 , Figure 3 This is a schematic flow chart of a data processing method provided by an embodiment of the present application. The data processing method can be applied to a data processing device, and is implemented by sending the first type of data to be processed, which is originally processed by the processor in the data processing device, to the coprocessor in the acceleration card for processing, and sending the second type of data to be accelerated to the acceleration processor in the acceleration card for accelerated calculation, thereby avoiding the need to transfer the data to be processed back and forth between the acceleration card and the data processing device when performing accelerated calculation, and effectively improving the data processing efficiency.
[0065] Exemplarily, the data processing device may be a server or a terminal. The server may be an independent server or a server cluster. The terminal may be an electronic device such as a smart phone, a tablet computer, a laptop computer, or a desktop computer.
[0066] Some embodiments of the present application are described in detail below in conjunction with the accompanying drawings. The following embodiments and features of the embodiments may be combined with each other if there is no conflict. Figure 3 As shown, the data processing method includes steps S101 to S103.
[0067] Step S101: Acquire data to be processed, where the data to be processed includes first-category data to be processed in the first category and second-category data to be processed in the second category.
[0068] Exemplarily, the data to be processed may be data that needs to be processed by an application program in a data processing device, wherein the data to be processed may be stored in a local database or a local disk, or may be stored in an external storage device.
[0069] In an embodiment of the present application, the data processing device can divide the data to be processed into a first type of data and a second type of data. The first type of data is data that does not require accelerated computing, and the second type of data is data that requires accelerated computing. The first type of processing refers to conventional processing other than accelerated computing, such as address mapping, algorithm module loading, and algorithm execution; the second type of processing refers to accelerated computing.
[0070] It should be noted that the data processing method provided in the embodiment of the present application can be applied to heterogeneous computing scenarios. It is understandable that heterogeneous computing refers to parallel computing performed on heterogeneous computing systems. For example, when some specific algorithms in an application need to use hardware acceleration, an accelerator card can be called to accelerate the calculation of these specific algorithms to improve the data processing efficiency of the application and ensure the normal operation of the application.
[0071] It should be noted that, in the prior art, when performing heterogeneous computing, the first type of data in the data to be processed is generally processed by the processor in the data processing device, and the second type of data in the data to be processed is processed by calling the acceleration card, so there is a problem that the data to be processed needs to be transported back and forth between the acceleration card and the processor of the data processing device, which reduces the data processing efficiency. In the embodiment of the present application, by sending the first type of data in the data to be processed that was originally processed by the processor in the data processing device to the coprocessor in the acceleration card for processing, and sending the second type of data to be accelerated to the acceleration processor in the acceleration card for accelerated calculation, the problem of the data to be processed needing to be transported back and forth between the acceleration card and the data processing device when performing accelerated calculation is avoided, and the data processing efficiency is effectively improved.
[0072] Exemplarily, an accelerator card refers to a device specifically used to accelerate computing; wherein the accelerator card can be installed in a data processing device. In an embodiment of the present application, the accelerator card may include a coprocessor and an accelerator processor. wherein the coprocessor is used to process the first type of data originally processed by the processor in the data processing device; and the accelerator processor performs accelerated computing on the second type of data.
[0073] By acquiring the data to be processed, first-category data to be subjected to the first-category processing and second-category data to be subjected to the second-category processing can be obtained.
[0074] Step S102: sending the data to be processed to the acceleration card, so that the coprocessor in the acceleration card performs a first type of processing on the first type of data, and the acceleration processor in the acceleration card performs a second type of processing on the second type of data, wherein the second type of processing includes accelerated calculation.
[0075] Exemplarily, the data processing device can be communicatively connected with the acceleration card through a PCIE (Peripheral Component Interconnect Express, a high-speed serial computer expansion bus standard) bus based on an SDK (Software Development Kit) interface.
[0076] In some embodiments, before sending the data to be processed to the acceleration card, the data processing device may further include: controlling the acceleration card to start the operating system in the coprocessor. In the embodiment of the present application, in order to enable the coprocessor in the acceleration card to normally process the first type of data, it is necessary to start the operating system in the coprocessor.
[0077] See also Figure 4 , Figure 4 is a schematic interaction diagram of starting an operating system in a coprocessor provided by an embodiment of the present application. Figure 4 As shown, when the data processing device controls the acceleration card to start the operating system in the coprocessor, it can include: obtaining the operating system image file; then sending the operating system image file to the shared memory, and writing the startup flag information of the operating system image file to the shared memory, so that when the coprocessor detects the startup flag information in the shared memory, it loads and runs the operating system image file from the shared memory, and the operating system image file is used to start the operating system and load the software architecture.
[0078] It should be noted that the operating system image file is a compressed file used to install the operating system. Exemplarily, the data processing device can obtain a pre-packaged operating system image file; based on the SDK interface, send the operating system image file to the shared memory through the PCIE bus, and write the startup flag information of the operating system image file in the shared memory.
[0079] Exemplarily, the startup flag information of the operating system image file may be written into a fixed address of the shared memory.
[0080] The shared memory is a part of the storage space of the memory of the accelerator card. The shared memory is used to transfer data between the data processing device and the accelerator card to realize data sharing between the data processing device and the accelerator card. For example, the operating system image file, the first type of data, the second type of data, the processing instructions and the processing results can be transferred.
[0081] like Figure 4 As shown, when the coprocessor in the accelerator card detects the startup flag information in the shared memory, it can load and run the operating system image file from the shared memory. It should be noted that the coprocessor can be a multi-core processor. After power-on, the coprocessor runs the boot code and completes the basic configuration according to the boot code; then the coprocessor runs a loop detection program to detect whether there is startup flag information at a fixed address of the shared memory through a loop. When the coprocessor detects that there is startup flag information in the shared memory, it loads and runs the operating system image file from the shared memory. Among them, the operating system image file is used to start the operating system and load the software architecture.
[0082] For example, the coprocessor can run the operating system image file to start the operating system; after the operating system is started, the software architecture can be automatically loaded. The specific process of starting the operating system and loading the software architecture is not limited here.
[0083] It should be noted that in an embodiment of the present application, the operating system supports SMP (Symmetric Multiprocessing) mode, which can accelerate data in parallel. Among them, SMP mode means that an instance of an operating system can manage all CPU cores at the same time, and the application is not bound to a certain core. The software architecture can be a Framework software architecture, and Framework refers to a group of mutually cooperating classes that constitute a class of specific software reusable designs. In an embodiment of the present application, the Framework software architecture is used to interact with data processing devices for instructions. The data processing device can send multiple processing instructions to the Framework software architecture at the same time, thereby improving system performance.
[0084] By sending the operating system image file to the shared memory and writing the startup flag information of the operating system image file into the shared memory, the coprocessor can start the operating system and load the software architecture when detecting the startup flag information in the shared memory, so that the data processing device and the software architecture in the acceleration card can interact with each other through instructions, thereby enabling the acceleration card to perform joint operations on the data to be processed.
[0085] It should be noted that the joint operation refers to the coprocessor in the acceleration card processing the first type of data and the acceleration processor in the acceleration card performing accelerated calculation on the second type of data.
[0086] In some embodiments, after sending the operating system image file to the shared memory, it may also include: when an interrupt notification sent by the coprocessor is received, querying whether the shared memory stores startup completion information according to the interrupt notification, the interrupt notification and the startup completion information are generated after the software architecture is loaded, and the interrupt notification is used to notify the data processing device that the software architecture has been loaded; when the startup completion information is queried, it is determined that the operating system has been successfully started.
[0087] For example, Figure 4 As shown, after the coprocessor in the acceleration card loads the software architecture, the coprocessor can generate a startup completion message and an interrupt notification; then, the startup completion message is written into the shared memory, and the interrupt notification is sent to the data processing device through the PCIE bus.
[0088] Exemplarily, the interrupt notification may be an MSI (Message Signaled Interrupt) notification. It should be noted that the MSI notification refers to triggering a CPU interrupt by writing a specific message to a specific address.
[0089] In an embodiment of the present application, the MSI notification is used to trigger the data processing device to read the processing result from the shared memory. For example, after the data processing device controls the accelerator card to start the operating system in the coprocessor, the coprocessor can trigger the data processing device to read the startup result of the operating system from the shared memory through the MSI notification. For another example, after the data processing device sends the processing instruction to the shared memory and the software architecture performs the corresponding data processing according to the processing instruction, the software architecture can trigger the data processing device to read the processing result from the shared memory through the MSI notification.
[0090] Exemplarily, when receiving an interrupt notification sent by the coprocessor, the data processing device may query whether the shared memory stores startup completion information according to the interrupt notification; if the startup completion information is found, it may be determined that the operating system is successfully started.
[0091] In an embodiment of the present application, after determining that the operating system in the coprocessor is successfully started, the data processing device may send the data to be processed to the acceleration card.
[0092] See also Figure 5 , Figure 5 It is a schematic flowchart of the sub-steps of sending the data to be processed to the acceleration card provided in an embodiment of the present application, which may specifically include the following steps S1021 to S1023.
[0093] Step S1021: After the operating system is successfully started, a processing instruction corresponding to the first type of data is generated.
[0094] Exemplarily, when the operating system is successfully started, the data processing device may generate a processing instruction corresponding to the first type of data, wherein the processing instruction is used to control the software architecture in the accelerator card to process the first type of data.
[0095] Step S1022: Send the first category data and the processing instructions to the shared memory of the acceleration card, so that the software architecture in the operating system obtains the first category data and the processing instructions from the shared memory.
[0096] Exemplarily, the first type of data and processing instructions can be sent to the shared memory of the accelerator card through the PCIE bus based on the SDK interface, so that the software architecture in the operating system can obtain the first type of data and processing instructions from the shared memory.
[0097] It should be noted that the software architecture can cyclically detect whether there is a processing instruction in the shared memory. When a processing instruction is detected, data processing can be performed on the first type of data according to the processing instruction to obtain a corresponding first processing result.
[0098] By sending the first type of data and processing instructions to the shared memory of the accelerator card, the software architecture can process the first type of data according to the processing instructions, so that the data processing device only needs to control the processing flow without processing the first type of data, thereby reducing the workload of the data processing device and improving the overall throughput of the data processing device.
[0099] Step S1023: Send the second type of data to the acceleration processor.
[0100] Exemplarily, the second type of data may be directly sent to an acceleration processor in the acceleration card, so that the acceleration processor performs accelerated processing on the second type of data to obtain a corresponding second processing result.
[0101] Exemplarily, the second type of data can also be sent to the shared memory in the acceleration card, and an acceleration processing mark can be added to the second type of data; when the acceleration processor detects the acceleration processing mark, the second type of data can be read from the shared memory and the second type of data can be accelerated. It should be noted that the acceleration processing mark is used to distinguish the second type of data from the first type of data so that the acceleration processor can correctly read the second type of data from the shared memory. The specific form of the acceleration processing mark is not limited here.
[0102] By sending the second type of data to the acceleration processor for accelerated computing, the coprocessor in the acceleration card and the acceleration processor can jointly calculate the data to be processed, avoiding the need to transfer the data to be processed back and forth between the acceleration card and the data processing device when performing accelerated computing, thereby effectively improving data processing efficiency.
[0103] Step S103: Obtain a first processing result corresponding to the first category of data, and obtain a second processing result corresponding to the second category of data.
[0104] Exemplarily, the data processing device may read the first processing result corresponding to the first category of data from the shared memory according to the MSI notification sent by the software architecture. It should be noted that after the software architecture processes the first category of data according to the processing instruction, it may write the obtained first processing result into the shared memory, and trigger the data processing device to read the first processing result from the shared memory through the MSI notification.
[0105] Exemplarily, the data processing device may receive the second processing result sent by the acceleration processor. Of course, the second processing result may also be read through the shared memory. It should be noted that the acceleration processor may write the second processing result into the shared memory and send an MSI notification to the data processing device, and the data processing device may read the second processing result in the shared memory according to the MSI notification.
[0106] The data processing method provided in the above embodiment can obtain the first type of data to be processed by the first type and the second type of data to be processed by the second type by acquiring the data to be processed; by sending the operating system image file to the shared memory and writing the startup flag information of the operating system image file into the shared memory, the coprocessor can start the operating system and load the software architecture when detecting the startup flag information in the shared memory, so that the data processing device and the software architecture in the acceleration card can interact with each other through instructions, thereby realizing the acceleration card to perform joint operations on the data to be processed; by sending the first type of data and the processing instructions to the shared memory of the acceleration card, the software architecture can process the first type of data according to the processing instructions, so that the data processing device only needs to control the processing flow without processing the first type of data, thereby reducing the workload of the data processing device and thereby improving the overall throughput of the data processing device; by sending the second type of data to the acceleration processor for accelerated calculation, the coprocessor in the acceleration card and the acceleration processor can perform joint operations on the data to be processed, thereby avoiding the need to transfer the data to be processed back and forth between the acceleration card and the data processing device when performing accelerated calculation, thereby effectively improving the data processing efficiency.
[0107] See also Figure 6 , Figure 6This is a schematic flow chart of another data processing method provided by an embodiment of the present application. The data processing method can be applied to an accelerator card, by calling the coprocessor in the accelerator card to process the first type of data originally processed by the processor in the data processing device, and calling the acceleration processor in the accelerator card to perform accelerated calculation on the second type of data, thereby avoiding the problem of needing to transfer data back and forth between the accelerator card and the data processing device when performing accelerated calculation on the data, and effectively improving the data processing efficiency.
[0108] like Figure 6 As shown, the data processing method includes steps S201 to S203.
[0109] Step S201: Acquire first-category data sent by a data processing device, and acquire second-category data sent by the data processing device.
[0110] Exemplarily, the accelerator card may obtain first-category data sent by a data processing device, and obtain second-category data sent by the data processing device.
[0111] It should be noted that the coprocessor in the accelerator card is installed with an operating system, and the operating system is loaded with a software framework, wherein the software framework is used to perform instruction interaction with the data processing device.
[0112] Exemplarily, the instruction interaction between the software architecture and the data processing device can be implemented based on a ring queue. It should be noted that the ring queue is a first-in, first-out data structure connected end to end, which is used for network data reception and transmission and data exchange between different programs. Among them, the ring queue may include a receiving queue and a sending queue. In the embodiment of the application itself, the data processing device can write processing instructions to the receiving queue, and the software architecture reads the processing instructions in the receiving queue and executes them; after executing the processing instructions, the software architecture writes the processing results to the sending queue, and the data processing device reads the processing results from the sending queue.
[0113] In some embodiments, before obtaining the first type of data sent by the data processing device, it may also include: when the startup flag information in the shared memory is detected, loading and running the operating system image file sent by the data processing device from the shared memory, the operating system image file is used to start the operating system and load the software architecture; if the software architecture is loaded, an interrupt notification and startup completion information are generated, and the startup completion information is written to the shared memory; an interrupt notification is sent to the data processing device, so that when the data processing device queries the shared memory for the existence of the startup completion information, it is determined that the operating system has been successfully started.
[0114] Exemplarily, the software architecture can detect whether there is startup flag information in the shared memory in a loop; when the startup flag information is detected in the shared memory, the operating system image file is loaded and run from the shared memory, thereby starting the operating system and loading the software architecture.
[0115] Exemplarily, the interrupt notification and the startup completion information may be generated by the software architecture.
[0116] It should be noted that by sending an interrupt notification to a data processing device, the data processing device can determine that the operating system has been successfully started when it queries the shared memory for startup completion information; and then, after determining that the operating system has been successfully started, the first type of data and the processing instructions corresponding to the first type of data can be written to the shared memory.
[0117] In some embodiments, obtaining the first type of data sent by the data processing device may include: calling the software architecture in the operating system to detect whether there is a processing instruction in the shared memory of the accelerator card; when the processing instruction is detected, controlling the software architecture to obtain the first type of data stored in the shared memory. The first type of data and the processing instruction are sent to the shared memory by the data processing device after determining that the operating system is successfully started.
[0118] It should be noted that when sending the first type of data, the data processing device can generate a processing instruction corresponding to the first type of data, and send the processing instruction and the first type of data to the shared memory in the accelerator card. The processing instruction is used to control the software architecture in the accelerator card to process the first type of data.
[0119] See also Figure 7 , Figure 7 Schematic diagram of the interaction between a software architecture and a data processing device for performing instruction interaction provided by an embodiment of the present application. Figure 7 As shown, the data processing device can send the processing instructions corresponding to the first type of data to the shared memory. The software architecture can cyclically detect whether there are processing instructions in the shared memory; when the processing instructions are detected, the software architecture obtains the first type of data stored in the shared memory. The processing instructions may include but are not limited to instructions such as algorithm module loading, address mapping, and algorithm execution.
[0120] By acquiring the first type of data sent by the data processing device and acquiring the second type of data sent by the data processing device, the acceleration card can subsequently perform a joint operation on the first type of data and the second type of data.
[0121] Step S202: calling the coprocessor in the acceleration card to perform a first type of processing on the first type of data, and calling the acceleration processor in the acceleration card to perform a second type of processing on the second type of data, where the second type of processing includes accelerated calculation.
[0122] Exemplarily, the accelerator card can call the coprocessor in the accelerator card to perform the first type of processing on the first type of data, and call the acceleration processor in the accelerator card to perform the second type of processing on the second type of data, wherein the second type of processing includes accelerated computing. The specific process of accelerated computing is not limited here.
[0123] By calling the coprocessor to process the first type of data originally processed by the processor in the data processing device, and calling the acceleration processor to accelerate the calculation of the second type of data, the problem of needing to move data back and forth between the acceleration card and the data processing device when accelerating the calculation is avoided, thereby effectively improving the data processing efficiency.
[0124] In some embodiments, before calling the coprocessor in the acceleration card to perform the first type of processing on the first type of data, the method may also include: calling the software architecture to create and start the processing unit.
[0125] Exemplarily, the coprocessor can actively call the software architecture to create and start the processing unit; the coprocessor can also call the software architecture to create and start the processing unit according to the request of the data processing device. For example, after determining that the operating system in the coprocessor has been successfully started, the data processing device can generate a processing unit creation instruction and write the processing unit creation instruction to the shared memory. When the software architecture detects the processing unit creation instruction in the shared memory, it can create and start the processing unit according to the processing unit creation instruction.
[0126] Exemplarily, the software architecture can create and start a preset number of processing units. The number of processing units can be set according to actual conditions, and the specific value is not limited here. For example, the software architecture can adjust the number of processing units according to the amount of data of the first category.
[0127] It should be noted that the processing units can be independently scheduled and executed concurrently by the operating system; the software architecture can also set the priority of the processing unit and whether the processing unit has CPU affinity.
[0128] The processing unit is created and started by calling the software architecture, and the processing unit can be called subsequently to process the first type of data according to the processing instructions.
[0129] In some embodiments, calling a coprocessor in an acceleration card to perform a first type of processing on a first type of data may include: sending the first type of data and a processing instruction to a processing unit, and the processing unit processing the first type of data according to the processing instruction, wherein the processing instruction includes at least one of address mapping, algorithm module loading, and algorithm execution.
[0130] In the implementation of this application, the software architecture has functions such as algorithm module loading, address mapping instructions and algorithm execution, which can be implemented by the processing unit.
[0131] It should be noted that algorithm module loading refers to loading the algorithm module into the processing unit; the algorithm in the processing unit can be determined by the user-defined algorithm module; the processing unit can load multiple different algorithm libraries as needed. Among them, the algorithm library can be a data processing device that automatically extracts the code file running on the coprocessor through the extended compiler keyword, and cross-compiles the code file to generate; the algorithm library can also be a code file running on the coprocessor created by the data processing device separately, and the code file is cross-compiled separately. Address mapping refers to mapping the physical address where the data is located to the address space of the running unit, so that the data can be processed by the processing unit. Algorithm execution means that after the algorithm library is loaded into the processing unit, it can be remotely called by the data processing device in the form of a function call, and the algorithm library can be called by passing in the function name and parameters. In addition, the software architecture can also perform system configuration operations such as log attribute setting, log information extraction, time synchronization between the data processing device and the coprocessor, and coprocessor reset.
[0132] Exemplarily, the software architecture may send the first category of data and the processing instructions to the processing unit, and the processing unit processes the first category of data according to the processing instructions.
[0133] For example, if the processing instruction is algorithm execution, the processing unit performs the algorithm execution operation on the first type of data to obtain a first processing result.
[0134] For another example, if the processing instruction is address mapping and algorithm execution, the processing unit performs an address mapping operation and an algorithm execution operation on the first type of data to obtain a first processing result.
[0135] By sending the first category of data and the processing instructions to the processing unit, the processing unit can process the first category of data in a targeted manner according to the processing instructions, thereby improving the efficiency of data processing.
[0136] Step S203: Return the first processing result corresponding to the first category of data and the second processing result corresponding to the second category of data to the data processing device.
[0137] For example, Figure 7 As shown, after the software architecture calls the processing unit to process the first type of data according to the processing instruction, it can also write the corresponding first processing result into the shared memory, and trigger the data processing device to read the first processing result from the shared memory through the MSI notification.
[0138] For example, the software architecture may write the first processing result into a sending queue, and the data processing device may read the first processing result from the sending queue.
[0139] By writing the first processing result corresponding to the first type of data into the shared memory and triggering the data processing device to read the first processing result from the shared memory through the MSI notification, the data processing device can read the first processing result in a timely manner.
[0140] Exemplarily, after calling the acceleration processor to perform the second type of processing on the second type of data, the acceleration card can send the obtained second processing result directly to the data processing device; or it can write the second processing result to the shared memory and send an MSI notification to the data processing device, and the data processing device can read the second processing result from the shared memory according to the MSI notification.
[0141] The data processing method provided in the above embodiment can obtain the first type of data sent by the data processing device and obtain the second type of data sent by the data processing device, and then realize the joint operation of the first type of data and the second type of data by the acceleration card; by calling the coprocessor to process the first type of data originally processed by the processor in the data processing device, and calling the acceleration processor to accelerate the calculation of the second type of data, it is avoided that the data needs to be transferred back and forth between the acceleration card and the data processing device when accelerating the calculation, and the data processing efficiency is effectively improved; by sending the first type of data and the processing instruction to the processing unit, the processing unit can process the first type of data in a targeted manner according to the processing instruction, thereby improving the data processing efficiency; by writing the first processing result corresponding to the first type of data into the shared memory and triggering the data processing device to read the first processing result from the shared memory through an interrupt notification, the data processing device can read the first processing result in a timely manner.
[0142] A computer-readable storage medium is also provided in an embodiment of the present application, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement a data processing method corresponding to the data processing device provided in an embodiment of the present application or a data processing method corresponding to the acceleration card.
[0143] For example, the computer program is loaded by a processor and may execute the following steps:
[0144] Acquire data to be processed, wherein the data to be processed includes first-category data to be subjected to first-category processing and second-category data to be subjected to second-category processing; send the data to be processed to an acceleration card, so that a coprocessor in the acceleration card performs first-category processing on the first-category data, and an acceleration processor in the acceleration card performs second-category processing on the second-category data, wherein the second-category processing includes accelerated calculation; obtain a first processing result corresponding to the first-category data, and obtain a second processing result corresponding to the second-category data.
[0145] For another example, the computer program is loaded by the processor and may execute the following steps:
[0146] Acquire first type of data sent by a data processing device, and acquire second type of data sent by the data processing device; call the coprocessor in the acceleration card to perform first type of processing on the first type of data, and call the acceleration processor in the acceleration card to perform second type of processing on the second type of data, wherein the second type of processing includes accelerated calculation; return a first processing result corresponding to the first type of data and a second processing result corresponding to the second type of data to the data processing device.
[0147] The computer-readable storage medium may be an internal storage unit of the data processing device described in the foregoing embodiments, such as a hard disk or memory of the data processing device. The computer-readable storage medium may also be an external storage device of the data processing device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital card (Secure Digital Card, SD Card), a flash card (FlashCard), etc., equipped on the data processing device.
[0148] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0149] In hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a storable medium, and the storage medium may include a computer storage medium (or a non-temporary medium) and a communication medium (or a temporary medium). As known to those of ordinary skill in the art, the term storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0150] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A data processing method, characterized in that: A processor applied to a data processing device, the processor being capable of processing data that does not require accelerated computing, the data processing device being equipped with an accelerator card, the data processing device being communicatively connected to the accelerator card via a high-speed serial computer expansion bus standard, the data processing method comprising: Acquire data to be processed, wherein the data to be processed includes first-category data to be processed by a first type of processing and second-category data to be processed by a second type of processing; the first-category data is data that does not require accelerated computing, and the second-category data is data that requires accelerated computing; Sending the data to be processed to the acceleration card, so that the coprocessor in the acceleration card performs a first type of processing on the first type of data, and the acceleration processor in the acceleration card performs a second type of processing on the second type of data, wherein the second type of processing includes accelerated computing; A first processing result corresponding to the first category of data is obtained, and a second processing result corresponding to the second category of data is obtained.
2. The data processing method according to claim 1, characterized in that: Before sending the data to be processed to the acceleration card, the method further includes: Controlling the acceleration card to start the operating system in the coprocessor; The sending the to-be-processed data to the acceleration card comprises: When the operating system is successfully started, generating a processing instruction corresponding to the first type of data; Sending the first type of data and the processing instruction to the shared memory of the acceleration card, so that the software architecture in the operating system obtains the first type of data and the processing instruction from the shared memory; The second type of data is sent to the acceleration processor.
3. The data processing method according to claim 2, characterized in that: The controlling the acceleration card to start the operating system in the coprocessor includes: Get the operating system image file; The operating system image file is sent to the shared memory, and the startup flag information of the operating system image file is written into the shared memory, so that when the coprocessor detects the startup flag information in the shared memory, it loads and runs the operating system image file from the shared memory, and the operating system image file is used to start the operating system and load the software architecture.
4. The data processing method according to claim 3, characterized in that: After sending the operating system image file to the shared memory, the method further includes: When receiving an interrupt notification sent by the coprocessor, querying whether the shared memory stores startup completion information according to the interrupt notification, the interrupt notification and the startup completion information are generated after the software architecture is loaded, and the interrupt notification is used to notify the data processing device that the software architecture has been loaded; When the startup completion information is queried, it is determined that the operating system is successfully started.
5. A data processing method, characterized in that: Applied to an accelerator card, the accelerator card is installed in a data processing device, the data processing device includes a processor capable of processing data that does not require accelerated calculation, the data processing device is connected to the accelerator card through a high-speed serial computer expansion bus standard, and the data processing method includes: Acquiring first-category data sent by the data processing device, and acquiring second-category data sent by the data processing device; Calling the coprocessor in the acceleration card to perform a first type of processing on the first type of data, and calling the acceleration processor in the acceleration card to perform a second type of processing on the second type of data, wherein the second type of processing includes accelerated calculation; the first type of data is data that does not require accelerated calculation, and the second type of data is data that requires accelerated calculation; A first processing result corresponding to the first category of data and a second processing result corresponding to the second category of data are returned to the data processing device.
6. The data processing method according to claim 5, characterized in that: The acceleration card also includes a shared memory; before obtaining the first type of data sent by the data processing device, it also includes: When the startup flag information in the shared memory is detected, the operating system image file sent by the data processing device is loaded and run from the shared memory, wherein the operating system image file is used to start the operating system and load the software architecture; If the software architecture is loaded, an interrupt notification and startup completion information are generated, and the startup completion information is written into the shared memory; The interrupt notification is sent to the data processing device, so that when the data processing device finds that the startup completion information exists in the shared memory, it is determined that the operating system is successfully started.
7. The data processing method according to claim 5, characterized in that: The coprocessor is installed with an operating system; the obtaining of the first type of data sent by the data processing device comprises: Calling the software architecture in the operating system to detect whether there is a processing instruction in the shared memory of the accelerator card; When the processing instruction is detected, controlling the software architecture to obtain the first type of data stored in the shared memory; The first type of data and the processing instructions are sent to the shared memory by the data processing device after determining that the operating system is successfully started.
8. The data processing method according to claim 7, characterized in that: Before calling the coprocessor in the acceleration card to perform the first type of processing on the first type of data, the method further includes: The software framework is called to create and start a processing unit.
9. The data processing method according to claim 8, characterized in that: The calling of the coprocessor in the acceleration card to perform the first type of processing on the first type of data includes: The first category of data and the processing instruction are sent to the processing unit, and the processing unit processes the first category of data according to the processing instruction, where the processing instruction includes at least one of address mapping, algorithm module loading, and algorithm execution.
10. A data processing device, characterized in that: The data processing device includes a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the data processing method according to any one of claims 1 to 4 when executing the computer program.
11. An accelerator card, characterized in that: The acceleration card includes a memory, an acceleration processor and a coprocessor; The memory is used to store a computer program, wherein the memory is provided with a shared memory, and the shared memory is used to transfer data between the data processing device and the acceleration card; The acceleration processor is used to perform accelerated calculation on the second type of data; The coprocessor is used to execute the computer program and implement the data processing method according to any one of claims 5 to 9 when executing the computer program.
12. A computer-readable storage medium, characterized in that: The computer readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor is enabled to implement: The data processing method according to any one of claims 1 to 4; or A data processing method as claimed in any one of claims 5 to 9.
Citation Information
Patent Citations
Multimedia device with error detection function while boot time and method thereof
CN104375920A
Operating system loading method and device
CN106155730A
Hardware acceleration method, compiler, and device
CN106325967A
Service operation method and device based on accelerator card, electronic equipment and storage medium
CN112598565A
Code compiling method and device, electronic equipment, storage medium and heterogeneous system
CN113031954A
