Resource Search Method and Related Devices
By analyzing resource requests and calculating the minimum search step size traversing in the resource data structure, the problem of inefficient resource search in the prior art is solved, and efficient search and allocation of multiple types of resources is realized.
Patent Information
- Application Number
- CN202111676340.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-31
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2041-12-31
AI Technical Summary
The existing resource allocator has inefficient resource search when facing multi-type resource requirements, multi-time modes, and resource parallelism and dependencies.
By analyzing resource requests to obtain various types of resource requirements, compute the minimum search step size, and traverse in the pre-built resource data structure until the allocation results of all types of resources meet the sharing conditions.
It improves the search efficiency of multi-type resource requirements, can adapt to complex resource distribution and time modes, and realizes collaborative joint search and allocation of multi-type resources.
Smart Images

Figure CN114443288B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of resource search, and in particular, to a resource search method and related devices. Background Art
[0002] The main function of a resource allocator is to search and match a certain amount of limited resources with resource usage requests, so that the resource usage requests are satisfied and a certain degree of maximization of resource utilization is achieved. In a general resource allocator, generally only real-time resource search and allocation of the same type are involved, that is, allocable resources of the same type are searched out according to resource requests for allocation. However, with the development of artificial intelligence, AI algorithms involve multi-type resource requirements, multi-time patterns, and resource parallelism and dependencies. Therefore, the resource search and allocation of AI algorithms present more complex requirements and problems. Using the existing resource allocator for resource search and allocation will result in low resource search efficiency. Summary of the Invention
[0003] An embodiment of the present invention provides a resource search method. By parsing the resource requirements corresponding to multi-type resources and traversing in a pre-constructed resource data structure through the calculated minimum search step lengths corresponding to the multi-type resources, a resource allocation result corresponding to the multi-type resources is obtained. When the resource allocation result corresponding to the multi-type resources meets a preset sharing condition, a target resource search result of the resource request is obtained, and multi-type resource requirements can be searched simultaneously, improving the resource search efficiency.
[0004] In a first aspect, an embodiment of the present invention provides a resource search method, and the resource search method includes:
[0005] When a resource request is received, the resource request is parsed through a preset parsing method to obtain the resource requirements corresponding to each type of resource;
[0006] For the resource requirements of a single type of resource, a minimum search step length is calculated through a preset calculation method, and the minimum search step length is used to traverse in a pre-constructed resource data structure to obtain a resource allocation result corresponding to the corresponding type of resource;
[0007] When the resource allocation results of all types of resources meet a preset sharing condition, the resource allocation results of all types of resources are determined as the target resource search result of the resource request.
[0008] Optionally, the resource request includes that when a resource request is received, the resource request is parsed through a preset parsing method to obtain the resource requirements corresponding to each type of resource, including:
[0009] Parsing out the calculation requirements of each algorithm on different types of resources from the resource request;
[0010] According to the computing requirements of each of the algorithms for different data types, divide the resource requests into requests with the smallest resource granularity;
[0011] Obtain the resource requirements corresponding to the resource requests according to the requests with the smallest resource granularity.
[0012] Optionally, the pre-constructed resource data structure includes multiple resource blocks. For the resource requirements for one type of resource, calculating the minimum search step length through a preset calculation method includes:
[0013] For the resource requirements for the current type of resource, determine the minimum resource allocable amount from the resource allocable amounts of the multiple resource blocks;
[0014] Obtain the minimum resource requirement amount corresponding to the currently allocated current type of resource in the multiple resource blocks;
[0015] Calculate the minimum search step length corresponding to the resource requirements for the current type of resource according to the minimum resource allocable amount and the minimum resource requirement amount. <**********
[0016] Optionally, the pre-constructed resource data structure includes multiple resource blocks, and each resource block includes corresponding resource data amount information. Traversing in the pre-constructed resource data structure through the minimum search step length to obtain the resource allocation result for the corresponding type of resource includes:
[0017] Determine the allocable resource blocks in the pre-constructed resource data structure according to the resource data amount information;
[0018] Traverse in the allocable resource blocks through the minimum search step length to obtain the resource allocation result for the corresponding type of resource.
[0019] Optionally, the resource data amount information includes allocated information. Traversing in the allocable resource blocks through the minimum search step length to obtain the resource allocation result for the corresponding type of resource includes:
[0020] Construct a two-dimensional resource pattern structure for the current allocable resource block according to the allocated information of the current allocable resource block. The two-dimensional resource pattern structure includes a time dimension and a data amount dimension;
[0021] Initialize a resource traversal pointer, and traverse in the data amount dimension through the resource traversal pointer with the minimum search step length to obtain the resource allocation result for the corresponding type of resource. [[ID=3**********7]]
[0022] Optionally, the initialized resource traversal pointer traverses in the data volume dimension with the minimum search step through the resource traversal pointer to obtain the resource allocation result of the corresponding type of resource, including:
[0023] When the search window corresponding to the position of the current resource traversal pointer is occupied in the time dimension, increase the current resource traversal pointer by one minimum search step to update the current resource traversal pointer;
[0024] When the search window corresponding to the position of the current resource traversal pointer is not occupied in the time dimension, determine the search window corresponding to the position of the current resource traversal pointer as the search result;
[0025] When the current resource traversal pointer finishes traversing in the data volume dimension, obtain the resource search result of the currently allocable resource block;
[0026] Based on the resource search result of the currently allocable resource block, determine the resource allocation result of the corresponding type of resource.
[0027] Optionally, the pre-constructed resource data structure includes a parent resource block and child resource blocks. The child resource blocks share the resources of a parent resource block. When the resource allocation results of all types of resources meet the preset sharing conditions, determine the resource allocation results of all types of resources as the target resource search result of the resource request, including:
[0028] When obtaining the resource allocation result of the current type of resource based on the child resource block, if it is detected that the resource allocation result of the current type of resource does not meet the preset sharing conditions, perform resource search in the next parent resource block;
[0029] If it is detected that the resource allocation result of the current type of resource meets the preset sharing conditions, perform the resource search of the next type of resource until the resource searches of all types of resources are completed or the pre-constructed resource data structure is traversed, and determine the resource allocation results of all types of resources as the target resource search result of the resource request.
[0030] In a second aspect, an embodiment of the present invention provides a resource search device, and the resource search device includes:
[0031] A parsing module, configured to parse the resource request through a preset parsing method when receiving the resource request to obtain the resource requirements corresponding to each type of resource;
[0032] A search module, configured to calculate a minimum search step through a preset calculation method for the resource requirements of a single type of resource, and traverse in a pre-constructed resource data structure through the minimum search step to obtain a resource allocation result for the corresponding type of resource;
[0033] A determination module, configured to determine the resource allocation results of all types of resources as the target resource search result of the resource request when the resource allocation results of all types of resources meet the preset sharing conditions.
[0034] In a third aspect, an embodiment of the present invention provides an electronic device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the steps in the resource search method provided by the embodiment of the present invention when executing the computer program.
[0035] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and the computer program implements the steps in the resource search method provided by the embodiment of the invention when executed by a processor.
[0036] In the embodiment of the present invention, when a resource request is received, the resource request is parsed through a preset parsing method to obtain the resource requirements corresponding to each type of resource; for the resource requirements of a single type of resource, a minimum search step is calculated through a preset calculation method, and the minimum search step is used to traverse in a pre-constructed resource data structure to obtain a resource allocation result for the corresponding type of resource; when the resource allocation results of all types of resources meet the preset sharing conditions, the resource allocation results of all types of resources are determined as the target resource search result of the resource request. By traversing in a pre-constructed resource data structure through the calculated minimum search steps corresponding to multiple types of resources according to the parsed resource requirements corresponding to multiple types of resources, and obtaining resource allocation results corresponding to multiple types of resources, when the resource allocation results corresponding to multiple types of resources meet the preset sharing conditions, the target resource search result of the resource request is obtained, and resource requirements of multiple types can be searched simultaneously, improving the resource search efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention, and those of ordinary skill in the art can obtain other drawings without creative efforts based on these drawings.
[0038] Figure 1It is a schematic flowchart of a resource search method provided by an embodiment of the present invention;
[0039] Figure 2 It is a schematic structural diagram of a resource requirement provided by an embodiment of the present invention;
[0040] Figure 3 It is a schematic diagram of a formalized resource description in a single - type distributed form provided by an embodiment of the present invention;
[0041] Figure 4 It is a structural diagram of a formalized storage of resources provided by an embodiment of the present invention;
[0042] Figure 5 It is a schematic diagram of a two - dimensional resource pattern of resource slices in space - time provided by an embodiment of the present invention;
[0043] Figure 6 It is a schematic structural diagram of a final resource search result provided by an embodiment of the present invention;
[0044] Figure 7 It is a schematic structural diagram of a resource hierarchical sharing relationship provided by an embodiment of the present invention;
[0045] Figure 8 It is a structural diagram of a resource search device provided by an embodiment of the present invention;
[0046] Figure 9 It is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. Detailed implementation manners
[0047] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without making creative efforts belong to the scope of protection of the present invention.
[0048] Please refer to Figure 1 , Figure 1 It is a flowchart of a resource search method provided by an embodiment of the present invention. As Figure 1 shown, the resource search method includes the following steps:
[0049] 101. When a resource request is received, parse the resource request through a preset parsing method to obtain the resource requirements corresponding to various types of resources.
[0050] In an embodiment of the present invention, the resource side receives a resource request of an AI algorithm. The AI algorithm can be understood as various algorithms applied in the field of artificial intelligence, and the resource request can be understood as the resource request required to execute the AI algorithm. It should be noted that the request for each AI algorithm involves multiple types of resources. For example, the resource request required to execute the AI algorithm may include resource requirements corresponding to multiple types of resources. The type of resources may include CPU time slice resources, NPU time slice resources, memory resources, network resources, and other types.
[0051] The resource side can be a server or a cloud server. The resource side is used to search for and allocate corresponding computing resources, and execute the corresponding AI algorithm through the allocated computing resources. The above resource request can be a resource request uploaded by the user through the user terminal, or formed by the AI terminal according to the AI algorithm required by the AI task. For example, the above AI tasks can be traffic monitoring tasks, pedestrian monitoring tasks, area monitoring tasks, venue monitoring tasks, etc. Taking the traffic monitoring task as an example, the AI algorithms in the traffic monitoring task may include vehicle detection algorithms, license plate number detection algorithms, vehicle tracking algorithms, vehicle violation detection algorithms, etc. Among them, the type of resources required by the vehicle detection algorithm may include CPU time slice resources, NPU time slice resources, memory resources, network resources, etc.
[0052] When the resource side receives the resource request of the AI algorithm, it can first parse the AI algorithm in the resource request, and then parse out the resource requirements of a single AI algorithm for various types of resources according to the AI algorithm, until it parses out the resource requirements of all AI algorithms for various types of resources, completes the parsing, and then obtains the resource requirements of various types of resources in the resource request. The resource requirements can be used as a search sliding window to search for various types of resources.
[0053] Optionally, parse out the computing requirements of each algorithm on different types of resources from the resource request; divide the resource request into requests with the smallest resource granularity according to the computing requirements of each algorithm on different data types; and obtain the resource requirements corresponding to the resource request according to the requests with the smallest resource granularity.
[0054] Specifically, the computing requirements of a single AI algorithm on a single type of resource can be calculated, and the minimum computing requirements of multiple AI algorithms on a single type of resource are used as the request with the smallest resource granularity. The request with the smallest resource granularity can also be used as the search sliding window for the corresponding type of resource during resource search.
[0055] Please refer to Figure 2 , Figure 2 which is a schematic structural diagram of a resource requirement provided by an embodiment of the present invention, as Figure 2As shown, the final resource requirements include the resource requirements r corresponding to each type of resource t in the resource requests, and the resource requirements r corresponding to each type of resource include the requests s with the smallest resource granularity.
[0056] 102. For the resource requirements of a single type of resource, calculate the minimum search step through a preset calculation method, and traverse the pre-constructed resource data structure with the minimum search step to obtain the resource allocation result for the corresponding type of resource.
[0057] In the embodiments of the present invention, the pre-constructed resource data structure includes the resource data structures of each type of resource, such as the resource data structures corresponding to types of resources such as CPU time slice resources, NPU time slice resources, memory resources, and network resources.
[0058] For a single type of resource, a distributed formal resource description can be referred to Figure 3 , Figure 3 is a schematic diagram of a single-type distributed formal resource description provided by the embodiments of the present invention. As Figure 3 shown, in the distributed formal resource description of a single type of resource, it includes the total data volume description of the resources corresponding to this type of resource, the structure of the resources, and the allocation description of the resources. The total data volume description of the resources can be to describe the quantity of entities such as the total number of cards CardNum(n), the total number of servers MachineNum, and the total number of computer rooms. The structure of the resources represents the subordinate relationship between each entity. For example, which resource cards belong to which servers, and which servers belong to which computer rooms, etc. Among them, different hierarchical structures can be nested. The subordinate relationship between different entities is represented by the parent pointer parent. And the total amount of resources of each entity can be represented by the data volume parameter Capacity to represent the data volume of the current type of resource. Specifically, refer to Figure 4 , Figure 4 is a structural diagram of a formal storage of resources provided by the embodiments of the present invention. As Figure 4 shown, each resource card represents the data volume of the current type of resource through the data volume parameter Capacity. Each resource card determines the subordinate relationship with the upper-level server through the parent pointer parent, and each server determines the subordinate relationship with the upper-level computer room through the parent pointer parent.
[0059] The allocation description of the resources can be the description of the data volume of the allocated resources in the resource data structure corresponding to each type of resource. The data volume of the allocated resources in the resource data structure is described in the form of resource slices. Specifically, refer to Figure 5 , Figure 5 is a schematic diagram of a two-dimensional spatio-temporal resource pattern of resource slices provided by the embodiments of the present invention. As Figure 5As shown in the figure, in the two-dimensional resource pattern of the resource slice in space-time, the horizontal axis is the data volume axis (data volume dimension), and the vertical axis is the time axis (time dimension). The data volume of the allocated resources is described by different occupancy modes, which may include permanent continuous mode, time period continuous mode, permanent periodic continuous mode, finite periodic continuous mode, etc. Among them, the permanent continuous mode is described as information such as the card / machine / engine room it belongs to, specifically describing the occupied data volume and the start time of occupancy. The time period continuous mode is described as information such as the card / machine / engine room it belongs to, specifically describing the occupied data volume, the start time of occupancy, and the end time of occupancy. The permanent periodic continuous mode is described as information such as the card / machine / engine room it belongs to, specifically describing parameters such as the start time of the period, the occupied duration within a single period, and the total duration of a single period. The finite periodic continuous mode is described as information such as the card / machine / engine room it belongs to, specifically describing parameters such as the start time of the period, the occupied duration within a single period, the total duration of a single period, and the total number of periods of continuous duration.
[0060] The resource end calculates the minimum search step size through a preset calculation method. In the embodiment of the present invention, the preset calculation method may be to quantify the total resource data volume in a type of resource, and the length of each quantization interval is the corresponding minimum search step size.
[0061] Optionally, the pre-constructed resource data structure includes multiple resource blocks, and each resource block corresponds to a resource card or a resource block in a resource card. The minimum resource allocable amount can be determined from the resource allocable amounts of multiple resource blocks according to the resource requirements of the current type of resource; obtain the minimum resource demand corresponding to the currently allocated current type of resource in multiple resource blocks; calculate the minimum search step size corresponding to the resource demand of the current type of resource according to the minimum resource allocable amount and the minimum resource demand.
[0062] Please combine Figure 5 for understanding. The minimum resource allocable amount in each resource block is the allocable data volume between the two closest allocated resources, and the minimum resource demand is the data volume corresponding to the allocated resource with the shortest length on the data volume axis. In a possible embodiment, the minimum resource demand may be the resource demand of the allocated resource with the smallest total area corresponding to the time axis and the data volume axis. Calculate the quotient of the minimum resource allocable amount and the minimum resource demand to obtain the normalized resource demand ResourceNorm, and take the minimum value among all the normalized resource demands as the minimum search step size.
[0063] In the embodiment of the present invention, the resource end can traverse the pre-constructed resource data structure with the minimum search step size through a preset search sliding window, and use the allocable resources that meet the search sliding window as the search results.
[0064] Optionally, according to the resource data volume information, determine the allocable resource blocks in the pre-constructed resource data structure; traverse the allocable resource blocks with the minimum search step size to obtain the resource allocation result of the corresponding type of resource.
[0065] In the embodiments of the present invention, the resource data volume information can be obtained by the data volume parameter Capacity. The data volume parameter includes the resource occupancy information CapacityAlloced(t, n), which represents the allocated information of the nth resource of type t. The allocated information is CapacityAllocedItem(t, n, m), which means the mth resource allocation record of the nth resource of type t. Read the pattern information, time information, and data volume information therein.
[0066] The remaining allocable resources of the resource block can be calculated through the allocated information. When the allocable resources are less than the resources corresponding to the request of the minimum resource granularity, it is determined that the resource block is an unallocable resource block. When the allocable resources are greater than the resource data volume corresponding to the request of the minimum resource granularity, it is determined that the resource block is an allocable resource block.
[0067] In the allocable resource blocks, a preset search sliding window can be used to traverse the pre-constructed resource data structure with the minimum search step size, and the allocable resources that meet the search sliding window are used as the search results. The length of the search sliding window can be the resource data volume corresponding to the request of the minimum resource granularity.
[0068] Optionally, the resource data volume information includes the allocated information. According to the allocated information of the current allocable resource block, construct a two-dimensional resource pattern structure of the current allocable resource block. The two-dimensional resource pattern structure includes a time dimension and a data volume dimension; initialize a resource traversal pointer, and traverse in the data volume dimension with the minimum search step size through the resource traversal pointer to obtain the resource allocation result of the corresponding type of resource.
[0069] After reading the allocated information, the pattern information, time information, and data volume information therein can be formed into a corresponding two-dimensional resource pattern structure. Please refer to Figure 5 for understanding.
[0070] Further, when the search window corresponding to the position of the current resource traversal pointer is occupied in the time dimension, a minimum search step is added to the current resource traversal pointer to update the current resource traversal pointer; when the search window corresponding to the position of the current resource traversal pointer is not occupied in the time dimension, the search window corresponding to the position of the current resource traversal pointer is determined as the search result; when the current resource traversal pointer finishes traversing in the data volume dimension, the resource search result of the currently allocable resource block is obtained; based on the resource search result of the currently allocable resource block, the resource allocation result of the corresponding type of resource is determined.
[0071] Specifically, initialize the resource traversal pointer CapacityAlloced(t, n, p). The resource traversal pointer CapacityAlloced(t, n, p) represents an allocation attempt at the position of the resource traversal pointer p for the nth resource block of type t resources. Initialize p = 0, and in each update operation after iteration, make p = p + SearchStep. For the current position p, determine whether the interval [p, p + T] in the data volume dimension is occupied in the time dimension. If not, the search is successful; if there is occupancy, re-search according to the above at p = p + SearchStep. T is the length of the search sliding window. According to the above process, directly iterate through all resource requirements, or traverse until the formal resource description of the corresponding single-type distribution is completed. The end of any one of them is the end.
[0072] Collect the resource search results corresponding to all types of resources to obtain the final resource allocation result. The resource allocation result can be used to allocate resources to the AI algorithm. Please refer to the Figure 6 , Figure 6 which is a schematic structural diagram of a final resource search result provided by an embodiment of the present invention.
[0073] The resource search results can be integrated. For example, the resources of an existing card can be merged. For resource requests that do not meet the resources of one card, rounding up is required to determine that the resources are sufficient.
[0074] 103. When the resource allocation results of all types of resources meet the preset sharing conditions, determine the resource allocation results of all types of resources as the target resource search results of the resource request.
[0075] In an embodiment of the present invention, the preset sharing condition may be that multiple resources share a superior resource. For example, if resource type A has a sharing relationship with resource type B in terms of allocation, it means that multiple pieces of resource type A share a certain piece of resource type B. For instance, multiple GPU cards (multiple pieces of resource type A) share the CPU computing power (resource type B) on the same server in terms of allocation. When performing resource allocation across or among multiple cards, corresponding resource partitioning is carried out from the same CPU resource until it is completely allocated.
[0076] Furthermore, the preset sharing condition may be that in a preset resource hierarchy relationship, resources at the same level have no sharing relationship, and resources at the upper level can be shared by resources at the lower level during allocation. For details, please refer to Figure 7 , Figure 7 which is a schematic structural diagram of a resource hierarchy sharing relationship provided by an embodiment of the present invention.
[0077] Optionally, the pre-constructed resource data structure includes a parent resource block and a child resource block. The child resource block shares the resources of the parent resource block. When obtaining the resource allocation result of the current type of resource based on the child resource block, if it is detected that the resource allocation result of the current type of resource does not meet the preset sharing condition, resource search is performed in the next parent resource block; if it is detected that the resource allocation result of the current type of resource meets the preset sharing condition, resource search for the next type of resource is performed until the resource search for all types of resources is completed or the pre-constructed resource data structure is traversed, and the resource allocation results of all types of resources are determined as the target resource search result of the resource request.
[0078] For example, in the case where a resource card has multiple resource areas, the resource card and the resource areas have a parent-child relationship. The resource areas can share the resources of the resource card. The resource card is the parent resource block of the resource areas, and the resource areas are the child resource blocks of the resource card.
[0079] Specifically, after completing the resource request allocation corresponding to a single type of resource, if the resource requirements include multiple sub-requirements, it can be determined whether the current resource search result meets the preset sharing relationship, such as determining whether the resources allocated for the current sub-requirement meet the preset sharing relationship. If not, the resource search result of the current sub-requirement is invalidated. In the case where the preset sharing relationship is not met, according to the sharing relationship, resource search is restarted in the next resource block at the parent level to obtain a new search result. After all types of resource searches for the current sub-task are completed successfully, iteration for the next sub-requirement is performed until all sub-requirements are iterated or the corresponding single-type distributed formal resource description is traversed. The end of any one of them means the end.
[0080] In an embodiment of the present invention, when a resource request is received, the resource request is parsed by a preset parsing method to obtain resource requirements corresponding to various types of resources. For the resource requirements of a single type of resource, a minimum search step is calculated by a preset calculation method, and the minimum search step is used to traverse a pre-constructed resource data structure to obtain a resource allocation result for the corresponding type of resource. When the resource allocation results of all types of resources meet the preset sharing conditions, the resource allocation results of all types of resources are determined as the target resource search result of the resource request. By traversing the pre-constructed resource data structure with the minimum search steps corresponding to multiple types of resources calculated based on the parsed resource requirements corresponding to multiple types of resources to obtain the resource allocation results corresponding to multiple types of resources, and when the resource allocation results corresponding to multiple types of resources meet the preset sharing conditions, the target resource search result of the resource request is obtained, so that multiple types of resource requirements can be searched simultaneously, improving the resource search efficiency. Implementing the embodiments of the present invention can perform collaborative and joint search and allocation of resources required by multiple AI algorithms, can be applicable to the distributed resource distribution situation of resources, including multi-card distribution, multi-machine distribution, cross-computer room distribution, etc., can be applicable to the complex relationships between resources, including independent parallel relationships, inter-class sharing relationships, etc., and can adapt to different resource allocation and search time patterns, including periodic patterns, timed start patterns, timed end patterns, or combinations of the above multiple patterns.
[0081] It should be noted that the resource search method provided by the embodiments of the present invention can be applied to devices such as smartphones, computers, and servers that can perform resource search.
[0082] Please refer to Figure 8 , Figure 8 which is a structural diagram of a resource search device provided by an embodiment of the present invention. As Figure 8 shown, the resource search device includes:
[0083] A parsing module 801, configured to parse the resource request by a preset parsing method when a resource request is received to obtain resource requirements corresponding to various types of resources;
[0084] A search module 802, configured to calculate a minimum search step by a preset calculation method for the resource requirements of a single type of resource, and traverse a pre-constructed resource data structure with the minimum search step to obtain a resource allocation result for the corresponding type of resource;
[0085] A determination module 803, configured to determine the resource allocation results of all types of resources as the target resource search result of the resource request when the resource allocation results of all types of resources meet the preset sharing conditions.
[0086] Optionally, the parsing module 801 includes:
[0087] A parsing sub-module, configured to parse the computing requirements of each algorithm on different types of resources from the resource request;
[0088] A partitioning sub-module, configured to partition the resource request into requests with the smallest resource granularity according to the computing requirements of each algorithm on different data types;
[0089] A processing sub-module, configured to obtain the resource requirements corresponding to the resource request according to the request with the smallest resource granularity.
[0090] Optionally, the pre-constructed resource data structure includes multiple resource blocks, and the search module 802 includes:
[0091] A first determination sub-module, configured to determine the smallest resource allocatable amount from the resource allocatable amounts of the multiple resource blocks for the resource requirements of the current type of resource;
[0092] An acquisition sub-module, configured to acquire the smallest resource requirement amount corresponding to the currently allocated current type of resource in the multiple resource blocks;
[0093] A calculation sub-module, configured to calculate the smallest search step corresponding to the resource requirements of the current type of resource according to the smallest resource allocatable amount and the smallest resource requirement amount.
[0094] Optionally, the pre-constructed resource data structure includes multiple resource blocks, and each resource block includes corresponding resource data amount information. The search module 802 further includes:
[0095] A second determination sub-module, configured to determine the allocatable resource blocks in the pre-constructed resource data structure according to the resource data amount information;
[0096] A traversal sub-module, configured to traverse the allocatable resource blocks with the smallest search step to obtain the resource allocation result of the corresponding type of resource.
[0097] Optionally, the resource data amount information includes allocation information, and the traversal sub-module includes:
[0098] A construction unit, configured to construct a two-dimensional resource pattern structure of the current allocatable resource block according to the allocation information of the current allocatable resource block, where the two-dimensional resource pattern structure includes a time dimension and a data amount dimension;
[0099] A traversal unit, configured to initialize a resource traversal pointer, and traverse in the data amount dimension with the smallest search step through the resource traversal pointer to obtain the resource allocation result of the corresponding type of resource.
[0100] Optionally, the traversal unit includes:
[0101] An update subunit, configured to increment the current resource traversal pointer by one minimum search step to update the current resource traversal pointer when the search window corresponding to the position of the current resource traversal pointer is occupied in the time dimension;
[0102] A first determination subunit, configured to determine the search window corresponding to the position of the current resource traversal pointer as the search result when the search window corresponding to the position of the current resource traversal pointer is not occupied in the time dimension;
[0103] A traversal subunit, configured to obtain a resource search result of the currently allocable resource block when the current resource traversal pointer finishes traversing in the data volume dimension;
[0104] A second determination subunit, configured to determine a resource allocation result of a corresponding type of resource based on the resource search result of the currently allocable resource block.
[0105] Optionally, the pre-constructed resource data structure includes a parent resource block and child resource blocks, and the child resource blocks share the resources of a parent resource block. The determination module 803 includes:
[0106] A first search sub-module, configured to, when obtaining a resource allocation result of the current type of resource based on a child resource block, if it is detected that the resource allocation result of the current type of resource does not meet a preset sharing condition, perform a resource search in the next parent resource block;
[0107] A second search sub-module, configured to, if it is detected that the resource allocation result of the current type of resource meets the preset sharing condition, perform a resource search for the next type of resource until the resource search for all types of resources is completed or the pre-constructed resource data structure is traversed, and determine the resource allocation results of all types of resources as the target resource search result of the resource request.
[0108] It should be noted that the data center device provided in the embodiments of the present invention can be applied to devices such as smart phones, computers, and servers that can perform resource searches.
[0109] The data center device provided in the embodiments of the present invention can implement each process implemented by the resource search method in the above method embodiments, and can achieve the same beneficial effects. To avoid repetition, it will not be elaborated here.
[0110] See Figure 9 , Figure 9 is a schematic structural diagram of an electronic device provided in the embodiments of the present invention. As Figure 9As shown in the figure, it includes: a memory 902, a processor 901, and a computer program of a resource search method stored on the memory 902 and operable on the processor 901, where:
[0111] The electronic device is applied to a data center, and the processor 901 is configured to call the computer program stored in the memory 902 and execute the following steps:
[0112] When a resource request is received, parse the resource request through a preset parsing method to obtain resource requirements corresponding to various types of resources;
[0113] For the resource requirements of a single type of resource, calculate the minimum search step through a preset calculation method, and traverse the pre-constructed resource data structure through the minimum search step to obtain a resource allocation result for the corresponding type of resource;
[0114] When the resource allocation results of all types of resources meet the preset sharing conditions, determine the resource allocation results of all types of resources as the target resource search result of the resource request.
[0115] Optionally, the resource request executed by the processor 901 includes, when a resource request is received, parsing the resource request through a preset parsing method to obtain resource requirements corresponding to various types of resources, including:
[0116] Parse out the computing requirements of each algorithm on different types of resources from the resource request;
[0117] According to the computing requirements of each algorithm on different data types, divide the resource request into requests with the smallest resource granularity;
[0118] Obtain the resource requirements corresponding to the resource request according to the request with the smallest resource granularity.
[0119] Optionally, the pre-constructed resource data structure includes multiple resource blocks, and the processor 901 executes calculating the minimum search step through a preset calculation method for the resource requirements of a type of resource, including:
[0120] For the resource requirements of the current type of resource, determine the minimum resource allocable amount from the resource allocable amounts of the multiple resource blocks;
[0121] Obtain the minimum resource requirement corresponding to the currently allocated current type of resource in the multiple resource blocks;
[0122] Calculate the minimum search step corresponding to the resource requirements of the current type of resource according to the minimum resource allocable amount and the minimum resource requirement.
[0123] Optionally, the pre-constructed resource data structure includes multiple resource blocks, and each resource block includes corresponding resource data volume information. The traversal in the pre-constructed resource data structure by the processor 901 using the minimum search step to obtain the resource allocation result of the corresponding type of resource includes:
[0124] Determine the allocable resource blocks in the pre-constructed resource data structure according to the resource data volume information;
[0125] Traverse in the allocable resource blocks using the minimum search step to obtain the resource allocation result of the corresponding type of resource.
[0126] Optionally, the resource data volume information includes allocated information. The traversal in the allocable resource blocks by the processor 901 using the minimum search step to obtain the resource allocation result of the corresponding type of resource includes:
[0127] Construct a two-dimensional resource pattern structure of the current allocable resource block according to the allocated information of the current allocable resource block. The two-dimensional resource pattern structure includes a time dimension and a data volume dimension;
[0128] Initialize a resource traversal pointer, and traverse in the data volume dimension using the resource traversal pointer with the minimum search step to obtain the resource allocation result of the corresponding type of resource.
[0129] Optionally, the initialization of the resource traversal pointer by the processor 901, and the traversal in the data volume dimension using the resource traversal pointer with the minimum search step to obtain the resource allocation result of the corresponding type of resource includes:
[0130] When the search window corresponding to the position of the current resource traversal pointer is occupied in the time dimension, increase the current resource traversal pointer by one minimum search step to update the current resource traversal pointer;
[0131] When the search window corresponding to the position of the current resource traversal pointer is not occupied in the time dimension, determine the search window corresponding to the position of the current resource traversal pointer as the search result;
[0132] When the current resource traversal pointer finishes traversing in the data volume dimension, obtain the resource search result of the current allocable resource block;
[0133] Based on the resource search result of the current allocable resource block, determine the resource allocation result of the corresponding type of resource.
[0134] Optionally, the pre-constructed resource data structure includes a parent resource block and child resource blocks, and the child resource blocks share the resources of a parent resource block. When the resource allocation results of all types of resources satisfy the preset sharing conditions, the processor 901 determines the resource allocation results of all types of resources as the target resource search result of the resource request, including:
[0135] When obtaining the resource allocation result of the current type of resource based on the child resource block, if it is detected that the resource allocation result of the current type of resource does not satisfy the preset sharing condition, then perform a resource search in the next parent resource block;
[0136] If it is detected that the resource allocation result of the current type of resource satisfies the preset sharing condition, then perform a resource search for the next type of resource until the resource searches for all types of resources are completed or the pre-constructed resource data structure is traversed, and determine the resource allocation results of all types of resources as the target resource search result of the resource request.
[0137] It should be noted that the electronic device provided in the embodiments of the present invention can be applied to devices such as smartphones, computers, and servers that can perform resource searches.
[0138] The electronic device provided in the embodiments of the present invention can implement each process implemented by the resource search method in the above method embodiments, and can achieve the same beneficial effects. To avoid repetition, it will not be elaborated here.
[0139] The embodiments of the present invention also provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements each process of the resource search method or the application-side resource search method provided in the embodiments of the present invention, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0140] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), etc.
[0141] The above-disclosed are only the preferred embodiments of the present invention. Of course, the scope of the rights of the present invention cannot be limited thereby. Therefore, equivalent changes made according to the claims of the present invention still fall within the scope covered by the present invention.
Claims
1. A resource search method, characterized in that, Including the following steps: When receiving a resource request, parse the resource request through a preset parsing method to obtain the resource requirements corresponding to various types of resources; For the resource requirements of a single type of resource, calculate the minimum search step through a preset calculation method, and determine the allocable resource blocks in the pre-constructed resource data structure according to the resource data volume information; the resource data volume information includes the allocated information; the pre-constructed resource data structure includes multiple resource blocks, and each resource block includes the corresponding resource data volume information; according to the allocated information of the current allocable resource block, construct the two-dimensional resource pattern structure of the current allocable resource block, and the two-dimensional resource pattern structure includes a time dimension and a data volume dimension; initialize the resource traversal pointer, and traverse in the data volume dimension with the minimum search step through the resource traversal pointer to obtain the resource allocation result of the corresponding type of resource, specifically including: when the search window corresponding to the position of the current resource traversal pointer is occupied in the time dimension, increase the current resource traversal pointer by one minimum search step to update the current resource traversal pointer; when the search window corresponding to the position of the current resource traversal pointer is not occupied in the time dimension, determine the search window corresponding to the position of the current resource traversal pointer as the search result; when the current resource traversal pointer finishes traversing in the data volume dimension, obtain the resource search result of the current allocable resource block; based on the resource search result of the current allocable resource block, determine the resource allocation result of the corresponding type of resource; When the resource allocation results of all types of resources meet the preset sharing conditions, determine the resource allocation results of all types of resources as the target resource search result of the resource request.
2. The resource search method according to claim 1, wherein The resource request includes that when receiving a resource request, parse the resource request through a preset parsing method to obtain the resource requirements corresponding to various types of resources, including: Parse out the computing requirements of each algorithm on different types of resources from the resource request; According to the computing requirements of each algorithm on different data types, divide the resource request into requests with the smallest resource granularity; Obtain the resource requirements corresponding to the resource request according to the request with the smallest resource granularity.
3. The resource search method according to claim 1, wherein The pre-constructed resource data structure includes multiple resource blocks, and for the resource requirements of a single type of resource, calculate the minimum search step through a preset calculation method, including: For the resource requirements of the current type of resource, determine the minimum resource allocable amount from the resource allocable amounts of the multiple resource blocks; Obtain the minimum resource requirement corresponding to the currently allocated current type of resource in the multiple resource blocks; Calculate the minimum search step corresponding to the resource requirements of the current type of resource according to the minimum resource allocable amount and the minimum resource requirement.
4. The resource search method according to claim 1, wherein The pre-constructed resource data structure includes a parent resource block and child resource blocks. The child resource blocks share the resources of a parent resource block. When the resource allocation results of all types of resources meet the preset sharing conditions, determining the resource allocation results of all types of resources as the target resource search result of the resource request includes: When obtaining the resource allocation result of the current type of resource based on the child resource block, if it is detected that the resource allocation result of the current type of resource does not meet the preset sharing conditions, then perform a resource search in the next parent resource block; If it is detected that the resource allocation result of the current type of resource meets the preset sharing conditions, then perform a resource search for the next type of resource until the resource searches for all types of resources are completed or the pre-constructed resource data structure is traversed. Determine the resource allocation results of all types of resources as the target resource search result of the resource request.
5. A resource search device, characterized in that, The resource search device includes: A parsing module, configured to, when receiving a resource request, parse the resource request through a preset parsing method to obtain the resource requirements corresponding to each type of resource; A search module, configured to, for the resource requirements of a single type of resource, calculate the minimum search step through a preset calculation method, and determine the allocable resource blocks in the pre-constructed resource data structure according to the resource data volume information; the resource data volume information includes the allocated information; the pre-constructed resource data structure includes multiple resource blocks, and each resource block includes corresponding resource data volume information; according to the allocated information of the current allocable resource block, construct a two-dimensional resource pattern structure of the current allocable resource block, the two-dimensional resource pattern structure including a time dimension and a data volume dimension; initialize a resource traversal pointer, and traverse in the data volume dimension with the minimum search step through the resource traversal pointer to obtain the resource allocation result of the corresponding type of resource. Specifically, when the search window corresponding to the position of the current resource traversal pointer is occupied in the time dimension, increase the current resource traversal pointer by one minimum search step to update the current resource traversal pointer; when the search window corresponding to the position of the current resource traversal pointer is not occupied in the time dimension, determine the search window corresponding to the position of the current resource traversal pointer as the search result; when the current resource traversal pointer finishes traversing in the data volume dimension, obtain the resource search result of the current allocable resource block; based on the resource search result of the current allocable resource block, determine the resource allocation result of the corresponding type of resource; A determination module, configured to, when the resource allocation results of all types of resources meet the preset sharing conditions, determine the resource allocation results of all types of resources as the target resource search result of the resource request.
6. An electronic device, characterized in that, including: A memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps in the resource search method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps in the resource search method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Frequency selection method and device of physical resource block
CN102404851A
Calculation unit distribution method and device and calculation unit distribution system
CN112685180A