Method, apparatus, device, medium and product for computing task allocation
By dynamically optimizing the allocation method of computing tasks on multi-core processors and adopting multi-round and serpentine allocation strategies, the problem of uneven distribution of computing tasks is solved, efficient utilization of computing cores and load balancing are achieved, and the overall performance of the model is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- KUNWANG (SHANGHAI) TECH CO LTD
- Filing Date
- 2026-04-23
- Publication Date
- 2026-06-16
AI Technical Summary
On multi-core processors, the mismatch between the number of hardware cores and the number of computing tasks leads to an unbalanced distribution of computing tasks, with some computing cores being overloaded while others are idle, reducing overall throughput efficiency.
By determining the total number of computing cores, calculating the number of candidate splits for a single computing task, and dynamically optimizing the number of candidate splits and the target split during multiple rounds of allocation, we ensure that computing tasks are evenly distributed across each computing core. We employ a multi-round cyclic allocation strategy and a serpentine cyclic allocation strategy to achieve precise load balancing of computing tasks.
It improves the utilization and load balancing of computing cores, enhances the training efficiency of hybrid expert architecture models, reduces communication overhead and redundant memory access between computing cores, and optimizes the utilization of hardware resources.
Smart Images

Figure CN122220115A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing technology, and more particularly to chip memory. Background Technology
[0002] In parallel processing of multiple computing tasks by multiple hardware cores, the mismatch between the number of hardware cores and the number of computing tasks can lead to an uneven distribution of tasks across different hardware cores. For example, in parallel inference of Mixture of Experts (MoE) models, distributing a balanced number of expert networks across multiple computing cores is the primary factor in ensuring load balancing.
[0003] Traditional task allocation methods typically employ strategies such as auxiliary loss functions and dynamic adjustment of expert network bias terms. However, these methods can easily lead to overloading of some computing cores while other cores remain idle, thus reducing overall throughput efficiency. Summary of the Invention
[0004] This disclosure provides a method, apparatus, device, medium, and product for allocating computing tasks.
[0005] According to one aspect of this disclosure, a method for allocating computing tasks is provided, comprising: The number of alternative splits for a single computing task is determined based on the total number of computing cores. Select the candidate split number for the current round from the candidate split number, and select the candidate computing task for the current round from the set of computing tasks to be assigned based on the candidate split number and the total number of cores; Based on the number of candidate computing tasks in each round and the total number of tasks in the computing task set, the number of candidate splits in each round is optimized to obtain the target number of splits in each round. After splitting each computing task in the computing task set according to the target split number in each round, the tasks are allocated to the computing core.
[0006] According to another aspect of this disclosure, a computing task allocation apparatus is provided, comprising: The alternative splitting number determination module is used to determine the alternative splitting number for a single computing task based on the total number of computing cores. The candidate task selection module is used to select the candidate split number for the current round from the candidate split number, and select the candidate computing task for the current round from the set of computing tasks to be assigned based on the candidate split number and the total number of cores. The target split number determination module is used to optimize the candidate split number for each round based on the number of candidate computing tasks in each round and the total number of tasks in the computing task set, so as to obtain the target split number for each round. The task splitting and allocation module is used to split each computing task in the computing task set according to the target splitting number in each round, and then allocate them to the computing core.
[0007] According to another aspect of this disclosure, an electronic device is provided, comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, which, when executed, enable the at least one processor to perform the task allocation method for computing tasks as described in any embodiment of this disclosure.
[0008] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause the computer to perform a method for allocating computing tasks as described in any embodiment of this disclosure.
[0009] According to another aspect of this disclosure, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the method for allocating computing tasks according to any embodiment of this disclosure.
[0010] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0011] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein: Figure 1 This is a schematic diagram of a method for allocating computing tasks according to an embodiment of this disclosure; Figure 2 This is a schematic diagram of another method for allocating computing tasks according to an embodiment of the present disclosure; Figure 3 This is a schematic diagram of another method for allocating computing tasks according to an embodiment of the present disclosure; Figure 4 This is a schematic diagram of the cyclic allocation process from the perspective of computing tasks provided in the embodiments of this disclosure; Figure 5 This is a schematic diagram of the total computing power requirement of the computing tasks allocated on the computing core after multiple rounds of cyclic allocation, according to an embodiment of this disclosure; Figure 6 This is a schematic diagram of another method for allocating computing tasks according to an embodiment of the present disclosure; Figure 7This is a schematic diagram of a computing task allocation device according to an embodiment of the present disclosure; Figure 8 This is a block diagram of an electronic device used to implement the computational task allocation method of the embodiments of this disclosure. Detailed Implementation
[0012] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0013] Figure 1 This diagram illustrates a method for allocating computing tasks according to an embodiment of this disclosure. This embodiment is applicable to situations where multiple computing tasks are executed in a load-balanced manner across multiple computing cores. The method can be executed by a computing task allocation device, which can be implemented in hardware and / or software and can be configured in an electronic device. (Reference) Figure 1 The method specifically includes the following: S110. Determine the number of alternative splits for a single computing task based on the total number of computing cores.
[0014] S120. Select the candidate split number for the current round from the candidate split number, and select the candidate computing task for the current round from the set of computing tasks to be assigned based on the candidate split number and the total number of cores.
[0015] S130. Based on the number of candidate computation tasks and the total number of tasks in the computation task set for each round, optimize the number of candidate splits for each round to obtain the target number of splits for each round.
[0016] S140. After splitting each computing task in the computing task set according to the target split number of each round, the tasks are allocated to the computing core.
[0017] In this context, a computing core refers to a basic hardware unit within a processor capable of independently executing instructions, performing arithmetic and logical operations, and processing data. For example, in a multi-core processor or heterogeneous computing system, multiple computing cores can work in parallel to jointly undertake computing tasks. A computing task refers to an independent working unit with clearly defined input, processing logic, and output that needs to be executed by the processor. For instance, a computing task is the independent computing unit undertaken by each expert subnetwork in the Moe model.
[0018] In another optional implementation of this embodiment, the set of computational tasks is a set of computational tasks of multiple expert subnetworks in the hybrid expert structure, and the computational task is the computational task of a single expert subnetwork.
[0019] Specifically, the Hybrid Expert Architecture (MoE) dynamically distributes input data to multiple expert subnetworks and combines gating networks to achieve sparse activation of these subnetworks. The computational tasks of these expert subnetworks are mostly concentrated on Generalized Matrix Multiplication (GEMM) computations. Using a multi-core architecture to process the computational tasks of multiple expert subnetworks in the MoE in parallel can effectively improve the overall computational speed of the model. However, if the computational load of the expert subnetworks is uneven among the various computing cores, it can lead to some computing cores being overloaded (e.g., GPU core utilization exceeding 90%), while other computing cores are idle (utilization below 30%). This imbalance not only fails to fully leverage the parallel computing advantages of the multi-core hardware architecture but also results in low hardware resource utilization, affecting the overall performance and efficiency of the model. Therefore, this embodiment comprehensively considers the characteristics of the multi-core hardware architecture and the rationality of computational task allocation, and achieves accurate load balancing of multi-core GEMM computational tasks by generalizing hardware characteristics and basic modeling.
[0020] This embodiment optimizes the load balancing of the parallel computing allocation of the multi-expert subnetworks in the hybrid expert structure within the multi-core architecture, which helps to improve the training efficiency of the hybrid expert structure model.
[0021] To achieve load balancing in a multi-core architecture, multiple computing tasks need to be evenly distributed across multiple computing cores. In this embodiment, to improve the accuracy of load balancing, a single computing task can be split into at least two sub-tasks, with each sub-task assigned to a computing core. This means that multiple computing cores process a single computing task. The "splitting number" refers to the number of sub-tasks a single computing task is split into, which is equivalent to the number of computing cores allocated to that single task. The "alternate splitting number" refers to the number of sub-tasks that a single computing task can be split into when allocating resources; for example, the alternative splitting number is determined based on the number of computing tasks to be allocated and the total number of cores.
[0022] Specifically, the total number of computing cores supporting the execution of computing tasks is determined as the total number of cores. Based on the total number of cores, the number of candidate splits for a single computing task is determined. For example, to achieve load balancing, in each round of allocation, based on the principle of full coverage of computing cores and the principle of reducing the number of computing cores used by each computing task in each round of allocation, the number of candidate splits for a single computing task is a positive integer less than or equal to the total number of cores. For example, if the total number of cores is 6, then the number of candidate splits for a single computing task is the set {1, 2, 3, 4, 5, 6}.
[0023] To further achieve load balancing, this embodiment allocates all computing tasks to each computing core through multiple rounds of allocation. That is, in each round, a portion of the computing task set is allocated to the computing core, and the number of candidate splits for each computing task can be the same or different in different rounds of allocation. In order to ensure load balancing of computing cores, each computing core is allocated one computing task or a portion of the split computing tasks in each round of allocation, and the number of candidate splits for each computing task is the same in the same round of allocation.
[0024] In the allocation of the current round, the number of candidate splits for a single computing task in the current round is determined, and at least one candidate split is selected from the candidate splits. After determining the number of candidate splits for the current round, in order to achieve accurate load balancing, after splitting a single computing task according to the number of candidate splits, all the split computing subtasks need to be allocated to all computing cores, and each computing core is allocated once. Therefore, the number of candidate computing tasks for the current round can be determined based on the number of candidate splits and the total number of cores. The candidate computing tasks for the current round are selected from the set of computing tasks to be allocated according to the number of candidate computing tasks for the current round. For example, if the number of candidate splits in the current round is one, then based on the above example, if the number of candidate splits in the current round is determined to be 2 by traversing the candidate splits, it means that the current round needs to split a single computing task into two computing subtasks for allocation. In order to achieve the even distribution of the split into two subtasks to the 6 computing cores and ensure that each computing core is allocated exactly once, the candidate computing task in the current round is the ratio of the total number of cores to the number of candidate splits. That is, in the current round, the 3 candidate computing tasks are split into two subtasks respectively, resulting in 6 subtasks, and the 6 subtasks are allocated to the 6 computing cores in a one-to-one correspondence. If there are at least two candidate splits in the current round, it means that there are candidate computing tasks that can be split into different numbers in the current round. Based on the at least two candidate splits and the total number of cores, the number of candidate computing tasks that can fully utilize the computing cores is determined. For example, if the total number of cores is 7 and the candidate splits in the current round are 2 and 3, then under the condition of fully utilizing the computing cores after splitting, the number of candidate computing tasks in the current round is 3. That is, two of the candidate computing tasks are split according to the candidate split number 2, and one of the candidate computing tasks is split according to the candidate split number 1. Further, after determining the candidate split number for the current round from the candidate split numbers, it is determined whether the candidate split number satisfies the requirement that the corresponding candidate computing task supports full utilization of the computing cores. If it does not satisfy the requirement, the candidate split number is eliminated, and the candidate split numbers are traversed again.
[0025] Following the aforementioned splitting and allocation principles for each round, candidate computation tasks are allocated until the sum of the candidate computation tasks across all rounds equals the total number of tasks in the computation task set. This completes one round of allocation for the computation task set, yielding a candidate allocation scheme. This scheme includes the candidate splitting number for each round. For example, by iterating through the candidate splitting number once per round, 100 computation tasks are allocated to 6 computation cores over 20 rounds. The candidate allocation scheme consists of the candidate splitting number selected in each of the 20 rounds. Depending on the value selected for each round's iteration of the candidate splitting number, multiple candidate allocation schemes can be obtained, and the candidate splitting number for each round will not be exactly the same in different schemes.
[0026] The target allocation scheme is determined from multiple candidate allocation schemes, and the number of candidate splits in each round corresponding to the target allocation scheme is taken as the target split number for each round. For example, the task communication loss is determined based on the number of computing cores corresponding to a single computing task in the candidate allocation schemes; the task communication loss of a single computing task is positively correlated with the number of allocated computing cores; based on the task communication loss, the target allocation scheme is determined from the candidate allocation schemes. For instance, the average number of candidate splits for all computing tasks in the set of computing tasks in the candidate allocation schemes is used as the task communication loss, and the candidate allocation scheme with the minimum task communication loss is selected as the target allocation scheme. This is because splitting a single computing task into multiple sub-tasks, which are processed by multiple computing cores respectively, inevitably requires communication between multiple computing cores to jointly complete the computing task, thus incurring task communication loss. The task communication loss is determined based on the additional communication overhead or repeated memory access caused by multiple computing cores processing a single computing task simultaneously. Therefore, in the final determined target allocation scheme, having fewer computing cores process a computing task results in more efficient hardware resource utilization.
[0027] After determining the target number of splits for each round, target computing tasks for the current round are selected from the current set of computing tasks to be assigned based on the target number of splits and the total number of cores. These tasks are then split according to the target number of splits and allocated to various computing cores. After all rounds of computing task splitting and allocation are completed, all computing tasks are evenly distributed across all computing cores. For example, the target number of computing tasks for the current round is determined based on the ratio of the total number of cores to the target number of splits. Target computing tasks for the current round are randomly selected from the current set of computing tasks to be assigned based on this target number of computing tasks. Alternatively, the set of computing tasks to be assigned is sorted in ascending or descending order based on the computational workload. The computing tasks are then sequentially numbered according to the sorting results. The first target computing task, corresponding to half of the target number of computing tasks, is selected sequentially from the set of computing tasks to be assigned according to the first numbering order, and the second target computing task, corresponding to half of the target number of computing tasks, is selected sequentially from the set of computing tasks to be assigned according to the second numbering order. The first and second target computing tasks together constitute the target computing tasks for the current round. If the number of target computing tasks is odd, another target computing task is randomly selected.
[0028] Based on the above allocation logic, in each round of allocation in each candidate allocation scheme, it must be ensured that each computing core is allocated a computing task and only one computing task is allocated. Therefore, when all computing tasks are allocated to each computing core through multiple rounds, it can be guaranteed that the number of computing tasks processed on each computing core is completely balanced.
[0029] In another optional implementation of this embodiment, in each round, the target number of each computing task is the same, and each computing core is allocated computing tasks according to the target number of splits.
[0030] To improve the efficiency of computing task allocation and load balancing, the target number of splits for all computing tasks allocated in each round is the same. That is, when determining the candidate allocation scheme, one of the candidate splits is selected as the candidate split for the current round. It is ensured that in each round of allocation, the computing tasks corresponding to that round are split according to the target split and allocated to each computing core. Each split computing task is allocated to only one computing core, ensuring that the computing cores are allocated with full utilization in each round of computing task allocation, thus ensuring load balancing.
[0031] For example, based on the above example, if the target number of splits in the current round is 2, it means that each computing task needs to be split into two computing subtasks for allocation in the current round. In order to evenly distribute the split into two subtasks to the 6 computing cores and ensure that each computing core is allocated one and only once, the candidate computing tasks in the current round are the ratio of the total number of cores to the number of candidate splits. That is, in the current round, the 3 candidate computing tasks are split into two subtasks respectively, resulting in 6 subtasks. The 6 subtasks are then allocated to the 6 computing cores in a one-to-one correspondence, ensuring that each computing core is allocated computing tasks according to the target number of splits.
[0032] This embodiment improves the efficiency of computing task allocation by splitting computing tasks using the same target number of splits in each round of allocation, and further improves the utilization efficiency of computing cores by fully utilizing computing cores in each round of allocation, thus ensuring accurate load balancing.
[0033] The solution in this embodiment dynamically determines and optimizes the number of task splits in each round of task allocation by combining the total number of computing cores and task characteristics. This achieves adaptive matching between the granularity of computing tasks and the hardware resources of computing cores, and maintains a full utilization strategy for multiple computing cores in multiple rounds of allocation, effectively improving the utilization rate and load balancing of computing cores.
[0034] Figure 2 This is a schematic diagram illustrating another method for allocating computing tasks according to an embodiment of this disclosure. This embodiment is a further refinement of the above technical solution, and the technical solution in this embodiment can be combined with various optional solutions in one or more of the above embodiments. Figure 2 As shown, the method specifically includes the following: S210. Determine the factor set based on the total number of cores, and determine the number of alternative splits for a single computing task from the factor set.
[0035] The total number of available computing cores is determined as the total number of cores. All positive integer factors of the total number of cores are then calculated and obtained, i.e., positive integers that divide the total number of cores. These positive integer factors form a factor set. For example, if the total number of cores is 6, then its factor set is {1, 2, 3, 6}.
[0036] All or some of the factors in the factor set can be used as the number of candidate splits for a single computation task. For example, multiple factors can be randomly selected from the factor set as the number of candidate splits for a single computation task. The number of randomly selected factors can be adjusted according to the actual needs of the scenario. Alternatively, all factors in the factor set can be used as the number of candidate splits for a single computation task.
[0037] In another optional implementation of this embodiment, determining the number of alternative splits for a single computational task from the factor set includes: If the number of computational tasks to be assigned is less than the product of the total number of cores and any factor, then the factor is removed, and the other factors in the factor set are used as candidate split numbers.
[0038] The number of computing tasks to be assigned refers to the remaining number of computing tasks that have not yet been assigned to a computing core. Because the following allocation conditions must be met in each round—including that each computing task has the same number of splits, each computing core is allocated computing tasks according to that number of splits, and each computing core is allocated one computing task—after a certain proportion of computing tasks have been allocated, some factors in the factor set may not meet the above allocation conditions. For example, based on the above example, if there are 5 computing tasks to be assigned and the factor set is {1, 2, 3, ...}, ... If the number of candidate splits is 2, then the factors 2, 3, and 6 can all satisfy the condition of selecting a suitable number of candidate computing tasks from the computing tasks to be assigned for the current round of allocation. That is, if the number of candidate splits includes 2, then 3 candidate computing tasks are selected from the computing tasks to be assigned, and the remaining 2 computing tasks are used for allocation in subsequent rounds. The current round can obtain 6 computing sub-tasks, which are assigned to 6 computing cores respectively. If the number of candidate splits includes 3, then 2 candidate computing tasks are selected from the computing tasks to be assigned, and the remaining 3 computing tasks are used for allocation in subsequent rounds. The current round of splitting can obtain 6 computing sub-tasks, which are assigned to 6 computing cores respectively. The calculation cores are calculated as follows: If the number of candidate splits includes 6, then one candidate computing task is selected from the computing tasks to be assigned, and the remaining four computing tasks are used for allocation in subsequent rounds. The current round of splitting can yield 6 computing subtasks, which are then assigned to 6 computing cores. Therefore, factors 2, 3, and 6 can be included in the number of candidate splits. However, if the number of candidate splits includes 1, then all the computing tasks to be assigned in the current round will be used for allocation in the current round, which will also result in one computing core having no corresponding computing task to be assigned, affecting the balance of computing cores. Therefore, the number of candidate splits for a single computing task in the current round needs to exclude factor 1.
[0039] In summary, based on the number of computing tasks to be allocated and the total number of cores, each factor in the factor set is evaluated. If any target factor satisfies the condition that the product of the target factor and the total number of cores is greater than the number of computing tasks to be allocated, it means that the target factor cannot meet the allocation condition of full utilization of computing cores in a single round. That is, under the current round conditions, the target factor cannot be used as the number of splits for a single computing task. Therefore, the target factor needs to be removed, and the other factors in the factor set other than the target factor are used as the alternative splits for a single computing task in the current round.
[0040] This embodiment filters factors in the factor set based on the number of computing tasks to be assigned, obtaining a number of candidate splits. This ensures that the number of candidate splits meets the principle of full utilization of computing cores in each round, improves the efficiency of computing task allocation, and avoids invalid candidate splits affecting the subsequent allocation progress.
[0041] S220. Select the candidate split number for the current round from the candidate split number, and select the candidate computing task for the current round from the set of computing tasks to be assigned based on the candidate split number and the total number of cores.
[0042] Optionally, the minimum value can be selected from the candidate splits after removing some factors as the candidate splits for the current round. This ensures that each expert must adhere to the principle of using the fewest computing cores in each round of allocation, avoiding the additional communication overhead or repeated memory access caused by using too many computing cores to process a single computing task.
[0043] S230. Based on the number of candidate computation tasks and the total number of tasks in the computation task set for each round, optimize the number of candidate splits for each round to obtain the target number of splits for each round.
[0044] S240. After splitting each computing task in the computing task set according to the target split number of each round, the tasks are allocated to the computing core.
[0045] In another optional implementation of this embodiment, the minimum number of allocation rounds to assign all computing tasks in the computing task set to computing cores is determined based on the ratio of the total number of tasks to the total number of cores.
[0046] To achieve efficient utilization of computing cores, a limit needs to be placed on the minimum number of allocation rounds required to distribute all computing tasks in the task set to computing cores. This means that more rounds are needed to complete the allocation of computing tasks in order to find a better splitting and allocation scheme to achieve full distribution of computing tasks. Specifically, the minimum number of allocation rounds is determined by rounding up the ratio of the total number of tasks to the total number of cores. For example, if k represents the number of allocation rounds required to distribute all computing tasks in the task set to computing cores, then k >= [n / m], where n represents the total number of tasks and m represents the total number of cores.
[0047] Based on the aforementioned allocation logic for full utilization of computing cores in each round, for example, a set of computing tasks includes computing tasks of n expert subnetworks: E1, E2, …, En. These tasks require Moe computation to be completed on m computing cores C1, C2, …, Cm during k rounds of allocation. For load balancing, each computing task Ei must be allocated to at least one computing core. Furthermore, to achieve efficient performance, each computing task must adhere to the principle of minimum computing core utilization in each round of allocation. Therefore, the constraints of the allocation process are: ,in, Let represent the set of computing cores allocated to the i-th computing task Ei, meaning that the computing cores in this set are used to process computing task Ei in parallel. Let k represent the number of allocation rounds after all n computing tasks have been allocated. Since each round fully utilizes the computing cores, the number of computing cores allocated in each round is m. Therefore, in k rounds of allocation, a total of m and k product-number of computing cores are allocated. Because each computing task participates in computation with at least one computing core, the following holds: Based on the above constraints, the result of determining k is: Since k is a constant, then k >= [n / m]. In k rounds of allocation, each computing core participates in the allocation and execution of k computing tasks. Therefore, the union of the sets of computing cores for all computing tasks must cover all computing cores to ensure that each computing core is allocated to at least one computing task. Based on the above analysis, it can be proven that determining the minimum number of allocation rounds based on the ratio of the total number of tasks to the total number of cores can guarantee the full utilization of computing cores in multiple rounds of allocation.
[0048] Furthermore, the above process ensures a balanced distribution of computing tasks across each computing core from the perspective of computing cores. However, the specific number of computing cores allocated to each computing task in each round of allocation still needs to be further determined. Due to the parallelism of computing cores and the need for a balanced distribution of computing tasks across each computing core in each allocation, a set of factors is determined for the total number of cores. This set of factors is expressed as: ,in, Let i represent the i-th factor.
[0049] For any set of computational tasks with a total number of tasks n, it can be represented in the following form: ; in, , Indicates adoption The number of repetitions required to calculate the allocation of m experts as a single computational task. A value greater than or equal to 1 indicates that repetition is allowed. This indicates the number of computational tasks to be assigned.
[0050] Remove from the above If the terms are equal to 0, then the above expression can be represented as: ; in, Since min(di) = 1, the above formula is always closed, meaning n can always be expressed in this form. Because di is divisible by m, the computational load per computing core is the same each time. k is the value after load balancing correction to ensure the overall number of experts. We can obtain k >= [n / m], which means determining the number of alternative splits for a single computing task from the factor set of the total number of cores. Alternatively, we can determine the minimum number of allocation rounds to distribute all computing tasks in the computing task set to computing cores based on the ratio of the total number of tasks to the total number of cores.
[0051] This embodiment determines the minimum number of allocation rounds based on the ratio of the total number of tasks to the total number of cores, which further ensures that the allocation principle of full utilization of computing cores is met during allocation, and improves the accuracy of computing task allocation.
[0052] The solution in this embodiment determines the number of candidate splits for a single computing task based on the total number of cores, ensuring that the number of candidate splits meets the principle of full utilization of computing cores in each round, thereby improving the utilization efficiency of computing cores and ensuring accurate load balancing.
[0053] Figure 3 This is a schematic diagram illustrating another method for allocating computing tasks according to an embodiment of this disclosure. This embodiment is a further refinement of the above technical solution, and the technical solution in this embodiment can be combined with various optional solutions in one or more of the above embodiments. Figure 3 As shown, the method specifically includes the following: S310. Based on the total number of computing cores, determine the number of alternative splits for a single computing task.
[0054] S320. Select the candidate split number for the current round from the candidate split number, and select the candidate computing task for the current round from the set of computing tasks to be assigned based on the candidate split number and the total number of cores.
[0055] S330. Based on the number of candidate computation tasks and the total number of tasks in the computation task set for each round, optimize the number of candidate splits for each round to obtain the target number of splits for each round.
[0056] S340. Sort the computing tasks in the computing task set according to the computing power requirements to obtain the computing task sequence.
[0057] The computing power requirement is used to represent the amount of computing resources needed to execute a computing task. For example, the computing power requirement is determined based on the computational workload of the task, meaning that the computing power requirement is positively correlated with the computational workload. For instance, during the Moe computation process, the GEMM computation scale of each expert subnetwork varies depending on the number of tokens allocated to it, often resulting in significant differences. Therefore, even if the matrix size of the expert subnetworks is the same, the different number of tokens allocated will cause different computational workloads for each expert subnetwork. In other words, the computing power requirement for each computing task is determined based on the number of tokens allocated to it, and the computing power requirement is positively correlated with the number of tokens.
[0058] Specifically, the computing tasks in the computing task set are sorted in ascending or descending order according to the computing power requirements to obtain the corresponding computing task sequence. This embodiment does not restrict the sorting direction.
[0059] S350. Based on the target split number and total core number of the current round, select the target computing task of the current round from the sequence of computing tasks to be assigned in a fixed direction.
[0060] After determining the target number of splits for the current round, the target computing tasks for the current round are selected sequentially from the current set of computing tasks to be allocated, according to a preset fixed direction, based on the target number of splits and the total number of cores. This fixed direction can be adjusted as needed and is not limited here. For example, the fixed direction can be the sequential direction or the reverse direction of the computing task sequence. Furthermore, this embodiment does not restrict the sorting direction of the computing task sequence, as long as it ensures that the selection of target computing tasks for each round is always performed in a fixed direction. That is, it ensures that the target computing tasks are always selected in ascending order of computing power demand, or in descending order of computing power demand.
[0061] For example, the target number of computing tasks for the current round is determined based on the ratio of the total number of cores to the target number of splits in the current round. Then, according to this target number of computing tasks, the remaining currently unassigned computing tasks in the computing task sequence are selected sequentially, continuing the allocation order from the previous round. For instance, the computing tasks in the computing task sequence can be numbered sequentially from smallest to largest in a fixed direction to obtain a numbered result for each computing task. When selecting target computing tasks in each round, the selection always starts with the computing task with the smallest number, and the corresponding number of target computing tasks is selected according to the numbering order based on the target number of computing tasks in the current round.
[0062] S360. Determine the core allocation order for the current round based on the core allocation order of the previous round.
[0063] The core allocation order refers to the scheduling strategy when allocating target computing tasks in each round to all computing cores. The core allocation order is determined based on the number of allocation rounds and the core performance of the computing cores. For example, the computing cores are pre-sorted according to their performance to obtain a computing core sequence. In the first round of allocation, computing cores are selected sequentially from this sequence according to a second fixed direction. The sorting direction for computing cores in the first round is consistent with the sorting direction for the computing task sequence. That is, if computing cores are selected in ascending order of performance in the first round, the target computing task is also selected from the computing task sequence in ascending order of computing power demand; conversely, if computing cores are selected in descending order of performance in the first round, the target computing task is also selected from the computing task sequence in descending order of computing power demand. This strategy ensures that tasks with high computing power demand are prioritized for scheduling to high-performance cores, and low-demand tasks are allocated to low-performance cores, or vice versa. In energy-efficiency-first scenarios, load balancing is achieved, thereby improving overall task execution efficiency while also considering the rational utilization of system resources and energy efficiency optimization.
[0064] The above embodiments ensure a certain degree of load balancing by calculating the full utilization of the computing cores in each round of allocation. However, if the computing power requirements of each computing task differ significantly, new imbalance points may arise. Therefore, it is necessary to ensure that each computing core is allocated to computing tasks with different computing power requirements in different rounds based on full utilization. This is to ensure that after multiple rounds of allocation, the total computing power requirements of the computing tasks allocated to different computing cores are similar, thus ensuring more accurate load balancing.
[0065] To ensure that each computing core is assigned computing tasks with varying computing power requirements in different rounds, the core allocation order for the current round is determined based on the core allocation order of the previous round when matching and allocating target computing tasks and computing cores in subsequent rounds, and the core allocation order of the current round is different from the core allocation order of the previous round.
[0066] For example, the computing cores are sorted in advance according to their core performance to obtain a computing core sequence. The computing cores in the computing core sequence are then numbered sequentially from smallest to largest according to a second fixed direction to obtain the numbering result of each computing core. If the core allocation order in the previous round was to allocate computing cores with smaller numbers first and then allocate computing cores with larger numbers, then the core allocation order in the current round is to allocate computing cores with larger numbers first and then allocate computing cores with smaller numbers. Alternatively, the numbering order corresponding to the core allocation order in the previous round is determined, and the numbering order is shuffled. The result of the shuffling is used as the core allocation order in the current round.
[0067] In another optional implementation of this embodiment, S360 includes: Use the reverse order of the core allocation order from the previous round as the core allocation order for the current round.
[0068] To ensure that each computing core is assigned computing tasks with similar computing power requirements in different rounds—that is, the difference in first computing power requirements between the computing tasks assigned to any first computing core in the previous round and the computing tasks assigned to it in the current round, and the difference in second computing power requirements between the computing tasks assigned to any second computing core in the previous round and the computing tasks assigned to it in the current round—in this embodiment, when matching and allocating target computing tasks and computing cores in subsequent rounds, the reverse order of the core allocation order in the previous round is first used as the core allocation order in the current round, and the target computing tasks in the current round are allocated using the core allocation order of the current round.
[0069] For example, based on the aforementioned numbering of computing cores, the core numbering order corresponding to the previous round's core allocation order is determined. This core numbering order is then reversed, and the current round's core allocation order is determined based on the reversed core numbering order. For instance, if the computing cores are pre-numbered, and the previous round's core allocation order was in ascending order of number, then the current round's core allocation order will be in descending order of number; or if the previous round's core allocation order was in descending order of number, then the current round's core allocation order will be in ascending order of number.
[0070] Since the target computing tasks for each round are selected from the sequence of computing tasks in a fixed order, and the target computing tasks for each round are allocated sequentially according to a unified sorting direction of computing power demand, when the core allocation order of the current round is completely reversed from the core allocation order of the previous round, the computing cores allocated to the computing tasks with the larger computing power demand in the current round correspond to the computing tasks with the smaller computing power demand in the previous round; similarly, the computing cores allocated to the computing tasks with the smaller computing power demand in the current round correspond to the computing tasks with the larger computing power demand in the previous round.
[0071] This embodiment alleviates the load balancing of all computing cores by alternating the core allocation order in reverse between adjacent rounds, enabling a balanced and differentiated allocation of computing power requirements in different rounds and reducing the difference in computing power between different computing cores.
[0072] S370. Assign the target calculation tasks of the current round to the calculation cores according to the core allocation order of the current round.
[0073] After the target computation tasks selected in the current round according to a fixed order are split according to the target split number corresponding to the current round, they are sequentially allocated to each computation core based on the core allocation order of the current round. After completing the splitting and allocation of computation tasks for all rounds, all computation tasks are evenly distributed across all computation cores. For example, if the total number of cores is 6, namely C1, C2...C6, and the core allocation order of the previous round was C6, C5...C1, then the core allocation order of the current round is C1, C2...C6. If the target split number corresponding to the current round is 3, then the target core tasks corresponding to the current round are Ei and Ei+1. In this fixed order, Ei is located one position before Ei+1 in the computation task sequence. Therefore, during allocation, computation task Ei is split into three sub-tasks and allocated to C1, C2, and C3 sequentially, and computation task Ei+1 is split into three sub-tasks and allocated to C4, C5, and C6 sequentially.
[0074] For example, this embodiment is based on a strategy of sorting computing tasks and allocating computing cores in a serpentine loop. First, all computing tasks are sorted according to the number of tokens allocated to each expert subnetwork. Then, tasks are allocated according to the principle of using the fewest computing cores and the principle of full core utilization. After allocating the target computing tasks for the current round in each round, the next round of computing tasks is allocated in the reverse direction of the computing core allocation. This ensures that the total computing power demand of the computing tasks allocated to all computing cores is relatively balanced. Figure 4 The diagram illustrates the cyclical allocation process from the perspective of computational tasks. E1, E2, ..., Ei, Ei+1, ..., En are sorted sequences of computational tasks. In the first round, E1, E2, ..., Ei are allocated to computational cores in a fixed order according to their first order. Then, in the second round, the computational tasks are processed in reverse order and allocated to the same computational cores. Through this serpentine cyclical allocation strategy, combined with the computational core utilization balancing strategy in the previous embodiment (i.e., each computational core performs at least one computational task per round), all computational cores are always allocated to computational tasks with varying computational loads. However, the task sorting and serpentine cyclical approach balance the computational load across the cores. Within the same round, since each expert uses as few computing cores as possible, they initially tend to complete a computing task on a single core. Therefore, the computational workload of the computing tasks on m computing cores is similar. In subsequent rounds, to ensure balance, computing tasks are assigned to computing cores greater than or equal to di>=1, which further narrows the gap in computational workload between different computing cores. Between different rounds, the serpentine loop always alleviates the load balancing across all computing cores by traversing in reverse.
[0075] Due to the inherent characteristics of the GEMM problem, the main problems arising from multi-core computation within the same expert subnetwork are additional communication overhead or redundant memory accesses. If wj is used as a weighting coefficient for the workload of different numbers of cores allocated to the expert subnetwork, the total workload for completing all computational tasks can be expressed as follows: ; Where wj represents the communication weighting coefficient of a computing task when splitting a single computing task using the number of splits dj. That is, the larger the number of splits of a single computing task, the greater the communication loss and the greater the amount of computing. Therefore, wj and dj are positively correlated. For example, wj=t×dj, where t is a fixed parameter related to hardware memory access or communication. This indicates that the computational task Ei is split and allocated using the number of splits dj. The maximum load difference between the m computational cores can then be expressed as: ; in, This represents the maximum load difference between different cores. Whether the load is balanced or not depends only on the maximum difference in the workload of each round of computation. From the above formula, we can see that when dj=m, Setting j to 0 achieves perfect balance, but this clearly violates the principle of using the fewest possible computing cores to compute an expert; therefore, following the strategy of full utilization of computing cores, under the serpentine loop strategy, the load difference will compensate for each other regardless of whether j is odd or even, i.e., a positive integer greater than or equal to 1. For example... Figure 5 The diagram shows the total computing power requirement of the computing tasks allocated on the computing cores after multiple rounds of cyclic allocation. C1, C2, C3...Cm-2, Cm-1 and Cm are m computing cores in a fixed order. Figure 5 The top graph shows the difference in total computing power demand for computing tasks allocated across m computing cores in the first few rounds. The middle graph shows the difference in total computing power demand for computing tasks allocated across m computing cores after multiple rounds of serpentine cyclic allocation. The bottom graph shows the difference in total computing power demand for computing tasks allocated across m computing cores after the serpentine cyclic allocation is completed. It can be seen that after multiple rounds of reverse serpentine cyclic allocation, the difference in total computing power demand between computing tasks allocated across different computing cores becomes smaller and smaller, achieving load balancing.
[0076] The scheme in this embodiment, based on sorting computing tasks according to computing power requirements, improves the balance of computing power distribution on computing cores by sequentially allocating the sorted computing tasks in adjacent rounds using different core allocation orders.
[0077] Figure 6This is a schematic diagram illustrating another method for allocating computing tasks according to an embodiment of this disclosure. This embodiment is a further refinement of the above technical solution, and the technical solution in this embodiment can be combined with various optional solutions in one or more of the above embodiments. Figure 6 As shown, the method specifically includes the following: S610. Sort the computing tasks in the computing task set according to the computing power requirements to obtain the computing task sequence.
[0078] Specifically, the computing tasks in the computing task set are sorted in ascending or descending order according to the computing power requirements to obtain the corresponding computing task sequence. This embodiment does not restrict the sorting direction.
[0079] S620. Determine the mutation computing tasks in the computing task sequence that meet the preset mutation conditions in terms of computing power requirements, and divide the computing task sequence into multiple computing task subsequences with the mutation computing tasks as the interruption points.
[0080] Because the number of computing cores used for computationally intensive tasks and the computing performance of a single core in the hardware architecture are always incompatible with all Moe scales, the task allocation method described in the above embodiment may result in a large difference in the amount of computation of computing tasks in the same round. Therefore, even if the full utilization and serpentine loop method described above is used, the load between different computing cores may be extremely unbalanced in the same round of allocation, and this imbalance cannot be balanced by the serpentine loop. For example, if the computational workloads of tasks in a computational task sequence are 1, 2, 3, 4, 5, 400, 410, 412, 415, 416, 417, 419..., and in the first round of allocation, tasks with computational workloads of 1, 2, 3, 4, 5, and 400 are allocated to computing cores C1, C2...C6 with a splitting factor of 1, and in the second round, tasks with computational workloads of 410, 412, 415, 416, 417, and 419 are allocated to computing cores C6, C5...C1 with a splitting factor of 1, then after two rounds of allocation, the total computational workload on computing core C1 will be 420, and the total computational workload on computing core C6 will be 810. If subsequent computational tasks with significantly different workloads appear, it will further exacerbate the load imbalance. Therefore, computational tasks with significantly different computational workloads will lead to a large difference in the total computational workload across different computing cores, resulting in a load imbalance.
[0081] As the above analysis shows, the fundamental reason why the load imbalance problem still occurs after adopting the allocation scheme of the above embodiments is that there are computing tasks with sudden changes in computing power demand in the sorted computing task sequence. That is, there are computing tasks in the computing task sequence with a large difference in computing power demand, which are not on the same computing scale. As a result, the computing cores on both sides of the computing core where the sudden change occurs will have a serious load balancing problem, causing the allocation strategy in the above embodiments to fail. Therefore, it is necessary to first identify the computing tasks with sudden changes in computing power demand.
[0082] Specifically, in the sorted sequence of computing tasks, abrupt computing tasks with significant increases or decreases in computing power demand are identified. For example, a pre-defined mutation condition is defined as the difference between the computing power demand of the previous computing task and the demand of the previous task exceeding a preset mutation threshold. Using the mutated computing task as the breakpoint, i.e., as the starting point of a new subsequence, the original sequence of computing tasks is divided into multiple consecutive subsequences of computing tasks. The first computing task in each subsequence is the mutated computing task. For example, if the computational quantities of each task in the sequence are 1, 2, 3, 4, 5, 400, 410, 412, 415, 416, 417, 419, 1000, ..., then the division into multiple subsequences includes at least the following: the first subsequence has computational quantities of 1, 2, 3, 4, and 5; the second subsequence has computational quantities of 400, 410, 412, 415, 416, 417, and 419; the third subsequence has computational quantities of 1000, ...
[0083] The specific settings of the preset mutation conditions can be adjusted according to actual needs and are not limited here. For example, the preset mutation conditions include: if the computing power requirement of the current computing task is greater than the product of the sum of the computing power requirements of the allocated computing tasks in the current computing task subsequence and the total number of cores, then the current computing task will be regarded as the mutation computing task.
[0084] S630. Determine the target split number for each round for each computation task subsequence.
[0085] The target number of splits is determined for each computational task subsequence in each round to ensure the independence between different subsequences. Specifically, during dynamic grouping, if a computational task experiences a sudden change in computing power demand, it is regrouped. Within each computational task subsequence, the full utilization core allocation strategy is still used, or a combination of full utilization core allocation and a serpentine loop task allocation strategy is employed. Since these two strategies are computationally complete for different numbers of computational tasks, they always achieve good load balancing within different subsequences. Furthermore, because different subsequences are completely separated, there is no need for mutual load compensation between subsequences after independent allocation of different computational task subsequences.
[0086] Optionally, based on the total number of computing cores, determine the number of candidate splits for a single computing task; select the candidate splits for the current round corresponding to the current computing task subsequence from the candidate splits; and select candidate computing tasks for the current computing task subsequence in the current round from the computing tasks to be assigned in the current computing task subsequence based on the number of candidate computing tasks in each round and the total number of subsequences of the current computing task subsequence, to obtain the target splits for each round corresponding to the current computing task subsequence; split each computing task in the current computing task subsequence according to the target splits for each round, and allocate them to computing cores, and then allocate each computing task subsequence in turn until all computing tasks in the computing task subsequence are allocated.
[0087] Optionally, further, based on the total number of computing cores, determine the number of candidate splits for a single computing task; select the candidate splits for the current round corresponding to the current computing task subsequence from the candidate splits; and based on the candidate splits and the total number of cores, select candidate computing tasks for the current computing task subsequence in the current round from the computing tasks to be assigned in the current computing task subsequence; optimize the candidate splits for each round based on the number of candidate computing tasks in each round and the total number of subsequences of the current computing task subsequence, to obtain the target splits for each round corresponding to the current computing task subsequence. Based on the target splits and the total number of cores for the current round corresponding to the current computing task subsequence, select the target computing tasks for the current round from the computing tasks to be assigned in the current computing task subsequence in a fixed direction; determine the core allocation order for the current round based on the core allocation order of the previous round in the current computing task subsequence; allocate the target computing tasks for the current round to the computing cores according to the core allocation order of the current round, and allocate each computing task subsequence sequentially until all computing tasks in the computing task subsequence are allocated.
[0088] In another optional implementation of this embodiment, after splitting each computing task in the computing task set according to the target split number of each round, the tasks are allocated to computing cores, including: The sequence order of the computation task subsequences is determined based on their positions within the overall computation task sequence. The current computation task subsequence is determined sequentially according to the sequence order. Each computation task in the current computation task subsequence is then split according to the target split number of each round corresponding to the current computation task subsequence and assigned to the computation core. The core allocation order corresponding to the first round of the current computation task subsequence is the reverse of the core allocation order corresponding to the last round of the previous computation task subsequence.
[0089] To avoid the impact of non-mutated computational tasks within a subsequence on the load of different computing cores during allocation, a serpentine cyclic allocation strategy is adopted between different computational task subsequences. For example, if the computing power requirements of the computing tasks in the first computing task subsequence are 10, 20, 50 and 60 respectively, and the computing power requirements of the computing tasks in the second computing task subsequence are 500, 510, 530 and 550 respectively, and if they are all allocated to the four computing cores according to the target split number of 1, then the first computing task subsequence and the second computing task subsequence will both be allocated in one round. If the first computing task subsequence and the second computing task subsequence are allocated according to the same core allocation order, it will result in the computing power requirements of the computing tasks allocated on the first computing core being 10 and 500, and so on, with the computing power requirements of the computing tasks allocated on the fourth computing core being 50 and 550. Therefore, there is still a certain degree of imbalance in the total computing power requirements between different computing cores. Therefore, an independent method for determining the target split number is used within the subsequence, while a serpentine cyclic allocation strategy is used between the subsequences to determine that the core allocation order of adjacent rounds between different subsequences is reversed.
[0090] Specifically, the sequence order for allocating each computation task subsequence is first determined. This sequence order is determined based on the position of each computation task subsequence in the computation task sequence. That is, if the first computation task subsequence is located before the second computation task subsequence, then the sequence order of the first computation task subsequence is before the second computation task subsequence. In other words, the first computation task subsequence is assigned tasks first, and then the second computation task subsequence is assigned tasks.
[0091] The computational task subsequences are allocated sequentially according to their order. Specifically, after determining the target number of partitions for each round of the current computational task subsequence, the first core allocation order corresponding to the previous computational task subsequence in its last round of allocation is determined. The reverse order of the first core allocation order is then used as the core allocation order corresponding to the current computational task subsequence in its first round of allocation. For example, based on the above example, after adopting a serpentine cyclic allocation strategy among subsequences, the computational power requirements of the tasks allocated on the first computational core are 10 and 550, and so on. The computational power requirements of the tasks allocated on the fourth computational core are 50 and 500. Therefore, the allocation strategy in this embodiment further improves the load balancing across different computational cores.
[0092] For example, the difference in workload between adjacent computational tasks after sorting can be expressed as: ; in, lLet be the target split number corresponding to the i-th and i+1-th computation tasks; if there are mutation computation tasks that satisfy the preset mutation conditions, then: ; Therefore, it can be determined that when allocating computing tasks, if the difference in the number of tasks within the current subsequence is so large that the aforementioned sorting and grouping fail, then it is considered that regrouping is necessary. That is, if the difference in the number of tasks within the current subsequence is greater than the sum of the number of tasks of all computing tasks within the current subsequence, then the current computing task is judged to be a sudden computing task. Quantitatively determining sudden computing tasks can better achieve load balancing and avoid dividing too many computing task subsequences, which would result in low task allocation.
[0093] This embodiment further improves the accurate load balancing of multi-computing task allocation on multiple computing cores by determining the core allocation order of adjacent rounds between adjacent computing task subsequences.
[0094] The scheme in this embodiment divides the computation task subsequence by calculating mutation computation tasks in the computation task sequence, and uses independent multi-round determination of target split number in different computation task subsequences to avoid the problem that the existence of mutation computation tasks will cause the difficulty in compensating for the difference in computing power demand on different computing cores, thereby improving the load balancing effect.
[0095] Figure 7 This is a schematic diagram of a computing task allocation device according to an embodiment of the present disclosure. This device can execute the computing task allocation method involved in any embodiment of the present disclosure; see reference. Figure 7 The task allocation device 700 includes: a candidate split number determination module 710, a candidate task selection module 720, a target split number determination module 730, and a task split allocation module 740.
[0096] The alternative splitting number determination module 710 is used to determine the alternative splitting number of a single computing task based on the total number of computing cores. The candidate task selection module 720 is used to select the candidate split number for the current round from the candidate split number, and select the candidate computing task for the current round from the set of computing tasks to be assigned based on the candidate split number and the total number of cores. The target split number determination module 730 is used to optimize the candidate split number of each round based on the number of candidate computing tasks of the candidate computing tasks in each round and the total number of tasks in the computing task set, so as to obtain the target split number of each round. The task splitting and allocation module 740 is used to split each computing task in the computing task set according to the target splitting number in each round, and then allocate them to the computing core.
[0097] The solution in this embodiment dynamically determines and optimizes the number of task splits in each round of task allocation by combining the total number of computing cores and task characteristics. This achieves adaptive matching between the granularity of computing tasks and the hardware resources of computing cores, and maintains a full utilization strategy for multiple computing cores in multiple rounds of allocation, effectively improving the utilization rate and load balancing of computing cores.
[0098] In an optional implementation of this embodiment, in each round, the target number of splits for each computing task is the same, and each computing core is allocated computing tasks according to the target number of splits.
[0099] In an optional implementation of this embodiment, the candidate split number determination module includes: A factor set determination unit is used to determine the factor set based on the total core number; The alternative split number determination unit is used to determine the alternative split number for a single computation task from the factor set.
[0100] In an optional implementation of this embodiment, the candidate splitting number determination unit is used to perform: If the number of computing tasks to be assigned is less than the product of the total number of cores and any factor, then the factor is removed, and the other factors in the factor set other than the factor are used as the candidate split numbers.
[0101] In an optional implementation of this embodiment, the minimum number of allocation rounds to assign all computing tasks in the computing task set to the computing cores is determined based on the ratio of the total number of tasks to the total number of cores.
[0102] In an optional implementation of this embodiment, the task splitting and allocation module includes: The computing task sorting unit is used to sort the computing tasks in the computing task set according to computing power requirements to obtain a computing task sequence; The target computing task selection unit is used to select the target computing task for the current round from the sequence of computing tasks to be assigned in a fixed direction based on the target split number and the total number of cores in the current round. The core allocation order determination unit is used to determine the core allocation order for the current round based on the core allocation order of the previous round. The task allocation unit is used to allocate the target computing tasks of the current round to the computing cores according to the core allocation order of the current round.
[0103] In an optional implementation of this embodiment, the core allocation order determination unit is specifically used to perform: Use the reverse order of the core allocation order from the previous round as the core allocation order for the current round.
[0104] In an optional implementation of this embodiment, the apparatus further includes a task subsequence execution module, comprising: The computing task sorting unit is used to sort the computing tasks in the computing task set according to computing power requirements to obtain a computing task sequence; The task subsequence partitioning unit is used to execute mutation computing tasks that determine whether the computing power requirement in the computing task sequence meets the preset mutation conditions, and to divide the computing task sequence into multiple computing task subsequences with the mutation computing task as the interruption point. The subsequence execution unit is used to determine the target split number for each round of each computation task subsequence.
[0105] In an optional implementation of this embodiment, the task splitting and allocation module is specifically used to execute: The sequence order of the computation task sub-sequences is determined based on their positions within the overall computation task sequence. The current computing task subsequence is determined sequentially according to the sequence order. Each computing task in the current computing task subsequence is split according to the target split number of each round corresponding to the current computing task subsequence and then allocated to the computing core. The core allocation order corresponding to the first round of the current computing task subsequence is the opposite of the core allocation order corresponding to the last round of the previous computing task subsequence.
[0106] In an optional implementation of this embodiment, the set of computational tasks is a set of computational tasks of multiple expert subnetworks in a hybrid expert structure, and the computational task is a computational task of a single expert subnetwork.
[0107] The aforementioned task allocation device can execute the task allocation method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the method. Technical details not described in detail in this embodiment can be found in the task allocation method provided in any embodiment of this disclosure.
[0108] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in this technical solution comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0109] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0110] Figure 8A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0111] like Figure 8 As shown, device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 802 or a computer program loaded from storage unit 808 into random access memory (RAM) 803. RAM 803 may also store various programs and data required for the operation of device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via bus 804. Input / output (I / O) interface 805 is also connected to bus 804.
[0112] Multiple components in device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of monitors, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0113] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as the method of allocating computing tasks. For example, in some embodiments, the method of allocating computing tasks can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed on device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the method of allocating computing tasks described above can be performed. Alternatively, in other embodiments, the computing unit 801 can be configured to perform the method of allocating computing tasks by any other suitable means (e.g., by means of firmware).
[0114] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0115] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0116] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0117] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0118] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0119] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is established by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem that addresses the management difficulties and weak business scalability inherent in traditional physical hosting and VPS services. Servers can also be servers for distributed systems or servers integrated with blockchain technology.
[0120] Artificial intelligence (AI) is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. AI software technologies mainly include computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graph technologies.
[0121] Cloud computing refers to a technology system that enables access to a shared pool of physical or virtual resources via a network. These resources can include servers, operating systems, networks, software, applications, and storage devices, and can be deployed and managed on demand and in a self-service manner. Cloud computing technology can provide efficient and powerful data processing capabilities for applications such as artificial intelligence and blockchain, as well as for model training.
[0122] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution provided in this disclosure can be achieved, and this is not limited herein.
[0123] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for allocating computational tasks, comprising: The number of alternative splits for a single computing task is determined based on the total number of computing cores. Select the candidate split number for the current round from the candidate split number, and select the candidate computing task for the current round from the set of computing tasks to be assigned based on the candidate split number and the total number of cores; Based on the number of candidate computing tasks in each round and the total number of tasks in the computing task set, the number of candidate splits in each round is optimized to obtain the target number of splits in each round. After splitting each computing task in the computing task set according to the target split number in each round, the tasks are allocated to the computing core.
2. The method according to claim 1, wherein, In each round, the target number of splits for each computing task is the same, and each computing core is allocated computing tasks according to the target number of splits.
3. The method according to claim 1, wherein, The step of determining the number of candidate splits for a single computing task based on the total number of computing cores includes: A factor set is determined based on the total number of cores, and the number of alternative splits for a single computing task is determined from the factor set.
4. The method according to claim 3, wherein, Determining the number of candidate splits for a single computational task from the factor set includes: If the number of computing tasks to be assigned is less than the product of the total number of cores and any factor, then the factor is removed, and the other factors in the factor set other than the factor are used as the candidate split numbers.
5. The method according to claim 1, wherein, The minimum number of allocation rounds to assign all computing tasks in the computing task set to the computing cores is determined based on the ratio of the total number of tasks to the total number of cores.
6. The method according to claim 1, wherein, The step of splitting each computing task in the computing task set according to the target split number in each round and then allocating them to the computing core includes: The computing tasks in the computing task set are sorted according to the computing power requirements to obtain a computing task sequence; Based on the target split number and the total number of cores in the current round, select the target computing task for the current round from the sequence of computing tasks to be assigned in a fixed direction; The core allocation order for the current round is determined based on the core allocation order of the previous round. The target computation task of the current round is assigned to the computation core according to the core allocation order of the current round.
7. The method according to claim 6, wherein, The process of determining the core allocation order for the current round based on the core allocation order of the previous round includes: Use the reverse order of the core allocation order from the previous round as the core allocation order for the current round.
8. The method according to any one of claims 1-7, wherein, The method also includes: The computing tasks in the computing task set are sorted according to the computing power requirements to obtain a computing task sequence; Identify mutation computing tasks in the computing task sequence that meet preset mutation conditions in terms of computing power requirements, and divide the computing task sequence into multiple computing task sub-sequences using the mutation computing tasks as breakpoints. For each computational task subsequence, the target number of splits for each round is determined.
9. The method according to claim 8, wherein, The step of splitting each computing task in the computing task set according to the target split number in each round and then allocating them to the computing core includes: The sequence order of the computation task sub-sequences is determined based on their positions within the overall computation task sequence. The current computing task subsequence is determined sequentially according to the sequence order. Each computing task in the current computing task subsequence is split according to the target split number of each round corresponding to the current computing task subsequence and then allocated to the computing core. The core allocation order corresponding to the first round of the current computing task subsequence is the opposite of the core allocation order corresponding to the last round of the previous computing task subsequence.
10. The method according to claim 1, wherein, The set of computational tasks is a set of computational tasks from multiple expert subnetworks in a hybrid expert structure, and each computational task is a computational task from a single expert subnetwork.
11. A computing task allocation device, comprising: The alternative splitting number determination module is used to determine the alternative splitting number for a single computing task based on the total number of computing cores. The candidate task selection module is used to select the candidate split number for the current round from the candidate split number, and select the candidate computing task for the current round from the set of computing tasks to be assigned based on the candidate split number and the total number of cores. The target split number determination module is used to optimize the candidate split number for each round based on the number of candidate computing tasks in each round and the total number of tasks in the computing task set, so as to obtain the target split number for each round. The task splitting and allocation module is used to split each computing task in the computing task set according to the target splitting number in each round, and then allocate them to the computing core.
12. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the computational task allocation method according to any one of claims 1-10.
13. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method for allocating computing tasks according to any one of claims 1-10.
14. A computer program product comprising a computer program / instructions that, when executed by a processor, implement the method for allocating computing tasks according to any one of claims 1-10.