Task processing method and device
By using the scheduler's solution model in the computing device, tasks are allocated according to the estimated calculation amount of the problem to be solved, the problem of unbalanced task processing load is solved and the task processing efficiency of the computing device is improved.
Patent Information
- Application Number
- CN202410323291.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-10-09
- Filing Date
- 2024-03-20
- Publication Date
- 2025-04-11
AI Technical Summary
In the existing parallel task processing process, the computing device performs task scheduling based on pre-configured task allocation rules, resulting in unbalanced task processing loads of different threads, thereby reducing the task processing efficiency of the computing device.
By introducing a scheduler solution model into the computing device, the computing device can allocate tasks to different threads more evenly according to the estimated calculation amount of the problem to be solved, improving the task processing efficiency of the computing device.
By evenly allocating tasks, computing devices can significantly improve the load balancing of different threads, thereby improving the efficiency of computing devices in solving problems.
Smart Images

Figure CN119806759A_ABST
Abstract
Description
[0001] This application claims the priority of the Chinese patent application filed with the State Intellectual Property Office on October 9, 2023, with application number 202311300824.6 and invention name “A mathematical solution method, device and system”, all contents of which are incorporated by reference in this application. Technical Field
[0002] The embodiments of the present application relate to the field of computers, and in particular to a task processing method and device. Background Art
[0003] Mixed integer programming (MIP) problems determine a suitable decision solution by computing a set of linear constraints and an objective function. In MIP problems, some decision variables need to take integer values. These integer variables usually represent actual choices or restrictions in the decision. Therefore, MIP problems can be applied to various practical scenarios, such as production planning, logistics scheduling, resource allocation, and project management.
[0004] In the current MIP problem solving process, in order to improve the efficiency of computing devices in solving MIP problems, computing devices usually use task parallel processing to process. For example, during the calculation process, the computing device first generates a task sequence corresponding to the MIP problem, and calculates the estimated time required to solve each task in the sequence, and assigns the tasks to different threads for execution according to the estimated solution time of the tasks, thereby realizing parallel solution of the tasks.
[0005] However, in the current task parallel processing process, computing devices often assign tasks corresponding to solving problems to different threads for parallel processing based on pre-configured task allocation rules. Since the computing device may generate new sub-tasks during the task processing process, task scheduling according to the pre-configured allocation rules will lead to unbalanced task processing loads on different threads, making the task processing efficiency of the computing device low. Summary of the invention
[0006] The embodiment of the present application provides a task processing method, in which a computing device can calculate the estimated amount of computation to solve a problem based on a solution model of a scheduler, thereby distributing the problem to be solved more evenly to different threads for execution according to the estimated amount of computation, thereby improving the processing efficiency of the computing device for solving the problem. The embodiment of the present application also provides a task processing device, a computing device, a computing device cluster, a computer-readable storage medium, and a computer program product corresponding to the task processing method.
[0007] In the first aspect, an embodiment of the present application provides a task processing method, which can be executed by a computing device, or by a component of the computing device, such as a processor, chip or chip system of the computing device, or by a logic module or software that can realize all or part of the functions of the computing device. The method provided in the first aspect includes: the computing device obtains a mathematical model expression and instance data of the problem to be solved, the mathematical model expression includes an objective function or a constraint condition, and the instance data is used to indicate the value of the coefficient of the mathematical model expression. The computing device decomposes the problem to be solved into N sub-problems based on the mathematical model expression and instance data of the problem to be solved. The computing device distributes the N sub-problems to M threads for parallel execution according to the computational amount of each sub-problem in the N sub-problems, N is greater than M, each of the M threads processes one or more sub-problems, and the difference between the computational amount required for each thread in the M threads to process one or more sub-problems is less than or equal to a preset threshold.
[0008] In the embodiment of the present application, the computing device can calculate the computational amount of the problem to be solved, and assign tasks to different threads for execution according to the computational amount of the problem to be solved, so that the total computational amount of tasks of different threads is close, thereby improving the load balancing of different threads and further improving the problem-solving efficiency of the computing device.
[0009] In one possible implementation, a computing device calculates the computational amount of each of the N subproblems based on at least one feature information and weights of the N subproblems, where the weight is used to indicate the weight of at least one feature information for calculating the computational amount, the feature information includes at least one of the problem type and depth of each of the N subproblems, and the weight is a parameter determined by the machine model based on the feature information.
[0010] In the embodiment of the present application, the computing device can calculate the computational amount of the sub-problem based on the characteristic information of the sub-problem and the corresponding weight, thereby improving the accuracy of the computing device's estimation of the computational amount of the sub-problem, and performing thread scheduling on the sub-problem based on the computational amount, further improving the load balancing of different threads.
[0011] In a possible implementation, the computation amount is based on the thread iteration count or the thread processing time indication, that is, the computation amount is based on the thread iteration count indication that can be obtained by estimation, or the thread processing time indication that can be estimated by the computing device, without specific limitation.
[0012] In the embodiment of the present application, the computing device can indicate the estimated amount of computation of the sub-problem by the number of thread iterations, or can indicate the estimated amount of computation by the thread processing time, thereby improving the richness of the solution.
[0013] In one possible implementation, the feature information of the sub-problem in the feature information also includes historical task idle information and historical task balance. The historical task idle information includes the idle time after different threads execute the historical sub-problem. The historical task balance includes the difference in historical computing amount after different threads execute the historical sub-problem. The historical sub-problem is a sub-problem of the same problem type as the sub-problem.
[0014] In the embodiment of the present application, the computing device can determine the computational amount of sub-problems based on historical task idle information and historical task balance, thereby improving the accuracy of the estimated computational amount of solving the problem and further improving the load balancing of different threads.
[0015] In one possible implementation, the difference between the total computational amount of subproblems in the task pool corresponding to different threads is less than or equal to a preset threshold. In order to ensure that the subproblems assigned to different threads are load balanced, the computing device needs to keep the total computational amount of subproblems assigned to different threads balanced.
[0016] In the embodiment of the present application, the computing device can make the difference between the total computational amount of sub-problems in the task pool corresponding to different threads less than or equal to the first threshold, thereby improving the load balancing of different threads.
[0017] In one possible implementation, before obtaining a sequence of sub-problems, the computing device needs to model the actual problem to obtain a problem model, and preprocess the problem model to obtain a simplified problem model after preprocessing. The simplified problem model is a problem model that can be solvable by the computing device, including a mathematical model expression and instance data. The computing device preliminarily solves the simplified problem model to generate multiple sub-problem sequences.
[0018] In the embodiment of the present application, the computing device can model the actual problem to obtain the problem model and pre-process the problem model, thereby improving the efficiency of the computing device in solving the actual problem.
[0019] In one possible implementation, when a thread executes a subproblem to generate multiple sub-subproblems, the computing device calculates the estimated computational effort of the sub-subproblems based on the weights of the task scheduler, and allocates the multiple sub-subproblems to different threads for execution according to the estimated processing time of the sub-subproblems.
[0020] In the embodiment of the present application, the computing device can generate multiple secondary sub-problems in the process of executing a task. The computing device can calculate the estimated computing amount of the secondary sub-problems based on the task scheduler and schedule the secondary sub-problems, thereby improving the processing efficiency of the computing device for the secondary sub-problems.
[0021] In one possible implementation, the threads include a first thread and a second thread, the first thread and the second thread share a task pool, the sub-problems in the shared task pool include sub-problems assigned to the first thread and sub-problems in the second thread, and the computing device reallocates the sub-problems in the shared task pool to the first thread and the second thread based on a task synchronizer.
[0022] In the embodiment of the present application, the computing device can reallocate sub-problems between two threads in a shared task pool, thereby reducing thread idle time and improving thread task processing efficiency.
[0023] In one possible implementation, during a round of task solving by a computing device, when the first thread is idle, the sub-problem in the task pool corresponding to the second thread is reallocated to the first thread for processing; or, when the second thread is idle, the sub-problem in the task pool corresponding to the first thread is reallocated to the second thread for execution.
[0024] In the embodiment of the present application, the computing device can use the idle thread to execute sub-problems of other threads that share a task pool with the idle thread, thereby improving the problem processing efficiency of the computing device.
[0025] In a possible implementation, the computing device receives a deterministic parameter configured by a user, the deterministic parameter being used to control the number of iterations of a thread among multiple threads. The computing device may determine a termination condition for processing the problem to be solved based on the deterministic parameter configured by the user.
[0026] In the embodiment of the present application, the computing device can receive the deterministic parameters configured by the user, and determine the termination condition for processing the problem to be solved based on the deterministic parameters configured by the user, thereby improving the processing efficiency of the problem to be solved.
[0027] In one possible implementation, before the computing device estimates the computational effort of the subproblem based on the feature information and the weight, the computing device generates a weight for the feature information based on the machine model.
[0028] In the embodiment of the present application, the computing device can generate weights of feature information based on the machine model, thereby improving the accuracy of the weights generated by the computing device and further improving the calculation accuracy of the estimated processing time.
[0029] In a possible implementation, the computing device also needs to train a machine model that generates weights. During the training of the machine model, the computing device collects feature information of the training problem and weights corresponding to the feature information to generate first training data. The training problem includes sub-problems and sub-sub-problems. The machine model is trained based on the first training data.
[0030] In the embodiment of the present application, the computing device can generate weights of feature information based on the machine model, thereby improving the accuracy of the weights generated by the computing device and further improving the calculation accuracy of the estimated processing time.
[0031] In a possible implementation, the ratio corresponding to the preset threshold is one of 0, 5%, and 10%, or, when the computation amount is indicated based on the number of thread iterations, the threshold is one of 500 and 1000 times.
[0032] In the embodiment of the present application, the computing device can control the estimated time difference or the number of iterations of different threads to execute sub-problems, so that the total computing amount of tasks of different threads is close, thereby improving the load balancing of different threads and further improving the problem-solving efficiency of the computing device.
[0033] In one possible implementation, before the computing device estimates the amount of computation for a subproblem based on feature information and weights, the computing device may also generate weights based on an inference engine, and the inference engine may generate weights based on prior knowledge and rules.
[0034] In the embodiment of the present application, the computing device can generate weights based on the inference engine during the task scheduling process, thereby improving the accuracy of the weights generated by the computing device and further improving the accuracy of the estimated processing time.
[0035] In one possible implementation, the computing device may update the knowledge and rules of the inference engine or train the machine model based on the label data generated by the machine model, or may train the machine model or update the knowledge and rules of the inference engine based on the label data generated by the inference engine, without specific limitation.
[0036] In the embodiment of the present application, the computing device trains the machine model or updates the knowledge and rules of the inference engine, thereby improving the accuracy of the weights and further improving the calculation accuracy of the estimated processing time.
[0037] In a second aspect, an embodiment of the present application provides a task processing device, which includes an acquisition unit and a processing unit. The acquisition unit is used to obtain a mathematical model expression and instance data of a problem to be solved, the mathematical model expression includes an objective function or a constraint condition, and the instance data is used to indicate the value of the coefficient of the mathematical model expression. The processing unit is used to decompose the problem to be solved into N sub-problems based on the mathematical model expression and instance data of the problem to be solved. The processing unit is also used to distribute the N sub-problems to M threads for parallel execution according to the computational amount of each sub-problem in the N sub-problems, N is greater than M, each of the M threads processes one or more sub-problems, and the difference between the computational amount required for each thread in the M threads to process one or more sub-problems is less than or equal to a preset threshold.
[0038] In one possible implementation, the processing unit is further used to calculate the computational amount of each subproblem in the N subproblems based on at least one feature information and weights of the N subproblems, where the weight is used to indicate the weight of at least one feature information for calculating the computational amount, and the feature information includes at least one of the problem type and depth of each subproblem in the N subproblems.
[0039] In a possible implementation, the amount of computation is based on the number of thread iterations or the thread processing time indication.
[0040] In one possible implementation, the depth of the subproblem includes historical task idle information and historical task balance. The historical task idle information includes the idle time after the thread executes the historical subproblem. The historical task balance includes the difference in historical computing amount after different threads execute the historical subproblem. The historical subproblem is a subproblem of the same problem type as the subproblem.
[0041] In one possible implementation, the threads include a first thread and a second thread, the first thread and the second thread have a shared task pool, the sub-problems in the shared task pool include sub-problems assigned to the first thread and sub-problems assigned to the second thread, and the processing unit is further used to reallocate the sub-problems in the shared task pool to the first thread or the second thread.
[0042] In one possible implementation, the processing unit is specifically used to reallocate sub-problems in the task pool corresponding to the second thread to the first thread for processing when the first thread is idle, or to reallocate sub-problems in the task pool corresponding to the first thread to the second thread for processing when the second thread is idle.
[0043] In a possible implementation, the processing unit is specifically used to generate weights based on a machine model, where the machine model is a machine model trained based on training data, and the training data includes feature information of historical sub-problems and weights corresponding to the feature information.
[0044] In a possible implementation, the processing unit is further configured to calculate the computational load of the secondary subproblems based on the weights of the secondary subproblems when the thread executes M subproblems and generates multiple secondary subproblems at the same time, and to assign the multiple secondary subproblems to different threads for execution according to the computational loads of the secondary subproblems.
[0045] In a possible implementation, the processing unit is specifically used to receive a deterministic parameter configured by a user, where the deterministic parameter is used to control the number of iterations of a thread among the multiple threads.
[0046] In a possible implementation, the processing unit is further used to collect feature information of a training problem and weights corresponding to the feature information to generate first training data, the training problem includes sub-problems and sub-sub-problems, and the machine model is trained based on the first training data.
[0047] In a possible implementation, the processing unit is further configured to preset a ratio corresponding to the threshold value to be one of 0, 5%, and 10%, or, when the amount of computation is indicated based on the number of thread iterations, the threshold value to be one of 500 and 1000 times.
[0048] In a third aspect, an embodiment of the present application provides a computing device, comprising a processor, the processor being coupled to a memory, the processor being used to store instructions, and when the instructions are executed by the processor, the computing device executes the method described in the first aspect or any possible implementation manner of the first aspect.
[0049] In a fourth aspect, an embodiment of the present application provides a computing device cluster, the computing device cluster includes one or more computing devices, the computing device includes a processor, the processor is coupled to a memory, the processor is used to store instructions, when the instructions are executed by the processor, the computing device cluster executes the method described in the first aspect or any possible implementation method of the first aspect.
[0050] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium having instructions stored thereon. When the instructions are executed, the computer executes the method described in the first aspect or any possible implementation manner of the first aspect.
[0051] In a sixth aspect, an embodiment of the present application provides a computer program product, which includes instructions. When the instructions are executed, the computer implements the method described in the first aspect or any possible implementation method of the first aspect.
[0052] It can be understood that the beneficial effects that can be achieved by any of the task processing devices, computing devices, computing device clusters, computer-readable media or computer program products provided above can refer to the beneficial effects in the corresponding methods and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 A schematic diagram of the system architecture of a task processing system provided in an embodiment of the present application;
[0054] Figure 2 A flowchart of a task processing method provided in an embodiment of the present application;
[0055] Figure 3 A flowchart of another task processing method provided in an embodiment of the present application;
[0056] Figure 4 A schematic diagram of a task scheduling process provided in an embodiment of the present application;
[0057] Figure 5A flowchart of another task processing method provided in an embodiment of the present application;
[0058] Figure 6 A schematic diagram of another task scheduling process provided in an embodiment of the present application;
[0059] Figure 7 A schematic diagram of another task scheduling process provided in an embodiment of the present application;
[0060] Figure 8 A schematic diagram of the structure of a task processing device provided in an embodiment of the present application;
[0061] Fig. 9 A schematic diagram of the structure of a computing device provided in an embodiment of the present application;
[0062] Fig.10 A schematic diagram of the structure of a computing device cluster provided in an embodiment of the present application;
[0063] Fig.11 A schematic diagram of the structure of another computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION
[0064] The embodiments of the present application provide a task processing method and apparatus for improving the task processing efficiency of a computing device.
[0065] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0066] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0067] First, some terms involved in the embodiments of the present application are introduced to facilitate technical personnel in this field to understand the technical solution.
[0068] Mixed-integer programming (MIP) is a type of optimization problem that requires some or all variables to be integers. Its objective function and constraints are both linear and are NP-hard problems. MIP has applications in many practical scenarios, such as capacity planning, resource allocation, and bin packing.
[0069] Prior knowledge refers to knowledge that has been verified in advance. Prior knowledge can be the relevant knowledge, skills, and experience that a computing device already has before performing a specific task. This knowledge and experience can help the subject complete tasks more effectively and improve the efficiency and accuracy of task execution. Prior knowledge includes expertise, concepts, principles, and rules in a specific field.
[0070] In order to make the technical solution of the present application clearer and easier to understand, the system architecture of the present application is introduced below with reference to the accompanying drawings.
[0071] See also Figure 1 , Figure 1 A system architecture diagram of a task processing system provided for the example of this application. Figure 1 In the example shown, the task processing system 10 includes a pre-processing module 101, a task sequence generating module 102, a task scheduling module 103, a task synchronizer 104 and a task adjusting module 105. The specific functions of each module are described below.
[0072] The preprocessing module 101 is used to receive the problem model and preprocess the problem model, wherein the preprocessing includes simplifying the problem model to obtain a simplified problem model, wherein the simplified problem model has fewer variables or constraints than the original problem model. For example, the preprocessing module 101 can delete irrelevant or redundant constraints of the original problem model, merge equivalent variables, etc.
[0073] The task sequence generation module 102 is used to perform a preliminary solution to the simplified problem model to obtain a sub-problem sequence corresponding to the simplified problem model, which can also be called a task sequence. The solution process is a serial method, and the sub-problems corresponding to the problem model can be solved, and these sub-problems can generate a task sequence. The task sequence generation module 102 sends the task sequence to the task scheduling module 103, and the task scheduling module 103 can further schedule and solve the sub-problems in the task sequence.
[0074] The task scheduling module 103 is used to schedule the sub-problems in the task sequence. The task scheduling module 103 can schedule the sub-problems in the task sequence to multiple threads, and the sub-problems in the task sequence are processed in parallel by the multiple threads.
[0075] Among them, the task scheduling module 103 includes a solution submodule 1031 and a scheduling submodule 1032. The solution module 1031 is used to determine the weight corresponding to the characteristic information of the subproblem, which can also be called a solution parameter, and calculate the estimated amount of calculation of the task based on the weight. The scheduling submodule 1032 is used to perform the scheduling of the subproblem and distribute the subproblem to different threads for execution. The scheduling submodule 1032 can perform task scheduling based on the estimated amount of calculation of the subproblem, so that the estimated amount of calculation of tasks of different threads is close or the same.
[0076] The task synchronizer 104 is used to implement mutual waiting and communication between threads, and to control the execution order of sub-problems of different threads. For example, the task synchronizer 104 can implement the orderly execution of sub-problems of different threads by controlling the access rights of threads. The task synchronizer 104 is also used to redistribute sub-problems between affinity threads, where affinity threads are two threads that share a task pool.
[0077] The task adjustment module 105 is used to adjust the sub-problems that have not been scheduled by the task scheduling module 103. The sub-problems that have not been scheduled include the primary sub-problems in the task sequence received by the task scheduling module 103 and the secondary sub-problems generated by the thread during the task execution process.
[0078] The task adjustment module 105 includes a waiting queue adjuster 1051 and an idle task adjuster 1052. The waiting queue adjuster 1051 is used to adjust the sub-problems in the task queue that have not been scheduled by the task scheduling module 103, that is, to sort the sub-problems that have not been scheduled and wait for scheduling by the task scheduling module 103. The idle task adjuster 1052 is used to adjust the idle secondary sub-problems generated during the thread execution of tasks. The idle secondary sub-problems refer to the secondary sub-problems that exceed the number of tasks that can be processed by the thread and have not been processed. The idle task adjuster 1052 can re-add these idle secondary sub-problems to the task sequence, and the task scheduling module 103 will schedule them.
[0079] It should be noted that each module in the above-mentioned task processing system 10 can be implemented by software or hardware, and there is no specific limitation. When each module in the task processing system 10 is implemented by software, the task processing system 10 can be an application running on a computing device. When the task processing system 10 is implemented by hardware, each module in the task processing system 10 can be a computing device or a processing circuit, etc.
[0080] based on Figure 1 The task processing system 10 shown in the figure, the present application also provides a task processing method. The task processing method provided by the embodiment of the present application is introduced below in combination with the embodiment.
[0081] See also Figure 2 , Figure 2 A flowchart of a task processing method provided in an embodiment of the present application. Figure 2 In the example shown, the method includes the following steps:
[0082] 201. The computing device obtains a mathematical model expression and instance data of a problem to be solved, wherein the mathematical model expression includes an objective function or constraint conditions, and the instance data is used to indicate the values of coefficients of the mathematical model expression.
[0083] The computing device obtains a mathematical model expression and instance data of a problem to be solved, wherein the mathematical model expression includes an objective function or a constraint condition, and the instance data is used to indicate the value of a coefficient of the mathematical model expression, and the instance data may be a specific data sample or case used to verify or apply the mathematical model expression. Specifically, the instance data file may be Excel table data or Python dictionary type data.
[0084] Specifically, the computing device needs to model the actual problem to obtain a problem model, and preprocess the problem model to obtain a simplified problem model after preprocessing. The simplified problem model is the problem to be solved by the computing device. Compared with the original problem model, the simplified problem model has fewer variables and constraints. The computing device can represent the problem to be solved based on a mathematical model expression.
[0085] For example, the actual problem that the computing device needs to solve is a production scheduling problem, which can be described as how to control production variables to maximize profits. The computing device can preprocess the actual problem to obtain the mathematical model expression corresponding to the actual problem. The computing device can also obtain instance data related to the mathematical model expression based on production information.
[0086] It should be noted that the types of problems to be solved in the embodiments of the present application include mixed integer programming MIP problems, integer linear programming (ILP) problems, binary linear programming (BLP) problems, mixed binary linear programming (MBLP) problems, etc., without specific limitation.
[0087] 202. The computing device decomposes the problem to be solved into N sub-problems based on the mathematical model expression and instance data of the problem to be solved.
[0088] The computing device decomposes the problem to be solved into N sub-problems based on the mathematical model expression and instance data of the problem to be solved. The computing device performs a preliminary solution to the problem to be solved based on the task sequence generation module 102 to obtain one or more sub-problems corresponding to the problem to be solved, which can also be called first-level sub-problems. These sub-problems can constitute a task sequence. In this application, sub-problems can also be called tasks or first-level tasks.
[0089] See also Figure 3 , Figure 3 A flowchart of a task processing method provided in an embodiment of the present application. Figure 3 In steps a to c of the example shown, the actual problem is first read and modeled, and the actual problem is converted into a problem model that can be solved by the computing device. The computing device then preprocesses the problem model to obtain a simplified problem model after preprocessing. The computing device continues to preliminarily solve the simplified problem model to obtain a sub-problem sequence corresponding to the simplified problem model.
[0090] For example, in Figure 3 In one example shown, when the computing device solves the mixed integer programming MIP problem, the computing device first determines the objective function and constraints of the MIP problem, and further determines the decision variables and related parameters that need to be optimized. Decision variables refer to variables that need to find the optimal solution during the optimization process, and related parameters are constraints between decision variables or coefficients in the objective function. After that, the computing device needs to model the MIP problem, including defining the objective function and constraints, and clarifying the value range of the decision variables.
[0091] exist Figure 3 In the example shown, after the computing device models the MIP problem, it preprocesses the problem model to improve the efficiency of solving the problem. The computing device preprocesses the problem model by simplifying the constraints and tightening the variable limits, etc. Simplifying the constraints includes merging the constraints, deleting redundant constraints, and converting them into equivalent forms, and tightening the variable limits, such as tightening the value range of the decision variables and setting more compact and more appropriate upper and lower bounds.
[0092] 203. The computing device distributes N sub-problems to M threads for parallel execution according to the computational amount of each sub-problem in the N sub-problems, where N is greater than M, each of the M threads processes one or more sub-problems, and the difference between the computational amount required for each of the M threads to process one or more sub-problems is less than or equal to a preset threshold.
[0093] After the computing device decomposes the problem to be solved into N sub-problems, it distributes the N sub-problems to M threads for parallel execution according to the computational amount of each of the N sub-problems, where N is greater than M, each of the M threads processes one or more sub-problems, and the difference between the computational amount required for each of the M threads to process one or more sub-problems is less than or equal to a preset threshold.
[0094] Specifically, in the process of scheduling N sub-problems in the task sequence, the computing device calculates the computational amount of each sub-problem in the N sub-problems based on at least one feature information and weight of the N sub-problems, the weight is used to indicate the weight of at least one feature information for calculating the computational amount, and the feature information includes at least one of the problem type and depth of each sub-problem in the N sub-problems. The computing device evenly distributes the sub-problems to different threads based on the computational amount of each sub-problem, so that the difference between the total computational amount of the sub-problems processed by each thread in the M threads is less than or equal to a preset threshold.
[0095] The following specifically introduces the feature information and weights of the sub-problems in the embodiments of the present application, and the process of the computing device determining the estimated computational amount of the sub-problems based on the feature information and weights of the sub-problems.
[0096] Before the computing device calculates the estimated amount of calculation of the sub-problem based on the feature information and weights of the sub-problem, the computing device needs to train a machine model that generates weights corresponding to the feature information. In the process of training the machine model, the computing device first collects the feature information of the training problem and the weights corresponding to the feature information to generate first training data, and then trains the machine model based on the first training data. After the machine model training is completed, the computing device can output a set of weights corresponding to a set of feature information based on the machine model. The weights are also called solution parameters or hyperparameters. The weights are used to indicate the weights of one or more feature information corresponding to the sub-problem for calculating the estimated amount of calculation time. Different feature information corresponds to different weights.
[0097] Please continue reading Figure 3 ,exist Figure 3 In step k of the example shown, after generating the task sequence, the computing device generates a set of weights for each problem based on the trained machine model. The computing device calculates the estimated calculation amount of one or more sub-problems in the task sequence based on the weights and feature information, and further performs task scheduling based on the estimated calculation amount.
[0098] In a possible implementation, the above-mentioned feature information includes task feature information and environmental feature information, etc., wherein the task feature information includes the problem type corresponding to the subproblem and the depth of the subproblem, and the depth of the task includes historical task idle information and historical task balance, and the historical task idle information indicates the idle computing resources released by the thread in the process of solving the historical subproblem, for example, the idle time after the thread completes the task. The historical task balance is used to indicate the degree of difference in the historical computing amount of different threads executing historical subproblems, and the relationship between the actual computing amount and the estimated computing amount of the historical subproblems, for example, the historical task balance is calculated based on the degree of difference in the historical computing amount of different threads. Among them, the historical subproblem is a subproblem of the same problem type as the subproblem to be solved. Environmental feature information includes computing device configuration and the number of concurrent threads, etc.
[0099] See also Figure 4 , Figure 4 A flowchart of a task scheduling module for performing task scheduling is provided in an embodiment of the present application. Figure 4 In steps a to c of the example shown, the task scheduling module 103 receives a task sequence. Before scheduling sub-problems in the task sequence, the task scheduling module 103 determines the characteristic information and weights of the sub-problems. The task scheduling module 103 calculates the estimated processing time of each sub-problem in the task sequence based on the characteristic information and weights.
[0100] exist Figure 4 In steps d to e of the example shown, the computing device calculates the estimated processing time of the sub-problem based on the feature information and weights corresponding to the sub-problem, and the estimated processing time is the maximum time of the computing device in one round of solving. The computing device performs task scheduling based on the estimated processing time.
[0101] In one possible implementation, the computing device may generate weights based on a machine model or based on an inference engine, where the inference engine is used to generate weights based on prior knowledge and rules. The computing device may also use the weights generated by the machine model as label data to optimize the inference knowledge and inference rules of the inference engine, thereby improving the inference accuracy of the inference engine.
[0102] See also Figure 5 , Figure 5 A schematic diagram of an optimization process for solving parameters provided for an application embodiment. In the example shown in 5, during the task scheduling process, the computing device needs to use the weight of the feature information to calculate the estimated processing time of the task. The computing device can generate the weight of the feature information based on the machine model or based on the search engine. Before scheduling a task, the task scheduling module 103 can select a machine model or an inference engine to generate weights corresponding to different feature information.
[0103] exist Figure 5 In the example shown, after the computing device turns on weight optimization during task processing, the computing device can filter data labels based on the solution results of the task during task processing. These data labels can be used as training data for the machine model or as guidance data for updating the rules and knowledge of the inference engine. Data labels include feature information and weights corresponding to the feature information.
[0104] It is understandable that in Figure 5 In the example shown, the computing device can update the knowledge and rules of the inference engine or train the machine model based on the label data generated by the machine model, or can train the machine model or update the knowledge and rules of the inference engine based on the label data generated by the inference engine, without specific limitation.
[0105] After the computing device calculates the estimated amount of computation for each sub-problem in the task sequence, the computing device allocates one or more sub-problems in the task sequence to different threads for execution according to the estimated amount of computation for the sub-problem. Specifically, the computing device determines a corresponding thread label for each sub-problem based on the estimated amount of computation for the sub-problem, and sends the sub-problem to the task pool corresponding to the thread label, so that the total estimated amount of computation for the task pools of different threads is balanced.
[0106] In one possible implementation, the difference between the total estimated computational amounts of tasks in the task pool corresponding to different threads is less than or equal to a preset threshold. That is, in order to ensure that the task loads assigned to different threads are balanced, the computing device needs to keep the total estimated computational amounts of sub-problems assigned to different threads balanced.
[0107] The total estimated computation amount of the tasks in the task pool corresponding to the above different threads can be based on the thread iteration number indication or the thread processing time indication. When the computation amount is based on the thread iteration number indication, the preset threshold value can be, for example, 500 or 1000 times. When the computation amount is based on the thread iteration number indication, the preset threshold value can be, for example, 5 to 100 microseconds. The ratio corresponding to the preset threshold value is, for example, one of 0, 5%, and 10%.
[0108] See also Figure 6 , Figure 6 A schematic diagram of a scheduling module for task scheduling provided in an embodiment of the present application. Figure 6 In the example shown, the computing device allocates sub-problems to different threads for execution based on the estimated computational amount of the task. For example, the computing device allocates sub-problems in the total task pool to the task pool corresponding to thread 0, the task pool corresponding to thread 1, ..., the task pool corresponding to thread k-1, and the task pool corresponding to thread k. The difference between the total estimated processing time of the sub-problems in the task pools corresponding to the k threads is less than the first threshold.
[0109] In one possible implementation, a thread generates a new secondary sub-problem during the execution of a sub-problem. When a thread generates multiple secondary sub-problems when executing a task, the computing device calculates the estimated computational amount of the secondary sub-problem based on the feature information and weight of the secondary sub-problem, and the computing device assigns the multiple secondary sub-problems to different threads for execution according to the estimated computational amount of the secondary sub-problem. In this application, the secondary sub-problem may also be referred to as a secondary sub-problem, or a sub-task or a secondary task.
[0110] It should be noted that when multiple sub-sub-problems are generated in the process of thread execution of a sub-problem, when these sub-sub-problems have not been assigned thread labels after a round of solving, these sub-sub-problems can be called idle sub-sub-problems. The computing device re-adds these idle sub-sub-problems to the task sequence through the task adjustment module 105, and the task scheduling module 103 schedules these idle sub-sub-problems.
[0111] In one possible implementation, the computing device may receive a deterministic parameter configured by a user, and the deterministic parameter is used to control the number of iterations of a thread among multiple threads, for example, the deterministic parameter is 9999 times. The computing device may determine the termination condition for processing the problem to be solved based on the deterministic parameter configured by the user. For example, when the deterministic parameter is 9999 times, if the thread has not completed the solution to the problem after 9999 iterations, the computing device terminates the solution to the problem.
[0112] Please continue reading Figure 3 ,exist Figure 3 In steps d to g and j in the example shown, the computing device calculates an estimated amount of computation based on the characteristic information and weights of the sub-problems during task execution, and distributes the sub-problems to different threads for execution based on the estimated amount of computation. The threads can generate new secondary sub-problems during task execution.
[0113] Among them, Figure 3 In steps f to h of the example shown, when a thread generates a new secondary sub-problem during the execution of a task, the thread can continue to solve the newly generated secondary sub-problem when the thread is idle in this round of solving. After the end of this round of solving, if the termination condition of the problem to be solved is not met, then for the secondary sub-problems that have not been assigned threads, the computing device performs idle task adjustment on these secondary sub-problems that have not been assigned threads, and the computing device re-adds these secondary sub-problems to the task sequence. After the end of this round of solving, if the termination condition of the problem to be solved has been met, the solving ends.
[0114] In a possible implementation, the computing device may update the task feature information based on the task execution data during the process of executing the sub-problem based on multiple threads. For example, the computing device may update the historical task idle information based on the idle time after the thread execution sub-problem is completed, and update the historical task allocation balance based on the historical computing amount of different threads.
[0115] Please continue reading Figure 3 , Figure 3 In steps i and j of the example shown, the task adjustment module 105 of the computing device can update the task characteristic information in the task scheduling module 103 based on the data of the task waiting queue, or can update the task characteristic information in the task scheduling module 103 based on the data adjusted by the idle task, without specific limitation.
[0116] In one possible implementation, the task scheduler of the computing device needs to perform multiple rounds of solving the sub-problems in the task sequence and the secondary sub-problems generated by the execution sub-problems, wherein each round of solving is called a first-level solving. After each round of solving is completed, the computing device can synchronize data between threads, and at the same time, the computing device recalculates the estimated calculation amount of subsequent problems and continues to schedule.
[0117] Please continue reading Figure 3 ,exist Figure 3 In step i shown, when the computing device is allocating thread labels based on the estimated computing amount, when the number of tasks in the task pool corresponding to the thread exceeds the threshold, the task scheduling module 103 of the computing device suspends the scheduling of tasks, and the tasks in the task sequence need to wait for scheduling by the task scheduling module 103.
[0118] See also Figure 7 , Figure 7 A schematic diagram of a secondary data synchronization process provided by an embodiment of the present application. Figure 7 In steps a to c of the example shown, the computing device generates multiple sub-problems during task execution. During the first round of solving the sub-problems, the computing device recalculates the estimated processing time of the first-level sub-problems while performing task synchronization, and reallocates thread labels based on the estimated processing time of the first-level sub-problems.
[0119] exist Figure 7 In steps d to f of the example shown, when the computing device is performing the second round of solving the secondary subproblem, the computing device recalculates the estimated processing time of the secondary subproblem while performing task synchronization, and reallocates the thread label according to the estimated processing time of the secondary subproblem.
[0120] In a possible implementation, the threads include a first thread and a second thread, and the first thread and the second thread are affinity threads defined for a computing device. When the first thread and the second thread are affinity threads, the first thread and the second thread share a task pool. Tasks in the shared task pool include tasks assigned to the first thread and tasks in the second thread. The computing device may reorder tasks in the affinity threads. Specifically, the computing device reallocates sub-problems in the shared task pool to the first thread and the second thread based on a task synchronizer.
[0121] For example, when the sub-problems in the task pool of the first thread are completed and the first thread is idle, the computing device can reallocate the sub-problems in the task pool of the second thread to the first thread for execution. Alternatively, when the sub-problems in the task pool of the second thread are completed and the second thread is idle, the computing device can reallocate the sub-problems in the task pool of the first thread to the second thread for execution.
[0122] It should be noted that affinity threads are thread pairs defined based on the historical data of tasks, and can be used to solve tasks with high similarity. Therefore, data synchronization can be performed relatively frequently between affinity thread pairs, thereby improving solution efficiency.
[0123] Please continue reading Figure 6 ,exist Figure 6 In the example shown, thread 0 and thread 1 are a pair of affinity threads, and thread 0 and thread 1 can be synchronized with each other. Task synchronization between threads refers to controlling the execution order of multiple threads by using the inter-thread communication mechanism. Since thread 0 and thread 1 share a task pool, when one of thread 0 or thread 1 is idle, the computing device can reallocate sub-problems in the shared task pool and assign the sub-problems to the idle threads for execution.
[0124] exist Figure 6 In the example shown, thread k-1 and thread k are also a pair of affinity threads. Thread k-1 and thread k can perform inter-thread synchronization and task reallocation. When one of threads k-1 and thread k is idle, the computing device can reallocate sub-problems in the shared task pool and assign the sub-problems to the idle threads for execution.
[0125] exist Figure 6 In the example shown, after performing the first-level solution of the task, the computing device can synchronize between threads again. For example, after performing the first-level solution, threads 0, thread 1, ..., thread k-1 and thread k of the computing device can synchronize between threads at the second-level synchronization point.
[0126] It can be seen from the above embodiments that the computing device in the embodiments of the present application can calculate the estimated amount of computation of the subproblems to be executed in the task sequence based on the characteristic information and weights of the subproblems, and make the total estimated amount of computation of the subproblems of different threads close during the task allocation process, thereby improving the load balancing of different threads and further improving the task processing efficiency of the computing device.
[0127] Based on the above method embodiment, the embodiment of the present application also provides a task processing device. The task processing device provided by the embodiment of the present application is specifically introduced below.
[0128] See also Figure 8 , Figure 8 A schematic diagram of the structure of a task processing device provided in an embodiment of the present application. Figure 8 In the example shown, the task processing device 800 is used to implement the various steps performed by the computing device in the above embodiments. The task processing device 800 includes an acquisition unit 801 and a processing unit 802 .
[0129] Among them, the acquisition unit 801 is used to obtain the mathematical model expression and instance data of the problem to be solved, the mathematical model expression includes the objective function or constraint conditions, and the instance data is used to indicate the value of the coefficient of the mathematical model expression. The processing unit 802 is used to decompose the problem to be solved into N sub-problems based on the mathematical model expression and instance data of the problem to be solved. The processing unit 802 is also used to distribute the N sub-problems to M threads for parallel execution according to the computational amount of each sub-problem in the N sub-problems, N is greater than M, each of the M threads processes one or more sub-problems, and the difference between the computational amount required for each thread in the M threads to process one or more sub-problems is less than or equal to a preset threshold.
[0130] In one possible implementation, the processing unit 802 is further used to calculate the computational amount of each subproblem in the N subproblems based on at least one feature information and weights of the N subproblems, where the weight is used to indicate the weight of at least one feature information for calculating the computational amount, and the feature information includes at least one of the problem type and depth of each subproblem in the N subproblems.
[0131] In a possible implementation, the amount of computation is based on the number of thread iterations or the thread processing time indication.
[0132] In one possible implementation, the depth of the subproblem includes historical task idle information and historical task balance. The historical task idle information includes the idle time after the thread executes the historical subproblem. The historical task balance includes the difference in historical computing amount after different threads execute the historical subproblem. The historical subproblem is a subproblem of the same problem type as the subproblem.
[0133] In one possible implementation, the threads include a first thread and a second thread, the first thread and the second thread have a shared task pool, the sub-problems in the shared task pool include sub-problems assigned to the first thread and sub-problems assigned to the second thread, and the processing unit 802 is further used to reallocate the sub-problems in the shared task pool to the first thread or the second thread.
[0134] In one possible implementation, the processing unit 802 is specifically used to reallocate the sub-problems in the task pool corresponding to the second thread to the first thread for processing when the first thread is idle, or to reallocate the sub-problems in the task pool corresponding to the first thread to the second thread for processing when the second thread is idle.
[0135] In a possible implementation, the processing unit 802 is specifically configured to generate weights based on a machine model, where the machine model is a machine model trained based on training data, and the training data includes feature information of historical sub-problems and weights corresponding to the feature information.
[0136] In a possible implementation, the processing unit 802 is further configured to calculate the computational load of the sub-problems based on the weights of the sub-problems when the thread executes M sub-problems and generates multiple sub-problems at the same time, and to assign the multiple sub-problems to different threads for execution according to the computational loads of the sub-problems.
[0137] In a possible implementation, the processing unit 802 is specifically configured to receive a deterministic parameter configured by a user, where the deterministic parameter is used to control the number of iterations of a thread among the multiple threads.
[0138] In a possible implementation, the processing unit 802 is further used to collect feature information of a training problem and weights corresponding to the feature information to generate first training data, where the training problem includes sub-problems and sub-sub-problems, and the machine model is trained based on the first training data.
[0139] In a possible implementation, the processing unit 802 is further configured to preset a ratio corresponding to the threshold value to be one of 0, 5%, and 10%, or, when the amount of computation is indicated based on the number of thread iterations, the threshold value to be one of 500 and 1000 times.
[0140] It is understandable that the acquisition unit 801 and the processing unit 802 in the task processing device 800 can be used as functional modules and Figure 1 There is a mapping between each module in the task processing system 10, so as to realize the function of each module in the task processing system 10.
[0141] It should be understood that the division of the units in the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And the units in the device can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some units can also be implemented in the form of software calling through processing elements, and some units can be implemented in the form of hardware. For example, each unit can be a separately established processing element, or it can be integrated in a certain chip of the device. In addition, it can also be stored in the memory in the form of a program, and called and executed by a certain processing element of the device. The function of the unit. In addition, all or part of these units can be integrated together, or they can be implemented independently. The processing element described here can also be a processor, which can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each unit above can be implemented by an integrated logic circuit of hardware in the processor element or in the form of software calling through a processing element.
[0142] It is worth noting that, for the above method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the described order of actions. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required for the present application.
[0143] Other reasonable step combinations that can be thought of by those skilled in the art based on the above description also fall within the scope of protection of this application. Secondly, those skilled in the art should also be familiar with the fact that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by this application.
[0144] See also Fig. 9 , Fig. 9 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. Fig. 9 As shown, the computing device 900 includes: a processor 901, a memory 902, a communication interface 903 and a bus 904. The processor 901, the memory 902 and the communication interface 903 are coupled via a bus (not marked in the figure). The memory 902 stores instructions. When the execution instructions in the memory 902 are executed, the computing device 900 executes the method executed by the computing device in the above method embodiment.
[0145] The computing device 900 may be one or more integrated circuits configured to implement the above method, such as one or more application specific integrated circuits (ASIC), or one or more microprocessors (digital signal processors, DSP), or one or more field programmable gate arrays (FPGA), or a combination of at least two of these integrated circuit forms. For another example, when a unit in the device can be implemented in the form of a processing element scheduler, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call a program. For another example, these units may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0146] The processor 901 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. A general-purpose processor may be a microprocessor or any conventional processor.
[0147] The memory 902 may be a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memories. Among them, the nonvolatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).
[0148] The memory 902 stores executable program codes, and the processor 901 executes the executable program codes to respectively implement the functions of the aforementioned units or modules, thereby implementing the aforementioned task processing method. That is, the memory 902 stores instructions for executing the aforementioned task processing method.
[0149] The communication interface 903 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 900 and other devices or a communication network.
[0150] In addition to the data bus, the bus 904 may also include a power bus, a control bus, a status signal bus, etc. The bus may be a peripheral component interconnect express (PCIe) bus, or an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. The bus may be divided into an address bus, a data bus, a control bus, etc.
[0151] See also Fig.10 , Fig.10 A schematic diagram of a computing device cluster provided in an embodiment of the present application. Fig.10 As shown, the computing device cluster 1000 includes at least one computing device 900 .
[0152] like Fig.10 As shown, the computing device cluster 1000 includes at least one computing device 900. The memory 902 in one or more computing devices 900 in the computing device cluster 1000 may store the same instructions for executing the above-mentioned task processing method.
[0153] In some possible implementations, the memory 902 of one or more computing devices 900 in the computing device cluster 1000 may also store partial instructions for executing the above-mentioned task processing method. In other words, the combination of one or more computing devices 900 may jointly execute instructions for executing the above-mentioned task processing method.
[0154] It should be noted that the memory 902 in different computing devices 900 in the computing device cluster 1000 can store different instructions, which are respectively used to execute part of the functions of the above-mentioned task processing device. That is, the instructions stored in the memory 902 in different computing devices 900 can realize the functions of one or more modules in the transceiver unit and the processing unit.
[0155] In some possible implementations, one or more computing devices 900 in the computing device cluster 1000 may be connected via a network, which may be a wide area network or a local area network.
[0156] See also Fig.11 , Fig.11A schematic diagram of computer devices in a computer cluster connected via a network provided in an embodiment of the present application. Fig.11 As shown, two computing devices 900A and 900B are connected via a network. Specifically, they are connected to the network via a communication interface in each computing device.
[0157] In a possible implementation, the memory in the computing device 900A stores instructions for executing the functions of the transceiver unit, and the memory in the computing device 900B stores instructions for executing the functions of the processing unit and the display unit.
[0158] It should be understood that Fig.11 The functions of the computing device 900A shown in FIG. 1 may also be completed by multiple computing devices. Similarly, the functions of the computing device 900B may also be completed by multiple computing devices.
[0159] In another embodiment of the present application, a computer-readable storage medium is provided, in which computer-executable instructions are stored. When the processor of the device executes the computer-executable instructions, the device executes the method executed by the computing device in the above method embodiment.
[0160] In another embodiment of the present application, a computer program product is provided, the computer program product includes computer execution instructions, the computer execution instructions are stored in a computer readable storage medium. When the processor of the device executes the computer execution instructions, the device executes the method executed by the computing device in the above method embodiment.
[0161] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0162] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0163] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0164] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0165] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.
Claims
1. A task processing method, characterized in that: Applied to a computing device, the method comprises: Acquire a mathematical model expression and instance data of a problem to be solved, wherein the mathematical model expression includes an objective function or a constraint condition, and the instance data is used to indicate the value of a coefficient of the mathematical model expression; Based on the mathematical model expression of the problem to be solved and the instance data, decomposing the problem to be solved into N sub-problems; The N subproblems are allocated to M threads for parallel execution according to the computational amount of each of the N subproblems, where N is greater than M, each of the M threads processes one or more subproblems, and the difference between the computational amount required for each of the M threads to process one or more subproblems is less than or equal to a preset threshold.
2. The method according to claim 1, characterized in that The method further comprises: The calculation amount of each subproblem in the N subproblems is calculated based on at least one feature information and a weight of the N subproblems, wherein the weight is used to indicate the weight of the at least one feature information for calculating the calculation amount, and the feature information includes at least one of a problem type and a depth of each subproblem in the N subproblems.
3. The method according to claim 1 or 2, characterized in that: The computation amount is based on a thread iteration number or a thread processing time indication.
4. The method according to claim 2 or 3, characterized in that: The characteristic information of the sub-problem also includes historical task idle information and historical task balance. The historical task idle information includes the idle time after the thread executes the historical sub-problem. The historical task balance includes the difference in historical calculation amount of different threads executing the historical sub-problem. The historical sub-problem is a sub-problem of the same problem type as the sub-problem.
5. The method according to any one of claims 1 to 4, characterized in that The threads include a first thread and a second thread, the first thread and the second thread have a shared task pool, the sub-problems in the shared task pool include sub-problems assigned to the first thread and sub-problems assigned to the second thread, and the method further includes: The sub-problems in the shared task pool are reallocated to the first thread or the second thread.
6. The method according to claim 5, characterized in that The reallocating the sub-problems in the shared task pool to the first thread or the second thread comprises: When the first thread is idle, the sub-problems in the task pool corresponding to the second thread are reallocated to the first thread for processing; or, when the second thread is idle, the sub-problems in the task pool corresponding to the first thread are reallocated to the second thread for processing.
7. The method according to any one of claims 1 to 6, characterized in that Before calculating the computation amount of each of the N sub-problems based on at least one feature information and weight of the N sub-problems, the method further includes: The weight is generated based on a machine model, where the machine model is a machine model trained based on training data, and the training data includes feature information of historical sub-problems and weights corresponding to the feature information.
8. The method according to any one of claims 1 to 7, characterized in that The method further comprises: When the thread executes the M sub-problems and generates multiple secondary sub-problems at the same time, the computation amount of the secondary sub-problems is calculated based on the weights of the secondary sub-problems; The multiple sub-sub-problems are assigned to different threads for execution according to the computational load of the sub-sub-problems.
9. The method according to any one of claims 1 to 8, characterized in that The method further comprises: A deterministic parameter configured by a user is received, where the deterministic parameter is used to control the number of iterations of a thread among the multiple threads.
10. The method according to any one of claims 1 to 9, characterized in that The method further comprises: Collecting feature information of a training problem and a weight corresponding to the feature information to generate first training data, wherein the training problem includes the sub-problem and the sub-sub-problem; The machine model is trained based on the first training data.
11. The method according to any one of claims 1 to 11, characterized in that The ratio corresponding to the preset threshold is one of 0, 5%, and 10%, or, when the computation amount is indicated based on the number of thread iterations, the threshold is one of 500 and 1000 times.
12. A task processing device, characterized in that: The device comprises: An acquisition unit, used to acquire a mathematical model expression and instance data of a problem to be solved, wherein the mathematical model expression includes an objective function or a constraint condition, and the instance data is used to indicate the value of a coefficient of the mathematical model expression; A processing unit, configured to decompose the problem to be solved into N sub-problems based on the mathematical model expression of the problem to be solved and the instance data; The processing unit is also used to distribute the N sub-problems to M threads for parallel execution according to the computational amount of each of the N sub-problems, where N is greater than M, each of the M threads processes one or more sub-problems, and the difference between the computational amount required for each of the M threads to process one or more sub-problems is less than or equal to a preset threshold.
13. The device according to claim 12, characterized in that The processing unit is also used for: The calculation amount of each subproblem in the N subproblems is calculated based on at least one feature information and a weight of the N subproblems, wherein the weight is used to indicate the weight of the at least one feature information for calculating the calculation amount, and the feature information includes at least one of a problem type and a depth of each subproblem in the N subproblems.
14. The device according to claim 12 or 13, characterized in that The computation amount is based on a thread iteration number or a thread processing time indication.
15. The device according to claim 13 or 14, characterized in that The characteristic information of the sub-problem also includes historical task idle information and historical task balance. The historical task idle information includes the idle time after the thread executes the historical sub-problem. The historical task balance includes the difference in historical calculation amount of different threads executing the historical sub-problem. The historical sub-problem is a sub-problem of the same problem type as the sub-problem.
16. The device according to any one of claims 12 to 15, characterized in that The threads include a first thread and a second thread, the first thread and the second thread have a shared task pool, the sub-problems in the shared task pool include sub-problems assigned to the first thread and sub-problems assigned to the second thread, and the processing unit is further used for: The sub-problems in the shared task pool are reallocated to the first thread or the second thread.
17. The device according to claim 16, characterized in that The processing unit is specifically used for: When the first thread is idle, the sub-problems in the task pool corresponding to the second thread are reallocated to the first thread for processing; or, when the second thread is idle, the sub-problems in the task pool corresponding to the first thread are reallocated to the second thread for processing.
18. The device according to any one of claims 12 to 17, characterized in that The processing unit is specifically used for: The weight is generated based on a machine model, where the machine model is a machine model trained based on training data, and the training data includes feature information of historical sub-problems and weights corresponding to the feature information.
19. The device according to any one of claims 12 to 18, characterized in that The processing unit is also used for: When the thread executes the M sub-problems and generates multiple secondary sub-problems at the same time, the computation amount of the secondary sub-problems is calculated based on the weights of the secondary sub-problems; The multiple sub-sub-problems are assigned to different threads for execution according to the computational load of the sub-sub-problems.
20. The device according to any one of claims 12 to 19, characterized in that The processing unit is specifically used for: A deterministic parameter configured by a user is received, where the deterministic parameter is used to control the number of iterations of a thread among the multiple threads.
21. The device according to any one of claims 12 to 20, characterized in that The processing unit is also used for: Collecting feature information of a training problem and a weight corresponding to the feature information to generate first training data, wherein the training problem includes the sub-problem and the sub-sub-problem; The machine model is trained based on the first training data.
22. The device according to any one of claims 12 to 21, characterized in that The ratio corresponding to the preset threshold is one of 0, 5%, and 10%, or, when the computation amount is indicated based on the number of thread iterations, the threshold is one of 500 and 1000 times.
23. A computing device cluster, characterized in that: The system comprises at least one computing device, each computing device comprises a processor and a memory, the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method as claimed in any one of claims 1 to 11.
24. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster executes the method according to any one of claims 1 to 11.
25. A computer-readable storage medium, characterized in that: The method comprises computer program instructions, and when the computer program instructions are executed by a computing device cluster, the computing device cluster performs the method according to any one of claims 1 to 11.
Citation Information
Cited By
Task processing method and apparatus
EP4783002A1
Task processing method and apparatus
WO2025077229A1