Resource allocation method and device, equipment and storage medium
By extracting static and dynamic features of computing tasks and resources, generating combined feature vectors and inputting them into the prediction model, the problem of low resource utilization in existing technologies is solved, and more efficient resource allocation is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-29
- Publication Date
- 2026-04-07
AI Technical Summary
Existing resource allocation methods predict performance based on the static program characteristics of tasks, ignoring the real-time dynamic state of quantum and classical hardware, resulting in low resource utilization.
Extract static features of the computational task and dynamic features of available resources, generate a combined feature vector, input it into a pre-trained prediction model, and generate the resource allocation scheme with the highest evaluation value based on the objective optimization strategy.
By taking into account the real-time dynamic status of computing resources, resource utilization is improved, and a better resource allocation scheme is generated.
Smart Images

Figure CN121807571A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of cloud computing, big data, and edge computing technologies, and in particular to a resource allocation method, apparatus, device, and storage medium. Background Technology
[0002] Currently, resource allocation schemes predict performance solely based on static program characteristics of the task, neglecting the real-time dynamic states of quantum and classical hardware (such as queue length and error rate), leading to suboptimal decisions. In other words, current resource allocation methods result in low resource utilization. Summary of the Invention
[0003] This application provides a resource allocation method, apparatus, device, and storage medium that can solve the problem of low resource utilization.
[0004] To solve the above-mentioned technical problems, this application is implemented as follows:
[0005] In a first aspect, embodiments of this application provide a resource allocation method, the method comprising:
[0006] Extract the static features of the computational tasks to be scheduled;
[0007] Based on the list of available resources, obtain the dynamic characteristics of N computing resources, wherein the list of available resources includes the N computing resources, and the N computing resources include at least one quantum processor and / or at least one classical computing cluster;
[0008] Based on the static features and the dynamic features of the N computing resources, M combined feature vectors are generated, and the M combined feature vectors are input into a pre-trained prediction model.
[0009] Based on the preset target optimization strategy and the M sets of prediction results output by the prediction model, a target resource allocation scheme is generated. The target resource allocation scheme is the resource allocation scheme with the highest evaluation value among the M resource allocation schemes corresponding to the M sets of prediction results.
[0010] Where N and M are both positive integers, and M is greater than or equal to N.
[0011] Secondly, embodiments of this application provide a resource allocation device, the device comprising:
[0012] The extraction module is used to extract the static features of the computational tasks to be scheduled.
[0013] The acquisition module is used to acquire the dynamic characteristics of N computing resources based on the available resource list, wherein the available resource list includes the N computing resources, and the N computing resources include at least one quantum processor and / or at least one classical computing cluster.
[0014] The input module generates M combined feature vectors based on the static features and the dynamic features of the N computing resources, and inputs the M combined feature vectors into the pre-trained prediction model;
[0015] The generation module is used to generate a target resource allocation scheme based on a preset target optimization strategy and M sets of prediction results output by the prediction model. The target resource allocation scheme is the resource allocation scheme with the highest evaluation value among the M resource allocation schemes corresponding to the M sets of prediction results.
[0016] Where N and M are both positive integers, and M is greater than or equal to N.
[0017] Thirdly, embodiments of this application provide an electronic device, including a processor and a memory, wherein the memory stores a program or instructions executable on the processor, and the program or instructions, when executed by the processor, implement the steps of the resource allocation method as described in the first aspect.
[0018] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the resource allocation method as described in the first aspect.
[0019] In this embodiment, static features of the computing task to be scheduled are extracted; dynamic features of N computing resources are obtained based on an available resource list, wherein the available resource list includes the N computing resources, and the N computing resources include at least one quantum processor and / or at least one classical computing cluster; M combined feature vectors are generated based on the static features and the dynamic features of the N computing resources, and the M combined feature vectors are input into a pre-trained prediction model; a target resource allocation scheme is generated based on a preset target optimization strategy and M sets of prediction results output by the prediction model, wherein the target resource allocation scheme is the resource allocation scheme with the highest evaluation value among the M resource allocation schemes corresponding to the M sets of prediction results; wherein N and M are both positive integers, and M is greater than or equal to N. Thus, by collecting dynamic features of available computing resources in real time and generating combined feature vectors with static features of the computing task to be scheduled, and inputting them into a pre-trained prediction model, a better target resource allocation scheme is generated based on the preset target optimization strategy and the prediction results output by the prediction model, thereby improving resource utilization. Attached Figure Description
[0020] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 Flowchart of the resource allocation method provided in the embodiments of this application Figure 1 ;
[0022] Figure 2 Flowchart of the resource allocation method provided in the embodiments of this application Figure 2 ;
[0023] Figure 3 Flowchart of the resource allocation method provided in the embodiments of this application Figure 3 ;
[0024] Figure 4 This is a schematic diagram of the structure of the resource allocation device provided in the embodiments of this application;
[0025] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0026] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0027] For ease of understanding, the resource allocation method, apparatus, equipment and storage medium proposed in this application will be further described below with reference to the accompanying drawings.
[0028] Please see Figure 1 , Figure 1 A flowchart illustrating a resource allocation method provided in this application embodiment. Figure 1 As shown in the figure, the method includes:
[0029] Step 101: Extract the static features of the computational tasks to be scheduled.
[0030] It should be understood that extracting the static features of a computational task to be scheduled refers to extracting its inherent, time-invariant attributes. Specifically, this may include task metadata, computational requirement features, and structural features. Task metadata may include task ID, user ID, submission timestamp, etc. Computational requirement features may include the type of computational task (e.g., VQE algorithm, QAOA algorithm, molecular simulation, optimization problem), scale parameters (e.g., the size of the simulated molecule, the number of variables in the optimization problem), Hamiltonian complexity analysis results, user-specified expected computational accuracy requirements, maximum allowed execution time, etc. Structural features can be used to identify whether the computational task to be scheduled can be broken down into subtasks, dependencies (if it is part of a workflow), etc.
[0031] Step 102: Based on the list of available resources, obtain the dynamic characteristics of N computing resources.
[0032] The list of available resources includes the N computing resources, which include at least one quantum processor and / or at least one classical computing cluster.
[0033] It should be understood that the list of available resources enumerates N computing resources that can be used for computation. The dynamic characteristics of these N computing resources can be the dynamic characteristics of at least one quantum processor, the dynamic characteristics of at least one classical computing cluster, or the dynamic characteristics of both at least one quantum processor and at least one classical computing cluster. Specifically, the dynamic characteristics of a quantum processor may include the quantum processing unit (QPU) identity document (ID), the total number of available qubits, the current single-qubit gate error rate, the double-qubit gate error rate, the average coherence time (T1, T2), the number of tasks in the current task queue, and the estimated queuing time calculated based on the current queue load and historical execution data. The dynamic characteristics of a classical computing cluster may include the cluster ID, the number of nodes, the average utilization of the central processing unit (CPU) / graphics processing unit (GPU), the average memory utilization, the current I / O load, and the task queue length.
[0034] In practice, the feature extraction module requests the real-time dynamic status of all available computing resources (quantum processors and classical computing clusters) from the hardware monitoring system.
[0035] Step 103: Generate M combined feature vectors based on the static features and the dynamic features of the N computing resources, and input the M combined feature vectors into the pre-trained prediction model. Here, N and M are both positive integers, and M is greater than or equal to N.
[0036] It should be understood that the combined feature vector is the input vector of the computational task to be scheduled and a certain computational resource at the decision moment. This input vector is then fed into a pre-trained prediction model to output the prediction result.
[0037] The aforementioned prediction model can be a gradient boosting decision tree (such as XGBoost, LightGBM) or a deep neural network model, thereby effectively handling heterogeneous features and capturing complex nonlinear relationships. Furthermore, this prediction model distinguishes different types of computing resources through feature engineering (such as one-hot encoding of resource types), thus enabling it to predict the performance of the scheduled computing task on any type of resource.
[0038] In practical implementation, for a task T and a resource (j is the resource index), its input vector at decision time t. It can be represented as:
[0039] ;
[0040] in, It is a task The static feature vector contains information that does not change over time, such as task type and scale. It is a resource At any moment The dynamic feature vector contains information such as the real-time queue length and error rate of the resource. ⊕ indicates a vector concatenation operation, which joins the two vectors end-to-end to form a longer combined feature vector containing all information about the task and resource. .
[0041] In this way, by combining feature vectors Input the data into the prediction model to output the prediction results.
[0042] It should be understood that the above is the prediction process for a computing task to be scheduled on a certain available computing resource. If there are N available resources, the prediction model will be called N times, generating N sets of prediction results, forming a prediction matrix.
[0043] Step 104: Based on the preset target optimization strategy and the M sets of prediction results output by the prediction model, generate a target resource allocation scheme. The target resource allocation scheme is the resource allocation scheme with the highest evaluation value among the M resource allocation schemes corresponding to the M sets of prediction results.
[0044] It should be understood that the preset target optimization strategy is a pre-set optimization strategy for the aforementioned computational tasks to be scheduled. This optimization strategy can be set based on time or cost, and this embodiment does not limit this. The aforementioned prediction results may include the expected total turnaround time and the expected accuracy of the computation results.
[0045] In the specific implementation, for each input combined feature vector The prediction model will output two key prediction values (i.e., prediction results), namely a tuple containing the expected total turnaround time and the expected calculation error:
[0046] ;
[0047] Thus, based on the preset target optimization strategy and the prediction results output by the prediction model, multiple resource allocation schemes are generated. Each resource allocation scheme assigns the computational tasks to be scheduled to target available computing resources for processing. In specific implementations, the target available computing resources can be one or more quantum processors, one or more classical computing clusters, or a combination of both. The target resource allocation scheme is the optimal one among these multiple schemes based on the preset target optimization strategy.
[0048] In practice, multiple resource allocation schemes can be evaluated or ranked, and then the resource allocation scheme with the highest evaluation value can be selected.
[0049] In this embodiment, static features of the computing task to be scheduled are extracted; dynamic features of N computing resources are obtained based on an available resource list, wherein the available resource list includes the N computing resources, and the N computing resources include at least one quantum processor and / or at least one classical computing cluster; M combined feature vectors are generated based on the static features and the dynamic features of the N computing resources, and the M combined feature vectors are input into a pre-trained prediction model; a target resource allocation scheme is generated based on a preset target optimization strategy and M sets of prediction results output by the prediction model, wherein the target resource allocation scheme is the resource allocation scheme with the highest evaluation value among the M resource allocation schemes corresponding to the M sets of prediction results; wherein N and M are both positive integers, and M is greater than or equal to N. Thus, by collecting dynamic features of available computing resources in real time and generating combined feature vectors with static features of the computing task to be scheduled, and inputting them into a pre-trained prediction model, a better target resource allocation scheme is generated based on the preset target optimization strategy and the prediction results output by the prediction model, thereby improving resource utilization.
[0050] Optionally, after generating the target resource allocation scheme, the method further includes:
[0051] Based on the target resource allocation scheme, the computing tasks to be scheduled are allocated to the target quantum processor and / or the target classical computing cluster;
[0052] When the target quantum processor and / or the target classical computing cluster complete the scheduled computing task, the task data of the scheduled computing task is recorded.
[0053] It should be understood that after generating the target resource allocation scheme in step 104, the computing tasks to be scheduled are allocated to the execution queues of the target quantum processors and / or target classical computing clusters based on the target resource allocation scheme. Finally, the computing tasks to be scheduled are executed on the allocated target quantum processors and / or target classical computing clusters. The number of target quantum processors can be one or more, and this embodiment does not limit this. Similarly, the number of target classical computing clusters can also be one or more, and this embodiment does not limit this either.
[0054] In this way, after the target quantum processor and / or target classical computing cluster have finished executing, the task data of the computing task is recorded.
[0055] Optionally, the task data includes the actual total turnaround time and the actual calculation result accuracy. After recording the task data of the computation task to be scheduled, the method further includes:
[0056] Based on the target combined feature vector, the actual total turnaround time, and the actual calculation result accuracy, a task sample corresponding to the computing task to be scheduled is generated, wherein the target combined feature vector is a combined feature vector corresponding to the target resource allocation scheme;
[0057] The task samples are stored in a historical database.
[0058] It should be understood that task data refers to the actual results corresponding to the prediction results output by the prediction model, including the actual total turnaround time and the accuracy of the actual calculation results.
[0059] After recording the task data, based on the target combination feature vector, the actual total turnaround time, and the accuracy of the actual calculation results, a task sample corresponding to the computation task to be scheduled is generated, and the task sample is stored in the historical database for subsequent updates or adjustments to the prediction model.
[0060] Optionally, the prediction result includes the expected total turnover time and the expected calculation result, and the method further includes:
[0061] The prediction model is updated based on a preset update strategy;
[0062] The preset update strategy includes at least one of the following:
[0063] If the number of task samples in the historical database exceeds a preset number, the prediction model is updated.
[0064] If the usage time of the prediction model exceeds a preset time, the prediction model is updated.
[0065] If the average prediction error of the prediction model is greater than a preset error value, the prediction model is updated. The prediction error is the difference between the accuracy of the expected calculation result and the accuracy of the actual calculation result, or the difference between the expected total turnaround time and the actual total turnaround time.
[0066] It should be understood that after storing the task samples in the historical database, the prediction model is updated based on a preset update strategy in order to improve the prediction accuracy of the prediction model.
[0067] The preset update strategy can be set based on the number of task samples, the length of time the prediction model has been used, or the performance of the prediction model. Specifically, the prediction model can be updated when the number of collected task samples exceeds a preset number; the prediction model can be updated after a fixed time period has been used; or the prediction model can be updated when the average prediction error of the prediction model exceeds a preset error value.
[0068] In this embodiment of the application, the prediction accuracy of the prediction model is improved by updating the prediction model.
[0069] Optionally, if the computational task to be scheduled is a divisible task, the step of generating M combined feature vectors based on the static features and the dynamic features of the N computational resources includes:
[0070] The computational task to be scheduled is decomposed into K subtasks, where K is an integer greater than 1;
[0071] Extract the static features of the K sub-tasks;
[0072] Based on the static features of the K sub-tasks and the dynamic features of the N computing resources, M combined feature vectors are generated.
[0073] It should be understood that when extracting the static features of the computing task to be scheduled in step 101, the structural features of the computing task to be scheduled are extracted to determine whether the computing task to be scheduled is a divisible task.
[0074] If the computational task to be scheduled is a divisible task, it is decomposed into multiple subtasks. Multiple combined feature vectors are generated by extracting the static features of each subtask and the dynamic features of N computational resources.
[0075] In practice, each subtask needs to independently extract its static features and combine them with the dynamic features of the N available computing resources to form a combined feature vector. The implementation steps are as follows:
[0076] First, the computational task T to be scheduled is decomposed into k logically independent subtasks. .
[0077] Then, for each subtask Extract its specific static feature vector (Because the types and scales of computation may differ between different subtasks).
[0078] Finally, for each subtask and every available resource Construct combined feature vectors .
[0079] It should be noted that after inputting the combined feature vectors into the prediction model, the output is the prediction results of all combinations, forming a... The prediction matrix (where k is the number of subtasks and N is the number of available computing resources), and the matrix elements contain the expected time. and expected error Thus, the optimization problem of combination is solved based on the prediction matrix (similar to the multidimensional knapsack problem or load balancing problem).
[0080] In practical implementation, the optimization result of the combination can be solved based on the objective function, which can be the maximum value of the completion time of all subtasks (Makespan), i.e. .
[0081] Additionally, it should be noted that the objective function should also ensure that the expected error of each subtask meets the requirements, and take into account the limitations of parallel execution of resources.
[0082] Optionally, the preset target optimization strategy includes a time strategy and a cost strategy. The step of generating a target resource allocation scheme based on the preset target optimization strategy and the M sets of prediction results output by the prediction model includes:
[0083] Obtain the task requirements of the computing task to be scheduled, including time requirements or cost requirements;
[0084] If the task requirement of the computing task to be scheduled is a time requirement, a target resource allocation scheme is generated based on the time strategy and the M sets of prediction results output by the prediction model.
[0085] or,
[0086] If the task requirement of the computing task to be scheduled is a cost requirement, a target resource allocation scheme is generated based on the cost strategy and the M sets of prediction results output by the prediction model.
[0087] It should be understood that the predicted target optimization strategy is flexibly configurable. Specifically, the predicted target optimization strategy may include a time strategy and a cost strategy. When the task requirement of the computing task to be scheduled is a time requirement, the preset target optimization strategy is a time strategy; when the task requirement of the computing task to be scheduled is a cost requirement, the preset target optimization strategy is a cost strategy. In this way, by selecting the corresponding optimization strategy based on the task requirement of the computing task to be scheduled, the rationality of resource allocation can be improved.
[0088] In an optional embodiment, for a requirement of accuracy not less than The task, its optimal resources The choice can be expressed as:
[0089] Time-optimal strategy: ;
[0090] This formula describes the decision-making logic under the "time-optimal" strategy. It means "find the parameter that minimizes the expression". The entire formula means: First, filter out all cases that meet the condition " (i.e., the prediction error is less than or equal to the error threshold required by the user) computing resources Then, among these resources that meet the conditions, find the predicted total turnaround time. Minimal resources and use it as the optimal resource for the final selection. .
[0091] In another alternative embodiment, its optimal resources The choice can be expressed as:
[0092] Cost-optimal strategy: ;
[0093] This formula describes the decision-making logic under the "cost-optimal" strategy. Similar to the time-optimal strategy, it first selects computing resources that meet the accuracy requirements, and then finds the resource with the lowest computing cost among those resources. and use it as the optimal resource for the final selection. This cost is comprised of "forecasted total turnaround time". "and resources" unit time cost The optimal resource is represented by the product of the two terms, and the resource with the smallest product is taken as the optimal resource. .
[0094] Optionally, obtaining the dynamic characteristics of N computing resources based on the list of available resources includes:
[0095] Based on the list of available resources, read the N computing resources sequentially;
[0096] The computing tasks to be scheduled are paired one by one with the N computing resources to obtain the dynamic characteristics of the N computing resources.
[0097] It should be understood that after obtaining the list of available resources, each available resource in the list is read in a loop, and the computing tasks to be scheduled are paired with each computing resource to obtain the dynamic characteristics of each computing resource.
[0098] To better understand, the resource allocation method provided in the embodiments of this application will be described below.
[0099] It should be understood that this resource allocation method is applied to a resource allocation system. This system consists of four core components: a feature extraction module, a machine learning prediction module, a decision logic module, and an online update module. For details, please refer to [link to relevant documentation]. Figure 2 , Figure 2 A flowchart illustrating the resource allocation method in an embodiment of this application. Figure 2 .
[0100] The feature extraction module serves as the system's data input, connecting in real-time with the task submission system and hardware monitoring system via an API interface. Its function is to generate a comprehensive, structured feature vector for each scheduled computation task, which can then be used by subsequent modules.
[0101] Among them, static feature extraction focuses on the task itself, extracting its inherent attributes that do not change over time. Specifically, this includes: task metadata (such as task ID, user ID, submission timestamp), computational requirement features (such as the type of computational task (e.g., VQE algorithm, QAOA algorithm, molecular simulation, optimization problem), scale parameters (e.g., the size of the simulated molecule, the number of variables in the optimization problem), Hamiltonian complexity analysis results, user-specified expected computational accuracy requirements (e.g., 1e-5), maximum allowed execution time), and structural features (such as whether the task can be broken down into subtasks, and dependencies (if it is part of a workflow)).
[0102] Hardware dynamic feature extraction obtains the current status of all available computing resources (including all quantum processors and classical computing clusters) from the hardware monitoring system in real time through polling or publish-subscribe mechanisms.
[0103] For a quantum processing unit (QPU), the extracted information includes: QPU ID, total number of available qubits, current single-qubit gate error rate, double-qubit gate error rate, average coherence time (T1, T2), number of tasks in the current task queue, and estimated queuing time calculated based on the current queue load and historical execution data.
[0104] For classic computing resources, the extracted information includes: cluster ID, number of nodes, average CPU / GPU utilization, average memory usage, current I / O load, and task queue length.
[0105] The machine learning prediction module is the core of the system's decision-making process, and it deploys a unified, pre-trained machine learning model. This model is preferably a gradient boosting decision tree (such as XGBoost, LightGBM) or a deep neural network model, because it can effectively handle heterogeneous features and capture complex nonlinear relationships.
[0106] This machine learning model distinguishes different types of computing resources through feature engineering (such as one-hot encoding of resource types), thereby enabling it to predict the performance of a task on any type of resource.
[0107] The machine learning prediction module receives a combined feature vector from the feature extraction module. Specifically, for a task T and a resource... (j is the resource index), its input vector at decision time t. It can be represented as: This formula describes how to construct a single input data set for a machine learning model. Wherein, It is a task The static feature vector contains information that does not change over time, such as task type and scale. It is a resource At any moment The dynamic feature vector contains information such as the real-time queue length and error rate of the resource. ⊕ indicates a vector concatenation operation, which joins the two vectors end-to-end to form a longer combined feature vector containing all information about the task and resource. This combined vector will serve as the input to the machine learning model.
[0108] The machine learning prediction module provides a combined feature vector for each input. It will output two key prediction values: a tuple containing the expected total turnaround time and the expected calculation error. This formula represents the prediction process of machine learning model M. When combining feature vectors... When input into model M, the model performs one inference calculation and outputs two results: and .in, The task of model prediction is in resources The predicted value of the "total turnaround time" required for execution; This is the predicted "error" of the model's computational result after the task is executed on this resource. The symbol "^" is typically used in machine learning to indicate that this is a predicted value, to distinguish it from the actual future value.
[0109] In this way, when a new task arrives, the system combines the task with each available computing resource (such as QPU-1, QPU-2, Classic-Cluster-A) to form a feature vector, and then feeds it into the prediction model. If there are N available resources, the model will be called N times, producing N sets of prediction results, forming a prediction matrix.
[0110] The decision logic module receives multiple sets of prediction results (prediction matrices) from the prediction module and executes the final allocation decision according to the preset optimization objective function.
[0111] The module evaluates all N sets of "resources, expected total turnaround time, expected error" tuples. The optimization objective function can be flexibly configured; for example, for a requirement of accuracy no less than [a certain value], it can be optimized. The task, its optimal resources The choice can be expressed as:
[0112] Time-optimal strategy: ;
[0113] This formula describes the decision-making logic under the "time-optimal" strategy. It means "find the parameter that minimizes the expression". The entire formula means: First, filter out all cases that meet the condition " (i.e., the prediction error is less than or equal to the error threshold required by the user) computing resources Then, among these resources that meet the conditions, find the predicted total turnaround time. Minimal resources and use it as the optimal resource for the final selection. .
[0114] It can also be identified as the cost-optimal strategy: ;
[0115] This formula describes a "cost-optimal" strategy. Similar to the time-optimal strategy, it first selects resources that meet the accuracy requirements. The difference lies in its optimization objective: minimizing the total cost, which is determined by the "predicted total turnaround time." "and resources" unit time cost The product of the two terms is used to represent the optimal resource. The system selects the resource that minimizes the product as the optimal resource. .
[0116] Additionally, it should be noted that if the computation task is identified as divisible, the task should first be decomposed into logical subtasks. Then, for each subtask, the prediction module should be called to construct a more complex allocation optimization problem (similar to the multidimensional knapsack problem) to decide whether to allocate the subtasks to different heterogeneous computing resources for parallel execution. Finally, the results should be merged.
[0117] The online update module constitutes the system's closed-loop adaptive learning capability, which is key to ensuring the long-term efficient operation of the system.
[0118] The online update module is used for data collection and recording. Specifically, after a task is assigned and executed, the system will use its complete lifecycle data to form a training sample. This is recorded in the historical database. The sample can be represented as:
[0119] ;
[0120] Formula Explanation: This formula defines the structure of a single data sample used for model retraining. This represents the i-th completed task sample. It consists of four parts: It is the complete input feature vector at the time the decision was made; It is the computing resource that the system ultimately selects for this task; and These represent the total turnaround time and the calculation error of the actual measurement, respectively, after the task is completed on the resource. It should be understood that these samples, containing both "questions" and "true answers," form the basis for the machine learning model to learn and optimize.
[0121] This online update module is also used for the model retraining trigger mechanism; that is, this module triggers model updates according to a preset strategy. The strategy can be:
[0122] Based on quantity: Triggered when a certain number of new training samples are collected (e.g., 1000 samples).
[0123] Time-based: Triggered according to a fixed time period (e.g., every 24 hours).
[0124] Based on performance monitoring: Triggered when the moving average of the model's prediction error (the difference between the predicted value and the actual value) exceeds a certain threshold.
[0125] The online update module updates the model in the following way: After being triggered, the system will automatically use all or the latest data in the historical database to perform incremental training or full retraining on the model in the machine learning prediction module, and seamlessly switch the updated model online.
[0126] Based on the above resource allocation system, the resource allocation method of this application embodiment will be described in detail below. Specifically, please refer to... Figure 3 , Figure 3 A flowchart illustrating the resource allocation method in an embodiment of this application. Figure 3 .
[0127] Step S1: The system receives a computation task to be scheduled and sends it to the feature extraction module.
[0128] Step S2: The feature extraction module performs two operations in parallel: a) parse the task and extract all its static features; b) request the real-time dynamic status of all available computing resources (quantum and classical) from the hardware monitoring system.
[0129] Step S3: The system enters a loop, traversing each available computing resource. In each loop, the static features of the task obtained in step S2 are combined with the dynamic state of the currently traversed computing resource to form a structured input feature vector.
[0130] Step S4: Input the combined feature vector into the machine learning prediction module, the model performs inference, and outputs two predicted values for the task on the specific computing resources: "expected total turnaround time" and "expected error (i.e., the accuracy of the above expected calculation results)".
[0131] Step S5: After the loop ends, the decision logic module summarizes the N sets of prediction results from all N computing resources.
[0132] Step S6: The decision logic module evaluates and sorts the N sets of results according to the preset optimization objective function (e.g., the shortest time while meeting accuracy requirements), selects the optimal resource allocation scheme, and sends the task to the execution queue of the selected computing resources.
[0133] Step S7: The task is executed on the allocated resources. After execution, the system records its "actual total turnaround time" and "actual calculation result accuracy", and stores it, along with its input feature vector before allocation, as a complete sample in the historical database of the online update module for subsequent periodic updates of the machine learning model.
[0134] Please see Figure 4 , Figure 4 This is a schematic diagram of a resource allocation device provided in an embodiment of this application. As shown in the figure, the device 400 includes:
[0135] Extraction module 401 is used to extract the static features of the computing task to be scheduled;
[0136] The acquisition module 402 is used to acquire the dynamic characteristics of N computing resources based on the available resource list, wherein the available resource list includes the N computing resources, and the N computing resources include at least one quantum processor and / or at least one classical computing cluster.
[0137] The input module 403 generates M combined feature vectors based on the static features and the dynamic features of the N computing resources, and inputs the M combined feature vectors into a pre-trained prediction model;
[0138] The first generation module 404 is used to generate a target resource allocation scheme based on a preset target optimization strategy and M sets of prediction results output by the prediction model. The target resource allocation scheme is the resource allocation scheme with the highest evaluation value among the M resource allocation schemes corresponding to the M sets of prediction results.
[0139] Where N and M are both positive integers, and M is greater than or equal to N.
[0140] Optionally, the device 400 further includes:
[0141] The allocation module is used to allocate the computing tasks to be scheduled to the target quantum processor and / or the target classical computing cluster based on the target resource allocation scheme.
[0142] A recording module is used to record the task data of the scheduled computing task when the target quantum processor and / or target classical computing cluster completes the scheduled computing task.
[0143] Optionally, the device 400 further includes:
[0144] The second generation module is used to generate a task sample corresponding to the computing task to be scheduled based on the target combined feature vector, the actual total turnover time, and the actual calculation result accuracy. The target combined feature vector is a combined feature vector corresponding to the target resource allocation scheme.
[0145] A storage module is used to store the task samples in a historical database.
[0146] Optionally, the prediction result includes the expected total turnaround time and the expected calculation result, and the device 400 further includes:
[0147] An update module is used to update the prediction model based on a preset update strategy;
[0148] The preset update strategy includes at least one of the following:
[0149] If the number of task samples in the historical database exceeds a preset number, the prediction model is updated.
[0150] If the usage time of the prediction model exceeds a preset time, the prediction model is updated.
[0151] If the average prediction error of the prediction model is greater than a preset error value, the prediction model is updated. The prediction error is the difference between the accuracy of the expected calculation result and the accuracy of the actual calculation result, or the difference between the expected total turnaround time and the actual total turnaround time.
[0152] Optionally, if the computational task to be scheduled is a divisible task, the input module 403 includes:
[0153] A decomposition unit is used to decompose the computation task to be scheduled into K subtasks, where K is an integer greater than 1;
[0154] An extraction unit is used to extract the static features of the K sub-tasks;
[0155] The first generation unit is used to generate M combined feature vectors based on the static features of the K sub-tasks and the dynamic features of the N computing resources.
[0156] Optionally, the preset target optimization strategy includes a time strategy and a cost strategy, and the first generation module 404 includes:
[0157] The first acquisition unit is used to acquire the task requirements of the computing task to be scheduled, the task requirements including time requirements or cost requirements;
[0158] The second generation unit is used to generate a target resource allocation scheme based on the time strategy and M sets of prediction results output by the prediction model, when the task requirement of the computing task to be scheduled is a time requirement.
[0159] or,
[0160] The third generation unit is used to generate a target resource allocation scheme based on the cost strategy and M sets of prediction results output by the prediction model, when the task requirement of the computing task to be scheduled is a cost requirement.
[0161] Optionally, the acquisition module 402 includes:
[0162] The reading unit is used to sequentially read the N computing resources based on the list of available resources;
[0163] The second acquisition unit is used to pair the computing tasks to be scheduled with the N computing resources one by one to obtain the dynamic characteristics of the N computing resources.
[0164] It should be noted that the resource allocation device provided in this application embodiment is a device capable of executing the above-described resource allocation method. Therefore, all implementation methods in the above-described resource allocation method embodiments are applicable to this device and can achieve the same or similar beneficial effects. To avoid repetition, this embodiment will not elaborate further.
[0165] For details, see Figure 5 As shown in the figure, this application embodiment also provides an electronic device, including a bus 501, a transceiver 502, an antenna 503, a bus interface 504, a processor 505, and a memory 506.
[0166] Processor 505, used for:
[0167] Extract the static features of the computational tasks to be scheduled;
[0168] Based on the list of available resources, obtain the dynamic characteristics of N computing resources, wherein the list of available resources includes the N computing resources, and the N computing resources include at least one quantum processor and / or at least one classical computing cluster;
[0169] Based on the static features and the dynamic features of the N computing resources, M combined feature vectors are generated, and the M combined feature vectors are input into a pre-trained prediction model.
[0170] Based on the preset target optimization strategy and the M sets of prediction results output by the prediction model, a target resource allocation scheme is generated. The target resource allocation scheme is the resource allocation scheme with the highest evaluation value among the M resource allocation schemes corresponding to the M sets of prediction results.
[0171] Where N and M are both positive integers, and M is greater than or equal to N.
[0172] exist Figure 5In this document, a bus architecture (represented by bus 501) is used. Bus 501 can include any number of interconnected buses and bridges, linking various circuits including one or more processors represented by processor 505 and memory represented by memory 506. Bus 501 can also link various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. Bus interface 504 provides an interface between bus 501 and transceiver 502. Transceiver 502 can be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by processor 505 is transmitted over a wireless medium via antenna 503, which further receives data and transmits it to processor 505.
[0173] Processor 505 manages bus 501 and general processing, and also provides various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory 506 can be used to store data used by processor 505 during operation.
[0174] Optionally, the processor 505 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or a complex programmable logic device (CPLD).
[0175] The processor 505 is specifically used for:
[0176] Based on the target resource allocation scheme, the computing tasks to be scheduled are allocated to the target quantum processor and / or the target classical computing cluster;
[0177] When the target quantum processor and / or the target classical computing cluster complete the scheduled computing task, the task data of the scheduled computing task is recorded.
[0178] Optionally, the processor 505 is further specifically used for:
[0179] Based on the target combined feature vector, the actual total turnaround time, and the actual calculation result accuracy, a task sample corresponding to the computing task to be scheduled is generated, wherein the target combined feature vector is a combined feature vector corresponding to the target resource allocation scheme;
[0180] The task samples are stored in a historical database.
[0181] Optionally, the prediction result includes the expected total turnaround time and the expected calculation result, and the processor 505 is further specifically used for:
[0182] The prediction model is updated based on a preset update strategy;
[0183] The preset update strategy includes at least one of the following:
[0184] If the number of task samples in the historical database exceeds a preset number, the prediction model is updated.
[0185] If the usage time of the prediction model exceeds a preset time, the prediction model is updated.
[0186] If the average prediction error of the prediction model is greater than a preset error value, the prediction model is updated. The prediction error is the difference between the accuracy of the expected calculation result and the accuracy of the actual calculation result, or the difference between the expected total turnaround time and the actual total turnaround time.
[0187] Optionally, when the computational task to be scheduled is a divisible task, the processor 505 is further specifically used for:
[0188] The computational task to be scheduled is decomposed into K subtasks, where K is an integer greater than 1;
[0189] Extract the static features of the K sub-tasks;
[0190] Based on the static features of the K sub-tasks and the dynamic features of the N computing resources, M combined feature vectors are generated.
[0191] Optionally, the preset target optimization strategy includes a time strategy and a cost strategy, and the processor 505 is further configured to:
[0192] Obtain the task requirements of the computing task to be scheduled, including time requirements or cost requirements;
[0193] If the task requirement of the computing task to be scheduled is a time requirement, a target resource allocation scheme is generated based on the time strategy and the M sets of prediction results output by the prediction model.
[0194] or,
[0195] If the task requirement of the computing task to be scheduled is a cost requirement, a target resource allocation scheme is generated based on the cost strategy and the M sets of prediction results output by the prediction model.
[0196] Optionally, the processor 505 is further configured to:
[0197] Based on the list of available resources, read the N computing resources sequentially;
[0198] The computing tasks to be scheduled are paired one by one with the N computing resources to obtain the dynamic characteristics of the N computing resources.
[0199] It should be noted that the electronic device provided in this application embodiment is a device capable of executing the above-described resource allocation method. Therefore, all implementation methods in the above-described resource allocation method embodiments are applicable to this electronic device and can achieve the same or similar beneficial effects. To avoid repetition, this embodiment will not elaborate further.
[0200] This invention also provides an electronic device, including: a processor, a memory, and a program stored in the memory and executable on the processor. When the program is executed by the processor, it implements the various processes of the above-described resource allocation method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0201] This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the various processes of the resource allocation method embodiments described above and achieves the same technical effects. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0202] This application also provides a computer program product, including computer instructions. When executed by a processor, these computer instructions implement the various processes of the above-described resource allocation method embodiments and achieve the same technical effects. To avoid repetition, they will not be described again here.
[0203] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0204] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0205] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A resource allocation method, characterized in that, The method includes: Extract the static features of the computational tasks to be scheduled; Based on the list of available resources, obtain the dynamic characteristics of N computing resources, wherein the list of available resources includes the N computing resources, and the N computing resources include at least one quantum processor and / or at least one classical computing cluster; Based on the static features and the dynamic features of the N computing resources, M combined feature vectors are generated, and the M combined feature vectors are input into a pre-trained prediction model. Based on the preset target optimization strategy and the M sets of prediction results output by the prediction model, a target resource allocation scheme is generated. The target resource allocation scheme is the resource allocation scheme with the highest evaluation value among the M resource allocation schemes corresponding to the M sets of prediction results. Where N and M are both positive integers, and M is greater than or equal to N.
2. The method according to claim 1, characterized in that, After generating the target resource allocation scheme, the method further includes: Based on the target resource allocation scheme, the computing tasks to be scheduled are allocated to the target quantum processor and / or the target classical computing cluster; When the target quantum processor and / or the target classical computing cluster complete the scheduled computing task, the task data of the scheduled computing task is recorded.
3. The method according to claim 2, characterized in that, The task data includes the actual total turnaround time and the actual calculation result accuracy. After recording the task data of the computation task to be scheduled, the method further includes: Based on the target combined feature vector, the actual total turnaround time, and the actual calculation result accuracy, a task sample corresponding to the computing task to be scheduled is generated, wherein the target combined feature vector is a combined feature vector corresponding to the target resource allocation scheme; The task samples are stored in a historical database.
4. The method according to claim 3, characterized in that, The prediction results include the expected total turnover time and the expected accuracy of the calculation results; the method further includes: The prediction model is updated based on a preset update strategy; The preset update strategy includes at least one of the following: If the number of task samples in the historical database exceeds a preset number, the prediction model is updated. If the usage time of the prediction model exceeds a preset time, the prediction model is updated. If the average prediction error of the prediction model is greater than a preset error value, the prediction model is updated. The prediction error is the difference between the accuracy of the expected calculation result and the accuracy of the actual calculation result, or the difference between the expected total turnaround time and the actual total turnaround time.
5. The method according to claim 1, characterized in that, When the computational task to be scheduled is a divisible task, the generation of M combined feature vectors based on the static features and the dynamic features of the N computational resources includes: The computational task to be scheduled is decomposed into K subtasks, where K is an integer greater than 1; Extract the static features of the K sub-tasks; Based on the static features of the K sub-tasks and the dynamic features of the N computing resources, M combined feature vectors are generated.
6. The method according to claim 1, characterized in that, The preset target optimization strategy includes a time strategy and a cost strategy. The generation of a target resource allocation scheme based on the preset target optimization strategy and the M sets of prediction results output by the prediction model includes: Obtain the task requirements of the computing task to be scheduled, including time requirements or cost requirements; If the task requirement of the computing task to be scheduled is a time requirement, a target resource allocation scheme is generated based on the time strategy and the M sets of prediction results output by the prediction model. or, If the task requirement of the computing task to be scheduled is a cost requirement, a target resource allocation scheme is generated based on the cost strategy and the M sets of prediction results output by the prediction model.
7. The method according to claim 1, characterized in that, The process of obtaining the dynamic characteristics of N computing resources based on the available resource list includes: Based on the list of available resources, read the N computing resources sequentially; The computing tasks to be scheduled are paired one by one with the N computing resources to obtain the dynamic characteristics of the N computing resources.
8. A resource allocation device, characterized in that, The device includes: The extraction module is used to extract the static features of the computational tasks to be scheduled. The acquisition module is used to acquire the dynamic characteristics of N computing resources based on the available resource list, wherein the available resource list includes the N computing resources, and the N computing resources include at least one quantum processor and / or at least one classical computing cluster. The input module generates M combined feature vectors based on the static features and the dynamic features of the N computing resources, and inputs the M combined feature vectors into the pre-trained prediction model; The generation module is used to generate a target resource allocation scheme based on a preset target optimization strategy and M sets of prediction results output by the prediction model. The target resource allocation scheme is the resource allocation scheme with the highest evaluation value among the M resource allocation schemes corresponding to the M sets of prediction results. Where N and M are both positive integers, and M is greater than or equal to N.
9. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method as described in any one of claims 1 to 7.