Acceleration method and device based on data parallelism and task parallelism and storage medium
By adopting transmission optimization, task parallelism and data parallelism in heterogeneous computing, the performance bottleneck problem in large-scale data processing is solved, efficient execution of heterogeneous computing is achieved, and the throughput and performance of the overall task are improved.
Patent Information
- Application Number
- CN202410603882.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-15
- Publication Date
- 2024-08-30
AI Technical Summary
Existing heterogeneous computing performance optimization methods have performance bottlenecks in large-scale data processing, resulting in insufficient improvement in overall task throughput performance. This is mainly due to the time interval and underutilization of resources caused by the serial execution of data transmission and computing processes.
Adopting a comprehensive method of transmission optimization, task parallelism and data parallelism, overlapping pre-processing and data transmission through pipelines, splitting tasks into sub-tasks for parallel execution, and evenly distributing sub-tasks to multiple hardware processing cores, using memory address mapping And large page memory technology optimizes data transmission to achieve asynchronous execution and full utilization of resources.
By overlapping the time-consuming calculation and data transmission, delay is hidden, the overall task execution efficiency is improved, hardware resources are fully utilized, IO-intensive is converted into computing-intensive, and the throughput and performance of the overall task are greatly improved.
Smart Images

Figure CN118567803A
Abstract
Description
Technical Field
[0001] The present application relates to the field of parallel computing technology, for example, to an acceleration method, device and storage medium based on data parallelism and task parallelism. Background Art
[0002] With the rapid development of artificial intelligence technology and the slowdown of Moore's Law, the importance of accelerators in specific fields has become increasingly prominent. Heterogeneous computing, as a way to efficiently utilize different computing resources, has become a key technology to meet the needs of efficient computing and improve application performance. However, existing heterogeneous computing performance optimization methods often need to be combined with specific task scenarios to fully realize their performance potential.
[0003] In this context, we need to deeply understand the characteristics and advantages of different heterogeneous platforms, and flexibly select appropriate computing architectures and algorithm strategies based on specific application requirements. Through refined tuning and customized design, heterogeneous computing can maximize its potential and provide users with more efficient and stable computing services.
[0004] like Figure 1 As shown in the figure, when performing heterogeneous computing, the preprocessing stage is first performed to obtain data to the main memory, such as reading data from a database or disk to the memory; the data transmission stage is then performed, and the data is moved from the memory to the device memory by means of DMA technology; after all the data is moved to the device memory, the computing core is started to perform a computing process; after the computing core completes a calculation, it notifies the main control CPU in the form of an event, and the main control CPU starts to transfer data from the device memory to the host memory after receiving the signal; finally, the CPU processes the acquired memory data, such as writing to the disk or writing to the database. The above stages are basically serial execution processes, and there is a certain time interval between each stage (the length of the time interval depends on the actual start time of the next task), and the time consumption of each stage depends on the actual situation (for example, in the field of image and video analysis, the time consumption of data transmission is negligible compared with the time consumption of calculation, but in the field of large-scale data calculation, the time consumption of data transmission may be equivalent to the time consumption of calculation). Relying solely on the performance improvement of the accelerator computing part, the overall task throughput performance improvement is not obvious enough.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0006] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.
[0007] The embodiments of the present disclosure provide an acceleration method, device and storage medium based on data parallelism and task parallelism, which aims to solve the performance bottleneck problem encountered in large-scale data parallel computing by comprehensively adopting technical means such as transmission optimization, task parallelism and data parallelism.
[0008] In some embodiments, the method comprises:
[0009] Transmission optimization: Use pipeline method to overlap preprocessing and data transmission;
[0010] Task parallelism: Split a single computing task into multiple subtasks, and run each subtask in parallel on different kernel functions. After each subtask is completed, merge the overall task to ensure the integrity of the single task.
[0011] Data parallelism: According to the number of processing cores in the hardware architecture, the subtasks issued at a time are evenly divided and executed on each hardware processing core to fully utilize the computing resources of the hardware.
[0012] Optionally, the pipeline overlapping preprocessing and data transmission in the transmission optimization are implemented in an asynchronous execution mode to hide related delays.
[0013] Optionally, during the transmission optimization process, when data is transmitted from the host side to the device side and from the device side to the host side, the related data transmission time is optimized through host side and device side memory address mapping technology and large page memory technology.
[0014] Optionally, the host-side and device-side memory address mapping technology is to simultaneously apply for host memory corresponding to the device memory when applying for device memory, and establish a mapping relationship to reduce performance loss caused by memory mapping and search.
[0015] Optionally, the large page memory technology is to adjust the page table size of the host memory from the default 4KB of the operating system to 2MB to reduce the number of page tables and further improve data transmission efficiency.
[0016] Optionally, the task parallelism is implemented by instantiating multiple kernel functions, each subtask runs in parallel on a different kernel function, and barrier technology is used to achieve synchronization between tasks, waiting for the completion of the execution of the previous layer of tasks before merging.
[0017] Optionally, the data parallelism is to evenly divide the subtasks issued at a time onto a hardware accelerator having multiple processing cores to achieve parallel processing of data.
[0018] In some embodiments, the device includes a processor and a memory storing program instructions, and the processor is configured to execute the aforementioned acceleration method based on data parallelism and task parallelism when running the program instructions.
[0019] In some embodiments, the device uses the aforementioned acceleration method based on data parallelism and task parallelism, and the acceleration device includes a host side device, a device side device, a data transmission module and a computing module, wherein the data transmission module is responsible for realizing data transmission between the host side device and the device side device, and the computing module is responsible for executing computing tasks on the device side device and optimizing performance by adopting data parallelism and task parallelism.
[0020] In some embodiments, the storage medium stores program instructions, and when the program instructions are run, they execute the aforementioned acceleration method based on data parallelism and task parallelism.
[0021] The acceleration method, device and storage medium based on data parallelism and task parallelism provided in the embodiments of the present disclosure can achieve the following technical effects:
[0022] This disclosure achieves the following technical effects and advantages by comprehensively adopting methods such as transmission optimization, task parallelism and data parallelism:
[0023] 1. Overlapping computing and data transmission time: By overlapping preprocessing and data transmission in a pipeline manner, the related delays are hidden and the overall task execution efficiency is improved.
[0024] 2. Make full use of hardware resources: Through task parallelism and data parallelism strategies, tasks are split into subtasks and assigned to different hardware processing cores for execution, making full use of the hardware's computing resources.
[0025] 3. Improve overall task throughput and performance: The method disclosed in the present invention transforms the overall task from IO-intensive to compute-intensive, greatly improving the overall task throughput and performance.
[0026] The above general description and the following description are exemplary and explanatory only and are not intended to limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] One or more embodiments are exemplarily described by corresponding drawings, which do not limit the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements, and the drawings do not constitute a scale limitation, and wherein:
[0028] Figure 1 It is a schematic diagram of the overall process of heterogeneous computing in the prior art;
[0029] Figure 2 It is a schematic diagram of a pipeline heterogeneous computing process provided by an embodiment of the present disclosure;
[0030] Figure 3 It is a schematic diagram of task splitting and task parallelism provided by an embodiment of the present disclosure;
[0031] Figure 4 It is a schematic diagram of an acceleration device based on data parallelism and task parallelism provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0032] In order to be able to understand the features and technical contents of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present disclosure. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.
[0033] The terms "first", "second", etc. in the embodiments of the present disclosure are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so as to describe the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.
[0034] Unless otherwise stated, the term "plurality" means two or more.
[0035] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.
[0036] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.
[0037] The term "correspondence" may refer to an association relationship or a binding relationship. The correspondence between A and B means that there is an association relationship or a binding relationship between A and B.
[0038] Combination Figure 2 , 3As shown, the present disclosure proposes a performance optimization method based on data parallelism and task parallelism, which aims to solve the performance bottleneck problem encountered in large-scale data parallel computing by comprehensively adopting technical means such as transmission optimization, task parallelism and data parallelism.
[0039] 1. Transmission optimization
[0040] In order to reduce the performance loss caused by data transmission between the host and the device, this disclosure adopts the following optimization measures:
[0041] Overlap preprocessing and data transmission in a pipeline manner: By splitting the task into subtasks and executing them asynchronously, the related links use a soft pipeline method to overlap the related calculation and transmission processes to hide the related delays.
[0042] Memory address mapping technology: When applying for device memory, simultaneously apply for the host memory corresponding to the device memory and establish a mapping relationship to reduce the performance loss caused by memory mapping and search.
[0043] Large page memory technology: The page table size of the host memory is adjusted from the operating system's default 4KB to 2MB to reduce the number of page tables and further improve data transmission efficiency.
[0044] 2. Task Parallelism
[0045] In order to fully utilize hardware computing resources, this paper adopts the following strategies to achieve task parallelism:
[0046] Task splitting: Split each task into multiple subtasks. During execution, each subtask will run in parallel on different kernel functions.
[0047] Task merging: After each subtask is completed, the overall task is merged to ensure the integrity of the single task. The synchronization between tasks is achieved through barrier technology, and the merging is performed after the execution of the previous layer of tasks is completed.
[0048] 3. Data Parallelism
[0049] For hardware architectures with a large number of processing cores, this disclosure adopts the following data parallel strategy:
[0050] Even data distribution: Evenly distribute the subtasks issued at a time to each hardware processing core to achieve data parallel processing. For example, for an accelerator with 4096 processing cores, evenly divide and distribute the task data to these cores to fully utilize the hardware resources.
[0051] As an example, the present disclosure uses a combination of transmission optimization, task parallelism, and data parallelism to optimize performance. Figure 2 This is a pipeline heterogeneous computing flow chart.
[0052] Depend on Figure 2 It can be seen that the pipeline heterogeneous computing flowchart splits the task into subtasks, which are executed asynchronously, and the front and back related links use a soft pipeline method to overlap the related calculation and transmission processes to hide the related delays.
[0053] (1) Transmission Optimization
[0054] In order to address the performance loss caused by data transmission from the host side to the device side and from the device side to the host side, in addition to overlapping the preprocessing and data transmission links in a pipeline manner in the above-mentioned overall process, the present invention also adopts host side and device side memory address mapping technology and large page memory technology to optimize the related data transmission time.
[0055] The specific method is that when applying for device memory, the host memory corresponding to the device memory is simultaneously applied. There is a mapping relationship between the host memory and the device memory. The page table of the host memory is adjusted from the default 4KB of the operating system to 2MB, reducing the number of page tables and the performance loss caused by more memory mapping and searching.
[0056] When data is transmitted, it is first cached in the corresponding host-side memory. After reaching the set relevant threshold, the memory data is dumped to the corresponding device memory at one time. When the above optimization method does not consider the pipelining method, the actual test results show that the performance improvement brought by the above optimization method is about 3 times.
[0057] (2) Task Parallelism
[0058] For the computing tasks issued at a single time, it was observed that the computing resources of the hardware were not fully utilized. Each task was split into subtasks for specific execution by instantiating multiple kernel functions. Each subtask ran in parallel on different kernel functions, and after each subtask was completed, the overall task was merged to ensure the integrity of the current single task.
[0059] Figure 3 The figure is a schematic diagram of task splitting and task parallelism. From top to bottom, tasks go through a process of splitting and merging. Tasks at the same level are calculated synchronously, and the merged tasks at the next level use barriers to wait for the tasks at the previous level to complete.
[0060] (3) Data Parallelism
[0061] Due to the particularity of the hardware architecture, there are many processing cores, so it is necessary to distribute the subtasks issued at a time to each hardware processing core. For example, for an accelerator with 4096 processing cores, the 64MB task is evenly divided into 4096 processing cores.
[0062] This disclosure achieves the following technical effects and advantages by comprehensively adopting methods such as transmission optimization, task parallelism and data parallelism:
[0063] Overlapping computing and data transmission time: By overlapping the preprocessing, data transmission and computing processes in a pipeline manner, the related delays are hidden and the overall task execution efficiency is improved.
[0064] Optimize data transmission efficiency: Through memory address mapping technology and large page memory technology, the performance loss caused by memory mapping and search is reduced, and the efficiency of data transmission is improved.
[0065] Fully utilize hardware resources: Through task parallelism and data parallelism strategies, tasks are split into subtasks and assigned to different hardware processing cores for execution, making full use of the hardware's computing resources.
[0066] Improve overall task throughput and performance: The method disclosed in the present invention transforms the overall task from IO-intensive to compute-intensive, greatly improving the overall task throughput and performance.
[0067] In summary, the present disclosure provides a heterogeneous computing performance optimization method based on data parallelism and task parallelism, which has broad application prospects and practical value and can effectively solve the performance bottleneck problem encountered in large-scale data processing.
[0068] Combination Figure 4 As shown, an embodiment of the present disclosure provides an acceleration device 300 based on data parallelism and task parallelism, including a processor 304 and a memory 301. Optionally, the device may also include a communication interface 302 and a bus 303. Among them, the processor 304, the communication interface 302, and the memory 301 can communicate with each other through the bus 303. The communication interface 302 can be used for information transmission. The processor 304 can call the logic instructions in the memory 301 to execute the acceleration method based on data parallelism and task parallelism of the above embodiment.
[0069] In addition, the logic instructions in the memory 301 described above can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
[0070] The memory 301 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor 304 executes the function application and data processing by running the program instructions / modules stored in the memory 301, that is, implementing the acceleration method based on data parallelism and task parallelism in the above embodiment.
[0071] The memory 301 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 301 may include a high-speed random access memory and may also include a non-volatile memory.
[0072] An embodiment of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured to execute the above-mentioned acceleration method based on data parallelism and task parallelism.
[0073] The computer-readable storage medium mentioned above may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.
[0074] The technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the embodiment of the present disclosure. The aforementioned storage medium may be a non-transient storage medium, including: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes, or a transient storage medium.
[0075] The above description and accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. The parts and features of some embodiments may be included in or replace the parts and features of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the scope of protection. As used in the description in the text, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
[0076] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. The technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. The technicians may clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0077] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.
[0078] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. An acceleration method based on data parallelism and task parallelism, characterized in that: include: Transmission optimization: Use pipeline method to overlap preprocessing and data transmission; Task parallelism: Split a single computing task into multiple subtasks, and run each subtask in parallel on different kernel functions. After each subtask is completed, merge the overall task to ensure the integrity of the single task. Data parallelism: According to the number of processing cores in the hardware architecture, the subtasks issued at a time are evenly divided and executed on each hardware processing core to fully utilize the computing resources of the hardware.
2. The method according to claim 1, characterized in that The pipeline overlapping preprocessing and data transmission in the transmission optimization are implemented in an asynchronous execution mode to hide the related delays.
3. The method according to claim 1, characterized in that During the transmission optimization process, when data is transmitted from the host side to the device side and from the device side to the host side, the host side and device side memory address mapping technology and large page memory technology are used to optimize the related data transmission time.
4. The method according to claim 3, characterized in that The host-side and device-side memory address mapping technology is to simultaneously apply for the host memory corresponding to the device memory when applying for the device memory, and establish a mapping relationship to reduce the performance loss caused by memory mapping and searching.
5. The method according to claim 3, characterized in that: The large page memory technology is to adjust the page table size of the host memory from the default 4KB of the operating system to 2MB to reduce the number of page tables and further improve data transmission efficiency.
6. The method according to any one of claims 1 to 5, characterized in that: The task parallelism is achieved by instantiating multiple kernel functions. Each subtask runs in parallel on different kernel functions, and barrier technology is used to achieve synchronization between tasks. The tasks are merged after the previous layer of tasks is completed.
7. The method according to any one of claims 1 to 5, characterized in that: The data parallelism is to evenly divide the subtasks issued at a time into hardware accelerators with multiple processing cores to achieve parallel processing of data.
8. An acceleration device based on data parallelism and task parallelism, comprising a processor and a memory storing program instructions, characterized in that: The processor is configured to execute the acceleration method based on data parallelism and task parallelism as described in any one of claims 1 to 7 when running the program instructions.
9. An acceleration device based on data parallelism and task parallelism, characterized in that: Using the acceleration method based on data parallelism and task parallelism as described in any one of claims 1 to 7, the acceleration device includes a host side device, a device side device, a data transmission module and a computing module, wherein the data transmission module is responsible for realizing data transmission between the host side device and the device side device, and the computing module is responsible for executing computing tasks on the device side device, and optimizing performance by adopting data parallelism and task parallelism.
10. A storage medium storing program instructions, characterized in that: When the program instructions are run, they execute the acceleration method based on data parallelism and task parallelism as described in any one of claims 1 to 7.
Citation Information
Cited By
Hardware acceleration method of elliptic curve addition group and related device
CN118819640A
Hardware acceleration method for elliptic curve addition group and related device
CN118819640B
Task scheduling method, system and equipment of data stream processor and storage medium
CN120909744A
