Model training method and device based on heterogeneous cluster and electronic equipment
By selecting the alternative pool and scheduling pool that meet the needs of training tasks in the heterogeneous cluster, and combining the load balance, resource fragmentation rate and topology score, the collaborative work of GPUs in the heterogeneous cluster is optimized and the computing problems in the heterogeneous cluster are solved. It solves the problem of low utilization efficiency of human resources and achieves efficient completion of model training tasks.
Patent Information
- Application Number
- CN202410867441.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-10-29
AI Technical Summary
How to effectively select image processors in heterogeneous clusters to fully utilize computing resources and complete large model training tasks. It is difficult to optimize the utilization of computing resources and task scheduling with existing technology.
By obtaining the GPU computing resources and topology structure diagram of the heterogeneous cluster, select an alternative pool that meets the needs of the training task, and determine the scheduling pool based on the load balance, resource fragmentation rate, and topology score to optimize the collaborative work of the GPUs.
It achieves more efficient completion of model training tasks, makes full use of the computing resources of heterogeneous clusters, and improves training efficiency and resource utilization.
Smart Images

Figure CN118862984A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a model training method, device and electronic device based on heterogeneous clusters. Background Art
[0002] With the rise of large models, higher requirements are placed on the computing resources required for large model training. Heterogeneous clusters are heterogeneous computing devices composed of multiple different types of central processing units and different types of image processors. The various image processors included in the heterogeneous cluster are scheduled to complete large model training together, thereby meeting the computing power resources required for large model training. How to select image processors in heterogeneous clusters to give full play to the computing power of heterogeneous clusters to complete model training tasks has become an urgent problem to be solved. Summary of the invention
[0003] In order to overcome the problems existing in the related art, this specification provides a model training method, device and electronic device based on heterogeneous clusters.
[0004] The embodiment of the present application provides a model training method based on heterogeneous clusters, the method comprising:
[0005] Obtain the computing power resources of each GPU included in the heterogeneous cluster and the GPU topology diagram of the heterogeneous cluster;
[0006] After obtaining the training task to be executed and the computing power resources required for the training task to be executed, select a candidate pool whose computing power resources meet the computing power resources required for the training task to be executed as a pre-selected pool; the candidate pool is obtained by dividing all GPUs in the heterogeneous cluster according to whether the types of training tasks supported are the same, and the types of training tasks supported by each GPU in the same candidate pool are the same;
[0007] A scheduling pool whose computing power evaluation value meets preset requirements is selected from the pre-selected pool; the computing power evaluation value is determined based on the load balancing degree, resource fragmentation rate and topology score of the pre-selected pool; the load balancing degree and the resource fragmentation rate are both determined based on the computing power resources of the GPUs included in the pre-selected pool, the topology score is determined based on the length of the transmission path between each GPU in the topology structure of the pre-selected pool, and the topology structure of the pre-selected pool is determined based on the GPU topology structure diagram of the heterogeneous cluster;
[0008] The training task is sent to the scheduling pool, so that the GPUs in the scheduling pool cooperate with each other to train the model specified by the training task.
[0009] Optionally, the computing power resources required for the training task to be executed include the GPU card type and the number of GPU cards required for the training task to be executed; the computing power resources of each GPU included in the heterogeneous cluster include the card type of each GPU;
[0010] The selecting a candidate pool of computing resources that meet the computing resources required by the to-be-performed training task as a pre-selected pool includes:
[0011] The candidate pool includes a GPU whose card type is consistent with the GPU card type required for the training task to be executed, and a candidate pool whose card number of GPUs is not less than the number of GPU cards required for the training task to be executed as a primary candidate pool;
[0012] Determine the GPU resources currently available in the primary candidate pool. When the GPU resources currently available in the primary candidate pool meet the GPU resources required by the training task to be executed, use the primary candidate pool as the pre-selected pool; the GPU resources required for the training task to be executed are determined according to the GPU card type required for the training task to be executed, the GPU resources corresponding to the GPU card type, and the number of GPU cards.
[0013] Optionally, selecting a scheduling pool whose computing power evaluation value meets preset requirements from a pre-selected pool includes:
[0014] For each pre-selected pool, determine the load balancing degree and resource fragmentation rate of the pre-selected pool based on the number of GPUs included in the pre-selected pool, the maximum value of the GPU utilization corresponding to each GPU, and the average value of the GPU utilization corresponding to each GPU;
[0015] The sum of the product of the load balancing degree of the pre-selected pool and the first weight, the product of the resource fragmentation rate of the pre-selected pool and the second weight, and the product of the topological structure score of the pre-selected pool and the third weight is taken as the computing power evaluation value of the pre-selected pool;
[0016] The pre-selected pool with the highest computing power evaluation value is selected from each pre-selected pool as the scheduling pool.
[0017] Optionally, after obtaining the computing power resources of each GPU included in the heterogeneous cluster, the following is further included:
[0018] When the computing power resources of each GPU included in the obtained heterogeneous cluster include the computing power resources of the GPU newly set up in the heterogeneous cluster, all GPUs in the heterogeneous cluster are divided into a new backup pool according to whether the types of training tasks supported are the same, and the step of selecting a candidate pool whose computing power resources meet the computing power resources required for the training task to be executed as a pre-selected pool is entered.
[0019] Optionally, after obtaining the computing power resources of each GPU included in the heterogeneous cluster, the following is further included:
[0020] Obtain monitoring indicator data of each GPU included in the heterogeneous cluster. When determining that a GPU corresponding to the monitoring indicator data is an abnormal GPU based on the monitoring indicator data, if the abnormal GPU is in a candidate pool or a pre-selection pool, delete the abnormal GPU from the candidate pool or the pre-selection pool; if the abnormal GPU is in a scheduling pool, delete the abnormal GPU from the scheduling pool, and add a normal GPU to the scheduling pool; the type of training tasks supported by the normal GPU is consistent with the type of training tasks supported by the abnormal GPU.
[0021] The embodiment of the present application also provides a model training device based on heterogeneous clusters, the device comprising:
[0022] An information acquisition module is used to obtain the computing resources of each GPU included in the heterogeneous cluster and the GPU topology diagram of the heterogeneous cluster;
[0023] A pre-selection pool determination module is used to select a candidate pool whose computing resources meet the computing resources required for the training task to be executed as a pre-selection pool after obtaining the training task to be executed and the computing resources required for the training task to be executed; the candidate pool is obtained by dividing all GPUs in the heterogeneous cluster according to whether the types of training tasks supported are the same, and the types of training tasks supported by each GPU in the same candidate pool are the same;
[0024] A scheduling pool determination module, used to select a scheduling pool whose computing power evaluation value meets preset requirements from the pre-selected pool; the computing power evaluation value is determined based on the load balancing degree, resource fragmentation rate and topology score of the pre-selected pool; the load balancing degree and the resource fragmentation rate are both determined based on the computing power resources of the GPUs included in the pre-selected pool, the topology score is determined based on the length of the transmission path between each GPU in the topology structure of the pre-selected pool, and the topology structure of the pre-selected pool is determined based on the GPU topology structure diagram of the heterogeneous cluster;
[0025] The model training module is used to send the training task to the scheduling pool so as to utilize the GPUs in the scheduling pool to cooperate with each other to train the model specified by the training task.
[0026] Optionally, the computing power resources required for the training task to be executed include the GPU card type and the number of GPU cards required for the training task to be executed; the computing power resources of each GPU included in the heterogeneous cluster include the card type of each GPU;
[0027] The selecting a candidate pool of computing resources that meet the computing resources required by the to-be-performed training task as a pre-selected pool includes:
[0028] The candidate pool includes a GPU whose card type is consistent with the GPU card type required for the training task to be executed, and a candidate pool whose card number of GPUs is not less than the number of GPU cards required for the training task to be executed as a primary candidate pool;
[0029] Determine the GPU resources currently available in the primary candidate pool, and when the GPU resources currently available in the primary candidate pool meet the GPU resources required by the training task to be executed, use the primary candidate pool as the pre-selected pool; the GPU resources required for the training task to be executed are determined according to the GPU card type required for the training task to be executed, the GPU resources corresponding to the GPU card type, and the number of GPU cards;
[0030] And / or, selecting a scheduling pool whose computing power evaluation value meets preset requirements from the pre-selected pool includes:
[0031] For each pre-selected pool, determine the load balancing degree and resource fragmentation rate of the pre-selected pool based on the number of GPUs included in the pre-selected pool, the maximum value of the GPU utilization corresponding to each GPU, and the average value of the GPU utilization corresponding to each GPU;
[0032] The sum of the product of the load balancing degree of the pre-selected pool and the first weight, the product of the resource fragmentation rate of the pre-selected pool and the second weight, and the product of the topological structure score of the pre-selected pool and the third weight is taken as the computing power evaluation value of the pre-selected pool;
[0033] The pre-selected pool with the highest computing power evaluation value is selected from each pre-selected pool as the scheduling pool.
[0034] Optionally, after obtaining the computing power resources of each GPU included in the heterogeneous cluster, the following is further included:
[0035] When the computing power resources of the GPUs included in the obtained heterogeneous cluster include the computing power resources of the GPU newly set up in the heterogeneous cluster, all GPUs in the heterogeneous cluster are divided into a new backup pool according to whether the types of training tasks supported are the same, and a step of selecting a candidate pool whose computing power resources meet the computing power resources required for the training task to be executed as a pre-selected pool is entered;
[0036] And / or, after obtaining the computing power resources of each GPU included in the heterogeneous cluster, it also includes:
[0037] Obtain monitoring indicator data of each GPU included in the heterogeneous cluster. When determining that a GPU corresponding to the monitoring indicator data is an abnormal GPU based on the monitoring indicator data, if the abnormal GPU is in a candidate pool or a pre-selection pool, delete the abnormal GPU from the candidate pool or the pre-selection pool; if the abnormal GPU is in a scheduling pool, delete the abnormal GPU from the scheduling pool, and add a normal GPU to the scheduling pool; the type of training tasks supported by the normal GPU is consistent with the type of training tasks supported by the abnormal GPU.
[0038] The present application also provides an electronic device, the electronic device comprising:
[0039] Processor; and
[0040] A memory, in which computer program instructions are stored, and when the computer program instructions are executed by the processor, the processor is caused to perform the steps in any of the above methods.
[0041] An embodiment of the present application further provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor is caused to execute the steps in any of the above methods.
[0042] The beneficial effect of the present application is to provide a model training method, device and electronic device based on a heterogeneous cluster, obtain the computing power resources and GPU topology diagram of each GPU of the heterogeneous cluster; after receiving the training task to be executed, select the candidate pool whose computing power resources meet the computing power resources required by the training task to be executed as the pre-selected pool, and select the scheduling pool whose computing power evaluation value meets the preset requirements from the pre-selected pool to use each GPU of the scheduling pool to complete the training task. The computing power evaluation value of the pre-selected pool is determined based on the load balance, resource fragmentation rate and topology score of the pre-selected pool, the load balance and resource fragmentation rate are determined based on the computing power resources of the GPU in the pre-selected pool, and the topology score is determined based on the length of the transmission path between each GPU in the topology of the pre-selected pool. The computing power resources are used to measure the computing power capacity of each GPU, and the scheduling pool is selected to complete the training task in combination with the load balance, resource fragmentation rate and topology of the pre-selected pool, so as to give full play to the capabilities of the heterogeneous cluster. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the specification and, together with the description, serve to explain the principles of the specification.
[0044] Figure 1 A first flow chart of a model training method based on heterogeneous clusters provided in an embodiment of the present application;
[0045] Figure 2A first virtual architecture schematic diagram of a model training method based on a heterogeneous cluster provided in an embodiment of the present application;
[0046] Figure 3 A second flow chart of a model training method based on heterogeneous clusters provided in an embodiment of the present application;
[0047] Figure 4 A schematic diagram of the structure of a model training device based on heterogeneous clusters provided in an embodiment of the present application;
[0048] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application and to make the above-mentioned purposes, features and advantages of the embodiments of the present application more obvious and understandable, the technical solutions in the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings.
[0050] In order to fully utilize the computing power of heterogeneous clusters to complete the task of model training, this application provides a model training method based on heterogeneous clusters. Please refer to Figure 1 , Figure 1 A first flow chart of a model training method based on heterogeneous clusters provided in an embodiment of the present application, the method comprising:
[0051] S101, obtaining computing resources of each GPU included in the heterogeneous cluster and a GPU topology diagram of the heterogeneous cluster;
[0052] A heterogeneous cluster is a heterogeneous computing device composed of different types of GPUs and other related devices. That is to say, there are many different types of GPUs deployed in the heterogeneous cluster (including but not limited to GPUs from different manufacturers). When using a heterogeneous cluster to complete the training tasks to be executed, it is necessary to reasonably select various types of GPUs to complete the tasks to be executed together, so as to give full play to the computing power of the heterogeneous cluster and improve the efficiency of completing the training tasks to be executed. This application uses the computing power resources of the GPU as an indicator to measure the GPU capabilities, uses the computing power resources of the GPU to abstractly describe the capabilities of various types of GPUs, and defines a general measurement indicator of computing power capabilities, thereby shielding the hardware differences of various types of GPUs, so as to select the appropriate GPU to complete the training tasks to be executed later.
[0053] Please refer to Figure 2 , Figure 2 A first virtual architecture diagram of a model training method based on a heterogeneous cluster provided in an embodiment of the present application, Figure 2GPUs from different manufacturers also report their own K8s resource information, hardware information, and monitoring index information to the computing resource monitoring module in the platform that executes the model training method based on heterogeneous clusters provided in this application. Among them, K8s resource information is the resource name registered by each manufacturer to K8s, such as NVIDA GPU or AMD GPU, etc.; hardware information includes the PCIe identification number corresponding to the GPU in the heterogeneous cluster, etc., which is used for subsequent monitoring of the GPU's computing resources based on the PCIe identification number; monitoring index information includes but is not limited to the temperature of the GPU and the utilization rate of the GPU, etc., and whether the GPU is abnormal can be detected by whether the temperature of the GPU exceeds the preset temperature value, so that when an abnormal GPU appears in the heterogeneous cluster, the GPU included in the alternative pool can be updated in time to ensure that the training tasks to be executed can be executed smoothly. By Figure 2 The heterogeneous scheduling module in the heterogeneous cluster-based model training platform completes the operations of determining the candidate pool, determining the pre-selected pool, determining the scheduling pool, and sending the training tasks to be executed to the scheduling pool based on the computing power resources of each GPU.
[0054] S102, after obtaining the training task to be executed and the computing resources required for the training task to be executed, select a candidate pool whose computing resources meet the computing resources required for the training task to be executed as a pre-selected pool; the candidate pool is obtained by dividing all GPUs in the heterogeneous cluster according to whether the types of training tasks supported are the same, and the types of training tasks supported by each GPU in the same candidate pool are the same;
[0055] This application divides all GPUs in a heterogeneous cluster into different candidate pools according to whether the types of training tasks supported are the same, ensuring that the types of training tasks supported by GPUs in the same candidate pool are the same, so that the GPUs in the candidate pool can be used to jointly complete the training tasks to be executed. The types of training tasks supported by each GPU can be determined in advance through a test algorithm, and the pooling classification of each GPU can be completed using a preset model, so that the GPUs of the types of training tasks supported can be divided into a candidate pool.
[0056] Before sending the training task to be executed, the computing power resources required for the training task to be executed are preliminarily determined through the preset test model, and then the task to be executed and the computing power resources required to complete the task to be executed are sent to the platform for executing the model training method based on heterogeneous clusters provided in this application. The candidate pool whose computing power resources meet the computing power resources required for the training task to be executed is used as the pre-selected pool. The computing power resources of the candidate pool are the sum of the computing power resources of each GPU included in the candidate pool.
[0057] As an optional embodiment, the computing power resources of the training task to be executed may include the GPU card type and the number of GPU cards required for the training task to be executed; the computing power resources of each GPU included in the heterogeneous cluster include the card type of each GPU.
[0058] Selecting a candidate pool whose computing power resources meet the computing power resources required for the training task to be executed as a pre-selected pool, including: using the candidate pool as a primary candidate pool, the GPU card type included in the candidate pool is consistent with the GPU card type required for the training task to be executed, and the number of GPU cards included in the candidate pool is not less than the number of GPU cards required for the training task to be executed. Determine the GPU resources currently available in the primary candidate pool, and when the GPU resources currently available in the primary candidate pool meet the GPU resources required for the training task to be executed, use the primary candidate pool as a pre-selected pool; the GPU resources required for the training task to be executed are determined based on the GPU card type required for the training task to be executed, the GPU resources corresponding to the GPU card type, and the number of GPU cards.
[0059] That is, first preliminarily screen out the primary candidate pool that meets the requirements based on whether the card type and number of GPUs in the candidate pool match the GPU card type and number of GPU cards required for the training task to be performed. Considering that the GPUs in the candidate pool may be performing other training tasks, it is necessary to further determine the GPU resources currently available in the primary candidate pool, and then determine whether the GPU resources actually available in the primary candidate pool meet the GPU resources required for the training task to be performed, and finally screen out the pre-selected pool that meets the requirements. It should be noted that when the card type of the GPU is determined, the maximum GPU resources that the GPU can provide are also determined. Therefore, the GPU resources required for the training task to be performed can be determined based on the GPU card type required for the training task to be performed, the GPU resources corresponding to the GPU card type, and the number of GPU cards.
[0060] Please refer to Figure 3 , Figure 3 A second flow chart of a model training method based on heterogeneous clusters provided for an embodiment of the present application. According to whether the type of training tasks supported is the same, GPU1 to GPU10 are divided into different candidate pools, wherein candidate pool 1 includes 3 target card-type GPUs (GPU1, GPU2 and GPU3), candidate pool 2 includes 3 target card-type GPUs (GPU4, GPU5 and GPU6), and candidate pool 3 and candidate pool 4 include 2 GPUs of other card types respectively. If the number of GPU cards required for training tasks to be performed is 3, and the required GPU card type is the target card type, and the currently available GPU resources of candidate pool 1 and candidate pool 2 all meet the GPU resources required for training tasks to be performed (the GPU resources that the GPU of 3* single target card type can provide), then candidate pool 1 is used as pre-selected pool 1, and candidate pool 2 is used as pre-selected pool 2.
[0061] S103, selecting a scheduling pool whose computing power evaluation value meets preset requirements from the pre-selected pool; the computing power evaluation value is determined based on the load balancing degree, resource fragmentation rate and topology score of the pre-selected pool; the load balancing degree and resource fragmentation rate are both determined based on the computing power resources of the GPUs included in the pre-selected pool, the topology score is determined based on the length of the transmission path between each GPU in the topology structure of the pre-selected pool, and the topology structure of the pre-selected pool is determined based on the GPU topology structure diagram of the heterogeneous cluster;
[0062] When multiple GPUs in the pre-selected pool are used to jointly complete the training tasks to be executed, there are many ways to send the training tasks to be executed to each GPU. First, based on load balancing considerations, the training tasks to be executed are evenly sent to each GPU in the pre-selected pool; second, the training tasks to be executed are concentrated and sent to several GPUs in the pre-selected pool to reduce the resource fragmentation rate. Therefore, this application determines the load balancing degree and resource fragmentation rate of each pre-selected pool for each pre-selected pool. The load balancing degree can evaluate the balance of the load distribution of each GPU in the pre-selected pool, and the resource fragmentation rate can evaluate whether the computing power resources in the pre-selected pool are effectively utilized. The scheduling pool is jointly selected according to the load balancing degree and resource fragmentation rate of the pre-selected pool, so that the scheduling pool finally selected has a relatively good performance in load balancing and resource fragmentation rate.
[0063] As an optional embodiment, for each pre-selected pool, the load balancing degree and resource fragmentation rate of the pre-selected pool are determined based on the number of GPUs included in the pre-selected pool, the maximum value of the GPU utilization rate corresponding to each GPU, and the average value of the GPU utilization rate corresponding to each GPU. For example, the load balancing degree RB and the resource fragmentation rate LB are calculated by the following formulas:
[0064]
[0065] Where N represents the number of GPUs included in the pre-selected pool. Indicates the average GPU utilization corresponding to each GPU, n jk represents the maximum value of the GPU utilization corresponding to each GPU, and m represents the number of resource indicators used (in this embodiment, GPU utilization is used as the resource indicator).
[0066] On this basis, the present application also takes into account that the pre-selection pool includes multiple GPUs. When each GPU is used to complete the training task to be executed, the data that needs to be synchronized needs to be transmitted between each GPU. If the transmission path between two GPUs is relatively short, the transmission speed of the two GPUs is relatively fast. The length of the transmission path between each GPU in the pre-selection pool can also be used as a measurement indicator for selecting a scheduling pool from the pre-selection pool. Therefore, the present application also determines the topological structure of the pre-selection pool based on the GPU topological structure diagram of the heterogeneous cluster. If the GPU in the pre-selection pool belongs to the GPU under the same node of the heterogeneous cluster, the topological structure diagram corresponding to the node in the topological structure diagram of the heterogeneous cluster can be intercepted as the topological structure diagram of the pre-selection pool; if the GPU in the pre-selection pool belongs to the GPU under different nodes of the heterogeneous cluster, it is also necessary to determine the interconnection form between each node according to the topological structure diagram of the heterogeneous cluster, and then determine the topological structure of each GPU in the pre-selection pool. The topological structure score of the pre-selection pool is determined based on the length of the transmission path between each GPU in the topological structure of the pre-selection pool. For the pre-selection pool with a higher topological structure score, the efficiency of data transmission of the GPU in the pre-selection pool is also relatively high, and the training task to be executed can be completed faster.
[0067] After determining the load balance, resource fragmentation rate and topological structure score of each pre-selected pool, determine the computing power evaluation value of the pre-selected pool according to the load balance, resource fragmentation rate and topological structure score of the pre-selected pool, and use the pre-selected pool whose computing power evaluation value meets the preset requirements as the scheduling pool. For example, a first weight is set for the load balance of the pre-selected pool, a second weight is set for the resource fragmentation rate, and a third weight is set for the topological structure score. For each pre-selected pool, the product of the load balance of the pre-selected pool and the first weight, the product of the resource fragmentation rate of the pre-selected pool and the second weight, and the product of the topological structure score of the pre-selected pool and the third weight is used as the computing power evaluation value of the pre-selected pool. The pre-selected pool with the highest computing power evaluation value is selected from each pre-selected pool as the scheduling pool.
[0068] The computing power evaluation value σ can be expressed as: σ = w_1RB + w_2LB + w_3TOPO;
[0069] Among them, w_1 is the first weight, w_2 is the second weight, w_3 is the third weight, RB is the load balancing degree, LB is the resource fragmentation rate, and TOPO is the topology score. The first weight, the second weight, and the third weight can be adjusted according to different scenarios and user preferences, and this application does not make special limitations.
[0070] Please refer to Figure 3 , Figure 3 A second flow chart of a model training method based on heterogeneous clusters provided in an embodiment of the present application. Figure 3The pre-selected pool includes pre-selected pool 1 and pre-selected pool 2. For pre-selected pool 1, the load balance and resource fragmentation rate of pre-selected pool 1 are determined according to the maximum value of the GPU utilization of each GPU in pre-selected pool 1 and the average value of the GPU utilization corresponding to each GPU, and then the first topology score of pre-selected pool 1 is determined according to the topology corresponding to GPU1, GPU2 and GPU3 in pre-selected pool 1. The first computing power evaluation value of pre-selected pool 1 is determined based on the product of the load balance of pre-selected pool 1 and the first weight, the product of the resource fragmentation rate of pre-selected pool 1 and the second weight, and the sum of the product of the topology score of pre-selected pool 1 and the third weight. Similarly, the second computing power evaluation value of pre-selected pool 2 is determined. The second computing power evaluation value is greater than the first computing power evaluation value, so pre-selected pool 2 is used as the scheduling pool.
[0071] S104: Send the training task to the scheduling pool, so that the GPUs in the scheduling pool cooperate with each other to train the model specified by the training task.
[0072] After the scheduling pool is determined, the training task is sent to the scheduling pool, and the GPUs in the scheduling pool cooperate with each other to complete the model training. Each GPU in the scheduling pool participates in the model training. As for how to allocate the training tasks to each GPU, it can be adjusted according to actual needs, such as using data parallelism, model parallelism or hybrid parallelism to perform model training.
[0073] In summary, the present application provides a model training method based on a heterogeneous cluster, obtains the computing power resources and GPU topology diagram of each GPU of the heterogeneous cluster; after receiving the training task to be executed, selects a candidate pool whose computing power resources meet the computing power resources required for the training task to be executed as a pre-selected pool, and selects a scheduling pool whose computing power evaluation value meets the preset requirements from the pre-selected pool to use each GPU in the scheduling pool to complete the training task. The computing power evaluation value of the pre-selected pool is determined based on the load balance, resource fragmentation rate and topology score of the pre-selected pool. The load balance and resource fragmentation rate are determined based on the computing power resources of the GPUs in the pre-selected pool, and the topology score is determined based on the length of the transmission path between each GPU in the topology of the pre-selected pool. The computing power resources are used to measure the computing power capabilities of each GPU, and the scheduling pool is selected to complete the training task in combination with the load balance, resource fragmentation rate and topology of the pre-selected pool, so as to give full play to the capabilities of the heterogeneous cluster.
[0074] Based on the above embodiments:
[0075] As an optional embodiment, after obtaining the computing power resources of each GPU included in the heterogeneous cluster, the method further includes:
[0076] When the computing power resources of each GPU included in the obtained heterogeneous cluster include the computing power resources of the GPU newly set up in the heterogeneous cluster, all GPUs in the heterogeneous cluster are divided into a new backup pool according to whether the types of training tasks supported are the same, and the step of selecting a candidate pool whose computing power resources meet the computing power resources required for the training task to be executed as a pre-selected pool is entered.
[0077] Obtain monitoring indicator data of each GPU included in the heterogeneous cluster. When determining that a GPU corresponding to the monitoring indicator data is an abnormal GPU based on the monitoring indicator data, if the abnormal GPU is in a candidate pool or a pre-selection pool, delete the abnormal GPU from the candidate pool or the pre-selection pool; if the abnormal GPU is in a scheduling pool, delete the abnormal GPU from the scheduling pool, and add a normal GPU to the scheduling pool; the type of training tasks supported by the normal GPU is consistent with the type of training tasks supported by the abnormal GPU.
[0078] In this embodiment, the platform that executes the model training method based on heterogeneous clusters can also identify the status of the GPU in the heterogeneous cluster in real time (for example, whether a new GPU is added to the heterogeneous cluster, or whether an abnormal GPU appears in the heterogeneous cluster), so as to update the alternative pool in time and provide real-time computing power support for selecting a suitable scheduling pool for the training tasks to be executed.
[0079] Specifically, when obtaining the computing power resources of each GPU included in the heterogeneous cluster, if the computing power resources of a new GPU are obtained, it is determined that a new GPU has been added to the heterogeneous cluster. For example, the computing power resources of a GPU include the name of the GPU and the PCIe identification number. After obtaining the name and PCIe identification number of the new GPU, it is determined that a new GPU has been added to the heterogeneous cluster. In this case, each candidate pool needs to be updated, so all GPUs in the heterogeneous cluster are re-divided into new backup pools according to whether the types of training tasks supported are the same, and then the candidate pool whose computing power resources meet the computing power resources required for the training tasks to be executed is selected as the pre-selected pool.
[0080] This embodiment also obtains the monitoring index data of each GPU included in the heterogeneous cluster. When the GPU corresponding to the monitoring index data is determined to be an abnormal GPU based on the monitoring index data, the abnormal GPU is deleted from the candidate pool or pre-selected pool including the abnormal GPU to avoid the training task to be executed being assigned to the abnormal GPU and to avoid affecting the execution of the training task to be executed. When the abnormal GPU is located in the scheduling pool, in addition to deleting the abnormal GPU from the scheduling pool, the present application also adds a normal GPU to the scheduling pool, and the type of training task supported by the newly added normal GPU is consistent with the type of training task supported by the abnormal GPU, so as to complete the training task to be executed using the new normal GPU. The monitoring index data of the GPU includes but is not limited to the temperature of the GPU, for example, when the temperature of the GPU exceeds a preset temperature value, the GPU is determined to be an abnormal GPU. According to the computing power resources of the abnormal GPU (such as the name of the GPU and the PCIe identification number), the candidate pool where the abnormal GPU is located is determined, and the abnormal GPU is deleted from the candidate pool where it is located, ensuring that the training task to be executed can be successfully executed when the candidate pool is subsequently selected as the pre-selected pool or scheduling pool.
[0081] Please refer to the figure, Figure 4 A schematic diagram of a model training device based on a heterogeneous cluster provided in an embodiment of the present application. The embodiment of the present application also provides a model training device based on a heterogeneous cluster, the device comprising:
[0082] The information acquisition module 401 is used to obtain the computing resources of each GPU included in the heterogeneous cluster and the GPU topology diagram of the heterogeneous cluster;
[0083] The pre-selection pool determination module 402 is used to select a candidate pool whose computing resources meet the computing resources required for the training task to be executed as the pre-selection pool after obtaining the training task to be executed and the computing resources required for the training task to be executed; the candidate pool is obtained by dividing all GPUs in the heterogeneous cluster according to whether the types of training tasks supported are the same, and the types of training tasks supported by each GPU in the same candidate pool are the same;
[0084] The scheduling pool determination module 403 is used to select a scheduling pool whose computing power evaluation value meets the preset requirements from the pre-selected pool; the computing power evaluation value is determined based on the load balancing degree, resource fragmentation rate and topology score of the pre-selected pool; the load balancing degree and resource fragmentation rate are both determined based on the computing power resources of the GPUs included in the pre-selected pool, the topology score is determined based on the length of the transmission path between each GPU in the topology structure of the pre-selected pool, and the topology structure of the pre-selected pool is determined based on the GPU topology structure diagram of the heterogeneous cluster;
[0085] The model training module 404 is used to send the training task to the scheduling pool so as to utilize the GPUs in the scheduling pool to cooperate with each other to train the model specified by the training task.
[0086] For a detailed introduction to the model training device based on heterogeneous clusters provided in this application, please refer to the above-mentioned embodiment of the model training method based on heterogeneous clusters, and this application will not elaborate on it here.
[0087] Based on the above embodiments:
[0088] As an optional embodiment, the computing power resources required for the training task to be executed include the GPU card type and the number of GPU cards required for the training task to be executed; the computing power resources of each GPU included in the heterogeneous cluster include the card type of each GPU;
[0089] Select a candidate pool whose computing power resources meet the computing power resources required for the training task to be executed as the pre-selected pool, including:
[0090] The candidate pool includes a GPU card type that is consistent with the GPU card type required for the training task to be executed, and the candidate pool includes a GPU card number that is not less than the GPU card number required for the training task to be executed as the primary candidate pool;
[0091] Determine the GPU resources currently available in the primary candidate pool. When the GPU resources currently available in the primary candidate pool meet the GPU resources required by the training task to be executed, use the primary candidate pool as the pre-selected pool. The GPU resources required for the training task to be executed are determined according to the GPU card type required for the training task to be executed, the GPU resources corresponding to the GPU card type, and the number of GPU cards.
[0092] And / or, selecting a scheduling pool whose computing power evaluation value meets the preset requirements from the pre-selected pool, including:
[0093] For each pre-selected pool, determine the load balancing degree and resource fragmentation rate of the pre-selected pool based on the number of GPUs included in the pre-selected pool, the maximum value of the GPU utilization corresponding to each GPU, and the average value of the GPU utilization corresponding to each GPU;
[0094] The sum of the product of the load balancing degree of the pre-selected pool and the first weight, the product of the resource fragmentation rate of the pre-selected pool and the second weight, and the product of the topological structure score of the pre-selected pool and the third weight is taken as the computing power evaluation value of the pre-selected pool;
[0095] The pre-selected pool with the highest computing power evaluation value is selected from each pre-selected pool as the scheduling pool.
[0096] As an optional embodiment, after obtaining the computing power resources of each GPU included in the heterogeneous cluster, the method further includes:
[0097] When the computing power resources of the GPUs included in the obtained heterogeneous cluster include the computing power resources of the GPU newly set up in the heterogeneous cluster, all GPUs in the heterogeneous cluster are divided into a new backup pool according to whether the types of training tasks supported are the same, and a step of selecting a candidate pool whose computing power resources meet the computing power resources required for the training task to be executed as a pre-selected pool is entered;
[0098] And / or, after obtaining the computing power resources of each GPU included in the heterogeneous cluster, it also includes:
[0099] Obtain monitoring indicator data of each GPU included in the heterogeneous cluster. When determining that a GPU corresponding to the monitoring indicator data is an abnormal GPU based on the monitoring indicator data, if the abnormal GPU is in a candidate pool or a pre-selection pool, delete the abnormal GPU from the candidate pool or the pre-selection pool; if the abnormal GPU is in a scheduling pool, delete the abnormal GPU from the scheduling pool, and add a normal GPU to the scheduling pool; the type of training tasks supported by the normal GPU is consistent with the type of training tasks supported by the abnormal GPU.
[0100] Please refer to Figure 5 , Figure 5 A structural diagram of an electronic device provided in the present application, the electronic device comprises: a processor 601; and a memory 602; computer program instructions are stored in the memory 602, and when the computer program instructions are executed by the processor 601, the processor executes the steps in any of the above methods.
[0101] For a detailed introduction to the electronic device provided in this application, please refer to the above-mentioned embodiment of the model training method based on heterogeneous clusters, and this application will not go into details here.
[0102] An embodiment of the present application further provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the steps in any of the above methods.
[0103] For a detailed introduction to the computer-readable storage medium provided in this application, please refer to the above-mentioned embodiment of the model training method based on heterogeneous clusters, and this application will not go into details here.
[0104] In this specification, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising 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 comprising the element.
[0105] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A model training method based on heterogeneous clusters, characterized in that: The method comprises: Obtain the computing power resources of each GPU included in the heterogeneous cluster and the GPU topology diagram of the heterogeneous cluster; After obtaining the training task to be executed and the computing power resources required for the training task to be executed, select a candidate pool whose computing power resources meet the computing power resources required for the training task to be executed as a pre-selected pool; the candidate pool is obtained by dividing all GPUs in the heterogeneous cluster according to whether the types of training tasks supported are the same, and the types of training tasks supported by each GPU in the same candidate pool are the same; A scheduling pool whose computing power evaluation value meets preset requirements is selected from the pre-selected pool; the computing power evaluation value is determined based on the load balancing degree, resource fragmentation rate and topology score of the pre-selected pool; the load balancing degree and the resource fragmentation rate are both determined based on the computing power resources of the GPUs included in the pre-selected pool, the topology score is determined based on the length of the transmission path between each GPU in the topology structure of the pre-selected pool, and the topology structure of the pre-selected pool is determined based on the GPU topology structure diagram of the heterogeneous cluster; The training task is sent to the scheduling pool, so that the GPUs in the scheduling pool cooperate with each other to train the model specified by the training task.
2. The model training method for heterogeneous clusters according to claim 1, characterized in that: The computing power resources required for the training task to be executed include the GPU card type and the number of GPU cards required for the training task to be executed; the computing power resources of each GPU included in the heterogeneous cluster include the card type of each GPU; The selecting a candidate pool of computing resources that meet the computing resources required by the to-be-performed training task as a pre-selected pool includes: The candidate pool includes a GPU whose card type is consistent with the GPU card type required for the training task to be executed, and a candidate pool whose card number of GPUs is not less than the number of GPU cards required for the training task to be executed as a primary candidate pool; Determine the GPU resources currently available in the primary candidate pool. When the GPU resources currently available in the primary candidate pool meet the GPU resources required by the training task to be executed, use the primary candidate pool as the pre-selected pool; the GPU resources required for the training task to be executed are determined according to the GPU card type required for the training task to be executed, the GPU resources corresponding to the GPU card type, and the number of GPU cards.
3. The model training method for heterogeneous clusters according to claim 1, characterized in that: The step of selecting a scheduling pool whose computing power evaluation value meets preset requirements from the pre-selected pool includes: For each pre-selected pool, determine the load balancing degree and resource fragmentation rate of the pre-selected pool based on the number of GPUs included in the pre-selected pool, the maximum value of the GPU utilization corresponding to each GPU, and the average value of the GPU utilization corresponding to each GPU; The sum of the product of the load balancing degree of the pre-selected pool and the first weight, the product of the resource fragmentation rate of the pre-selected pool and the second weight, and the product of the topological structure score of the pre-selected pool and the third weight is taken as the computing power evaluation value of the pre-selected pool; The pre-selected pool with the highest computing power evaluation value is selected from each pre-selected pool as the scheduling pool.
4. The model training method based on heterogeneous clusters according to claim 1, characterized in that: After obtaining the computing power resources of each GPU included in the heterogeneous cluster, it also includes: When the computing power resources of each GPU included in the obtained heterogeneous cluster include the computing power resources of the GPU newly set up in the heterogeneous cluster, all GPUs in the heterogeneous cluster are divided into a new backup pool according to whether the types of training tasks supported are the same, and the step of selecting a candidate pool whose computing power resources meet the computing power resources required for the training task to be executed as a pre-selected pool is entered.
5. The model training method based on heterogeneous clusters according to claim 1, characterized in that: After obtaining the computing power resources of each GPU included in the heterogeneous cluster, it also includes: Obtain monitoring indicator data of each GPU included in the heterogeneous cluster. When determining that a GPU corresponding to the monitoring indicator data is an abnormal GPU based on the monitoring indicator data, if the abnormal GPU is in a candidate pool or a pre-selection pool, delete the abnormal GPU from the candidate pool or the pre-selection pool; if the abnormal GPU is in a scheduling pool, delete the abnormal GPU from the scheduling pool, and add a normal GPU to the scheduling pool; the type of training tasks supported by the normal GPU is consistent with the type of training tasks supported by the abnormal GPU.
6. A model training device based on heterogeneous clusters, characterized in that: The device comprises: An information acquisition module is used to obtain the computing resources of each GPU included in the heterogeneous cluster and the GPU topology diagram of the heterogeneous cluster; A pre-selection pool determination module is used to select a candidate pool whose computing resources meet the computing resources required for the training task to be executed as a pre-selection pool after obtaining the training task to be executed and the computing resources required for the training task to be executed; the candidate pool is obtained by dividing all GPUs in the heterogeneous cluster according to whether the types of training tasks supported are the same, and the types of training tasks supported by each GPU in the same candidate pool are the same; A scheduling pool determination module, used to select a scheduling pool whose computing power evaluation value meets preset requirements from the pre-selected pool; the computing power evaluation value is determined based on the load balancing degree, resource fragmentation rate and topology score of the pre-selected pool; the load balancing degree and the resource fragmentation rate are both determined based on the computing power resources of the GPUs included in the pre-selected pool, the topology score is determined based on the length of the transmission path between each GPU in the topology structure of the pre-selected pool, and the topology structure of the pre-selected pool is determined based on the GPU topology structure diagram of the heterogeneous cluster; The model training module is used to send the training task to the scheduling pool so as to utilize the GPUs in the scheduling pool to cooperate with each other to train the model specified by the training task.
7. The model training device based on heterogeneous clusters according to claim 6, characterized in that: The computing power resources required for the training task to be executed include the GPU card type and the number of GPU cards required for the training task to be executed; the computing power resources of each GPU included in the heterogeneous cluster include the card type of each GPU; The selecting a candidate pool of computing resources that meet the computing resources required by the to-be-performed training task as a pre-selected pool includes: The candidate pool includes a GPU whose card type is consistent with the GPU card type required for the training task to be executed, and a candidate pool whose card number of GPUs is not less than the number of GPU cards required for the training task to be executed as a primary candidate pool; Determine the GPU resources currently available in the primary candidate pool, and when the GPU resources currently available in the primary candidate pool meet the GPU resources required by the training task to be executed, use the primary candidate pool as the pre-selected pool; the GPU resources required for the training task to be executed are determined according to the GPU card type required for the training task to be executed, the GPU resources corresponding to the GPU card type, and the number of GPU cards; And / or, selecting a scheduling pool whose computing power evaluation value meets preset requirements from the pre-selected pool includes: For each pre-selected pool, determine the load balancing degree and resource fragmentation rate of the pre-selected pool based on the number of GPUs included in the pre-selected pool, the maximum value of the GPU utilization corresponding to each GPU, and the average value of the GPU utilization corresponding to each GPU; The sum of the product of the load balancing degree of the pre-selected pool and the first weight, the product of the resource fragmentation rate of the pre-selected pool and the second weight, and the product of the topological structure score of the pre-selected pool and the third weight is taken as the computing power evaluation value of the pre-selected pool; The pre-selected pool with the highest computing power evaluation value is selected from each pre-selected pool as the scheduling pool.
8. The model training device based on heterogeneous clusters according to claim 6, characterized in that: After obtaining the computing power resources of each GPU included in the heterogeneous cluster, it also includes: When the computing power resources of the GPUs included in the obtained heterogeneous cluster include the computing power resources of the GPU newly set up in the heterogeneous cluster, all GPUs in the heterogeneous cluster are divided into a new backup pool according to whether the types of training tasks supported are the same, and a step of selecting a candidate pool whose computing power resources meet the computing power resources required for the training task to be executed as a pre-selected pool is entered; And / or, after obtaining the computing power resources of each GPU included in the heterogeneous cluster, it also includes: Obtain monitoring indicator data of each GPU included in the heterogeneous cluster. When determining that a GPU corresponding to the monitoring indicator data is an abnormal GPU based on the monitoring indicator data, if the abnormal GPU is in a candidate pool or a pre-selection pool, delete the abnormal GPU from the candidate pool or the pre-selection pool; if the abnormal GPU is in a scheduling pool, delete the abnormal GPU from the scheduling pool, and add a normal GPU to the scheduling pool; the type of training tasks supported by the normal GPU is consistent with the type of training tasks supported by the abnormal GPU.
9. An electronic device, characterized in that: The electronic device comprises: Processor; and A memory, wherein computer program instructions are stored in the memory, and when the computer program instructions are executed by the processor, the processor is caused to perform the steps in any one of the methods of claims 1 to 5.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, which, when executed by a processor, enable the processor to perform the steps of any one of the methods of claims 1 to 5.
Citation Information
Patent Citations
Method and system for balancing loads of central processing units and graphic processing units
CN105045670A
Deep learning-oriented multi-type GPU cluster resource management scheduling method and system
CN110442451A
Elastic training method of large language model, cluster system, product and medium
CN117786412A
Cited By
Intelligent computing power integration service management method and platform based on cloud side-end cooperation
CN120675957A
