A task synchronization communication method, device and medium for heterogeneous computing systems

By using the communication mechanism of signal functions and monitoring functions in heterogeneous computing systems, the effective synchronization of tasks in heterogeneous computing systems is achieved, and the problems of large CPU resource consumption and high PCIe occupancy in the existing technology are solved, and the system processing efficiency is improved .

CN118819878BActive Publication Date: 2025-02-25YUANQIXIN (SHANDONG) SEMICONDUCTOR TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411303412.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2025-02-25
Estimated Expiration
2044-09-19

AI Technical Summary

Technical Problem

Existing heterogeneous computing systems need to invest large CPU resources when implementing task synchronization, resulting in high PCIe occupancy and low system processing efficiency.

Method used

By determining the task execution set and preset dependency list of the application process to be executed, the signal function and the listening function are allocated to the corresponding task to be executed, and effective synchronization between tasks is achieved. The signal function is executed by the slave device, and the monitoring function is executed by the master device. It uses the communication mechanism between the signal and the monitoring function to avoid the CPU from frequently polling and querying the slave device status.

Benefits of technology

It reduces the consumption of CPU resources, reduces the frequency of access occupancy on the PCIe bus, improves the overall processing efficiency of the system, and avoids task waiting or deadlock.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118819878B_ABST
    Figure CN118819878B_ABST
Patent Text Reader

Abstract

The present application provides a task synchronization communication method, device and medium for heterogeneous computing systems, belonging to the field of electrical digital data processing technology. The method determines a task execution set corresponding to multiple to-be-executed application processes; based on the task execution set and the preset dependency list, the functions in the dependency trigger function group are assigned to the corresponding to-be-executed tasks; the dependency trigger function group includes a signal function assigned to the first dependency attribute task and a listening function assigned to the second dependency attribute task; the signal function and the listening function include a one-to-one binding relationship. Based on each to-be-executed task after function allocation and the preset slave device allocation strategy, the to-be-executed task is sent to the corresponding selected slave device; when the selected slave device completes the execution of the first dependency attribute task, the trigger signal of the corresponding signal function is obtained and the corresponding listening function is called according to the trigger signal, so as to send the second dependency attribute task corresponding to the called listening function to the selected slave device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of electronic digital data processing, and in particular to a task synchronization communication method, device and medium for a heterogeneous computing system. Background Art

[0002] Heterogeneous computing systems usually consist of a master device (such as a CPU) and multiple slave devices. This system architecture aims to achieve efficient data processing task allocation and execution by utilizing the computing characteristics and advantages of different processing units. However, with the increasing complexity of application layer programs, it has become a challenge to effectively manage and synchronize multiple application processes and their data processing tasks in a heterogeneous computing environment.

[0003] Existing solutions mainly rely on shared memory between processes and CPU polling to query the status flags in the memory of the slave device to achieve task synchronization communication. For example, when the data processing task of an application process depends on the completion of the task of another application process, the CPU needs to continuously query the status of the slave device to confirm whether the dependent task has been completed.

[0004] This frequent polling query method occupies a large amount of CPU resources and frequently occupies the high-speed serial computer expansion bus standard Peripheral Component Interconnect express (PCIe) bus, affecting the system's processing efficiency and user experience. Summary of the invention

[0005] The embodiments of the present application provide a task synchronization communication method, device and medium for a heterogeneous computing system, which are used to solve the technical problems that the existing heterogeneous computing system needs to invest a large amount of CPU resources to achieve task synchronization, has a high PCIe occupancy rate, and causes low system processing efficiency.

[0006] On the one hand, an embodiment of the present application provides a task synchronization communication method for a heterogeneous computing system, the method comprising:

[0007] Determine a task execution set corresponding to multiple application processes to be executed;

[0008] Based on the task execution set and the preset dependency list, functions in the dependency trigger function group are assigned to corresponding tasks to be executed; wherein the dependency trigger function group includes a signal function assigned to a first dependency attribute task and a listening function assigned to a second dependency attribute task; the signal function and the listening function include a one-to-one binding relationship; the signal function is executed by a slave device, and the listening function is executed by a master device;

[0009] Based on each of the tasks to be executed after function allocation and a preset slave device allocation strategy, the tasks to be executed are sent to the corresponding selected slave devices;

[0010] After the selected slave device completes executing the first dependency attribute task, a trigger signal of the corresponding signal function is obtained and the corresponding monitoring function is called according to the trigger signal, so as to send the second dependency attribute task corresponding to the called monitoring function to the selected slave device.

[0011] In one implementation of the present application, based on the task execution set and the preset dependency list, the functions in the dependency trigger function group are assigned to corresponding tasks to be executed, specifically including:

[0012] Matching the task execution set with the preset dependency list to generate a task dependency sequence according to the matching result; the task dependency sequence includes a plurality of the tasks to be executed arranged according to the dependency relationship;

[0013] According to the task dependency sequence, the first dependency attribute task and the corresponding second dependency attribute task are determined, and a dependency task tuple is generated; wherein the dependency relationship in the dependency task tuple at least includes: the first dependency attribute task is a predecessor task of the second dependency attribute task; the first dependency attribute task and the second dependency attribute task in the same dependency task tuple come from different application processes to be executed;

[0014] According to the same dependent task tuple, the signal function is added to the execution logic tail of the first dependent attribute task, and the bound listening function is added to the execution logic head of the second dependent attribute task.

[0015] In one implementation of the present application, after allocating the functions in the dependency trigger function group to the corresponding tasks to be executed based on the task execution set and the preset dependency relationship list, the method further includes:

[0016] According to a preset application process execution order, determining in sequence whether each of the to-be-executed application processes has a task with the second dependency attribute;

[0017] If so, remove the second dependency attribute task from the task queue of the corresponding application process to be executed, and send the removed task queue to the corresponding slave device according to the preset application process execution order and the preset slave device allocation strategy.

[0018] In one implementation of the present application, based on each of the tasks to be executed after function allocation and a preset slave device allocation strategy, the tasks to be executed are sent to the corresponding selected slave devices, specifically including:

[0019] Determine the required computing resource vector corresponding to the task to be executed and the available resource vectors corresponding to each slave device according to the preset computing resource matching list;

[0020] Determining, based on the demand computing resource vector and each of the available resource vectors, a first resource matching degree between the task to be executed and each of the slave devices;

[0021] Determine the task priority corresponding to the task to be executed based on the priority calculation data of the task to be executed; wherein the priority calculation data includes the task type, task urgency, task importance and dependency relationship obtained based on historical execution tasks;

[0022] Based on the product value of each first resource matching degree and the task priority, the selected slave device corresponding to each of the tasks to be executed in the same execution period is determined respectively, so as to send the tasks to be executed to the corresponding selected slave device.

[0023] In one implementation of the present application, after respectively determining the selected slave devices corresponding to the tasks to be executed in the same execution period based on the product value of each resource matching degree and the task priority, the method further includes:

[0024] In the case where the task to be executed is the task with the first dependency attribute, determining a matching degree between the corresponding task with the second dependency attribute and the second resource of the selected slave device;

[0025] Comparing the second resource matching degree with a preset resource matching threshold;

[0026] In a case where the second resource matching degree is greater than or equal to the preset resource matching threshold, taking the selected slave device as the selected slave device corresponding to the second dependency attribute task, so as to send the second dependency attribute task corresponding to the called listening function to the selected slave device;

[0027] Otherwise, in the order of the product values ​​from small to large, the slave devices corresponding to different product values ​​are updated in sequence as the slave devices to be selected for the first dependency attribute task, until the second resource matching degree corresponding to the slave device to be selected is greater than or equal to the preset resource matching threshold, and the corresponding slave device to be selected is used as the selected slave device corresponding to the first dependency attribute task and the second dependency attribute task.

[0028] In one implementation of the present application, determining the first resource matching degree between the task to be executed and each of the slave devices based on the demand computing resource vector and each of the available resource vectors specifically includes:

[0029] Determine a ratio of the required computing resource vector to the corresponding vector element of the available resource vector as a matching score of the corresponding resource type; wherein the corresponding vector element indicates that the resource types of the two vector elements are the same;

[0030] Compare each of the matching scores with 1 respectively, and determine the minimum value of the comparison result as the type matching degree respectively;

[0031] Calculate, according to the same available resource vector, the sum of the matching degrees of each type corresponding to each resource type as the first resource matching degree corresponding to the corresponding slave device;

[0032] Determining the task priority corresponding to the task to be executed based on the priority calculation data of the task to be executed, specifically includes:

[0033] Determine a corresponding priority weight group according to the task type and the historical priority weight list of the task to be executed; wherein the priority weight group includes the priority weights corresponding to the task urgency, the task importance and the dependency relationship respectively;

[0034] According to the priority weight group, the task urgency, the task importance and the dependency, a corresponding weighted sum value is calculated as the task priority.

[0035] In one implementation of the present application, the method further includes:

[0036] In the case where the first dependency attribute task fails to execute, the slave device sends a task execution failure error value to the master device, and does not generate the trigger signal of the corresponding signal function.

[0037] In one implementation of the present application, the slave device includes at least the following types: a graphics processing unit GPU, a field programmable gate array FPGA.

[0038] On the other hand, an embodiment of the present application further provides a task synchronization communication device for a heterogeneous computing system, the device comprising:

[0039] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a task synchronization communication method for a heterogeneous computing system as described above.

[0040] On the other hand, an embodiment of the present application further provides a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions can execute a task synchronization communication method for a heterogeneous computing system as described above.

[0041] Compared with the prior art, the present invention has the following significant effects:

[0042] Through the above scheme, the present application establishes a communication mechanism of signals and monitoring, designs corresponding signal functions and monitoring functions for tasks to be executed that have a front-and-back dependency relationship between processes, and realizes effective synchronization between tasks of different application processes. It avoids waiting or deadlocking caused by tasks in the application process not meeting the execution conditions; at the same time, compared with the existing scheme of querying the status flag of the slave device through shared memory and CPU polling, it reduces the consumption of CPU resources, and by avoiding polling to query the status flag of the device end, it reduces the access occupancy frequency of the PICe bus, and improves the overall processing efficiency of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0044] Figure 1 A flowchart of a task synchronization communication method for a heterogeneous computing system in an embodiment of the present application;

[0045] Figure 2 A schematic diagram of the structure of a heterogeneous computing system in a task synchronization communication method for a heterogeneous computing system in an embodiment of the present application;

[0046] Figure 3 Another structural schematic diagram of a heterogeneous computing system in a task synchronization communication method for a heterogeneous computing system in an embodiment of the present application;

[0047] Figure 4 It is a structural diagram of a task synchronization communication device for a heterogeneous computing system in an embodiment of the present application. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only 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 making creative work are within the scope of protection of the present application.

[0049] A heterogeneous computing system usually contains a master device and multiple slave devices. The operating system running in the heterogeneous computing system usually executes multiple application layer program processes, and each application process contains several data processing tasks. The CPU, as the master device, will assign different data processing tasks to the slave devices according to the computing characteristics and resource availability of each slave device. All data processing tasks contained in an application process often need to be coordinated with multiple slave devices for multiple processing to complete all processing tasks.

[0050] If there is a certain dependency between the data processing tasks of two application processes, for example, task B in application process 2 can only meet the execution conditions after task A in application process 1 is completed, then it is necessary to implement synchronous communication of the execution status of the data processing tasks between the application processes on the slave device.

[0051] To address the above issues, the existing solution uses inter-process shared memory and CPU polling to query status flags from device memory. Although this solves the problem of task synchronization between processes, the CPU polling query consumes a lot of CPU time and frequently occupies the PCIe bus, reducing the system's processing efficiency.

[0052] Based on this, the embodiments of the present application provide a task synchronization communication method, device and medium for a heterogeneous computing system, which is used to solve the technical problems that the existing heterogeneous computing system needs to invest a large amount of CPU resources to achieve task synchronization, has a high PCIe occupancy rate, and causes low system processing efficiency.

[0053] The following describes in detail various embodiments of the present application in conjunction with the accompanying drawings.

[0054] The present application embodiment provides a task synchronization communication method for a heterogeneous computing system, such as Figure 1 As shown, the method may include steps S101-S104:

[0055] S101, the CPU determines a task execution set corresponding to a plurality of application processes to be executed.

[0056] It should be noted that the execution subject of the embodiment of the present application is a master device, the master device is a CPU, and the slave device can be of the following types: a graphics processing unit (GPU), a field programmable gate array (FPGA). The present application takes the slave device as an example to illustrate the embodiment.

[0057] Figure 2A schematic diagram of the structure of the master and slave devices of a heterogeneous computing system. The CPU-host master device includes an operating system, which includes multiple application processes. Figure 2 Given two application processes, process1 and process2, process1 contains three data processing tasks (i.e., tasks to be executed), task1, task2, and task3; process2 contains three data processing tasks, task4, task5, and task6. The CPU and GPU communicate through the PCIE bus, and the GPU-device slave device can contain n GPUs, where n is a natural number.

[0058] The multiple application processes to be executed can be understood as the two application processes mentioned above, and the six tasks to be executed can be used as set constituent elements to form a task execution set.

[0059] S102: The CPU allocates functions in the dependency trigger function group to corresponding tasks to be executed based on the task execution set and the preset dependency relationship list.

[0060] The dependent trigger function group includes a signal function assigned to the first dependency attribute task and a monitoring function assigned to the second dependency attribute task. The signal function and the monitoring function include a one-to-one binding relationship. The signal function is executed by the slave device, and the monitoring function is executed by the master device.

[0061] In the embodiment of the present application, based on the task execution set and the preset dependency list, the functions in the dependency trigger function group are assigned to the corresponding tasks to be executed, specifically including:

[0062] Match the task execution set with the preset dependency list to generate a task dependency sequence based on the matching results. The task dependency sequence includes multiple tasks to be executed arranged according to the dependencies. According to the task dependency sequence, determine the first dependency attribute task and the corresponding second dependency attribute task, and generate a dependency task tuple. Among them, the dependency in the dependency task tuple at least includes: the first dependency attribute task is the predecessor task of the second dependency attribute task. The first dependency attribute task and the second dependency attribute task in the same dependency task tuple come from different application processes to be executed. According to the same dependency task tuple, add the signal function to the execution logic tail of the first dependency attribute task, and add the bound listening function to the execution logic head of the second dependency attribute task.

[0063] The above-mentioned preset dependency list can be a list prepared by the user or developer according to the task attributes. For example, the preset dependency list includes<A,B> ,<C,D> ,in<A,B> Characterize that task B depends on task A, A is the first dependency attribute task of B, B is the second dependency attribute task, A is the predecessor task of B, and B is the successor task of A. The CPU can query the dependency relationship of each task to be executed in the task execution set through the above preset dependency list, and arrange the tasks to be executed with dependencies into the task dependency sequence according to the order of dependencies. For example, there is [E, F, G] in the task dependency sequence, E is the predecessor task of F, and F is the predecessor task of G.

[0064] Then, the CPU groups the tasks in the task dependency sequence into dependent task tuples according to the dependency attributes, which can be understood as the predecessor task and the successor task mentioned above. Then, the CPU assigns the signal functions and monitoring functions written by the user or developer to the tasks to be executed corresponding to the dependent task tuples.

[0065] The specific allocation rule is to add the signal function to the end of the execution logic of the first dependency attribute task, and add the bound listening function to the head of the execution logic of the second dependency attribute task. That is to say, after the first dependency attribute task is executed according to its execution logic, the signal function at the end of its execution logic is executed, while the second dependency attribute task needs to execute the listening function first, and then execute the program corresponding to its execution logic.

[0066] In one embodiment of the present application, after allocating the functions in the dependency trigger function group to the corresponding tasks to be executed based on the task execution set and the preset dependency relationship list, the method further includes:

[0067] According to the preset application process execution order, it is determined in turn whether each application process to be executed has a second dependency attribute task. When it is determined that each application process to be executed has a second dependency attribute task, the second dependency attribute task is removed from the task queue of the corresponding application process to be executed, so as to send the removed task queue to the corresponding slave device according to the preset application process execution order and the preset slave device allocation strategy.

[0068] That is to say, if a task to be executed in the application process to be executed is a task with the second dependency attribute, the execution of the task with the second dependency attribute is no longer executed together with other tasks to be executed in the application process to be executed, but needs to wait for the execution of its corresponding task with the first dependency attribute, and can only be executed by the GPU after calling the signal function and the monitoring function. The normal execution of the task with the second dependency attribute is achieved without the CPU polling the GPU device, thereby reducing the CPU resource consumption.

[0069] Specifically, the present application creates a listening function in the application process for each task that depends on the data processing tasks in other processes, and executes the data processing task when the listening function is called; creates a signal function in the application process for each task that is depended on by the data processing tasks in other processes, and triggers the corresponding listening function when the signal function is called. The listening function is compiled and run in the host-side CPU device as part of the host-side program. The signal function is part of the device-side program and is sent to the device side together with the data processing task through the host-side device for execution. When multiple application processes are executed, the host-side CPU device sends the data processing tasks of different processes to the GPU for processing on the slave device; when the dependent task is executed, the signal function is called to trigger the execution of the corresponding listening function. The listening function calls the corresponding data processing task on the host side, and sends the data processing task to the GPU for execution through the host-side CPU.

[0070] For example, in the application process process1 and process2, a listening function is created for each task that depends on the data processing task in other processes. A corresponding listening function slot_task5() is created for task5, and the task5() task function and the listening function slot_task5() are marked with __declspec(dllexport) so that the compiler can compile them into export functions for other processes to call. When the listening function slot_task5() is triggered and called, the task5 data processing task is executed. In the application process process1 and process2, a signal function is created for each task that is dependent on the data processing task in other processes. A corresponding signal function signal_task2() is created for task2, which is embedded at the end of the task2() data processing task code. When the signal function signal_task2() is called, the corresponding listening function slot_task5() is triggered. The listening function slot_task5() is compiled and run in the host-side CPU device as a host-side program. As part of the device-side program, the signal function signal_task2() is sent to the GPU through the host-side CPU device together with the data processing task for execution from the device side.

[0071] When the application process process1 is executed, the host side CPU device writes the three data processing tasks task1, task2, and task3 into the task processing queue in order, and submits them to the GPU slave device for processing. When the dependent task task2 is executed, the signal function signal_task2() is called and triggers the corresponding listening function slot_task5() to execute; the listening function calls the data processing task task5() on the host side, which is sent to the GPU slave device for execution through the host side. When the application process2 is executed, the host side CPU device writes the two data processing tasks task4 and task6 into the task processing queue in order. Because task5() is marked as a __declspec(dllexport) export function, it is not written into the task queue. The CPU submits the task queue to the GPU slave device for processing.

[0072] S103, the CPU sends the tasks to be executed to the corresponding selected slave devices based on the tasks to be executed after function allocation and the preset slave device allocation strategy.

[0073] In the embodiment of the present application, based on each task to be executed after function allocation and a preset slave device allocation strategy, the task to be executed is sent to the corresponding selected slave device, specifically including:

[0074] According to the preset computing resource matching list, the demand computing resource vector corresponding to the task to be executed and the available resource vector corresponding to each slave device are determined. Based on the demand computing resource vector and each available resource vector, the first resource matching degree corresponding to the task to be executed and each slave device is determined. Subsequently, based on the priority calculation data of the task to be executed, the task priority corresponding to the task to be executed is determined. Among them, the priority calculation data includes the task type, task urgency, task importance and dependency relationship obtained based on historical execution tasks. Finally, based on the product value of each first resource matching degree and the task priority, the selected slave devices corresponding to each task to be executed in the same execution period are determined respectively, so as to send the task to be executed to the corresponding selected slave device.

[0075] In other words, a preset computing resource matching list can be pre-set in the CPU, which records the required computing resource vectors required by the tasks to be executed and the available resource vectors of each slave device, i.e., GPU. For example, there are M tasks to be executed and N slave devices, and each task The required demand computing resource vector is vector elements of different resource types, the required computing resource vector is , Indicates tasks to be performed For resource types The amount of computing resources required, such as CPU time, GPU memory, bandwidth, etc. The available resource vector is ,in Indicates slave device Resource Type The amount of available resources.

[0076] In the embodiment of the present application, based on the demand calculation resource vector and each available resource vector, determining the first resource matching degree of the task to be executed and each slave device respectively includes:

[0077] The CPU determines the ratio of the required computing resource vector to the corresponding vector element of the available resource vector as the matching score of the corresponding resource type. The corresponding vector element indicates that the resource types of the two vector elements are the same. Each matching score is compared with 1, and the minimum value of the comparison result is determined as the type matching degree. Based on the same available resource vector, the sum of the matching degrees of each type corresponding to each resource type is calculated as the first resource matching degree corresponding to the corresponding slave device.

[0078] Specifically, the matching score calculation formula is as follows:

[0079] ;

[0080] in, Indicates tasks to be performed On the slave device The first resource matching degree, For resource type The corresponding matching score. The minimum value among 1 and 1 is the task to be executed With slave device In resource type Type matching, CPU calculation The sum of the type matching degrees of different resource types is used to obtain the first resource matching degree.

[0081] In the embodiment of the present application, based on the priority calculation data of the task to be executed, the task priority corresponding to the task to be executed is determined, specifically including:

[0082] According to the task type and historical priority weight list of the task to be executed, the corresponding priority weight group is determined. Among them, the priority weight group includes the priority weights corresponding to the task urgency, task importance and dependency relationship. According to the priority weight group, task urgency, task importance and dependency relationship, the corresponding weighted sum value is calculated as the task priority.

[0083] That is to say, the task to be executed contains priority calculation data of multiple dimensions. The priority calculation data can be the historical execution tasks collected by the user, and the user-annotated labels are added, and input into the preset neural network model for training until the loss function value of the preset neural network model is less than the preset value, and the trained priority calculation data recognition model is obtained. The CPU can input the task type of the task to be executed into the priority calculation data recognition model, and then obtain the priority calculation data including three dimensions of task urgency, task importance and dependency. Subsequently, the CPU will match the priority weights of each dimension in the historical priority weight list by the task type. The task priority is calculated by the priority weight and the priority calculation data. The specific calculation formula is as follows:

[0084] ;

[0085] ;

[0086] in, For tasks to be performed The task priority, , , are the priority weights corresponding to task urgency, task importance, and dependency relationships, respectively. Calculate the data value for the first priority corresponding to the task urgency, Calculate the data value for the second priority corresponding to the task importance, The data value is calculated for the third priority level corresponding to the dependency relationship.

[0087] Preferably, after obtaining the first resource matching degree of the task to be executed relative to each slave device and its corresponding task priority, the CPU can respectively calculate the product value of the first resource matching degree and the task priority, and select a maximum product value from the product values, and use the slave device corresponding to the maximum product value as the selected slave device.

[0088] The specific formula is as follows:

[0089]

[0090] in, The preset slave device allocation strategy is to allocate slave devices according to the product value of the first resource matching degree and the task priority, and determine the selected slave device for the task to be executed.

[0091] In actual use, there is not only one task to be executed in an execution period, but the maximum product value of two tasks to be executed may correspond to the same slave device. In this case, the preset slave device allocation strategy needs to be added: the CPU selects a pre-selected slave device from other unselected slave devices, and calculates the product value of the first resource matching degree and task priority corresponding to the two tasks to be executed and the pending slave device, and compares the size of the two product values. The task to be executed corresponding to the larger product value is assigned to the pre-selected slave device, that is, the pre-selected slave device is used as the selected slave device for the task to be executed corresponding to the larger product value.

[0092] In one embodiment of the present application, when allocating slave devices for tasks to be executed, if the task to be executed is a task with a first dependency attribute, after determining the selected slave device for the task with the first dependency attribute, after the execution of the task with the first dependency attribute is completed, in order to avoid repeated data transmission between the master device and the slave device and reduce the occupancy of the PCIe bandwidth, the present application will also send the task with the second dependency attribute to the selected slave device for execution.

[0093] To ensure that the selected slave device can also support the task with the second dependency attribute, the preset slave device allocation strategy may further include the following contents. Specifically, after respectively determining the selected slave devices corresponding to the tasks to be executed in the same execution period based on the product values ​​of the matching degrees of each resource and the task priorities, it further includes:

[0094] In the case where the task to be executed is a task with the first dependency attribute, determine the second resource matching degree between the corresponding second dependency attribute task and the selected slave device. Compare the second resource matching degree with the preset resource matching threshold. In the case where the second resource matching degree is greater than or equal to the preset resource matching threshold, the selected slave device is used as the selected slave device corresponding to the second dependency attribute task, so as to send the second dependency attribute task corresponding to the called listening function to the selected slave device. Otherwise, in the order of product values ​​from small to large, the slave devices corresponding to different product values ​​are updated as the slave devices to be selected for the first dependency attribute task, until the second resource matching degree corresponding to the slave device to be selected is greater than or equal to the preset resource matching threshold, and the corresponding slave device to be selected is used as the selected slave device corresponding to the first dependency attribute task and the second dependency attribute task.

[0095] That is to say, after determining the selected slave device for the first dependency attribute task, the present application will simultaneously calculate the second resource matching degree between the second dependency attribute task and the selected slave device. The second resource matching degree is compared with a preset resource matching threshold, wherein the preset resource matching threshold is set by the user based on experience, and the present application does not make specific limitations on this. The preset resource matching threshold characterizes the efficiency level of task processing, and a resource matching degree higher than the preset resource matching threshold indicates that the corresponding slave device can execute the task to be executed with higher efficiency. If the second resource matching degree is greater than or equal to the preset resource matching threshold, then the above-mentioned selected slave device will be simultaneously used as the selected slave device for the second dependency attribute task.

[0096] When the second resource matching degree is less than the preset resource matching threshold, the CPU can calculate the product value according to the above calculation. , select the slave device to be selected for the first dependency attribute task in order from small to large. And calculate the second resource matching degree of the slave device to be selected with respect to the second dependency attribute task, and compare the second resource matching degree with the preset resource matching degree threshold in real time, so as to select the selected slave device that satisfies both the first dependency attribute task and the second dependency attribute task. At the same time, in the process of re-updating the selected slave device, the updated slave device to be selected may have been assigned to other tasks to be executed. At this time, the CPU will calculate whether there are other slave devices that meet the requirements of other tasks to be executed in the same execution period. If there are, the slave device to be selected will be selected as the selected slave device, and other tasks to be executed will be assigned to other idle slave devices. If not, the CPU will select other slave devices to be selected. If the CPU cannot find a slave device to be selected that meets the above requirements, it will generate an alarm prompt information and send it to the user terminal. The alarm prompt information includes but is not limited to text and picture information.

[0097] Through the above preset slave device allocation strategy, the slave device allocation can be made more reasonable, ensuring that the slave devices can perform tasks efficiently and reducing unnecessary PCIe bus occupancy.

[0098] The above-mentioned preset slave device allocation strategy can be run in a preset runtime intelligent scheduling module, and another structural diagram of the computing system is shown in FIG. Figure 3 In Figure 3As shown in the figure, the runtime intelligent scheduling module performs abstract modeling for the entire heterogeneous computing system and PCIe controller. According to the type of slave devices in the heterogeneous system, a device model is abstracted for each slave device; the PCIe controller is abstracted and virtualized into multiple channels virtual_channel_1, virtual_channel_2, ..., virtual_channel_n. And a PCIe virtual channel is bound to each specific slave device object instance. The access of the process tasks of the application layer to the PCIe bus is allocated and executed through the runtime intelligent scheduling module.

[0099] S104, after the selected slave device completes executing the first dependency attribute task, the CPU obtains a trigger signal of the corresponding signal function and calls the corresponding monitoring function according to the trigger signal, so as to send the second dependency attribute task corresponding to the called monitoring function to the selected slave device.

[0100] That is to say, in this application, the slave device can execute the signal function and generate a trigger signal to send to the CPU, and the listening function bound to it can receive the trigger signal and then issue the second dependency attribute task.

[0101] In the embodiment of the present application, when the first dependency attribute task fails to execute, the slave device sends a task execution failure error value to the master device, and does not generate a trigger signal of the corresponding signal function. That is, when the first dependency attribute task fails to execute, the execution of the signal function at the end of its execution logic is not continued, so as to avoid affecting the second dependency attribute task.

[0102] Through the above scheme, the present application establishes a communication mechanism of signals and monitoring, designs corresponding signal functions and monitoring functions for tasks to be executed that have a front-and-back dependency relationship between processes, and realizes effective synchronization between tasks of different application processes. It avoids waiting or deadlocking caused by tasks in the application process not meeting the execution conditions; at the same time, compared with the existing scheme of querying the status flag of the slave device through shared memory and CPU polling, it reduces the consumption of CPU resources, and by avoiding polling to query the status flag of the device end, it reduces the access occupancy frequency of the PICe bus, and improves the overall processing efficiency of the system.

[0103] Figure 4 A structural diagram of a task synchronization communication device for a heterogeneous computing system provided in an embodiment of the present application, such as Figure 4 As shown, the device includes:

[0104] At least one processor; and a memory in communication with the at least one processor. The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to:

[0105] Determine a task execution set corresponding to multiple to-be-executed application processes. Based on the task execution set and the preset dependency list, assign the functions in the dependency trigger function group to the corresponding to-be-executed tasks. Among them, the dependency trigger function group includes a signal function assigned to a first dependency attribute task and a listening function assigned to a second dependency attribute task. The signal function and the listening function include a one-to-one binding relationship. The signal function is executed by the slave device, and the listening function is executed by the master device. Based on each to-be-executed task after function allocation and the preset slave device allocation strategy, the to-be-executed task is sent to the corresponding selected slave device. When the selected slave device completes the execution of the first dependency attribute task, obtain the trigger signal of the corresponding signal function and call the corresponding listening function according to the trigger signal, so as to send the second dependency attribute task corresponding to the called listening function to the selected slave device.

[0106] The embodiment of the present application further provides a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured as follows:

[0107] Determine a task execution set corresponding to multiple to-be-executed application processes. Based on the task execution set and the preset dependency list, assign the functions in the dependency trigger function group to the corresponding to-be-executed tasks. Among them, the dependency trigger function group includes a signal function assigned to a first dependency attribute task and a listening function assigned to a second dependency attribute task. The signal function and the listening function include a one-to-one binding relationship. The signal function is executed by the slave device, and the listening function is executed by the master device. Based on each to-be-executed task after function allocation and the preset slave device allocation strategy, the to-be-executed task is sent to the corresponding selected slave device. When the selected slave device completes the execution of the first dependency attribute task, obtain the trigger signal of the corresponding signal function and call the corresponding listening function according to the trigger signal, so as to send the second dependency attribute task corresponding to the called listening function to the selected slave device.

[0108] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0109] The devices and media provided in the embodiments of the present application correspond one-to-one to the methods. Therefore, the devices and media also have similar beneficial technical effects as the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.

[0110] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0111] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A task synchronization communication method for a heterogeneous computing system, characterized in that: The method comprises: Determine a task execution set corresponding to multiple application processes to be executed; Based on the task execution set and the preset dependency list, functions in the dependency trigger function group are assigned to corresponding tasks to be executed; wherein the dependency trigger function group includes a signal function assigned to a first dependency attribute task and a listening function assigned to a second dependency attribute task; the signal function and the listening function include a one-to-one binding relationship; the signal function is executed by a slave device, and the listening function is executed by a master device; Based on each of the tasks to be executed after function allocation and a preset slave device allocation strategy, the tasks to be executed are sent to the corresponding selected slave devices; After the selected slave device completes executing the first dependency attribute task, obtaining a trigger signal corresponding to the signal function and calling the corresponding listening function according to the trigger signal, so as to send the second dependency attribute task corresponding to the called listening function to the selected slave device; Among them, based on the task execution set and the preset dependency list, the functions in the dependency trigger function group are assigned to the corresponding tasks to be executed, specifically including: Matching the task execution set with the preset dependency list to generate a task dependency sequence according to the matching result; the task dependency sequence includes a plurality of the tasks to be executed arranged according to the dependency relationship; According to the task dependency sequence, the first dependency attribute task and the corresponding second dependency attribute task are determined, and a dependency task tuple is generated; wherein the dependency relationship in the dependency task tuple at least includes: the first dependency attribute task is a predecessor task of the second dependency attribute task; the first dependency attribute task and the second dependency attribute task in the same dependency task tuple come from different application processes to be executed; According to the same dependent task tuple, the signal function is added to the execution logic tail of the first dependent attribute task, and the bound listening function is added to the execution logic head of the second dependent attribute task.

2. A task synchronization communication method for a heterogeneous computing system according to claim 1, characterized in that: After allocating the functions in the dependency trigger function group to corresponding tasks to be executed based on the task execution set and the preset dependency relationship list, the method further includes: According to a preset application process execution order, determining in sequence whether each of the to-be-executed application processes has a task with the second dependency attribute; If so, remove the second dependency attribute task from the task queue of the corresponding application process to be executed, and send the removed task queue to the corresponding slave device according to the preset application process execution order and the preset slave device allocation strategy.

3. The task synchronization communication method for heterogeneous computing systems according to claim 1, characterized in that: Based on each of the tasks to be executed after function allocation and a preset slave device allocation strategy, the tasks to be executed are sent to the corresponding selected slave devices, specifically including: Determine the required computing resource vector corresponding to the task to be executed and the available resource vectors corresponding to each slave device according to the preset computing resource matching list; Determining, based on the demand computing resource vector and each of the available resource vectors, a first resource matching degree between the task to be executed and each of the slave devices; Determine the task priority corresponding to the task to be executed based on the priority calculation data of the task to be executed; wherein the priority calculation data includes the task type, task urgency, task importance and dependency relationship obtained based on historical execution tasks; Based on the product value of each first resource matching degree and the task priority, the selected slave device corresponding to each of the tasks to be executed in the same execution period is determined respectively, so as to send the tasks to be executed to the corresponding selected slave device.

4. The task synchronization communication method for heterogeneous computing systems according to claim 3, characterized in that: After respectively determining the selected slave devices corresponding to the tasks to be executed in the same execution period based on the product value of each resource matching degree and the task priority, the method further includes: In the case where the task to be executed is the task with the first dependency attribute, determining a matching degree between the corresponding task with the second dependency attribute and the second resource of the selected slave device; Comparing the second resource matching degree with a preset resource matching threshold; In a case where the second resource matching degree is greater than or equal to the preset resource matching threshold, taking the selected slave device as the selected slave device corresponding to the second dependency attribute task, so as to send the second dependency attribute task corresponding to the called listening function to the selected slave device; Otherwise, in the order of the product values ​​from small to large, the slave devices corresponding to different product values ​​are updated in sequence as the slave devices to be selected for the first dependency attribute task, until the second resource matching degree corresponding to the slave device to be selected is greater than or equal to the preset resource matching threshold, and the corresponding slave device to be selected is used as the selected slave device corresponding to the first dependency attribute task and the second dependency attribute task.

5. The task synchronization communication method for heterogeneous computing systems according to claim 3, characterized in that: Determining the first resource matching degree between the task to be executed and each slave device based on the demand computing resource vector and each of the available resource vectors specifically includes: Determine a ratio of the required computing resource vector to the corresponding vector element of the available resource vector as a matching score of the corresponding resource type; wherein the corresponding vector element indicates that the resource types of the two vector elements are the same; Compare each of the matching scores with 1 respectively, and determine the minimum value of the comparison result as the type matching degree respectively; Calculate, according to the same available resource vector, the sum of the matching degrees of each type corresponding to each resource type as the first resource matching degree corresponding to the corresponding slave device; Determining the task priority corresponding to the task to be executed based on the priority calculation data of the task to be executed, specifically includes: Determine a corresponding priority weight group according to the task type and the historical priority weight list of the task to be executed; wherein the priority weight group includes the priority weights corresponding to the task urgency, the task importance and the dependency relationship respectively; According to the priority weight group, the task urgency, the task importance and the dependency, a corresponding weighted sum value is calculated as the task priority.

6. The task synchronization communication method for heterogeneous computing systems according to claim 1, characterized in that: The method further comprises: In the case where the first dependency attribute task fails to execute, the slave device sends a task execution failure error value to the master device, and does not generate the trigger signal of the corresponding signal function.

7. The task synchronization communication method for heterogeneous computing systems according to claim 1, characterized in that: The slave devices include at least the following types: a graphics processing unit GPU and a field programmable gate array FPGA.

8. A task synchronization communication device for a heterogeneous computing system, characterized in that: The device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a task synchronization communication method for a heterogeneous computing system as described in any one of claims 1 to 7.

9. A non-volatile computer storage medium storing computer executable instructions, characterized in that: The computer executable instructions can execute a task synchronization communication method for a heterogeneous computing system as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method for processing multiple tasks, processing equipment and heterogeneous computing system

    CN115237582A

  • Resource scheduling method, system and equipment for batch services and storage medium

    CN115391009A