Memory scheduling method for heterogeneous computing system, heterogeneous computing system and device

By obtaining the memory index information and mutual access duration between heterogeneous computing devices, identifying idle devices and performing memory scheduling, the problem of unreasonable memory allocation in heterogeneous computing systems is solved, and resource utilization and training task execution are improved. efficiency.

CN118260053BActive Publication Date: 2024-08-27SHANDONG HAILIANG INFORMATION TECH RES INST
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202410676344.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-29
Publication Date
2024-08-27
Estimated Expiration
2044-05-29

AI Technical Summary

Technical Problem

In a multi-element heterogeneous computing system, unreasonable memory allocation of heterogeneous computing devices causes some devices to be idle or report overflow errors, which is a waste of resources. It is necessary to improve the rational utilization of memory resources.

Method used

By obtaining the memory index information and mutual access duration between heterogeneous computing devices, the current idle device is determined, and is scheduled according to the expanded memory of the risk training subtask to achieve reasonable allocation of memory.

Benefits of technology

It effectively avoids memory overflow errors and waste of idle resources, optimizes the utilization of memory resources of heterogeneous computing devices, and improves the execution efficiency of distributed training tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118260053B
    Figure CN118260053B
Patent Text Reader

Abstract

The present invention discloses a memory scheduling method, a heterogeneous computing system and a device, and relates to the field of computer technology. Based on the index information of the mutual access between the memories of multiple heterogeneous computing devices, the mutual access duration and the extended memory of the current risk training subtask, the memory of the currently idle heterogeneous computing device determined in the multiple heterogeneous computing devices is scheduled and processed, so as to determine the memory scheduling corresponding to the extended memory of the risk training subtask, so that the extended memory of the risk training subtask with memory overflow can schedule the memory resources corresponding to the idle heterogeneous computing device, improve the reasonable use of the memory resources of the heterogeneous computing device, avoid the memory overflow error of the risk training subtask and the waste of idle memory resources of the idle heterogeneous computing device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a memory scheduling method for a heterogeneous computing system, a heterogeneous computing system and a device. Background Art

[0002] Computing units usually refer to a variety of different computing power processing systems, such as the central processing unit (CPU), graphics processing unit (GPU), field-programmable gate array (FPGA), and application-specific integrated circuit (ASIC), which can meet the application requirements of different scenarios and maximize computing efficiency.

[0003] The memory corresponding to each heterogeneous computing device in a multi-heterogeneous computing system is different. When users use the multi-heterogeneous computing system for distributed training, it is easy to cause unreasonable memory allocation, which will cause the memory corresponding to some heterogeneous computing devices to be idle, wasting resources; and the memory corresponding to some heterogeneous computing devices will overflow and report errors.

[0004] Therefore, how to improve the rational utilization of memory resources corresponding to heterogeneous computing devices to avoid overflow errors and waste of idle resources is an urgent problem to be solved by technical personnel in this field. Summary of the invention

[0005] The purpose of the present invention is to provide a memory scheduling method, a heterogeneous computing system and a device for a heterogeneous computing system, so as to solve the problem of unreasonable memory allocation corresponding to heterogeneous computing devices in a multi-heterogeneous computing system.

[0006] In order to solve the above technical problems, the present invention provides a memory scheduling method for a heterogeneous computing system, wherein the heterogeneous computing system includes a host and a plurality of heterogeneous computing devices; the host is connected to each heterogeneous computing device, and each heterogeneous computing device is connected to each other; each heterogeneous computing device includes a computing unit and a memory; the memory scheduling method includes:

[0007] Obtain the index information and duration of mutual access between the extended memory corresponding to the current risk training subtask and the memory of multiple heterogeneous computing devices;

[0008] Determine a currently idle heterogeneous computing device among multiple heterogeneous computing devices;

[0009] The memory of the currently idle heterogeneous computing device is scheduled according to the index information, the mutual access duration and the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask.

[0010] On the one hand, the process of determining the index information for mutual access between the memories of multiple heterogeneous computing devices includes:

[0011] Obtain all heterogeneous computing devices under the heterogeneous computing platform corresponding to the model training task;

[0012] Determine whether there is a mutual access relationship between the current heterogeneous computing device and all heterogeneous computing devices except the current heterogeneous computing device;

[0013] If so, a mutual access mapping relationship will be established with the remaining heterogeneous computing devices that have a mutual access relationship with the current heterogeneous computing power to determine the index information of mutual access between the memories of multiple heterogeneous computing devices; wherein the mutual access mapping relationship is represented in the form of a mutual access list or a mutual access matrix.

[0014] On the other hand, the process of determining the extended memory corresponding to the current risk training subtask includes:

[0015] Get the preset memory tolerance value;

[0016] Obtain each training subtask after the model training task is divided, and assign each training subtask to the corresponding first target heterogeneous computing power device;

[0017] Obtain the occupied memory corresponding to the first target heterogeneous computing power device;

[0018] Determine a first memory value according to a relationship between a predicted peak memory of a current training subtask and the preset memory tolerance value;

[0019] Determine whether the first memory value is greater than the occupied memory corresponding to the first target heterogeneous computing device to which the current training subtask belongs;

[0020] If it is greater than, the current training subtask is determined to be the current risk training subtask, and the first target heterogeneous computing power device corresponding to the current training subtask is used as the risk heterogeneous computing power device;

[0021] The first memory value corresponding to the current risk training subtask is processed with the occupied memory to obtain the extended memory of the current risk training subtask.

[0022] On the other hand, the currently idle heterogeneous computing power device is determined among multiple heterogeneous computing power devices, including:

[0023] Determine the currently idle heterogeneous computing power device among all heterogeneous computing power devices according to the first memory screening condition;

[0024] Among them, the first memory screening condition is the second memory screening condition or the third memory screening condition; the second memory screening condition is a heterogeneous computing device that is in a working state and has free memory; the third memory screening condition is a heterogeneous computing device that is in the process of executing a computing task and has free memory;

[0025] Determine whether there is a heterogeneous computing device in working state and with free memory among all heterogeneous computing devices; if there is, use the heterogeneous computing device in working state and with free memory as the current free heterogeneous computing device;

[0026] Alternatively, determine whether there is a heterogeneous computing power device that is executing a computing task and has free memory among all heterogeneous computing power devices; if so, use the heterogeneous computing power device that is executing a computing task and has free memory as the current free heterogeneous computing power device.

[0027] On the other hand, the memory of the currently idle heterogeneous computing device is scheduled according to the index information, the mutual access duration and the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask, including:

[0028] According to the index information, the mutual visit duration, and the heterogeneous computing power device to which the current risk training subtask belongs, the currently idle heterogeneous computing power device is screened to obtain the second target heterogeneous computing power device that can be scheduled for the current risk training subtask;

[0029] The free memory of the second target heterogeneous computing device is scheduled according to the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask.

[0030] On the other hand, according to the index information, the mutual visit duration and the heterogeneous computing power device to which the current risk training subtask belongs, the currently idle heterogeneous computing power device is screened to obtain the second target heterogeneous computing power device that can be scheduled for the current risk training subtask, including:

[0031] Obtain the preset mutual access latency between the memories of multiple heterogeneous computing devices;

[0032] Get the current risk heterogeneous computing device to which the current risk training subtask belongs;

[0033] In the currently idle heterogeneous computing devices, it is determined based on the index information whether the inter-access duration of the idle heterogeneous computing devices corresponding to the current risky heterogeneous computing devices is less than the preset inter-access delay;

[0034] If so, the idle heterogeneous computing power device corresponding to the mutual access time length being less than the preset mutual access delay is used as the second target heterogeneous computing power device.

[0035] On the other hand, according to the index information, the mutual visit duration and the heterogeneous computing power device to which the current risk training subtask belongs, the currently idle heterogeneous computing power device is screened to obtain the second target heterogeneous computing power device that can be scheduled for the current risk training subtask, including:

[0036] Obtain the preset mutual access latency between the memories of multiple heterogeneous computing devices;

[0037] Get the current risk heterogeneous computing power device and extended memory to which the current risk training subtask belongs;

[0038] In the currently idle heterogeneous computing devices, it is determined based on the index information whether the inter-access duration of the idle heterogeneous computing devices corresponding to the current risky heterogeneous computing devices is less than the preset inter-access delay;

[0039] If so, the idle heterogeneous computing device corresponding to the mutual access time shorter than the preset mutual access delay is used as the initial second target heterogeneous computing device;

[0040] Determine whether the extended memory of the current risk training subtask is less than or equal to the memory value of the initial second target heterogeneous computing power device;

[0041] If there is a memory value that is less than or equal to the initial second target heterogeneous computing power device, the initial second target heterogeneous computing power device whose extended memory of the current risk training subtask is less than or equal to the memory value of the initial second target heterogeneous computing power device will be used as the final second target heterogeneous computing power device.

[0042] On the other hand, scheduling the free memory of the second target heterogeneous computing device according to the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask, including:

[0043] Get the current free memory of all second target heterogeneous computing devices;

[0044] In the current free memory of all second target heterogeneous computing devices, determine whether there is an extended memory greater than or equal to the current risk training subtask;

[0045] If it exists, the second target heterogeneous computing power device corresponding to the extended memory that is greater than or equal to the current risk training subtask is used as the target heterogeneous computing power device to be scheduled;

[0046] According to the relationship between the current free memory of each target heterogeneous computing device to be scheduled and the extended memory of the current risk training subtask, determine the target heterogeneous computing device to be scheduled that has the smallest difference with the extended memory of the current risk training subtask, so as to complete the scheduling process of the extended memory of the current risk training subtask;

[0047] If it does not exist, the current free memory of the second target heterogeneous computing device is combined using a memory scheduling combination method to determine the same memory as the extended memory of the current risk training subtask for scheduling processing.

[0048] On the other hand, scheduling the free memory of the second target heterogeneous computing device according to the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask, including:

[0049] Obtain the free memory subset of all second target heterogeneous computing devices;

[0050] Selecting a current memory of the free memory subset; wherein the current memory is the memory of the free memory subset scheduled in a sequential order;

[0051] Determine whether the extended memory of the current risk training subtask is greater than the current memory;

[0052] If the extended memory of the current risk training subtask is less than or equal to the current memory, the second target heterogeneous computing device corresponding to the current memory is scheduled to complete the memory scheduling of the extended memory of the current risk training subtask;

[0053] If the extended memory of the current risk training subtask is larger than the current memory, the memory to be combined is determined according to the difference between the extended memory of the current risk training subtask and the current memory;

[0054] If the memory to be combined is larger than the next memory, the next memory after the next memory is scheduled, and so on, until the sum of the N memories after the current memory is equal to the extended memory of the current risk training subtask; the second target heterogeneous computing power device corresponding to the N memories after the current memory and the current memory is scheduled to complete the memory scheduling of the extended memory of the current risk training subtask; wherein N is a positive integer greater than or equal to 1;

[0055] If the memory to be combined is smaller than the next memory, the second target heterogeneous computing devices corresponding to the current memory and the next memory are scheduled to complete the memory scheduling of the extended memory of the current risk training subtask.

[0056] On the other hand, scheduling the free memory of the second target heterogeneous computing device according to the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask, including:

[0057] Obtain the free memory subset of all second target heterogeneous computing devices;

[0058] Sorting the free memory subsets in ascending order to obtain a first free memory subset;

[0059] If the first memory of the first free memory subset is greater than or equal to the extended memory of the current risk training subtask, the second target heterogeneous computing device corresponding to the first memory is scheduled to complete the memory scheduling of the extended memory of the current risk training subtask;

[0060] If the first memory of the first free memory subset is smaller than the extended memory of the current risk training subtask, the memory to be combined is determined according to the relationship between the extended memory of the current risk training subtask and the first memory of the first free memory subset;

[0061] If the memory to be combined is larger than the next memory, the next memory after the next memory is scheduled, and so on, until the sum of the N memories after the first memory is equal to the extended memory of the current risk training subtask; the second target heterogeneous computing power device corresponding to the N memories after the current memory and the current memory is scheduled to complete the memory scheduling of the extended memory of the current risk training subtask; wherein N is a positive integer greater than or equal to 1;

[0062] If the memory to be combined is smaller than the next memory, the second target heterogeneous computing devices corresponding to the first memory and the next memory are scheduled to complete the memory scheduling of the extended memory of the current risk training subtask.

[0063] On the other hand, after the memory scheduling of the extended memory of the current risk training subtask is completed and there is remaining memory in the memory to be combined, it also includes:

[0064] Re-adding the second target heterogeneous computing power device corresponding to the remaining memory to the first free memory subset;

[0065] The second free memory subset is updated and sorted in ascending order to obtain a third free memory subset, so as to facilitate memory scheduling for the next risk training subtask.

[0066] On the other hand, the training subtasks after the model training task is divided are obtained, including:

[0067] Obtain a distributed training strategy corresponding to the model training task; wherein the distributed training strategy includes at least one or more strategies of a data parallel strategy, a model parallel strategy, and a pipeline parallel strategy;

[0068] The model training task is divided into various training subtasks according to the distributed training strategy.

[0069] On the other hand, the process of determining the predicted peak memory of the current training subtask includes:

[0070] Get the peak memory corresponding to each training subtask when it is executed on a heterogeneous computing device;

[0071] Establish a mapping relationship between each peak memory and each training subtask;

[0072] The predicted peak memory of each training subtask is predicted through the mapping relationship; wherein the data form of the predicted peak memory is the numerical form of the memory of the training subtask.

[0073] On the other hand, the process of determining the predicted peak memory of the current training subtask includes:

[0074] Obtaining preset computing task features of each training subtask; wherein the preset computing task features are characteristic parameters of the computing tasks corresponding to each training subtask executed on the heterogeneous computing power device, and at least include data storage type features of each training subtask and model features of the model training task corresponding to each training subtask;

[0075] Get the peak memory corresponding to each training subtask when it is executed on a heterogeneous computing device;

[0076] Each peak memory is used as a data training set;

[0077] Perform feature extraction on the data training set according to the preset computing task features to obtain the actual computing task features corresponding to each training subtask;

[0078] Calling a neural network model, and inputting the actual computing task features into a feature embedding layer of the neural network model; wherein the neural network model is at least a first neural network model or a second neural network model, the first neural network model at least includes a feature embedding layer and a multilayer perceptron, and the second neural network model at least includes a feature embedding layer and a self-attention layer encoder;

[0079] The output parameters of the neural network model are obtained and used as the predicted peak memory of each training subtask.

[0080] On the other hand, the process of determining the neural network model includes:

[0081] Get the number of model training times;

[0082] Calling an initial neural network model, and inputting the actual computing task features into a feature embedding layer of the initial neural network model;

[0083] Obtaining the initial neural network model and the current number of iterations;

[0084] Determine the remaining number of iterations based on the relationship between the current number of iterations and the number of model training times;

[0085] If the remaining number of iterations is not 0, return to the step of calling the initial neural network model for training;

[0086] If the remaining number of iterations is 0, the neural network model corresponding to the current number of iterations is used as the final neural network model.

[0087] On the other hand, the model characteristics of each training subtask corresponding to the model training task include at least training accuracy, full connection computational complexity, convolutional layer computational complexity, pooling layer computational complexity, anti-overfitting layer computational complexity, norm layer computational complexity, fully connected layer computational complexity, self-attention layer computational complexity, loss function type, optimizer type, activation function type and number of activation function calls.

[0088] On the other hand, it also includes:

[0089] If the extended memory of the risk training subtask has not been scheduled, and the memory of the currently idle heterogeneous computing device is 0, the output result of no memory scheduling is returned.

[0090] On the other hand, the process of determining the preset memory tolerance value includes:

[0091] Obtain the predicted peak memory corresponding to each historical training subtask on the heterogeneous computing power device and the actual memory corresponding to the execution;

[0092] Establish a mapping relationship between the predicted peak memory and the actual memory corresponding to each historical training subtask on the heterogeneous computing power device; wherein the predicted peak memory and the actual memory corresponding to each historical training subtask on the heterogeneous computing power device correspond one to one;

[0093] Determine each difference information based on the predicted peak memory and the corresponding actual memory of each historical training subtask on the heterogeneous computing power device;

[0094] Averaging each difference information to obtain first average data;

[0095] Perform variance processing on each difference information to obtain first variance data;

[0096] Multiply the first variance data by 3 to obtain second variance data;

[0097] Adding the first average data and the second variance data to obtain first interval data;

[0098] The predicted peak memory corresponding to each historical training subtask in the heterogeneous computing power device is averaged to obtain the second average data;

[0099] The preset memory tolerance value is obtained by dividing the first interval data by the second average data.

[0100] In order to solve the above technical problems, the present invention also provides a heterogeneous computing system, including a host and a plurality of heterogeneous computing devices; the host is connected to each heterogeneous computing device respectively, and each heterogeneous computing device is connected to each other; each heterogeneous computing device includes a computing unit and a memory;

[0101] The host is used to obtain the index information and the duration of mutual access between the extended memory corresponding to the current risk training subtask and the memory of multiple heterogeneous computing devices; determine the current idle heterogeneous computing device among the multiple heterogeneous computing devices; and schedule the memory of the current idle heterogeneous computing device according to the index information, the duration of mutual access and the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask;

[0102] Multiple heterogeneous computing devices are used to execute the current risk training subtask and non-risk training subtasks in the training subtasks except the current risk training subtask after the current risk training subtask is memory scheduled, and output corresponding training calculation results.

[0103] In order to solve the above technical problems, the present invention further provides a memory scheduling device for a heterogeneous computing system, wherein the heterogeneous computing system includes a host and a plurality of heterogeneous computing devices; the host is connected to each heterogeneous computing device, and each heterogeneous computing device is connected to each other; each heterogeneous computing device includes a computing unit and a memory; the memory scheduling device includes:

[0104] An acquisition module is used to obtain the index information and duration of mutual access between the extended memory corresponding to the current risk training subtask and the memory of multiple heterogeneous computing devices;

[0105] A determination module, used to determine a currently idle heterogeneous computing power device among multiple heterogeneous computing power devices;

[0106] The scheduling processing module is used to schedule the memory of the currently idle heterogeneous computing device according to the index information, the mutual access time and the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask.

[0107] In order to solve the above technical problems, the present invention further provides a memory scheduling device for a heterogeneous computing system, comprising:

[0108] Memory for storing computer programs;

[0109] A processor is used to implement the steps of the memory scheduling method for a heterogeneous computing system as described above when executing the computer program.

[0110] To solve the above technical problems, the present invention also provides a non-volatile storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the memory scheduling method for a heterogeneous computing system as described above are implemented.

[0111] In order to solve the above technical problems, the present invention also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the memory scheduling method for a heterogeneous computing system as described above.

[0112] The present invention provides a memory scheduling method for a heterogeneous computing system, wherein the heterogeneous computing system includes a host and multiple heterogeneous computing devices; the host is connected to each heterogeneous computing device, respectively, and each heterogeneous computing device is connected to each other; each heterogeneous computing device includes a computing unit and a memory; the memory scheduling method includes: obtaining an extended memory corresponding to a current risk training subtask, index information of mutual accesses between memories of multiple heterogeneous computing devices, and a duration of mutual accesses; determining a currently idle heterogeneous computing device among multiple heterogeneous computing devices; and scheduling the memory of the currently idle heterogeneous computing device according to the index information, the duration of mutual accesses, and the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask.

[0113] The beneficial effect of the present invention is that the memory of the currently idle heterogeneous computing power device determined in the multiple heterogeneous computing power devices is scheduled based on the index information of the mutual access between the memories of multiple heterogeneous computing power devices, the mutual access duration and the extended memory of the current risk training subtask, so as to determine the memory scheduling corresponding to the extended memory of the risk training subtask, so that the extended memory of the risk training subtask with memory overflow can schedule the memory resources corresponding to the idle heterogeneous computing power device, improve the rational use of the memory resources of the heterogeneous computing power device, avoid the memory overflow error of the risk training subtask and the waste of idle memory resources of the idle heterogeneous computing power device. At the same time, the memory allocation of heterogeneous computing power is optimized without the user's perception, and the execution of distributed training tasks is optimized to solve the problem of flexible allocation of training task memory when the user does not understand the performance of the underlying hardware.

[0114] Secondly, the process of determining the index information of the mutual access between the memories of multiple heterogeneous computing devices is convenient for subsequent reference in the idle heterogeneous computing devices to ensure that the selected idle heterogeneous computing devices are accessed by the extended memory of the risk training subtask. The process of determining the extended memory and the preset memory tolerance value corresponding to the current risk training subtask, and the process of determining the extended memory corresponding to the current risk training subtask, are convenient for the memory scheduling of the subsequent idle heterogeneous computing devices according to the extended memory, thereby improving the memory scheduling efficiency. The process of determining the current idle heterogeneous computing devices is convenient for the subsequent screening of the heterogeneous computing devices that can schedule the memory for each risk training subtask based on the current idle heterogeneous computing devices. First, determine the second target heterogeneous computing device that can be scheduled for the current risk training subtask, and then schedule the idle memory of the second target heterogeneous computing device based on the extended memory of the current risk training subtask. Here, the second target heterogeneous computing device exclusive to the current risk training subtask is first screened to improve the efficiency of the memory scheduling of the entire training subtask. The two implementation methods corresponding to the determination of the second target heterogeneous computing device are both processes that take into account the memory access time, which provide guarantees for the efficiency of subsequent memory scheduling. At the same time, taking into account the memory access time, the memory value of the initial second target heterogeneous computing power device of the free memory is determined again, so that the second target heterogeneous computing power device corresponding to the subsequent scheduling memory process can improve the accuracy.

[0115] In addition, the present invention also provides a heterogeneous computing system, a memory scheduling device, equipment, medium and product of a heterogeneous computing system, which have the same beneficial effects as the memory scheduling method of the heterogeneous computing system mentioned above. BRIEF DESCRIPTION OF THE DRAWINGS

[0116] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0117] Figure 1 An abstract description diagram of a multi-heterogeneous computing system provided by an embodiment of the present invention;

[0118] Figure 2 A schematic diagram of traditional memory resource allocation for each heterogeneous computing device in a multi-heterogeneous computing system;

[0119] Figure 3 A flowchart of a memory scheduling method for a heterogeneous computing system provided by an embodiment of the present invention;

[0120] Figure 4 A flowchart of predicting peak memory provided by an embodiment of the present invention;

[0121] Figure 5 A schematic diagram of memory scheduling of another heterogeneous computing system provided by an embodiment of the present invention;

[0122] Figure 6 A structural diagram of a memory scheduling device for a heterogeneous computing system provided by an embodiment of the present invention;

[0123] Figure 7 A structural diagram of a memory scheduling device for a heterogeneous computing system provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0124] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0125] The core of the present invention is to provide a memory scheduling method, a heterogeneous computing system and a device for a heterogeneous computing system to solve the problem of unreasonable memory allocation corresponding to heterogeneous computing power devices in a multi-heterogeneous computing system.

[0126] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0127] In a multi-heterogeneous computing system, heterogeneous computing power with different computing performance, such as heterogeneous computing chips or computing cards, will be connected to the same distributed computing system and used to coordinate distributed training of neural network models. Since distributed training tasks require a large amount of memory resources, the memory owned by each heterogeneous computing power in the multi-heterogeneous computing system is different, which makes it difficult to reasonably split the training data and training tasks. When users use the multi-heterogeneous computing system for distributed training without understanding each heterogeneous computing power, it is easy to cause unreasonable memory allocation, which will cause the memory corresponding to some heterogeneous computing power to be idle, and the memory overflow error corresponding to the heterogeneous computing power will not be divided.

[0128] In order to solve the above problems, the present invention needs to use the memory interconnection and expansion technology of the cloud computing platform. It can be to use the open interconnection technology standard (Compute Express Link, CXL) protocol to achieve interconnection and mutual access between memories and achieve memory consistency. It can be to use high-speed GPU interconnection technology to achieve interconnection between GPU video memories. The coherent accelerator processor interface (CAPI) protocol can also achieve similar functions. The heterogeneous computing devices of the heterogeneous computing system of the present invention can achieve mutual memory connection and mutual access through the above-mentioned technologies.

[0129] Figure 1 An abstract description diagram of a multi-heterogeneous computing system provided for an embodiment of the present invention, in which distributed training tasks are assigned to each heterogeneous computing device. The host is respectively connected to each heterogeneous computing device, and each heterogeneous computing device is interconnected. Each heterogeneous computing device includes a computing unit and a memory, that is, each computing unit has a corresponding memory. Heterogeneous computing mainly refers to a computing method that uses computing units with different types of instruction sets and architectures to form a system. Common types of computing units include CPU, GPU, Digital Signal Processor (DSP), ASIC, FPGA, etc. Heterogeneous computing devices have different types of processors and corresponding memories, and their performance varies when processing different types of applications. Figure 1 As shown, Figure 1 The system includes four heterogeneous computing devices, namely heterogeneous computing device 1, heterogeneous computing device 2, heterogeneous computing device 3 and heterogeneous computing device 4. Each heterogeneous computing device is connected to a host 5, and each heterogeneous computing device is connected to each other. Heterogeneous computing device 1 includes a graphics processor and a memory, heterogeneous computing device 2 includes a field programmable logic gate array device and a memory, heterogeneous computing device 3 includes a dedicated integrated circuit device and a memory, and heterogeneous computing device 4 includes a data signal processor and a memory.

[0130] Computing power is the ability of a computer device or computing / data center to process information. It is the ability of computer hardware and software to work together to perform certain computing needs. The more times a device performs operations per second, the greater the computing power, which means stronger computing power. Figure 2 A schematic diagram of traditional memory resource allocation for each heterogeneous computing device in a multi-heterogeneous computing system, such as Figure 2As shown, after a distributed training task is deployed, it is allocated to heterogeneous computing devices 1 to 4. Heterogeneous computing devices 1 and 3 have idle memory waste, and heterogeneous computing devices 2 and 4 have memory overflow, which leads to unreasonable memory resource allocation. The memory scheduling method of the heterogeneous computing system provided by the present invention can solve the above technical problems.

[0131] Figure 3 A flowchart of a memory scheduling method for a heterogeneous computing system provided by an embodiment of the present invention is shown in FIG. Figure 3 As shown, the heterogeneous computing system includes a host and multiple heterogeneous computing devices; the host is connected to each heterogeneous computing device, and each heterogeneous computing device is connected to each other; each heterogeneous computing device includes a computing unit and a memory; the memory scheduling method includes:

[0132] S11: Obtain the index information and duration of mutual access between the extended memory corresponding to the current risk training subtask and the memories of multiple heterogeneous computing devices.

[0133] Specifically, if the current risk training subtask is a training subtask with a memory overflow risk, the memory allocated to the corresponding heterogeneous computing device by each training subtask can be compared with the preset memory, so that the training subtask corresponding to the preset memory can be determined as a risk training subtask. The peak memory allocated to the corresponding heterogeneous computing device by each training subtask can also be predicted and compared with the available memory allocated to the corresponding heterogeneous computing device, which is not limited here.

[0134] The number of tasks for the current risk training subtask can be one or multiple tasks processed in parallel, which can be set according to the actual situation. The extended memory corresponding to the current risk training subtask is the overflow memory corresponding to the overflow risk, that is, the memory value of other idle heterogeneous computing devices that need to be scheduled.

[0135] The index information of the mutual access between the memories of multiple heterogeneous computing devices is collectively referred to as the information that the memory of a heterogeneous computing device on the heterogeneous computing platform can access the memory of other heterogeneous computing devices. The index information of the mutual access between the memories of multiple heterogeneous computing devices in this embodiment is used for reference in idle heterogeneous computing devices to ensure that the memory of the currently idle heterogeneous computing device scheduled can be accessed by the extended memory of the risk training sub-training.

[0136] The memory access duration between multiple heterogeneous computing devices is the actual duration of one heterogeneous computing device accessing the memory of another heterogeneous computing device.

[0137] S12: Determine a currently idle heterogeneous computing device among multiple heterogeneous computing devices.

[0138] The currently idle heterogeneous computing power device may be a heterogeneous computing power device that can be used on the current heterogeneous computing power platform and has free memory. The standard for determining whether a heterogeneous computing power device is available may be that it is in a working state or is executing a computing task, which is not limited here. The multiple heterogeneous computing power devices are all heterogeneous computing power devices on the current heterogeneous computing power platform.

[0139] S13: Schedule the memory of the currently idle heterogeneous computing device according to the index information, the mutual access duration and the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask.

[0140] Based on the extended memory of the current risk training subtask, the memory of the current idle heterogeneous computing power device is scheduled according to the scheduling criteria such as index information and mutual access duration. In the specific scheduling process, the heterogeneous computing power device corresponding to the current risk training subtask can directly access the indexed idle heterogeneous computing power, and then schedule it in the memory of these idle heterogeneous computing power devices. It can also be judged and compared one by one by the memory of the current idle heterogeneous computing power devices to determine the idle heterogeneous computing power devices to be scheduled, so as to complete the memory scheduling of the current risk training subtask.

[0141] Since the currently idle heterogeneous computing power devices that each risk training subtask can select are universal, for example, the currently idle heterogeneous computing power device selected by risk training subtask A is A', and the currently idle heterogeneous computing power devices selected by risk training subtask B are A' and B'. After risk training subtask A schedules the currently idle heterogeneous computing power device A', the memory status of the available currently idle heterogeneous computing power devices of risk training subtask B is updated in real time.

[0142] A general term for various processors such as GPU, CPU and DPU, namely heterogeneous computing power (X processing unit, XPU). The final scheduling memory output result is, for example: the extended memory of XPU1 is 150MB, then the corresponding current idle heterogeneous computing power devices of the scheduling combination are: [(XPU2, 100MB), (XPU4, 50MB)]; the extended memory of XPU2 is 1000MB, then the corresponding current idle heterogeneous computing power devices of the scheduling are: [(XPU4, 1000MB)].

[0143] An embodiment of the present invention provides a memory scheduling method for a heterogeneous computing system, wherein the heterogeneous computing system includes a host and multiple heterogeneous computing devices; the host is connected to each heterogeneous computing device, respectively, and each heterogeneous computing device is connected to each other; each heterogeneous computing device includes a computing unit and a memory; the memory scheduling method includes: obtaining an extended memory corresponding to a current risk training subtask, index information of mutual accesses between memories of multiple heterogeneous computing devices, and a duration of mutual accesses; determining a currently idle heterogeneous computing device among multiple heterogeneous computing devices; and scheduling the memory of the currently idle heterogeneous computing device according to the index information, the duration of mutual accesses, and the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask. Based on the index information of the mutual access between the memories of multiple heterogeneous computing devices, the mutual access duration and the extended memory of the current risk training subtask, the memory of the currently idle heterogeneous computing device determined in the multiple heterogeneous computing devices is scheduled and processed, so as to determine the memory scheduling corresponding to the extended memory of the risk training subtask, so that the extended memory of the risk training subtask with memory overflow can schedule the memory resources corresponding to the idle heterogeneous computing device, improve the rational use of the memory resources of the heterogeneous computing device, avoid the memory overflow error of the risk training subtask and the waste of idle memory resources of the idle heterogeneous computing device. At the same time, the memory allocation of heterogeneous computing power is optimized without the user's perception, and the execution of distributed training tasks is optimized to solve the problem of flexible allocation of training task memory when the user does not understand the performance of the underlying hardware.

[0144] In some embodiments, a process of determining index information for mutual access between memories of multiple heterogeneous computing devices includes:

[0145] Obtain all heterogeneous computing devices under the heterogeneous computing platform corresponding to the model training task;

[0146] Determine whether there is a mutual access relationship between the current heterogeneous computing device and all heterogeneous computing devices except the current heterogeneous computing device;

[0147] If so, a mutual access mapping relationship will be established with the remaining heterogeneous computing devices that have a mutual access relationship with the current heterogeneous computing power to determine the index information of mutual access between the memories of multiple heterogeneous computing devices; wherein the mutual access mapping relationship is represented in the form of a mutual access list or a mutual access matrix.

[0148] Specifically, the index information of mutual access between the memories of multiple heterogeneous computing devices in this embodiment is information that records the mutual access to the memories between heterogeneous computing devices, and this is based on all heterogeneous computing devices under the heterogeneous computing platform. Whether there is a mutual access relationship between each heterogeneous computing device and the remaining heterogeneous computing devices among all heterogeneous computing devices except its own heterogeneous computing device, if so, it is necessary to mark and determine the index information of mutual access between the memories of the corresponding heterogeneous computing devices. Currently, the mutual access information of the corresponding heterogeneous computing devices is determined by each heterogeneous computing device, which can be achieved by establishing a mutual access list or mutual access matrix corresponding to each heterogeneous computing device. For example, the mutual access matrix MX ,in MX 1,2 Represents heterogeneous computing device 1 to access the memory of heterogeneous computing device 2.

[0149] The process of determining the index information of mutual access between the memories of multiple heterogeneous computing devices provided in this embodiment is convenient for subsequent reference in idle heterogeneous computing devices to ensure that the screened idle heterogeneous computing devices are accessed by the extended memory of the risk training sub-training.

[0150] In some embodiments, the process of determining the extended memory corresponding to the current risk training subtask includes:

[0151] Get the preset memory tolerance value;

[0152] Obtain each training subtask after the model training task is divided, and assign each training subtask to the corresponding first target heterogeneous computing power device;

[0153] Obtain the occupied memory corresponding to the first target heterogeneous computing power device;

[0154] Determine a first memory value according to a relationship between a predicted peak memory of a current training subtask and a preset memory tolerance value;

[0155] Determine whether the first memory value is greater than the occupied memory corresponding to the first target heterogeneous computing device to which the current training subtask belongs;

[0156] If it is greater than, the current training subtask is determined to be the current risk training subtask, and the first target heterogeneous computing power device corresponding to the current training subtask is used as the risk heterogeneous computing power device;

[0157] The first memory value corresponding to the current risk training subtask is processed with the occupied memory to obtain the extended memory of the current risk training subtask.

[0158] Specifically, get the preset memory tolerance value Q th And the first target heterogeneous computing power equipment The corresponding memory usage , where the first target heterogeneous computing device corresponds to n express n The first target heterogeneous computing device, R Indicates memory usage. Indicates n The memory occupied by the first target heterogeneous computing device. The preset memory tolerance value here can be specified as 10% to prevent memory overflow errors caused by inaccurate peak memory prediction.

[0159] Model training tasks are distributed training tasks in heterogeneous computing platforms. Distributed training tasks are to split the training tasks of a large machine learning or deep learning model into multiple subtasks, and complete the training process through the collaborative work of multiple computers or servers, which has the advantages of parallelization, accelerated training, and improved model effects.

[0160] In distributed training tasks, data and model parameters are usually distributed to different computing nodes for training. Each computing node independently calculates the gradient of a part of the data and transmits the gradient information to other nodes through the communication mechanism, thereby updating and optimizing the model parameters. The heterogeneous computing devices can be the same or different, and can be set according to the actual situation.

[0161] The division process may be the same as or different from the division process of traditional distributed training tasks, and is not limited here. Each training subtask after division is allocated to the corresponding first target heterogeneous computing power device. It should be noted that the number of first target heterogeneous computing power devices is less than or equal to the total heterogeneous computing power devices on the heterogeneous computing power platform. The allocation process is not limited and may be the same as or different from the traditional allocation process. The first memory value is determined based on the relationship between the predicted peak memory of the current training subtask and the preset memory tolerance value. It should be noted that it is necessary to compare the occupied memory of each training subtask with the first target heterogeneous computing power device one by one, so as to preliminarily screen out the training subtasks with the risk of memory errors. The set of predicted peak memory of each training subtask is List r =[ r 1, r 2,……, r n ], the relationship between the predicted peak memory and the preset memory tolerance value of each training subtask is: r i × (1+ Q th ),in, r i Indicates i The predicted peak memory of each training subtask is used to determine a first memory value, where the first memory value is based on the memory difference corresponding to each training subtask.

[0162] Determine whether the first memory value is greater than the occupied memory corresponding to the first target heterogeneous computing device to which the current training subtask belongs; if greater, determine that the current training subtask has a risk of memory error, and set the first target heterogeneous computing device corresponding to the current training subtask as a risky heterogeneous computing device. r i × (1+ Q th )- Is it greater than 0? If so, determine the i The training subtask is a risk training subtask. For the i The occupied memory corresponding to the first target heterogeneous computing power device.

[0163] The first memory value corresponding to the current risk training subtask is processed with the occupied memory to obtain the extended memory of the current risk training subtask, that is, risk i = r i × (1+ Q th )- , risk i Indicates i The extended memory of each training subtask is also the extended memory of the current risk training subtask. Similarly, after comparing all training subtasks one by one with the occupied memory of their corresponding first target heterogeneous computing devices, the risk training subtasks with memory errors are screened out as the current risk training subtask in step S11 of this embodiment.

[0164] In addition, a risk memory list can be established based on the current risk training subtask, the corresponding extended memory, and the corresponding risk heterogeneous computing power device, that is, ,in, z represents the number of risk training subtasks, represents the extended memory of the risk training subtask, Indicates the risky heterogeneous computing device corresponding to the risky training subtask, using the risky XPU identifier.

[0165] The process of determining the extended memory corresponding to the current risk training subtask provided in this embodiment facilitates the memory scheduling of subsequent idle heterogeneous computing devices according to the extended memory, thereby improving the memory scheduling efficiency.

[0166] In some embodiments, the process of determining the preset memory tolerance value includes:

[0167] Obtain the predicted peak memory corresponding to each historical training subtask on the heterogeneous computing power device and the actual memory corresponding to the execution;

[0168] Establish a mapping relationship between the predicted peak memory and the actual memory corresponding to each historical training subtask on the heterogeneous computing power device; wherein the predicted peak memory and the actual memory corresponding to each historical training subtask on the heterogeneous computing power device correspond one to one;

[0169] Determine each difference information based on the predicted peak memory and the corresponding actual memory of each historical training subtask on the heterogeneous computing power device;

[0170] Averaging each difference information to obtain first average data;

[0171] Perform variance processing on each difference information to obtain first variance data;

[0172] Multiply the first variance data by 3 to obtain second variance data;

[0173] Adding the first average data and the second variance data to obtain first interval data;

[0174] The predicted peak memory corresponding to each historical training subtask in the heterogeneous computing power device is averaged to obtain the second average data;

[0175] The first interval data is divided by the second average data to obtain a preset memory tolerance value.

[0176] Specifically, the preset memory tolerance value can be determined based on empirical values, or more accurate data can be obtained through data processing methods, such as determining each difference information in the mapping relationship between the predicted peak memory corresponding to each historical training subtask in the heterogeneous computing power device and each actual memory, and then performing average processing and variance processing on each difference information to obtain the corresponding first average data and first variance data; multiplying the first variance data by 3 to obtain the second variance data. The first average data and the second variance data are added to obtain the first interval data, where the first interval data is the maximum value corresponding to the valid range, and the predicted peak memory corresponding to the first interval data is abnormal data. The predicted peak memory corresponding to each historical training subtask in the heterogeneous computing power device is averaged to obtain the second average data. The first interval data is divided by the second average data to obtain the preset memory tolerance value.

[0177] For example, the predicted peak memory corresponding to each historical training subtask in the heterogeneous computing power device is a1, b1, c1, d1, and e1. The corresponding actual memory during execution is a2, b2, c2, d2, and e2, and the corresponding difference information is a3, b3, c3, d3, and e3. The difference information is averaged to obtain the first average data m1, and the difference information is processed with variance to obtain the first variance data σ. The first variance data is multiplied by 3 to obtain the second variance data 3σ. The first average data and the second variance data are added to obtain the first interval data m1+3σ. The predicted peak memory corresponding to each historical training subtask in the heterogeneous computing power device is averaged to obtain the second average data m2; the first interval data is divided by the second average data to obtain the preset memory tolerance value of (m1+3σ) / m2.

[0178] The preset memory tolerance value here can also be specified as an empirical value of 10%, which is not limited here.

[0179] The process of determining the preset memory tolerance value provided in this embodiment is to prevent the memory overflow error caused by inaccurate setting of the peak memory prediction, thereby reducing the risk of memory overflow error.

[0180] In some embodiments, determining a currently idle heterogeneous computing device among a plurality of heterogeneous computing devices includes:

[0181] Determine a currently idle heterogeneous computing device among all heterogeneous computing devices according to the first memory screening condition;

[0182] Among them, the first memory screening condition is the second memory screening condition or the third memory screening condition; the second memory screening condition is a heterogeneous computing device that is in a working state and has free memory; the third memory screening condition is a heterogeneous computing device that is in the process of executing a computing task and has free memory;

[0183] Determine whether there is a heterogeneous computing device in working state and with free memory among all heterogeneous computing devices; if there is, take the heterogeneous computing device in working state and with free memory as the current free heterogeneous computing device;

[0184] Alternatively, determine whether there is a heterogeneous computing device that is executing a computing task and has free memory among all heterogeneous computing devices; if so, take the heterogeneous computing device that is executing a computing task and has free memory as the current free heterogeneous computing device.

[0185] Specifically, the currently idle heterogeneous computing power devices are determined according to the first memory filtering condition among all heterogeneous computing power devices. The currently idle heterogeneous computing power devices may be determined according to the second memory filtering condition of heterogeneous computing power devices that are in working state and have idle memory, or according to the third memory filtering condition of heterogeneous computing power devices that are in execution of computing tasks and have idle memory. If the second memory filtering condition or the third memory filtering condition is met, the heterogeneous computing power devices that meet the second memory filtering condition or the third memory filtering condition will be regarded as idle heterogeneous computing power devices.

[0186] This embodiment provides a process for determining the currently idle heterogeneous computing power devices, so as to facilitate the subsequent screening of heterogeneous computing power devices that can schedule memory for each risk training subtask based on the currently idle heterogeneous computing power devices.

[0187] In some embodiments, the memory of the currently idle heterogeneous computing device is scheduled according to the index information, the mutual access duration, and the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask, including:

[0188] According to the index information, the mutual visit duration, and the heterogeneous computing power device to which the current risk training subtask belongs, the currently idle heterogeneous computing power device is screened to obtain the second target heterogeneous computing power device that can be scheduled for the current risk training subtask;

[0189] The free memory of the second target heterogeneous computing device is scheduled according to the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask.

[0190] Considering that a preset screening is performed in the subsequent scheduling process to ensure that the second target heterogeneous computing power devices can be scheduled for use. In other words, it is currently necessary to screen the current idle heterogeneous computing power devices based on the index information, the duration of the mutual visit, and the heterogeneous computing power devices assigned to the current risk training subtask to obtain the second target heterogeneous computing power devices that can be scheduled for the current risk training subtask. The current idle heterogeneous computing power devices are all idle heterogeneous computing power devices that meet the screening conditions on the heterogeneous computing power platform. Based on the index information, the second target heterogeneous computing power devices that can be scheduled for the current risk training subtask can be determined in the current idle heterogeneous computing power devices, that is, the second target heterogeneous computing power devices that are exclusively used for scheduling the current risk training subtask.

[0191] The free memory of the second target heterogeneous computing device is scheduled according to the extended memory of the current risk training subtask. The free memory here is the remaining free memory in the second target heterogeneous computing device excluding the memory corresponding to the working state or executing other computing tasks.

[0192] The second target heterogeneous computing device that can be scheduled for the current risk training subtask is first determined in this embodiment, and then the free memory of the second target heterogeneous computing device is scheduled based on the extended memory of the current risk training subtask. Here, the second target heterogeneous computing device exclusive to the current risk training subtask is first screened to improve the efficiency of the memory scheduling of the entire training subtask.

[0193] In some embodiments, the currently idle heterogeneous computing devices are screened according to the index information, the mutual visit duration, and the heterogeneous computing device to which the current risk training subtask belongs to obtain the second target heterogeneous computing device that can be scheduled for the current risk training subtask, including:

[0194] Obtain the preset mutual access latency between the memories of multiple heterogeneous computing devices;

[0195] Get the current risk heterogeneous computing device to which the current risk training subtask belongs;

[0196] In the currently idle heterogeneous computing devices, it is determined based on the index information whether the inter-access duration of the idle heterogeneous computing devices corresponding to the current risky heterogeneous computing devices is less than the preset inter-access delay;

[0197] If so, the idle heterogeneous computing power device corresponding to the mutual access time length being less than the preset mutual access delay is used as the second target heterogeneous computing power device.

[0198] It is understandable that, with regard to the relationship between the mutual visit duration and the preset mutual visit delay (generally set to 300ns, which can be set according to the delay requirements of the actual application), if the mutual visit duration is greater than the preset mutual visit delay, it means that the extended memory of the current risk training subtask takes up more time in the scheduling memory process, resulting in other risk training subtasks being unable to proceed, delaying the subsequent scheduling memory time.

[0199] Therefore, by setting the comparison relationship between the mutual visit duration and the preset mutual visit delay, among the currently idle heterogeneous computing power devices, it is determined according to the index information whether the mutual visit duration of the idle heterogeneous computing power device corresponding to the current risk heterogeneous computing power device is less than the preset mutual visit delay; if so, the idle heterogeneous computing power device corresponding to the mutual visit duration less than the preset mutual visit delay is used as the second target heterogeneous computing power device.

[0200] In other embodiments, the currently idle heterogeneous computing devices are screened according to the index information, the mutual access duration, and the heterogeneous computing device to which the current risk training subtask belongs to obtain the second target heterogeneous computing device that can be scheduled for the current risk training subtask, including:

[0201] Obtain the preset mutual access latency between the memories of multiple heterogeneous computing devices;

[0202] Get the current risk heterogeneous computing power device and extended memory to which the current risk training subtask belongs;

[0203] In the currently idle heterogeneous computing devices, it is determined based on the index information whether the inter-access duration of the idle heterogeneous computing devices corresponding to the current risky heterogeneous computing devices is less than the preset inter-access delay;

[0204] If so, the idle heterogeneous computing device corresponding to the mutual access time shorter than the preset mutual access delay is used as the initial second target heterogeneous computing device;

[0205] Determine whether the extended memory of the current risk training subtask is less than or equal to the memory value of the initial second target heterogeneous computing power device;

[0206] If there is a memory value that is less than or equal to the initial second target heterogeneous computing power device, the initial second target heterogeneous computing power device whose extended memory of the current risk training subtask is less than or equal to the memory value of the initial second target heterogeneous computing power device will be used as the final second target heterogeneous computing power device.

[0207] It can be understood that, based on the comparison between the mutual visit duration and the preset mutual visit delay in the above embodiment, the extended memory added to the risk training subtask is not greater than the memory value of the idle heterogeneous computing power device, so that the initial second target heterogeneous computing power device corresponding to the memory value less than or equal to the idle heterogeneous computing power device is used as the final second target heterogeneous computing power device. It should be noted that the idle heterogeneous computing power device corresponding to the mutual visit duration less than the preset mutual visit delay is used as the initial second target heterogeneous computing power device. The first screening is performed here, and then the initial second target heterogeneous computing power device is screened, mainly considering the real-time scheduling memory, and selecting the second target heterogeneous computing power device after the latest screening, so that the second target heterogeneous computing power device corresponding to the subsequent scheduling memory process improves the accuracy.

[0208] The two implementation methods corresponding to the determination of the second target heterogeneous computing power device in this embodiment are both processes that take into account the memory access duration, providing guarantees for the efficiency of subsequent memory scheduling. At the same time, based on the memory access duration, other embodiments again determine the memory value of the initial second target heterogeneous computing power device of the free memory, so that the second target heterogeneous computing power device corresponding to the subsequent scheduling memory process improves accuracy.

[0209] In some embodiments, scheduling the free memory of the second target heterogeneous computing device according to the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask includes:

[0210] Get the current free memory of all second target heterogeneous computing devices;

[0211] In the current free memory of all second target heterogeneous computing devices, determine whether there is an extended memory greater than or equal to the current risk training subtask;

[0212] If it exists, the second target heterogeneous computing power device corresponding to the extended memory that is greater than or equal to the current risk training subtask is used as the target heterogeneous computing power device to be scheduled;

[0213] According to the relationship between the current free memory of each target heterogeneous computing device to be scheduled and the extended memory of the current risk training subtask, determine the target heterogeneous computing device to be scheduled that has the smallest difference with the extended memory of the current risk training subtask, so as to complete the scheduling process of the extended memory of the current risk training subtask;

[0214] If it does not exist, the current free memory of the second target heterogeneous computing device is combined using a memory scheduling combination method to determine the same memory as the extended memory of the current risk training subtask for scheduling processing.

[0215] Specifically, in combination with the above embodiment, the list of currently free memory of the second target heterogeneous computing device that can be scheduled corresponding to the extended memory of each risk training subtask is:

[0216] ;

[0217] in, , respectively represent the risk training subtasks a The corresponding extended memory, the corresponding risk heterogeneous computing power equipment, and the schedulable second target heterogeneous computing power equipment; similarly, , respectively represent the risk training subtasks z Corresponding extended memory, corresponding risk heterogeneous computing power equipment, and schedulable second target heterogeneous computing power equipment.

[0218] In this embodiment, the second target heterogeneous computing power device corresponding to the extended memory greater than or equal to the current risk training subtask is directly selected from the list of actual memory of the second target heterogeneous computing power device that can be scheduled; if it exists, it is used as the target heterogeneous computing power device to be scheduled. Then, according to the relationship between the current free memory of each target heterogeneous computing power device to be scheduled and the extended memory of the current risk training subtask, the target heterogeneous computing power device to be scheduled with the smallest difference in extended memory with the current risk training subtask is determined, so that the full usability of the corresponding second target heterogeneous computing power device can be guaranteed while the entire target heterogeneous computing power device to be scheduled is scheduled.

[0219] In some embodiments, scheduling the free memory of the second target heterogeneous computing device according to the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask includes:

[0220] Obtain the free memory subset of all second target heterogeneous computing devices;

[0221] Selecting the current memory of the free memory subset; wherein the current memory is the memory of the free memory subset scheduled in the order of priority scheduling;

[0222] Determine whether the extended memory of the current risk training subtask is greater than the current memory;

[0223] If the extended memory of the current risk training subtask is less than or equal to the current memory, the second target heterogeneous computing device corresponding to the current memory is scheduled to complete the memory scheduling of the extended memory of the current risk training subtask;

[0224] If the extended memory of the current risk training subtask is larger than the current memory, the memory to be combined is determined according to the difference between the extended memory of the current risk training subtask and the current memory;

[0225] If the memory to be combined is larger than the next memory, the next memory after the next memory is scheduled, and so on, until the sum of the N memories after the current memory is equal to the extended memory of the current risk training subtask; the second target heterogeneous computing power device corresponding to the N memories after the current memory and the current memory is scheduled to complete the memory scheduling of the extended memory of the current risk training subtask; wherein N is a positive integer greater than or equal to 1;

[0226] If the memory to be combined is smaller than the next memory, the second target heterogeneous computing devices corresponding to the current memory and the next memory are scheduled to complete the memory scheduling of the extended memory of the current risk training subtask.

[0227] Specifically, in this embodiment, a random method is adopted, that is, the current memory is selected from the subset of free memory of all second-target heterogeneous computing power devices. There is no need to sort here, and it is directly scheduled in order. Determine whether the extended memory of the current risk training subtask is larger than the current memory; if it is larger, it means that the memory scheduling of the extended memory needs to schedule the free memory of multiple second-target heterogeneous computing power devices in a combined form, which determines the memory to be combined, that is, determines the specific value of the remaining free memory other than the current memory that needs to be combined. If the memory to be combined is larger than the next memory, it means that in addition to the current memory and the next memory, it needs to be combined, and so on, until the sum of the N memories after the current memory is equal to the extended memory of the current risk training subtask. Schedule the second target heterogeneous computing power devices corresponding to the N memories after the current memory and the current memory respectively to complete the memory scheduling of the extended memory of the current risk training subtask; wherein N is a positive integer greater than or equal to 1;

[0228] If the memory to be combined is smaller than the next memory, the second target heterogeneous computing devices corresponding to the current memory and the next memory are directly scheduled to complete the memory scheduling of the extended memory of the current risk training subtask.

[0229] If the extended memory of the current risk training subtask is less than or equal to the current memory, the second target heterogeneous computing device corresponding to the current memory is directly scheduled, which is the same as scheduling the entire target heterogeneous computing device to be scheduled in the above embodiment.

[0230] In some other embodiments, scheduling the free memory of the second target heterogeneous computing device according to the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask includes:

[0231] Obtain the free memory subset of all second target heterogeneous computing devices;

[0232] Sorting the free memory subsets in ascending order to obtain a first free memory subset;

[0233] If the first memory of the first free memory subset is greater than or equal to the extended memory of the current risk training subtask, the second target heterogeneous computing device corresponding to the first memory is scheduled to complete the memory scheduling of the extended memory of the current risk training subtask;

[0234] If the first memory of the first free memory subset is smaller than the extended memory of the current risk training subtask, the memory to be combined is determined according to the relationship between the extended memory of the current risk training subtask and the first memory of the first free memory subset;

[0235] If the memory to be combined is larger than the next memory, the next memory after the next memory is scheduled, and so on, until the sum of the N memories after the first memory is equal to the extended memory of the current risk training subtask; the second target heterogeneous computing power device corresponding to the N memories after the current memory and the current memory is scheduled to complete the memory scheduling of the extended memory of the current risk training subtask; wherein N is a positive integer greater than or equal to 1;

[0236] If the memory to be combined is smaller than the next memory, the second target heterogeneous computing devices corresponding to the first memory and the next memory are scheduled to complete the memory scheduling of the extended memory of the current risk training subtask.

[0237] Specifically, the free memory subsets are sorted in ascending order to obtain the first free memory subset. In the first free memory subset corresponding to the current risk training subtask, the first memory is first compared with the extended memory of the current risk training subtask. If the first memory of the first free memory subset is greater than or equal to the extended memory of the current risk training subtask, the second target heterogeneous computing device corresponding to the first memory is scheduled to complete the memory scheduling of the extended memory of the current risk training subtask; if the first memory of the first free memory subset is less than the extended memory of the current risk training subtask, the memory to be combined is determined according to the relationship between the extended memory of the current risk training subtask and the first memory of the first free memory subset. The memory to be combined in this embodiment is the same as the memory to be combined in the above embodiment, and will not be repeated here until the memory scheduling of the extended memory of the current risk training subtask is completed.

[0238] The memory scheduling processing method in this embodiment, whether it is a sorted combined memory method or a screening method to schedule the memory of the entire second target heterogeneous computing device, improves the flexibility and diversity of memory scheduling. It solves the problem of insufficient memory errors or memory waste caused by users' lack of understanding of the underlying hardware performance.

[0239] In some embodiments, after the memory scheduling of the extended memory of the current risk training subtask is completed and there is remaining memory in the memory to be combined, it also includes:

[0240] Re-adding the second target heterogeneous computing power device corresponding to the remaining memory to the first actual free memory subset;

[0241] The second actual free memory subset is updated and sorted in ascending order to obtain a third actual free memory subset, so as to facilitate memory scheduling for the next risk training subtask.

[0242] It is understandable that if there is remaining memory in the combined memory, it needs to be updated in real time, and the second target heterogeneous computing device corresponding to the remaining memory needs to be re-added to the first free memory subset, and sorted in order from small to large to obtain the third free memory subset, so as to facilitate memory scheduling for the next risk training subtask, ensure the rational use of free memory, and improve the memory resource utilization rate of free memory.

[0243] In some embodiments, obtaining each training subtask after the model training task is divided includes:

[0244] Obtain a distributed training strategy corresponding to the model training task; wherein the distributed training strategy includes at least one or more strategies of a data parallel strategy, a model parallel strategy, and a pipeline parallel strategy;

[0245] The model training task is divided into various training subtasks according to the distributed training strategy.

[0246] Specifically, parallelization is a key strategy for training large models in large-scale training. Different parallel technologies divide the training process into different dimensions, such as data parallelism, pipeline parallelism, model parallelism, etc. Taking GPU as an example, the data parallel strategy runs different subsets of the same batch of data on different GPUs, and pipeline parallelism runs different layers of the model on different GPUs; the model parallel strategy is to split a single mathematical operation (such as matrix multiplication) to run on different GPUs.

[0247] The model training task is divided according to one or more strategies in the distributed training strategy to obtain various training subtasks. The specific division process can be the same as the conventional division process or different, and is not limited here.

[0248] The distributed training strategy provided in this embodiment divides the model training task into various training subtasks to facilitate subsequent memory optimization of each training subtask.

[0249] In some embodiments, the process of determining the predicted peak memory of the current training subtask includes:

[0250] Get the peak memory corresponding to each training subtask when it is executed on a heterogeneous computing device;

[0251] Establish a mapping relationship between each peak memory and each training subtask;

[0252] The predicted peak memory of each training subtask is predicted through the mapping relationship; wherein the data form of the predicted peak memory is the numerical form of the memory of the training subtask.

[0253] Specifically, the predicted maximum memory usage of each training subtask is mainly taken into consideration, so as to determine whether each training subtask has the risk of memory error based on the predicted peak memory and the available memory corresponding to each training subtask in the allocated first target heterogeneous computing device, so as to avoid memory overflow.

[0254] The method for determining the predicted peak memory here is mainly to make a current prediction for the peak memory usage of each training subtask. The specific prediction method can be determined by fitting method or artificial intelligence model prediction. Fitting method: a fitting curve is established through each training subtask and the corresponding peak memory to predict the peak memory. Artificial intelligence model prediction: the computing task characteristics of each training subtask are used as the input of feature parameters, and the peak memory occupancy of each training subtask is used as the training set of labels. The artificial intelligence model can be a machine learning model or a deep learning model, which is not limited here. The computing task characteristics are abstract representations of each training subtask, using unified feature representation parameters, including input features and model features of the data storage type. The model features are based on the model parameters corresponding to the training subtasks.

[0255] In this embodiment, the peak memory is predicted by fitting. Based on the mapping relationship between the peak memories and the training subtasks corresponding to each training subtask when the training subtask is executed on the heterogeneous computing power device, the distribution of each peak memory is determined, and the peak memory is predicted by linear fitting. The specific linear fitting method can be performed by the least squares method or other fitting methods, which are not limited here. It can be understood that the peak memory is not in the form of a percentage, but in the form of a memory value of a separate training subtask.

[0256] In some other embodiments, the prediction can be made by an artificial intelligence model, that is, the process of determining the predicted peak memory of the current training subtask includes:

[0257] Obtaining preset computing task features of each training subtask; wherein the preset computing task features are characteristic parameters of the computing tasks corresponding to each training subtask executed on the heterogeneous computing power device, and at least include data storage type features of each training subtask and model features of the model training task corresponding to each training subtask;

[0258] Get the peak memory corresponding to each training subtask when it is executed on a heterogeneous computing device;

[0259] Each peak memory is used as a data training set;

[0260] Perform feature extraction on the data training set according to the preset computing task features to obtain the actual computing task features corresponding to each training subtask;

[0261] Calling a neural network model, and inputting actual computing task features into a feature embedding layer of the neural network model; wherein the neural network model is at least a first neural network model or a second neural network model, the first neural network model at least includes a feature embedding layer and a multilayer perceptron, and the second neural network model at least includes a feature embedding layer and a self-attention layer encoder;

[0262] Get the output parameters of the neural network model and use them as the predicted peak memory for each training subtask.

[0263] Specifically, each peak memory is used as a data training set, which is labeled and feature extracted to obtain the actual computing task features. The neural network model is called, and the actual computing task features are input into the feature embedding layer (feature embedding layer) of the neural network model. It should be noted that the neural network model in this embodiment can be a model including a feature embedding layer and a multilayer perceptron (Multilayer Perceptron, MLP), or a model including a feature embedding layer and a self-attention layer encoder (transformer encoder), which is not limited here.

[0264] Get the output parameters of the neural network model as the predicted peak memory for each training subtask.

[0265] Figure 4 A flowchart of predicting peak memory provided by an embodiment of the present invention, such as Figure 4 As shown, the input features of each training subtask, the model features of the subtask, and the peak memory usage value are collected, and then a training set is constructed with the input features and model features of the training subtask as input and the peak memory usage as the label, which is input into the feature embedding layer, and then passes through a multi-layer perceptron or a multi-layer self-attention layer encoder, and then output to the output layer of the multi-layer perceptron, and finally the predicted peak memory is output through the output layer of the multi-layer perceptron.

[0266] The preset computing task characteristics are characteristic parameters of the corresponding computing tasks executed by each training subtask on a heterogeneous computing device, and include at least the data storage type characteristics of each training subtask and the model characteristics of each training subtask corresponding to the model training task.

[0267] Specifically, the data storage type is the input feature of the training subtask, such as the batch_size of the training. In some embodiments, the model features of the model training task corresponding to each training subtask include at least training accuracy, full connection computational complexity, convolution layer computational complexity, pooling layer computational complexity, anti-overfitting layer computational complexity, normalization layer computational complexity, full connection layer computational complexity, self-attention layer computational complexity, loss function type, optimizer type, activation function type, and activation function call times.

[0268] It can be understood that the model characteristics of the subtasks are training accuracy, full connection computational complexity (floating point of operations (FLOPs), all units related to the neural network layer are in this unit), convolutional layer computational complexity, pooling layer computational complexity, anti-overfitting layer (dropout) computational complexity, batchnormalization layer computational complexity, recurrent neural network layer (RNN) computational complexity, self-attention layer computational complexity, loss function type, optimizer type, activation function type and activation function call times, etc.

[0269] In some embodiments, the process of determining the neural network model includes:

[0270] Get the number of model training times;

[0271] Call the initial neural network model and input the actual computing task features into the feature embedding layer of the initial neural network model;

[0272] Get the current iteration number of the initial neural network model;

[0273] Determine the remaining number of iterations based on the relationship between the current number of iterations and the number of model training times;

[0274] If the remaining number of iterations is not 0, return to the step of calling the initial neural network model for training;

[0275] If the remaining number of iterations is 0, the neural network model corresponding to the current number of iterations is used as the final neural network model.

[0276] Specifically, the training of the neural network model can be achieved by limiting the number of model training times to obtain the final model. Call the initial neural network model, input the actual computing task features into the feature embedding layer of the initial neural network model; obtain the current number of iterations of the initial neural network model; determine the remaining number of iterations based on the relationship between the current number of iterations and the number of model training times; if the remaining number of iterations is not 0, return to the step of calling the initial neural network model for training; if the remaining number of iterations is 0, use the neural network model corresponding to the current number of iterations as the final neural network model.

[0277] In addition, the final neural network model can also be determined by combining the number of iterations and the final output parameters. The maximum number of iterations and the preset number of iterations are set. The maximum number of iterations is greater than the preset number of iterations. When the preset number of iterations is reached, the predicted peak memory output by the neural network model corresponding to the current iteration is checked. If the current preset peak memory meets the preset peak memory, it means that the model training requirements are met and it can be used as the final neural network model. If the current preset peak memory does not meet the preset peak memory, continue to iterate until the number of iterations reaches the maximum number of iterations to obtain the corresponding neural network model.

[0278] The predicted peak memory obtained by the fitting method and the model prediction method provided in this embodiment enriches the diversity of prediction methods and improves the accuracy of prediction, providing a reliability basis for the subsequent determination of risk training subtasks.

[0279] In some embodiments, it also includes:

[0280] If the extended memory of the risk training subtask has not been scheduled, and the memory of the currently idle heterogeneous computing device is 0, the output result of no memory scheduling is returned.

[0281] Specifically, if the memory of the currently idle heterogeneous computing device is 0, that is, it is all occupied and there is no free memory, and the extended memory of the risk training subtask has not been scheduled, the output result of no memory scheduling is returned to ensure timely reminders and wait for the preset time, so that the second target heterogeneous computing device that is being used can update the latest usage after the corresponding computing task is completed.

[0282] Figure 5 A schematic diagram of memory scheduling of another heterogeneous computing system provided by an embodiment of the present invention is shown in FIG. Figure 5 As shown, the user issues a distributed training task, and the memory consumption prediction module of the distributed training task predicts the peak memory consumption of the sub-training task assigned to each heterogeneous computing power according to the characteristics of the training task issued by the user, and sends the result to the distributed training task memory optimization module. The heterogeneous computing power information collection module mainly collects the real-time status information of each computing power of the current multi-heterogeneous computing platform, and sends the result to the distributed training task memory optimization module. The distributed training task memory optimization module calculates the memory optimization plan based on the input of the above distributed training task memory consumption prediction module and the heterogeneous computing power information collection module, and feeds the plan back to the multi-heterogeneous computing platform for the execution of the distributed training task, obtains the memory optimization result, and sends the memory optimization result to the multi-heterogeneous computing platform.

[0283] It should be noted that the heterogeneous computing power information collection module is used to collect the status of each heterogeneous computing power in the multi-heterogeneous computing platform. This includes:

[0284] a. Working status of each heterogeneous computing power: monitor whether each heterogeneous computing power in the heterogeneous computing platform is in a working state.

[0285] b. Free memory value of each heterogeneous computing power: Monitor the free memory value of each heterogeneous computing power.

[0286] c. The latency of memory access between heterogeneous computing forces: monitors the latency of memory access between heterogeneous computing forces.

[0287] The two states a and b can usually be directly obtained by calling the status monitoring program in the heterogeneous computing power driver software. For c, it can be achieved using the memory latency test tool. The latency of accessing memory between heterogeneous computing power devices can be stored in the form of a matrix. It is worth noting that the status information of these heterogeneous computing power devices needs to be re-acquired every time it is used to calculate the memory optimization solution to ensure the real-time status information.

[0288] For example, in a heterogeneous computing system, a user submitted a task to train a large model, in which three heterogeneous computing devices, H100, H200, and MLU370, were selected to perform distributed training. In the subtasks submitted by the user, the peak memory prediction algorithm found that the peak memory usage of the subtasks in MLU370 exceeded the available memory of MLU370 by 10GB, while the peak memory usage of the subtasks in H200 was 30GB less than the available memory of H200. By adopting the memory scheduling strategy, the idle memory of H200 can be allocated to MLU370 through memory expansion technology, and finally the memory optimization of training large models is achieved.

[0289] Furthermore, the present invention also provides a heterogeneous computing system, comprising: a host and a plurality of heterogeneous computing devices; the host is connected to each heterogeneous computing device respectively, and each heterogeneous computing device is connected to each other; each heterogeneous computing device comprises a computing unit and a memory;

[0290] The host is used to obtain the index information and the duration of mutual access between the extended memory corresponding to the current risk training subtask and the memories of multiple heterogeneous computing devices; determine the current idle heterogeneous computing device among the multiple heterogeneous computing devices; schedule the memory of the current idle heterogeneous computing device according to the index information, the duration of mutual access and the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask;

[0291] Multiple heterogeneous computing devices are used to execute the current risk training subtask and non-risk training subtasks in the training subtasks except the current risk training subtask after the current risk training subtask is memory scheduled, and output corresponding training calculation results.

[0292] For an introduction to a heterogeneous computing system provided by the present invention, please refer to the above method embodiment, and the present invention will not be repeated here. It has the same beneficial effects as the memory scheduling method of the above heterogeneous computing system.

[0293] The above describes in detail various embodiments corresponding to the memory scheduling method for heterogeneous computing systems. On this basis, the present invention also discloses a memory scheduling device for a heterogeneous computing system corresponding to the above method. Figure 6 The structure diagram of a memory scheduling device for a heterogeneous computing system provided by an embodiment of the present invention. Figure 6 As shown, the heterogeneous computing system includes a host and multiple heterogeneous computing devices; the host is connected to each heterogeneous computing device, and each heterogeneous computing device is connected to each other; each heterogeneous computing device includes a computing unit and a memory; the memory scheduling device includes:

[0294] An acquisition module 11 is used to obtain index information and duration of mutual access between the extended memory corresponding to the current risk training subtask and the memory of multiple heterogeneous computing devices;

[0295] A determination module 12, used to determine a currently idle heterogeneous computing device among multiple heterogeneous computing devices;

[0296] The scheduling processing module 13 is used to schedule the memory of the currently idle heterogeneous computing power device according to the index information, the mutual access duration and the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask.

[0297] For an introduction to a memory scheduling device for a heterogeneous computing system provided by the present invention, please refer to the above method embodiment, and the present invention will not be repeated here. It has the same beneficial effects as the above memory scheduling method for a heterogeneous computing system.

[0298] Figure 7 A structural diagram of a memory scheduling device for a heterogeneous computing system provided by an embodiment of the present invention, such as Figure 7 As shown, the device includes:

[0299] A memory 21, used for storing computer programs;

[0300] The processor 22 is used to implement the steps of the memory scheduling method for the heterogeneous computing system when executing the computer program.

[0301] The memory scheduling device of the heterogeneous computing system provided in this embodiment may include but is not limited to a tablet computer, a laptop computer, or a desktop computer.

[0302] Among them, the processor 22 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 22 may be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 22 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 22 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 22 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.

[0303] The memory 21 may include one or more non-volatile storage media, which may be non-transitory. The memory 21 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 21 is at least used to store the following computer program 211, wherein, after the computer program is loaded and executed by the processor 22, it can implement the relevant steps of the memory scheduling method of the heterogeneous computing system disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 21 may also include an operating system 212 and data 213, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 212 may include Windows, Unix, Linux, etc. The data 213 may include, but is not limited to, data involved in the memory scheduling method of the heterogeneous computing system, etc.

[0304] In some embodiments, the memory scheduling device of the heterogeneous computing system may also include a display screen 23 , an input and output interface 24 , a communication interface 25 , a power supply 26 , and a communication bus 27 .

[0305] Those skilled in the art can understand that Figure 7 The structure shown in the figure does not constitute a limitation on the memory scheduling device of the heterogeneous computing system, and may include more or less components than those shown in the figure.

[0306] The processor 22 implements the memory scheduling method for the heterogeneous computing system provided by any of the above embodiments by calling the instructions stored in the memory 21 .

[0307] For an introduction to a memory scheduling device for a heterogeneous computing system provided by the present invention, please refer to the above method embodiment, and the present invention will not be repeated here. It has the same beneficial effects as the above memory scheduling method for a heterogeneous computing system.

[0308] Furthermore, the present invention also provides a non-volatile storage medium, on which a computer program is stored, and when the computer program is executed by the processor 22, the steps of the memory scheduling method for the heterogeneous computing system as described above are implemented.

[0309] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and executes all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0310] For an introduction to a non-volatile storage medium provided by the present invention, please refer to the above method embodiment, which will not be described in detail herein. It has the same beneficial effects as the above memory scheduling method for heterogeneous computing systems.

[0311] Furthermore, the present invention also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of a memory scheduling method for a heterogeneous computing system.

[0312] For an introduction to a computer program product provided by the present invention, please refer to the above method embodiment, which will not be described in detail herein. It has the same beneficial effects as the above memory scheduling method for heterogeneous computing systems.

[0313] The memory scheduling method, heterogeneous computing system and device provided by the present invention are introduced in detail above. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the present invention.

[0314] It should also be noted that, in this specification, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article 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, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A memory scheduling method for a heterogeneous computing system, characterized in that: The heterogeneous computing system includes a host and a plurality of heterogeneous computing devices; the host is connected to each heterogeneous computing device, and each heterogeneous computing device is connected to each other; Each heterogeneous computing device includes a computing unit and memory; Memory scheduling methods include: Obtain the index information and duration of mutual access between the extended memory corresponding to the current risk training subtask and the memories of multiple heterogeneous computing devices; wherein, the current risk training subtask is a training subtask with a memory overflow risk, specifically by comparing the memory allocated to the corresponding heterogeneous computing device by each training subtask with the preset memory, determining that the training subtask corresponding to the memory exceeding the preset memory is a risk training subtask; or, by predicting the peak memory allocated to the corresponding heterogeneous computing device by each training subtask, and comparing it with the available memory allocated to the corresponding heterogeneous computing device, the training subtask corresponding to the memory exceeding the available memory is a risk training subtask; the mutual access duration is the actual duration of one heterogeneous computing device accessing the memory of another heterogeneous computing device; Determine a currently idle heterogeneous computing device among multiple heterogeneous computing devices; The memory of the currently idle heterogeneous computing device is scheduled according to the index information, the mutual access duration and the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask.

2. The memory scheduling method for a heterogeneous computing system according to claim 1, characterized in that: The process of determining the index information for mutual access between the memories of multiple heterogeneous computing devices includes: Obtain all heterogeneous computing devices under the heterogeneous computing platform corresponding to the model training task; Determine whether there is a mutual access relationship between the current heterogeneous computing device and all heterogeneous computing devices except the current heterogeneous computing device; If so, a mutual access mapping relationship will be established with the remaining heterogeneous computing devices that have a mutual access relationship with the current heterogeneous computing power to determine the index information of mutual access between the memories of multiple heterogeneous computing devices; wherein the mutual access mapping relationship is represented in the form of a mutual access list or a mutual access matrix.

3. The memory scheduling method for a heterogeneous computing system according to claim 2, characterized in that: The process of determining the extended memory corresponding to the current risk training subtask includes: Get the preset memory tolerance value; Obtain each training subtask after the model training task is divided, and assign each training subtask to the corresponding first target heterogeneous computing power device; Obtain the occupied memory corresponding to the first target heterogeneous computing power device; Determine a first memory value according to a relationship between a predicted peak memory of a current training subtask and the preset memory tolerance value; Determine whether the first memory value is greater than the occupied memory corresponding to the first target heterogeneous computing device to which the current training subtask belongs; If it is greater than, the current training subtask is determined to be the current risk training subtask, and the first target heterogeneous computing power device corresponding to the current training subtask is used as the risk heterogeneous computing power device; The first memory value corresponding to the current risk training subtask is processed with the occupied memory to obtain the extended memory of the current risk training subtask.

4. The memory scheduling method for a heterogeneous computing system according to claim 3, characterized in that: Determine the currently idle heterogeneous computing devices among multiple heterogeneous computing devices, including: Determine the currently idle heterogeneous computing power device among all heterogeneous computing power devices according to the first memory screening condition; Among them, the first memory screening condition is the second memory screening condition or the third memory screening condition; the second memory screening condition is a heterogeneous computing device that is in a working state and has free memory; the third memory screening condition is a heterogeneous computing device that is in the process of executing a computing task and has free memory; Determine whether there is a heterogeneous computing device in working state and with free memory among all heterogeneous computing devices; if there is, use the heterogeneous computing device in working state and with free memory as the current free heterogeneous computing device; Alternatively, determine whether there is a heterogeneous computing power device that is executing a computing task and has free memory among all heterogeneous computing power devices; if so, use the heterogeneous computing power device that is executing a computing task and has free memory as the current free heterogeneous computing power device.

5. The memory scheduling method for a heterogeneous computing system according to claim 4, characterized in that: The memory of the currently idle heterogeneous computing device is scheduled according to the index information, the mutual access duration and the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask, including: According to the index information, the mutual visit duration, and the heterogeneous computing power device to which the current risk training subtask belongs, the currently idle heterogeneous computing power device is screened to obtain the second target heterogeneous computing power device that can be scheduled for the current risk training subtask; The free memory of the second target heterogeneous computing device is scheduled according to the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask.

6. The memory scheduling method for a heterogeneous computing system according to claim 5, characterized in that: According to the index information, the mutual access time and the heterogeneous computing power device to which the current risk training subtask belongs, the currently idle heterogeneous computing power device is screened to obtain the second target heterogeneous computing power device that can be scheduled for the current risk training subtask, including: Obtain the preset mutual access latency between the memories of multiple heterogeneous computing devices; Get the current risk heterogeneous computing device to which the current risk training subtask belongs; In the currently idle heterogeneous computing devices, it is determined based on the index information whether the inter-access duration of the idle heterogeneous computing devices corresponding to the current risky heterogeneous computing devices is less than the preset inter-access delay; If so, the idle heterogeneous computing power device corresponding to the mutual access time length being less than the preset mutual access delay is used as the second target heterogeneous computing power device.

7. The memory scheduling method for a heterogeneous computing system according to claim 5, characterized in that: According to the index information, the mutual access time and the heterogeneous computing power device to which the current risk training subtask belongs, the currently idle heterogeneous computing power device is screened to obtain the second target heterogeneous computing power device that can be scheduled for the current risk training subtask, including: Obtain the preset mutual access latency between the memories of multiple heterogeneous computing devices; Get the current risk heterogeneous computing power device and extended memory to which the current risk training subtask belongs; In the currently idle heterogeneous computing devices, it is determined based on the index information whether the inter-access duration of the idle heterogeneous computing devices corresponding to the current risky heterogeneous computing devices is less than the preset inter-access delay; If so, the idle heterogeneous computing device corresponding to the mutual access time shorter than the preset mutual access delay is used as the initial second target heterogeneous computing device; Determine whether the extended memory of the current risk training subtask is less than or equal to the memory value of the initial second target heterogeneous computing power device; If there is a memory value less than or equal to the initial second target heterogeneous computing power device, the initial second target heterogeneous computing power device whose extended memory of the current risk training subtask is less than or equal to the memory value of the initial second target heterogeneous computing power device will be used as the final second target heterogeneous computing power device.

8. The memory scheduling method for a heterogeneous computing system according to claim 6 or 7, characterized in that: Scheduling the free memory of the second target heterogeneous computing device according to the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask, including: Get the current free memory of all second target heterogeneous computing devices; In the current free memory of all second target heterogeneous computing devices, determine whether there is an extended memory greater than or equal to the current risk training subtask; If it exists, the second target heterogeneous computing power device corresponding to the extended memory that is greater than or equal to the current risk training subtask is used as the target heterogeneous computing power device to be scheduled; According to the relationship between the current free memory of each target heterogeneous computing device to be scheduled and the extended memory of the current risk training subtask, determine the target heterogeneous computing device to be scheduled that has the smallest difference with the extended memory of the current risk training subtask, so as to complete the scheduling process of the extended memory of the current risk training subtask; If it does not exist, the current free memory of the second target heterogeneous computing device is combined using a memory scheduling combination method to determine the same memory as the extended memory of the current risk training subtask for scheduling processing.

9. The memory scheduling method for a heterogeneous computing system according to claim 6 or 7, characterized in that: Scheduling the free memory of the second target heterogeneous computing device according to the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask, including: Obtain the free memory subset of all second target heterogeneous computing devices; Selecting a current memory of the free memory subset; wherein the current memory is the memory of the free memory subset scheduled in a sequential order; Determine whether the extended memory of the current risk training subtask is greater than the current memory; If the extended memory of the current risk training subtask is less than or equal to the current memory, the second target heterogeneous computing device corresponding to the current memory is scheduled to complete the memory scheduling of the extended memory of the current risk training subtask; If the extended memory of the current risk training subtask is larger than the current memory, the memory to be combined is determined according to the difference between the extended memory of the current risk training subtask and the current memory; If the memory to be combined is larger than the next memory, the next memory after the next memory is scheduled, and so on, until the sum of the N memories after the current memory is equal to the extended memory of the current risk training subtask; the second target heterogeneous computing power device corresponding to the N memories after the current memory and the current memory is scheduled to complete the memory scheduling of the extended memory of the current risk training subtask; wherein N is a positive integer greater than or equal to 1; If the memory to be combined is smaller than the next memory, the second target heterogeneous computing devices corresponding to the current memory and the next memory are scheduled to complete the memory scheduling of the extended memory of the current risk training subtask.

10. The memory scheduling method for a heterogeneous computing system according to claim 6 or 7, characterized in that: Scheduling the free memory of the second target heterogeneous computing device according to the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask, including: Obtain the free memory subset of all second target heterogeneous computing devices; Sorting the free memory subsets in ascending order to obtain a first free memory subset; If the first memory of the first free memory subset is greater than or equal to the extended memory of the current risk training subtask, the second target heterogeneous computing device corresponding to the first memory is scheduled to complete the memory scheduling of the extended memory of the current risk training subtask; If the first memory of the first free memory subset is smaller than the extended memory of the current risk training subtask, the memory to be combined is determined according to the relationship between the extended memory of the current risk training subtask and the first memory of the first free memory subset; If the memory to be combined is larger than the next memory, the next memory after the next memory is scheduled, and so on, until the sum of the N memories after the first memory is equal to the extended memory of the current risk training subtask; the second target heterogeneous computing power device corresponding to the N memories after the current memory and the current memory is scheduled to complete the memory scheduling of the extended memory of the current risk training subtask; wherein N is a positive integer greater than or equal to 1; If the memory to be combined is smaller than the next memory, the second target heterogeneous computing devices corresponding to the first memory and the next memory are scheduled to complete the memory scheduling of the extended memory of the current risk training subtask.

11. The memory scheduling method for a heterogeneous computing system according to claim 10, characterized in that: After the memory scheduling of the extended memory of the current risk training subtask is completed and there is remaining memory in the memory to be combined, it also includes: Re-adding the second target heterogeneous computing power device corresponding to the remaining memory to the first free memory subset; The second free memory subset is updated and sorted in ascending order to obtain a third free memory subset, so as to facilitate memory scheduling for the next risk training subtask.

12. The memory scheduling method for a heterogeneous computing system according to claim 3, characterized in that: Get the training subtasks after the model training task is divided, including: Obtain a distributed training strategy corresponding to the model training task; wherein the distributed training strategy includes at least one or more strategies of a data parallel strategy, a model parallel strategy, and a pipeline parallel strategy; The model training task is divided into various training subtasks according to the distributed training strategy.

13. The memory scheduling method for a heterogeneous computing system according to claim 12, characterized in that: The process of determining the predicted peak memory of the current training subtask includes: Get the peak memory corresponding to each training subtask when it is executed on a heterogeneous computing device; Establish a mapping relationship between each peak memory and each training subtask; The predicted peak memory of each training subtask is predicted through the mapping relationship; wherein the data form of the predicted peak memory is the memory numerical form of the training subtask.

14. The memory scheduling method for a heterogeneous computing system according to claim 12, characterized in that: The process of determining the predicted peak memory of the current training subtask includes: Obtaining preset computing task features of each training subtask; wherein the preset computing task features are characteristic parameters of the computing tasks corresponding to each training subtask executed on the heterogeneous computing power device, and at least include data storage type features of each training subtask and model features of the model training task corresponding to each training subtask; Get the peak memory corresponding to each training subtask when it is executed on a heterogeneous computing device; Each peak memory is used as a data training set; Perform feature extraction on the data training set according to the preset computing task features to obtain the actual computing task features corresponding to each training subtask; Calling a neural network model, and inputting the actual computing task features into a feature embedding layer of the neural network model; wherein the neural network model is at least a first neural network model or a second neural network model, the first neural network model at least includes a feature embedding layer and a multilayer perceptron, and the second neural network model at least includes a feature embedding layer and a self-attention layer encoder; The output parameters of the neural network model are obtained and used as the predicted peak memory of each training subtask.

15. The memory scheduling method for a heterogeneous computing system according to claim 14, characterized in that: The process of determining the neural network model includes: Get the number of model training times; Calling an initial neural network model, and inputting the actual computing task features into a feature embedding layer of the initial neural network model; Obtaining the current iteration number of the initial neural network model; Determine the remaining number of iterations based on the relationship between the current number of iterations and the number of model training times; If the remaining number of iterations is not 0, return to the step of calling the initial neural network model for training; If the remaining number of iterations is 0, the neural network model corresponding to the current number of iterations is used as the final neural network model.

16. The memory scheduling method for a heterogeneous computing system according to claim 14, characterized in that: The model characteristics of each training subtask corresponding to the model training task include at least training accuracy, full connection computational complexity, convolutional layer computational complexity, pooling layer computational complexity, overfitting prevention layer computational complexity, norm layer computational complexity, full connection layer computational complexity, self-attention layer computational complexity, loss function type, optimizer type, activation function type and activation function call count.

17. The memory scheduling method for a heterogeneous computing system according to claim 1, characterized in that: Also includes: If the extended memory of the risk training subtask has not been scheduled, and the memory of the currently idle heterogeneous computing device is 0, the output result of no memory scheduling is returned.

18. The memory scheduling method for a heterogeneous computing system according to claim 3, characterized in that: The process of determining the preset memory tolerance value includes: Obtain the predicted peak memory corresponding to each historical training subtask on the heterogeneous computing power device and the actual memory corresponding to the execution; Establish a mapping relationship between the predicted peak memory and the actual memory corresponding to each historical training subtask on the heterogeneous computing power device; wherein the predicted peak memory and the actual memory corresponding to each historical training subtask on the heterogeneous computing power device correspond one to one; Determine each difference information based on the predicted peak memory and the corresponding actual memory of each historical training subtask on the heterogeneous computing power device; Averaging each difference information to obtain first average data; Perform variance processing on each difference information to obtain first variance data; Multiply the first variance data by 3 to obtain second variance data; Adding the first average data and the second variance data to obtain first interval data; The predicted peak memory corresponding to each historical training subtask in the heterogeneous computing power device is averaged to obtain the second average data; The preset memory tolerance value is obtained by dividing the first interval data by the second average data.

19. A heterogeneous computing system, characterized in that: It includes a host and multiple heterogeneous computing devices; the host is connected to each heterogeneous computing device, and each heterogeneous computing device is connected to each other; each heterogeneous computing device includes a computing unit and a memory; The host is used to obtain index information and duration of mutual access between the extended memory corresponding to the current risk training subtask and the memory of multiple heterogeneous computing devices; Determine a currently idle heterogeneous computing device among multiple heterogeneous computing devices; The memory of the currently idle heterogeneous computing device is scheduled and processed according to the index information, the mutual access time and the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask; wherein, the current risk training subtask is a training subtask with a memory overflow risk, specifically by comparing the memory allocated to the corresponding heterogeneous computing device by each training subtask with the preset memory, determining that the training subtask corresponding to the preset memory is a risk training subtask; or, by predicting the peak memory allocated to the corresponding heterogeneous computing device by each training subtask, and comparing it with the available memory allocated to the corresponding heterogeneous computing device, the training subtask corresponding to the available memory is a risk training subtask; the mutual access time is the actual time length of one heterogeneous computing device accessing the memory of another heterogeneous computing device; Multiple heterogeneous computing devices are used to execute the current risk training subtask and non-risk training subtasks in the training subtasks except the current risk training subtask after the current risk training subtask is memory scheduled, and output corresponding training calculation results.

20. A memory scheduling device for a heterogeneous computing system, characterized in that: The heterogeneous computing system includes a host and a plurality of heterogeneous computing devices; the host is connected to each heterogeneous computing device, and each heterogeneous computing device is connected to each other; Each heterogeneous computing device includes a computing unit and memory; The memory scheduling device includes: An acquisition module is used to obtain the index information and mutual access duration between the extended memory corresponding to the current risk training subtask and the memory of multiple heterogeneous computing devices; wherein, the current risk training subtask is a training subtask with a memory overflow risk, specifically by comparing the memory allocated to the corresponding heterogeneous computing device by each training subtask with the preset memory, determining that the training subtask corresponding to the preset memory is a risk training subtask; or, by predicting the peak memory allocated to the corresponding heterogeneous computing device by each training subtask, and comparing it with the available memory allocated to the corresponding heterogeneous computing device, the training subtask corresponding to the available memory is a risk training subtask; the mutual access duration is the actual duration of one heterogeneous computing device accessing the memory of another heterogeneous computing device; A determination module, used to determine a currently idle heterogeneous computing power device among multiple heterogeneous computing power devices; The scheduling processing module is used to schedule the memory of the currently idle heterogeneous computing device according to the index information, the mutual access time and the extended memory of the current risk training subtask to complete the memory scheduling of the current risk training subtask.

21. A memory scheduling device for a heterogeneous computing system, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the memory scheduling method for a heterogeneous computing system as described in any one of claims 1 to 18 when executing the computer program.

22. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the memory scheduling method for a heterogeneous computing system as described in any one of claims 1 to 18 are implemented.

23. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps of the memory scheduling method for a heterogeneous computing system described in any one of claims 1 to 18 are implemented.

Citation Information

Patent Citations

  • Method and device for expanding synchronous memory bus function

    CN105095138A

  • DRAM (dynamic random access memory)-NVM (non-volatile memory) hierarchical heterogeneous memory access method and system adopting software and hardware collaborative management

    CN105786717A

  • Streaming data heterogeneous computing memory optimization method based on dynamic telescopic memory pool

    CN114048025A

  • Application program operation management method and device, equipment and readable storage medium

    CN116244077A

  • Federal transfer learning system

    CN116384504A