Resource allocation method and apparatus, and electronic device

By obtaining the resource size required by the task, adjusting the computing resource blocks, and matching with the task requirements, the problem of low computing resource utilization is solved and the resource utilization and task processing efficiency is improved.

CN120295796AActive Publication Date: 2025-07-11INSPUR SUZHOU INTELLIGENT TECH CO LTD

Patent Information

Application Number
CN202510772174.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-10
Publication Date
2025-07-11
Estimated Expiration
2045-06-10

AI Technical Summary

Technical Problem

The fixed division of computing resources does not match the resources required for the task, resulting in a low utilization rate of computing resources.

Method used

By obtaining the computing resource size required for the pending task, adjusting the computing resource blocks of the computing resource nodes to match them with the task requirements, and achieving flexible allocation.

Benefits of technology

It improves the utilization rate of computing resources, avoids resource waste and insufficient resources, and improves task processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120295796A_ABST
    Figure CN120295796A_ABST
Patent Text Reader

Abstract

The invention discloses a resource allocation method and device, and electronic equipment, and relates to the technical field of computers, and the method comprises the steps: obtaining the size of a first computing resource required by a to-be-processed task, adjusting at least one computing resource block of a target computing resource node corresponding to the to-be-processed task according to the size of the first computing resource, therefore, flexible allocation of the computing resource blocks is realized, the computing resource blocks are enabled to be matched with resources required by the task, then the to-be-processed task is processed based on the at least one adjusted computing resource block, a processing result of the to-be-processed task is obtained, the problem of mismatching of the fixedly divided computing resource blocks and the to-be-processed task is avoided, and the processing efficiency of the to-be-processed task is improved. And the utilization rate of computing resources is improved. Therefore, the technical problem that the utilization rate of the computing resources is low can be solved, and the technical effect of improving the utilization rate of the computing resources is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to a method and device for resource allocation, and an electronic device. Background Art

[0002] When computing resources are processing a large number of tasks, the computing resource nodes need to process multiple tasks in parallel. The computing resource requirements of each task are not the same, and it is necessary to allocate computing resources for the tasks.

[0003] In the related art of resource allocation, usually a computing resource node is fixedly divided into multiple computing resource blocks, and different tasks are processed in different computing resource blocks. The computing resource requirements of different tasks are not the same, and the fixedly divided computing resource blocks do not match the computing resource requirements of the tasks, resulting in low utilization rate of computing resources. Summary of the Invention

[0004] This application provides a method and device for resource allocation, and an electronic device, so as to at least solve the problem of low utilization rate of computing resources in the related art.

[0005] This application provides a method for resource allocation, including: Obtaining the size of the first computing resource required for the task to be processed; According to the size of the first computing resource, adjusting at least one computing resource block of the target computing resource node corresponding to the task to be processed; the target computing resource node includes at least two computing resource blocks; Based on the adjusted at least one computing resource block, processing the task to be processed to obtain a processing result of the task to be processed.

[0006] This application also provides a device for resource allocation, including: An obtaining unit, configured to obtain the size of the first computing resource required for the task to be processed; An adjusting unit, configured to adjust at least one computing resource block of the target computing resource node corresponding to the task to be processed according to the size of the first computing resource; the target computing resource node includes at least two computing resource blocks; A processing unit, configured to process the task to be processed based on the adjusted at least one computing resource block to obtain a processing result of the task to be processed.

[0007] This application also provides an electronic device, including: a memory, configured to store a computer program; a processor, configured to implement the steps of any of the above methods for resource allocation when executing the computer program.

[0008] The present application also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any one of the above resource allocation methods.

[0009] The present application also provides a computer program product including a computer program, and the computer program, when executed by a processor, implements the steps of any one of the above resource allocation methods.

[0010] Through the present application, since the size of the first computing resource required for the task to be processed is obtained, and at least one computing resource block of the target computing resource node corresponding to the task to be processed is adjusted according to the size of the first computing resource, the flexible allocation of the computing resource block is realized, so that it matches the resources required by the task. Then, based on the adjusted at least one computing resource block, the task to be processed is processed to obtain the processing result of the task to be processed, avoiding the mismatch problem between the fixed division of the computing resource block and the task to be processed, and improving the utilization rate of the computing resource. Therefore, the technical problem of low utilization rate of the computing resource can be solved, and the technical effect of improving the utilization rate of the computing resource can be achieved. Description of the Drawings

[0011] To more clearly illustrate the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts.

[0012] Figure 1 It is a schematic flowchart of a resource allocation method provided by an embodiment of the present application; Figure 2 It is a schematic flowchart of a method for adjusting a computing resource block provided by an embodiment of the present application; Figure 3 It is a schematic flowchart of video memory management provided by an embodiment of the present application; Figure 4 It is a schematic structural diagram of isolation of a computing unit disclosed by an embodiment of the present application; Figure 5 It is a schematic structural diagram of a resource allocation device provided by an embodiment of the present application; Figure 6 It is a schematic structural diagram of another resource allocation device provided by an embodiment of the present application. Detailed Embodiments

[0013] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without making creative efforts belong to the protection scope of the present application.

[0014] It should be noted that in the description of the present application, the terms "including", "comprising" or any other variation thereof are intended to cover a non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0015] In order to enable those skilled in the art of the present technology to better understand the solution of the present application, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0016] Combined with the specific application environment architecture or specific hardware architecture on which the execution of the resource allocation method depends, the specific application environment architecture or specific hardware architecture will be described herein.

[0017] An embodiment of the present application provides a resource allocation method, and the method will be described in detail in combination with the execution process of the resource allocation method.

[0018] Figure 1 It is a schematic flow chart of a resource allocation method provided by an embodiment of the present application.

[0019] As Figure 1 shown, the method includes the following steps: Step 101, obtain the size of the first computing resource required for the task to be processed.

[0020] The task to be processed refers to a computing task or workload to be executed, usually a task that requires computing resources to complete. For example, these tasks can be computationally intensive tasks, data processing tasks, or other tasks that require computing resources such as processors and memory. In the embodiments of the present application, the task to be processed can be a model running task.

[0021] The size of the first computing resource refers to the amount of computing resources required for the task to be processed, usually expressed in specific units of computing resources (such as the number of processor cores, memory capacity, computing duration, etc.). The size of the first computing resource is determined by the nature and complexity of the task to be processed and is the amount of computing resources required to execute the task.

[0022] When a task to be processed enters the system, the task will be analyzed first. For example, by parsing information such as the program code, algorithm complexity, and data scale of the task, the computing intensity required to complete the task is estimated. The system will call the historical records of similar tasks to check the time taken to complete these tasks and the resource utilization rate under different computing resources before. For example, if there was a previous task of the same type with a similar data scale that could be completed within a reasonable time when using 4 central processing unit (CPU) cores and 8GB of memory, then this can be used as the reference computing resource size for the task to be processed. Using a pre-trained machine learning or deep learning model, by inputting the relevant features of the task to be processed (such as task type identifier, input data scale, etc.), the model will output a predicted value of the computing resource size. For example, a neural network model trained with a large number of task sample data can, based on the image resolution and processing algorithm type of the input image processing task, output the required computing power of the graphics processing unit (GPU).

[0023] By obtaining the computing resource size required for the task to be processed, the system can allocate appropriate computing resources for each task, avoiding the situation of excessive resource waste or insufficiency. Compared with the traditional fixed resource allocation method, this method can significantly improve the utilization rate of computing resources.

[0024] Step 102: Adjust at least one computing resource block of the target computing resource node corresponding to the task to be processed according to the first computing resource size; the target computing resource node includes at least two computing resource blocks.

[0025] The target computing resource node refers to the computing resource node selected from multiple computing resource nodes to process the current task to be processed. A computing resource node can be understood as a unit with a certain computing ability, such as a server, a processor chip, or a computing unit in a computing cluster, etc. The target computing resource node contains at least two computing resource blocks. A computing resource block is the basic unit of computing power that can be flexibly allocated within the target computing resource node. Each computing resource block has a specific computing resource configuration, such as quantitative indicators like the number of CPU cores, memory capacity, and GPU computing power. A computing resource block is the basic computing unit that makes up the target computing resource node. Each computing resource block has a clear computing resource size and can be individually allocated, adjusted, or combined according to the task requirements to meet the resource requirements of different computing tasks.

[0026] In the target computing resource node, first determine which computing resource blocks can be used for the current task to be processed. This includes checking the current status of each computing resource block (such as whether it is idle, the situation of the task being processed, etc.), and whether its computing resource size matches or is close to the first computing resource size required by the task to be processed. According to the comparison between the first computing resource size of the task to be processed and the sizes of the existing computing resource blocks in the target computing resource node, select an appropriate adjustment method. For example, if there is a computing resource block whose size exactly meets the task requirements, directly allocate this block; if there is a large idle computing resource block, it can be split into smaller blocks to precisely match the task requirements; if there is no completely matching idle block, but there are some non-idle blocks that can be adjusted (such as in the case where task priorities allow preemption), it may involve stopping low-priority tasks and releasing the corresponding block resources to meet the current task requirements. After adjusting the computing resource blocks, update the resource pool information of the target computing resource node in a timely manner, including recording the allocation status, the tasks to which each computing resource block belongs, and changes in computing resource sizes, etc. This helps with subsequent further management and allocation of resources, ensuring the effective utilization and reasonable allocation of the computing resources of the entire node.

[0027] By adjusting the computing resource blocks in the target computing resource node according to the first computing resource size required by the task, fine-grained allocation of computing resources can be achieved. It avoids the problems of resource waste or insufficiency caused by the traditional fixed partitioning of computing resource blocks, improves the utilization rate of computing resources, enables each task to obtain just the right amount of resource support, and thus better completes the task.

[0028] Step 103: Based on at least one adjusted computing resource block, process the task to be processed to obtain the processing result of the task to be processed.

[0029] The adjusted computing resource blocks refer to one or more computing resource blocks that meet the computing resource requirements of the task after reasonably adjusting (such as operations like splitting, merging, releasing, etc.) the computing resource blocks in the target computing resource node according to the first computing resource size required by the task to be processed. These blocks have clear computing resource configurations (such as the number of CPU cores, memory capacity, computing power, etc.) and can provide precise resource support for the task. The processing result refers to the final output obtained after the task to be processed runs and completes using the adjusted computing resource blocks. It can be calculated data, generated files, completed operation tasks, etc., depending on the type and objective of the task.

[0030] Assign the task to be processed to the adjusted computing resource blocks and establish a resource binding relationship between the task and these blocks. This ensures that during the task execution, it can use the assigned computing resource blocks exclusively or shareably, guaranteeing that the task has sufficient resources for processing. According to scheduling policies such as the priority and dependency relationship of the task, the task is placed in the corresponding task queue waiting to be executed. When the task starts to execute, the computing resource blocks begin to provide computing support for it, such as the CPU running the task code and the memory storing the task data. Meanwhile, the task performs operations and processing on the allocated resources according to its predefined algorithms and logic. During the task execution, the usage of the computing resource blocks and the running status of the task are monitored in real time, such as CPU utilization rate, memory occupancy, task progress, etc. If resource shortage is found or the task is completed ahead of schedule, the allocation of the computing resource blocks can be dynamically adjusted to optimize the task processing efficiency and resource utilization rate. When the task is completed, collect the processing results of the task, including output data, result status, etc., and feedback these results to the corresponding users or systems. This can be used for subsequent analysis, decision-making, or further task processing. Meanwhile, release the computing resource blocks occupied by the task and mark them as idle for the use of other tasks later.

[0031] By allocating appropriate adjusted computing resource blocks for each task, it is ensured that the task has sufficient resource support during operation, avoiding problems such as task waiting, delay, or frequent switching caused by resource shortage, thus improving the task execution efficiency and enabling it to be completed faster.

[0032] Through this application, since the size of the first computing resources required for the task to be processed is obtained, and according to the size of the first computing resources, at least one computing resource block of the target computing resource node corresponding to the task to be processed is adjusted, thereby realizing the flexible allocation of the computing resource blocks to match them with the resources required by the task. Then, based on the adjusted at least one computing resource block, the task to be processed is processed to obtain the processing result of the task to be processed, avoiding the mismatch problem between the fixed partitioning of the computing resource blocks and the task to be processed, and improving the utilization rate of the computing resources. Therefore, the technical problem of low utilization rate of computing resources can be solved, and the technical effect of improving the utilization rate of computing resources can be achieved.

[0033] As a refinement of step 102, when executing the adjustment of at least one computing resource block of the target computing resource node corresponding to the task to be processed according to the size of the first computing resources, it can be implemented by, but not limited to, the following methods, such as Figure 2 as shown Figure 2 is a schematic flowchart of a method for adjusting computing resource blocks provided by an embodiment of this application, including: Step 201: Determine whether there is a first computing resource block in the target computing resource node; the first computing resource block is the smallest free computing resource block required to meet the first computing resource size.

[0034] The smallest free computing resource block refers to the computing resource block that is not allocated or occupied in the target computing resource node, and the size of this free block exactly meets the requirements of the task for the first computing resource size. This block is the smallest block that can fully meet the resource requirements of the task without wasting resources.

[0035] The system continuously maintains detailed information about each computing resource block in the target computing resource node, including the computing resource size, usage status (free or occupied), etc. of each block. This information is usually stored in a resource management database or data structure and updated in real time to reflect the latest status changes of the computing resource blocks. For example, when a task is completed, the originally occupied block will be marked as free. After obtaining the first computing resource size of the task to be processed, in the target computing resource node, the free computing resource blocks are retrieved in ascending order of computing resource size to check whether there is a computing resource block whose size is equal to or greater than the first computing resource size and is the smallest block that meets the conditions. For example, if the task to be processed requires 4GB of memory computing resources and there are multiple free blocks in the target computing resource node with memory sizes of 2GB, 4GB, 8GB, etc., then the 4GB free block is the first computing resource block. To improve the retrieval efficiency, some fast retrieval algorithms can be used, such as binary search. First, sort the free computing resource blocks in the target computing resource node according to the computing resource size and construct an index structure. When searching, according to the first computing resource size of the task to be processed, use the binary search method to quickly locate the possible range of block positions that meet the conditions, and then accurately select the smallest free block that meets the computing resource size requirements to determine whether it exists.

[0036] It can accurately find the smallest free block that meets the task's computing resource requirements and achieve efficient resource matching. This can not only ensure that the task has sufficient computing resources to execute but also avoid allocating excessive resources to the task, resulting in resource idleness and waste, and improve the utilization rate of the entire computing resource system.

[0037] Step 202: If there is a first computing resource block in the target computing resource node, determine whether the second computing resource size of the first computing resource block is greater than the first computing resource size.

[0038] The second computing resource size refers to the actual physical resource amount of the resource size (such as CPU, memory, etc.) of the first computing resource block, which is different from the initially allocated first computing resource size due to system optimization, scheduling, and other factors.

[0039] After determining the existence of a first computing resource block in the target computing resource node, directly read the specific value of the second computing resource size corresponding to the first computing resource block from the resource management database or data structure maintained by the system. This value is pre-recorded in the system, usually determined and stored when the computing resource block is created or initialized. Compare the obtained second computing resource size numerically with the first computing resource size required by the task to be processed. This can be achieved through simple arithmetic comparison instructions. For example, in a computer program, use a comparison operator (such as ">") to determine whether the second computing resource size is greater than the first computing resource size. According to the comparison result, output the corresponding judgment flag or signal. If it is a greater-than relationship, output a flag indicating that "the second computing resource size is greater than the first computing resource size"; otherwise, output the opposite flag. This flag will be used as the basis for subsequent process control to determine whether operations such as splitting the first computing resource block are required.

[0040] By determining whether the second computing resource size of the first computing resource block is greater than the first computing resource size, the matching degree between the computing resource block and the task requirements can be further accurately determined. This helps to reasonably adjust the computing resource block according to the actual situation in the subsequent process, such as splitting operations, so as to achieve more precise resource allocation and avoid resource waste.

[0041] Step 203, if the second computing resource size of the first computing resource block is greater than the first computing resource size, then split the first computing resource block into at least two second computing resource blocks; at least two second computing resource blocks include at least one target second computing resource block with a third computing resource size equal to the first computing resource size; the adjusted at least one computing resource block includes at least two second computing resource blocks.

[0042] The second computing resource block refers to the new computing resource block obtained by splitting the first computing resource block. The size and configuration information of these blocks will be adjusted accordingly according to the splitting operation. Among them, at least one block (the target second computing resource block) has a third computing resource size equal to the first computing resource size required by the task, and the remaining blocks form new computing resource blocks according to the splitting situation, which can be used for the allocation of subsequent other tasks or continue to exist as divisible resources. The third computing resource size is the computing resource size of the target second computing resource block, which is equal to the first computing resource size required by the task to be processed and is obtained through precise splitting, and can completely match the task requirements.

[0043] After confirming that the second computing resource size of the first computing resource block is greater than the first computing resource size, it is necessary to first determine whether the block is divisible. This mainly depends on whether the actual physical or logical architecture of the computing resources supports the splitting operation. For example, for a memory resource block, it is necessary to examine whether the memory management unit supports memory partitioning operations; for resources such as processor cores, it depends on whether the operating system or hardware architecture allows multiple cores to be split into smaller execution units, etc. If splitting is supported, continue with the subsequent splitting operation; if not, it may be necessary to find other alternative solutions, such as looking for other suitable computing resource blocks or adjusting the resource requirements of the task. Based on factors such as the difference between the second computing resource size and the first computing resource size of the first computing resource block, and the usage of other computing resource blocks in the target computing resource node, formulate a reasonable splitting strategy. The splitting strategy should ensure that among at least two second computing resource blocks after splitting, the third computing resource size of one block is equal to the first computing resource size required by the task, and the sizes of other blocks should also be as reasonable as possible to facilitate subsequent task allocation and usage. For example, assume that the second computing resource size of the first computing resource block is 16GB of memory, and the first computing resource size required by the task is 8GB. Then the splitting strategy can be to split the 16GB of memory into a second computing resource block of 8GB and a second computing resource block of 8GB, which can not only meet the current task's requirements but also make the remaining 8GB memory block easy to be used by other tasks with similar requirements. According to the formulated splitting strategy, execute the specific splitting operation by calling the underlying resource management interface or relevant hardware instructions. During the splitting process, ensure the integrity and consistency of the computing resources to avoid data loss or resource anomalies caused by the splitting operation. For example, when splitting a memory block, it is necessary to first back up or migrate the data in the original memory block, then reconfigure the memory management unit, divide the new memory blocks, and assign corresponding identifiers and attribute information, such as start addresses, sizes, etc., to each new second computing resource block so that the system can correctly identify and manage these new blocks. After completing the splitting operation, update the resource information of the target computing resource node in a timely manner, including the number, size, usage status, etc. of the computing resource blocks. These updated information will be recorded in the resource management database or data structure for subsequent task allocation and resource management operations. For example, mark the newly generated second computing resource blocks as available status and record their third computing resource sizes and other detailed information so that other tasks can quickly find suitable computing resource blocks when needed.

[0044] By dividing the first computing resource block into at least two second computing resource blocks and ensuring that the third computing resource size of at least one of the blocks is equal to the first computing resource size required by the task, an accurate match between the computing resources and the task requirements is achieved. This avoids resource waste caused by overly large computing resource blocks, and at the same time ensures that the task can obtain just the right amount of resource support, improving the utilization efficiency of the resources.

[0045] As a refinement of step 103, when processing the task to be processed based on the adjusted at least one computing resource block to obtain the processing result of the task to be processed, the following methods can be used but are not limited to, including: using the target second computing resource block to process the task to be processed to obtain the processing result of the task to be processed.

[0046] The target second computing resource block refers to the specific block among the adjusted second computing resource blocks that is equal to the first computing resource size required by the task to be processed. It can precisely meet the computing resource requirements of the task and is the computing resource unit actually used during the task execution process.

[0047] Obtain the task to be processed from the task scheduling queue and allocate it to the computing node with the target second computing resource block. This is usually done by the task scheduling system according to factors such as resource allocation policies and task priorities. Bind the task to be processed with the target second computing resource block to ensure that the task can use the computing resources of this block exclusively or shareably during the execution process. This involves corresponding configurations at the operating system or resource management software level, such as setting memory allocation, CPU core binding, etc. Load the data required by the task to be processed from the storage device (such as hard disk, network storage, etc.) into the memory of the computing node where the target second computing resource block is located so that the task can quickly access and process this data. According to the requirements of the task, configure the corresponding running environment, including setting environment variables, loading the required software libraries and dependencies, etc., to ensure that the task can run in a suitable working environment. Start the execution of the task to be processed on the target second computing resource block, which is usually completed by calling the execution program or function of the task. Real-time monitor the resource usage of the target second computing resource block, such as CPU usage rate, memory occupancy, network bandwidth, etc., to ensure that the task has sufficient resource support during the execution process and promptly discover and handle possible resource bottlenecks or abnormal situations. After the task execution is completed, collect the processing result from the computing node where the target second computing resource block is located, which may include operations such as reading the output data in the memory, generating result files, etc. Feed back the collected processing result to the corresponding user or system so that the user can view and analyze the result, or the system can perform further processing and decision-making based on the result.

[0048] By using the target second computing resource block, it is possible to ensure that the task obtains just the right amount of resource support, avoiding over-allocation or insufficiency of resources. This can improve the utilization rate of computing resources, enabling limited resources to serve more tasks, thereby enhancing the resource usage efficiency of the entire system.

[0049] In practical applications, after using the target second computing resource block to process the task to be processed and obtaining the processing result of the task to be processed, it is necessary to process the target second computing resource block, which can be implemented by but not limited to the following methods, including: marking the target second computing resource block as an idle computing resource block; determining whether there is an idle computing resource block adjacent to the marked target second computing resource block; if there is an idle computing resource block adjacent to the marked target second computing resource block, then merge the idle computing resource block adjacent to the marked target second computing resource block and the marked target second computing resource block to obtain a merged idle computing resource block.

[0050] An idle computing resource block refers to a computing resource block that is not currently occupied by any task and can be allocated to new tasks at any time. These blocks are in a standby state, ready to provide support for new computing requirements at any time. In this embodiment, adjacent means the close adjacency relationship of computing resource blocks physically or logically. Physical adjacency means that two blocks are continuous in the hardware layout, such as consecutive address spaces on a memory module; logical adjacency means that in the scheduling and allocation logic of the resource management system, they are regarded as continuous resource units that can be merged, even if they may not be continuous in physical location. Merging idle computing resource blocks refers to the operation of integrating two or more adjacent idle computing resource blocks into a larger idle computing resource block. The merged block has a larger computing resource size and can meet the task requirements that need more resources.

[0051] After the task processing is completed, an instruction is sent through the scheduling module of the resource management system to update the status of the target second computing resource block from "in use" to "idle". This usually involves modifying the corresponding status fields in the resource management database or data structure. The binding relationship between the target second computing resource block and the completed task is released to ensure that the block is no longer occupied by the task and can be accessed by other task requests. The resource management system maintains a spatial index of the computing resource blocks, recording information such as the location, size, and status of each block. This can be an index based on physical addresses or a logical resource allocation graph. According to the spatial index, check whether the blocks adjacent to the target second computing resource block exist and are in the idle state. For physical adjacency, check the continuity of the memory addresses or hardware resource locations; for logical adjacency, check whether the scheduling and allocation logic in the resource management system considers them mergeable. If there are adjacent idle computing resource blocks, through the merging module of the resource management system, these adjacent idle blocks are merged with the target second computing resource block into a larger idle computing resource block. After the merging is completed, update the resource management database or data structure to record the size, location, and status of the newly merged block, etc., to ensure that the system can accurately identify and manage this new idle block.

[0052] Merging adjacent idle computing resource blocks can reduce resource fragmentation and improve resource utilization. By integrating small pieces of idle resources into large pieces of resources, it can better meet the task requirements that need a large amount of resources and avoid the problem of ineffective utilization caused by resource dispersion.

[0053] In practical applications, after determining whether there is a first computing resource block in the target computing resource node, other computing resource blocks can be used to process the task to be processed. The following methods can be adopted but are not limited to: If there is no first computing resource block in the target computing resource node, obtain the first priority of the task to be processed and obtain the second priority of the processing task processed by the third computing resource block in the target computing resource node; The third computing resource block is the smallest non-idle computing resource block required to meet the size of the first computing resource; If the first priority is greater than the second priority, stop the third computing resource block from processing the processing task and use the third computing resource block to process the task to be processed.

[0054] The first priority refers to the priority of the task to be processed, which reflects the importance and urgency of the task. The priority is usually set by the task initiator or the system according to the nature of the task (such as real-time performance, importance, etc.).

[0055] The second priority refers to the priority of the current task processed by the third computing resource block in the target computing resource node. It is used to compare with the priority of the task to be processed to determine whether to interrupt the current task to process a new high-priority task.

[0056] The third computing resource block refers to the smallest non-idle computing resource block in the target computing resource node that meets the computing resource size required by the task to be processed. It is currently processing another task, but if the priority of the task to be processed is higher, it will be reassigned to process the new task.

[0057] Analyze the computing resource requirements of the task to be processed and determine the required size of the first computing resource. This can be done through the task description file, historical data, or the estimation algorithm of the task. Obtain the first priority of the task to be processed from the task attributes or system settings. At the same time, in the target computing resource node, find the third computing resource block that meets the size of the first computing resource and obtain the second priority of the current task it is processing. Compare the first priority of the task to be processed with the second priority of the current task of the third computing resource block. This is usually achieved by comparing the magnitudes of the priority values, where a larger value indicates a higher priority. If the priority of the task to be processed is higher than the priority of the current task, decide to interrupt the current task and reassign the third computing resource block to the task to be processed. Before interrupting the current task, ensure that the task can be safely interrupted. This may involve checking the execution status of the task, saving the progress, releasing locks, etc. to avoid data inconsistency or task failure. Update the status of the third computing resource block to available and assign the task to be processed to this block. This involves updating the allocation records of the resource management system, the task scheduling queue, etc. According to the system policy, decide whether to suspend the current task and save its status for subsequent recovery or directly terminate the current task. If it is suspended, the task status and data need to be saved to an appropriate location, such as a specific area in the disk or memory.

[0058] By dynamically adjusting resource allocation, it ensures that high-priority tasks can obtain the required computing resources in a timely manner, improving the utilization efficiency of resources and the overall performance of the system.

[0059] As a refinement of step 102, the target computing resource node is any computing resource node in the processor, and the processor includes at least two computing resource nodes; different computing resource nodes are physically isolated.

[0060] The processor is the core component of a computer or computing system, responsible for executing computing tasks and data processing. In this embodiment, the processor includes multiple computing resource nodes, which can operate independently and process different tasks. In the embodiments of this application, the processor can be a CPU or a GPU. Physical isolation means that the computing resource nodes are independent of each other at the physical hardware level, and each node has its own processor core, memory, and other hardware resources. This isolation ensures that the resources between nodes do not interfere with each other, providing good performance isolation and security.

[0061] In a processor with multiple computing resource nodes, the target computing resource node is one of the computing resource units. Each computing resource node usually includes multiple computing cores, independent cache and memory resources, and these nodes can process different tasks in parallel. In this embodiment, the target computing resource node can be any one of the computing resource nodes in the processor, as long as it can meet the computing requirements of the processing task. Physical isolation is used between the computing resource nodes in the processor to ensure that each node operates independently. The specific implementation methods include: Independent memory and cache: Each computing resource node has an independent memory area and cache, which ensures that tasks are not interfered by the resources of other nodes during execution. Independent execution units: The execution units (such as arithmetic logic units) inside each computing resource node work independently and do not share computing resources. This ensures the parallel execution of tasks on each node and there are no resource conflicts during the computing process. Dedicated input / output interfaces: The communication interfaces of each computing resource node with external devices are independent, avoiding data transmission interference between nodes. Task scheduling and resource allocation: When a task is submitted to the processor, the system selects a suitable computing resource node for task processing according to the requirements of the task and the computing power of the target computing resource node. Due to the physical isolation between the computing resource nodes, the system can ensure that the computing resources of the task are not affected by the tasks of other nodes, avoiding competition or conflicts of computing resources. Communication between computing resource nodes: Although the computing resource nodes are physically isolated, they still need to perform necessary data exchange and coordination. This can be achieved through a cross-node communication mechanism, such as using a high-speed interconnection network (interconnection of network chips) for communication between nodes to ensure data synchronization and collaboration.

[0062] By physically isolating multiple computing resource nodes in the processor, the system can process multiple tasks simultaneously, and each task is executed on an independent computing resource node, avoiding resource conflicts and interference between tasks. This can significantly improve the parallelism of computing resources and enhance the overall computing efficiency.

[0063] In practical applications, resource allocation can also be implemented in, but not limited to, the following ways, including: obtaining the target weight of the task to be processed; determining the target computing resource block of the target weight according to the pre-established mapping relationship between the weight and the computing resource block; and using the target computing resource block to process the task to be processed.

[0064] The target weight refers to the weight value calculated by the task to be processed according to its attributes such as the delay time threshold, which is used to reflect the urgency and priority of the task. The mapping relationship between the weight and the computing resource block refers to a pre-established corresponding rule that maps different target weight ranges to specific computing resource blocks. This mapping relationship can be adjusted according to the system's resource allocation strategy to meet the needs of different tasks. The target computing resource block refers to the computing resource block that is most suitable for processing the task determined through the mapping relationship according to the target weight of the task to be processed.

[0065] Obtain the delay time threshold of the task to be processed from the task attributes, and this threshold represents the maximum allowable delay for the task to be completed within a specified time. After squaring the delay time threshold and taking the reciprocal through a formula such as, the target weight is obtained. For example, if the delay time threshold is T, the target weight can be calculated as 1 / ( ). This formula can be adjusted according to actual needs to better reflect the urgency of the task. Define the weight intervals: divide the target weight into different intervals, such as a high weight interval (0.8 - 1.0), a medium weight interval (0.5 - 0.79), and a low weight interval (0 - 0.49). Allocate computing resource blocks: allocate corresponding computing resource blocks for each weight interval. For example, allocate high-performance computing resource blocks (such as multi-core CPUs and large-capacity memories) for the high weight interval, medium-performance computing resource blocks for the medium weight interval, and basic-performance computing resource blocks for the low weight interval. Weight matching: match the target weight of the task to be processed with the mapping relationship to determine its corresponding target computing resource block. Task scheduling: allocate the task to be processed to the target computing resource block and start the task execution through a task scheduler. Task execution monitoring: monitor its resource usage and progress during the task execution to ensure that the task is completed within the specified delay time.

[0066] Perform resource allocation according to the target weight of the task to ensure that high-priority tasks can obtain sufficient resource support, improving the overall performance of the system and the completion rate of the tasks. For example, high-priority tasks (such as real-time video processing) can quickly obtain high-performance computing resources to ensure timely completion of the tasks.

[0067] As a refinement of the above embodiments, when obtaining the target weight of the task to be processed, the following methods can be adopted but are not limited to them, including: obtaining the delay time threshold of the task to be processed; performing a square calculation on the delay time threshold to obtain a square result; performing a reciprocal calculation on the square result to obtain the target weight.

[0068] The delay time threshold refers to the maximum allowable delay time within which the task to be processed must be completed. It is an important parameter for measuring the time sensitivity of a task and is usually in milliseconds (ms) or seconds (s).

[0069] Obtain the delay time threshold from the task's description file or attributes. This value is usually set by the task initiator or the system according to the nature of the task. For example, in a real-time video processing task, the delay time threshold may be set to 100 milliseconds to ensure smooth video playback. In some cases, the delay time threshold may be stored in the system configuration file or database. By reading these configurations, the delay time threshold of the task can be obtained. Perform a square operation on the obtained delay time threshold. For example, if the delay time threshold is T milliseconds, the square result is . This step can be achieved through simple mathematical operations, such as using the power operator or the corresponding mathematical function in a programming language. Store the result of the square operation in memory or cache for subsequent use. This ensures the continuity of the calculation process and the integrity of the data. Perform a reciprocal operation on the square result to obtain the target weight. For example, the square result is , then the target weight is 1 / ( ). In a programming language, this step can be implemented using the reciprocal function in the math library or a simple division operation. Verify the validity of the calculation result to ensure that the target weight is a reasonable value. If the delay time threshold is zero or negative, special processing is required, such as setting a default value or returning an error message.

[0070] In an implementable manner of the embodiments of the present disclosure, resource abstraction and virtualization: computing power segmentation: divide the streaming multiprocessor (SM) of the GPU into time slices, supporting millisecond-level computing power allocation (such as allocating 10 ms of computing duration for each time slice); video memory management: adopt the video memory block bitmap marking method, divide the video memory into granular units of 1MB, support dynamic merging and splitting. For better understanding of video memory management, as Figure 3 shown, Figure 3A flowchart showing the process of video memory management provided by an embodiment of this application. In the embodiment of this application, the video memory is a computing resource block, and Compute Unified Device Architecture (CUDA) stream isolation: Logical isolation of CUDA is created through virtualization technology to avoid resource contention between streams. Containerized deployment: Use containerized development (Docker) + cluster management (Kubernetes) to encapsulate model instances, and each container is bound to an independent multi-instance (MI) GPU instance or virtual video memory partition; dynamic injection of GPU resources is achieved through the Kubernetes device plugin (such as allocating exclusive containers for real-time models and sharing containers for batch models).

[0071] Intelligent scheduler: Real-time monitoring and decision-making: Data collection: The following metrics are collected in real time: request queue depth, model service level agreement (SLA) (such as P99 latency ≤ 50 ms), GPU resource occupancy rate (video memory / power consumption). Dynamic scheduling algorithm: Priority preemption: High-priority tasks can preempt the resources of low-priority tasks. Optimization by reinforcement learning: Construct a state space (resource occupancy, request volume, SLA) and an action space (resource allocation strategy), and maximize the long-term resource utilization rate through reinforcement learning algorithms. Fair allocation: Allocate resources according to the model weight (such as weight = 1 / model latency requirement²).

[0072] Isolation and guarantee: Hardware-level isolation: The GPU is divided into multiple independent instances, and each instance is allocated an independent computing unit (each instance has exclusive access to a group of SMs), independent video memory (the video memory is divided into independent blocks), independent video memory bandwidth, and task scheduling channels (each instance is allocated a dedicated video memory bandwidth channel), achieving physical isolation of hardware resources; the crash of a program within a MIG instance will not affect other instances. For example, if there are some errors or crashes in one instance, only the problem instance will become invalid, rather than the entire GPU. For performance isolation, the computing power, video memory, and bandwidth of each instance are strictly guaranteed, and other instances will not preempt the resources of this instance if there is a sudden load. For better understanding of the isolation of computing units, as Figure 4 shown Figure 4Schematic diagram of the isolation structure of a computing unit disclosed in the embodiments of the present application. Software virtualization: Allocate exclusive MPS servers for each model to isolate the computing context; limit the SM occupancy rate of a single model (e.g., not exceeding 30% of the total SM). Elastic scaling: Horizontal scaling: When the single GPU resource is insufficient, migrate the model instance across nodes through the Kubernetes scheduler; Vertical scaling: Dynamically adjust the video memory and the number of SMs of the MIG instance (e.g., expand from 5GB / 10SM to 10GB / 20SM); Warm-up mechanism: Preload the parameters of frequently used models into the unified memory; Video memory compression: Enable the Zlib compression algorithm for low-frequency models, with a compression ratio of 1.5:1 (the increase in latency ≤ 2ms).

[0073] Dynamic resource pooling: Abstract the computing resources of the GPU (such as computing power, video memory, CUDA streams) into divisible units and allocate them to different model instances as needed. Intelligent scheduler: Dynamically adjust the resource allocation policy by real-time monitoring of the request queue, model priority, and resource occupancy status. Isolation and guarantee: Avoid performance fluctuations caused by resource preemption through hardware isolation or software virtualization. Elastic scaling: Automatically expand / contract model instances according to the request volume, and combine the cold start warm-up mechanism to reduce latency.

[0074] Implementation steps: Resource abstraction layer: Divide the GPU resources (computing power, video memory) into virtual units (e.g., through time slices, video memory partitioning). Use containerization technologies such as (Docker + Kubernetes) to encapsulate model instances and isolate resource allocation. Dynamic scheduling algorithm: Real-time collect the request volume, model SLA (such as maximum latency), and resource occupancy rate. Dynamically adjust the resource allocation based on priority (high-priority models preempt resources) or fairness (allocate proportionally). Use reinforcement learning (RL) or dynamic programming to optimize the long-term resource utilization rate. Resource recycling mechanism: Release resources for idle model instances and recycle them to the resource pool for other models to use. Combine video memory compression technology to reduce fragmentation. Resource utilization improvement: Dynamic allocation increases the GPU utilization rate from 40 - 60% in static partitioning to over 80%. Low-latency guarantee: Through the priority scheduling and preemption mechanism, the latency of high-priority models is reduced by 30 - 50%. Flexible scalability: Support the mixed deployment of heterogeneous models without modifying the model structure. Anti-resource competition: Video memory / computing power isolation technology avoids interference between models. Cross-node cooperation: Combine the cluster scheduler to achieve load balancing between multiple GPU servers.

[0075] Through the description of the above implementation manners, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware, but in many cases, the former is a better implementation manner.

[0076] An embodiment of the present application further provides a resource allocation device. Figure 5 As shown in the structure diagram of a resource allocation device provided by an embodiment of the present application, Figure 5 it includes: An obtaining unit 31, configured to obtain the size of the first computing resource required for a task to be processed; An adjusting unit 32, configured to adjust at least one computing resource block of a target computing resource node corresponding to the task to be processed according to the size of the first computing resource; the target computing resource node includes at least two computing resource blocks; A processing unit 33, configured to process the task to be processed based on the adjusted at least one computing resource block to obtain a processing result of the task to be processed.

[0077] Through the present application, since the size of the first computing resource required for the task to be processed is obtained, and at least one computing resource block of the target computing resource node corresponding to the task to be processed is adjusted according to the size of the first computing resource, flexible allocation of the computing resource blocks is realized, so that they match the resources required by the task. Then, based on the adjusted at least one computing resource block, the task to be processed is processed to obtain a processing result of the task to be processed, avoiding the mismatch problem between the fixedly divided computing resource blocks and the task to be processed, and improving the utilization rate of the computing resources. Therefore, the technical problem of low utilization rate of computing resources can be solved, and the technical effect of improving the utilization rate of computing resources can be achieved.

[0078] Further, in a possible implementation manner of this embodiment, as Figure 6 shown, the adjusting unit 32 includes: A determining module 321, configured to determine whether there is a first computing resource block in the target computing resource node; the first computing resource block is the smallest idle computing resource block that meets the size of the first computing resource; The determining module 321 is further configured to, when there is a first computing resource block in the target computing resource node, determine whether the second computing resource size of the first computing resource block is greater than the first computing resource size; A splitting module 322, configured to, when the second computing resource size of the first computing resource block is greater than the first computing resource size, split the first computing resource block into at least two second computing resource blocks; at least two second computing resource blocks include at least one target second computing resource block with a third computing resource size equal to the first computing resource size; the adjusted at least one computing resource block includes at least two second computing resource blocks.

[0079] Further, in a possible implementation manner of this embodiment, as Figure 6 shown, the processing unit 33 is further configured to: Utilize the target second computing resource block to process the task to be processed, and obtain the processing result of the task to be processed.

[0080] Further, in a possible implementation manner of this embodiment, as Figure 6 shown, after utilizing the target second computing resource block to process the task to be processed and obtaining the processing result of the task to be processed, the apparatus further includes: A marking unit 34, configured to mark the target second computing resource block as an idle computing resource block; A determining unit 35, configured to determine whether there is an idle computing resource block adjacent to the marked target second computing resource block; A merging unit 36, configured to, when there is an idle computing resource block adjacent to the marked target second computing resource block, merge the idle computing resource block adjacent to the marked target second computing resource block and the marked target second computing resource block to obtain a merged idle computing resource block.

[0081] Further, in a possible implementation manner of this embodiment, as Figure 6 shown, after determining whether there is a first computing resource block in the target computing resource node, the apparatus further includes: The obtaining unit 31 is further configured to, when there is no first computing resource block in the target computing resource node, obtain the first priority of the task to be processed, and obtain the second priority of the processing task processed by the third computing resource block in the target computing resource node; the third computing resource block is the smallest non-idle computing resource block that meets the required size of the first computing resource; The processing unit 33 is further configured to, when the first priority is greater than the second priority, stop the third computing resource block from processing the processing task, and utilize the third computing resource block to process the task to be processed.

[0082] Further, in a possible implementation manner of this embodiment, the target computing resource node is any computing resource node in the processor, and the processor includes at least two computing resource nodes; different computing resource nodes are physically isolated from each other.

[0083] Further, in a possible implementation manner of this embodiment, as Figure 6 shown, the apparatus further includes: The obtaining unit 31 is further configured to obtain the target weight of the task to be processed; The determining unit 35 is further configured to determine the target computing resource block of the target weight according to the mapping relationship established in advance between the weight and the computing resource block; The processing unit 33 is further configured to utilize the target computing resource block to process the task to be processed.

[0084] Further, in a possible implementation manner of this embodiment, as Figure 6 shown, the obtaining unit 31 is further configured to: Obtain the delay time threshold of the task to be processed; Perform a square calculation on the delay time threshold to obtain a square result; Perform a reciprocal calculation on the square result to obtain a target weight.

[0085] For the description of the features in the corresponding embodiment of the resource allocation device, reference can be made to the relevant description in the corresponding embodiment of the resource allocation method, which will not be elaborated here one by one.

[0086] An embodiment of the present application further provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments of resource allocation.

[0087] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps in any one of the above method embodiments of resource allocation when running.

[0088] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: USB flash drives, read-only memories (ROM for short), random access memories (RAM for short), mobile hard disks, magnetic disks, or optical disks and other media that can store computer programs.

[0089] An embodiment of the present application further provides a computer program product. The above computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps in any one of the above method embodiments of resource allocation.

[0090] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the steps in any one of the above method embodiments of resource allocation.

[0091] Those skilled in the art may further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered as exceeding the scope of this application.

[0092] The above has introduced in detail a method, an apparatus, and an electronic device for resource allocation provided by this application. Specific examples are used herein to elaborate on the principle and implementation manner of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application. It should be noted that for those of ordinary skill in the art, without departing from the principle of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the protection scope of the claims of this application.

Claims

1. A method for resource allocation, characterized in that, Including: Obtaining the size of the first computing resource required for the task to be processed; Adjusting at least one computing resource block of the target computing resource node corresponding to the task to be processed according to the size of the first computing resource; The target computing resource node includes at least two computing resource blocks; Processing the task to be processed based on the adjusted at least one computing resource block to obtain the processing result of the task to be processed.

2. The method for resource allocation according to claim 1, wherein The adjusting at least one computing resource block of the target computing resource node corresponding to the task to be processed according to the size of the first computing resource includes: Determining whether there is a first computing resource block in the target computing resource node; the first computing resource block is the smallest idle computing resource block required to meet the size of the first computing resource; If there is the first computing resource block in the target computing resource node, determining whether the second computing resource size of the first computing resource block is greater than the size of the first computing resource; If the second computing resource size of the first computing resource block is greater than the size of the first computing resource, splitting the first computing resource block into at least two second computing resource blocks; the at least two second computing resource blocks include at least one target second computing resource block with a third computing resource size equal to the size of the first computing resource; The adjusted at least one computing resource block includes at least two second computing resource blocks.

3. The method for resource allocation according to claim 2, wherein The processing the task to be processed based on the adjusted at least one computing resource block to obtain the processing result of the task to be processed includes: Processing the task to be processed by using the target second computing resource block to obtain the processing result of the task to be processed.

4. The method for resource allocation according to claim 3, wherein After processing the task to be processed by using the target second computing resource block to obtain the processing result of the task to be processed, the method further includes: Marking the target second computing resource block as an idle computing resource block; Determining whether there is an idle computing resource block adjacent to the marked target second computing resource block; If there is an idle computing resource block adjacent to the marked target second computing resource block, merging the idle computing resource block adjacent to the marked target second computing resource block and the marked target second computing resource block to obtain a merged idle computing resource block.

5. The method for resource allocation according to claim 2, wherein After determining whether there is a first computing resource block in the target computing resource node, the method further includes: If there is no first computing resource block in the target computing resource node, obtaining the first priority of the task to be processed and obtaining the second priority of the processing task processed by the third computing resource block in the target computing resource node; the third computing resource block is the smallest non-idle computing resource block required to meet the size of the first computing resource; If the first priority is greater than the second priority, stopping the third computing resource block from processing the processing task and using the third computing resource block to process the task to be processed.

6. The method for resource allocation according to claim 1, characterized in that The target computing resource node is any one of the computing resource nodes in the processor, and the processor includes at least two computing resource nodes; physical isolation exists between different computing resource nodes.

7. The method for resource allocation according to claim 1, wherein The method includes: Obtaining a target weight of the task to be processed; Determining a target computing resource block of the target weight according to a pre-established mapping relationship between the weight and the computing resource block; Processing the task to be processed by using the target computing resource block.

8. The method for resource allocation according to claim 7, wherein The obtaining the target weight of the task to be processed includes: Obtaining a delay time threshold of the task to be processed; Performing a square calculation on the delay time threshold to obtain a square result; Performing a reciprocal calculation on the square result to obtain the target weight.

9. A resource allocation device, characterized in that It includes: An obtaining unit, configured to obtain a first computing resource size required by a task to be processed; An adjusting unit, configured to adjust at least one computing resource block of a target computing resource node corresponding to the task to be processed according to the first computing resource size; The target computing resource node includes at least two computing resource blocks; A processing unit, configured to process the task to be processed based on the at least one adjusted computing resource block to obtain a processing result of the task to be processed.

10. An electronic device, characterized in that, It includes: A memory, configured to store a computer program; A processor, configured to implement the steps of the method for resource allocation according to any one of claims 1 to 8 when executing the computer program.

Citation Information

Patent Citations

  • Resource allocation method and device, task submission method and device, electronic equipment and medium

    CN111694672A

  • Computing power directional scheduling method and device of intelligent computing center

    CN119088569A

  • Cluster resource scheduling method and apparatus, electronic device and storage medium

    WO2022262167A1

Cited By

  • Rendering task allocation method and device, electronic equipment and storage medium

    CN120523610A

  • Task scheduling method and device, chip, equipment and storage medium

    CN121210071A

  • Task scheduling method and device, chip, equipment and storage medium

    CN121210071B

  • Resource scheduling method and device, electronic equipment and storage medium

    CN121433918A