CN115374188A - Resource state query method and device, electronic equipment and storage medium - Google Patents
Resource state query method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN115374188A CN115374188A CN202211299449.3A CN202211299449A CN115374188A CN 115374188 A CN115374188 A CN 115374188A CN 202211299449 A CN202211299449 A CN 202211299449A CN 115374188 A CN115374188 A CN 115374188A
- Authority
- CN
- China
- Prior art keywords
- resource
- processor
- dimensional array
- array
- dimensional
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2458—Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
- G06F16/2474—Sequence data queries, e.g. querying versioned data
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Fuzzy Systems (AREA)
- Mathematical Physics (AREA)
- Probability & Statistics with Applications (AREA)
- Software Systems (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application provides a resource state query method, a resource state query device, electronic equipment and a storage medium. The method comprises the following steps: triggering and updating the one-dimensional array after the resource is updated; wherein each element in the one-dimensional array corresponds to a resource of the processor; when the element comprises a first character, representing that the resource corresponding to the element is in an idle state, and when the element comprises a second character, representing that the resource corresponding to the element is in a busy state; determining a resource usage state of the processor based on the updated one-dimensional array. In the embodiment of the application, the one-dimensional array is triggered and updated after the resources are updated, and the using states of the resources are marked through the characters of the elements in the one-dimensional array.
Description
Technical Field
The present application relates to the technical field of hardware resource query, and in particular, to a resource status query method, apparatus, electronic device, and storage medium.
Background
With the rapid development of science and technology, in order to meet the increasing computing requirements, the utilization rate of processor resources needs to be improved. The fundamental point for improving the utilization rate of the processor resources is that the occupation state of the resources needs to be effectively obtained, so that the resources are reasonably distributed and effectively utilized, the physical performance of hardware is exerted, and the utilization rate of the processor resources is effectively improved.
However, the occupation and release of processor resources are random, the updating frequency is very high, and the current software query algorithm cannot obtain a real-time and accurate resource state.
Disclosure of Invention
An embodiment of the present application aims to provide a resource status query method, a resource status query device, an electronic device, and a storage medium, so as to improve the real-time performance and accuracy of processor resource status query.
The invention is realized by the following steps:
in a first aspect, an embodiment of the present application provides a resource status query method, including: triggering and updating the one-dimensional array after the resource is updated; wherein each element in the one-dimensional array corresponds to a resource of the processor; when the element comprises a first character, representing that the resource corresponding to the element is in an idle state, and when the element comprises a second character, representing that the resource corresponding to the element is in a busy state; determining a resource usage state of the processor based on the updated one-dimensional array.
Because the resources of the processor on the hardware may be occupied or released in each clock cycle, in the embodiment of the present application, the update of the one-dimensional array is triggered after the resources are updated, and the use state of each resource is marked by the characters of each element in the one-dimensional array.
With reference to the technical solution provided by the first aspect, in some possible implementation manners, an order of elements in the one-dimensional array is the same as an order of resources in the processor.
In the embodiment of the present application, since the sequence of each element in the one-dimensional array is the same as the sequence of the resource in the processor, the usage state of each resource of the processor can be determined directly based on the mapping between each element and the resource.
With reference to the technical solution provided by the first aspect, in some possible implementation manners, the determining a resource usage state of the processor based on the updated one-dimensional array includes: constructing a two-dimensional array based on the updated one-dimensional array; wherein the first row of the two-dimensional array is the one-dimensional array; the second row to the Nth row of the two-dimensional array are obtained by moving one bit in the previous row according to a preset direction; the numerical value of N is equal to the number of elements of the one-dimensional array; determining a resource usage status of the processor based on the two-dimensional array.
In the embodiment of the application, the two-dimensional array is constructed, so that each row element and each column element of the two-dimensional array can represent the use states of all resources of the processor, the position relation between the idle resources is analyzed, and the idle resources are reasonably utilized subsequently.
With reference to the technical solution provided by the first aspect, in some possible implementation manners, the determining a resource usage state of the processor based on the two-dimensional array includes: constructing a two-dimensional statistical array based on the two-dimensional array; each element in the two-dimensional statistical array is obtained by performing phase and calculation on the element and elements in the same row in the previous row, and the two-dimensional statistical array is generated by performing line-by-line calculation on the two-dimensional array; and determining the resource use state of the processor based on the two-dimensional statistical array.
In the embodiment of the application, all continuous idle resources in the processor can be effectively determined by constructing the two-dimensional statistical array, so that the continuous idle resources can be reasonably utilized subsequently.
With reference to the technical solution provided by the first aspect, in some possible implementation manners, the determining a resource usage state of the processor based on the two-dimensional statistical array includes: constructing a one-dimensional statistical array based on the two-dimensional statistical array; the one-dimensional statistical array represents the number of continuous idle resources in each row of elements; and determining the resource use state of the processor based on the one-dimensional statistical array.
In the embodiment of the application, the number of the continuous idle resources can be effectively determined by constructing the one-dimensional statistical array, so that the continuous idle resources can be reasonably distributed subsequently.
With reference to the technical solution provided by the first aspect, in some possible implementations, after the determining the resource usage state of the processor, the method further includes: resource allocation is performed based on the resource usage status of the processor.
With reference to the technical solution provided by the first aspect, in some possible implementation manners, the processor is a GPU.
In a second aspect, an embodiment of the present application provides an apparatus for querying a resource status, including: the updating module is used for triggering and updating the one-dimensional array after the resources are updated; wherein each element in the one-dimensional array corresponds to a resource of the processor; when the element comprises a first character, representing that the resource corresponding to the element is in an idle state, and when the element comprises a second character, representing that the resource corresponding to the element is in a busy state; and the resource state determining module is used for determining the resource using state of the processor based on the updated one-dimensional array.
In a third aspect, an embodiment of the present application provides an electronic device, including: a processor and a memory, the processor and the memory connected; the memory is used for storing programs; the processor is configured to invoke a program stored in the memory to perform a method as provided in the above-described first aspect embodiment and/or in combination with some possible implementations of the above-described first aspect embodiment.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, performs the method as provided in the first aspect embodiment or the second aspect embodiment.
Drawings
To more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a block diagram of an electronic device according to an embodiment of the present disclosure.
Fig. 2 is a flowchart illustrating steps of a resource status query method according to an embodiment of the present application.
Fig. 3 is a schematic diagram of a one-dimensional array according to an embodiment of the present disclosure.
Fig. 4 is a schematic diagram of a two-dimensional array according to an embodiment of the present disclosure.
Fig. 5 is a schematic diagram of a two-dimensional statistical array according to an embodiment of the present disclosure.
Fig. 6 is a schematic diagram of a process for constructing a one-dimensional statistical array by using a two-dimensional statistical array according to an embodiment of the present application.
Fig. 7 is a block diagram of a resource status query apparatus according to an embodiment of the present application.
Icon: 100-an electronic device; 110-a processor; 120-a memory; 200-resource status query means; 210-an update module; 220-resource status determination module.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
Referring to fig. 1, a schematic structural block diagram of an electronic device 100 applying a resource status query method and apparatus provided in the present application is shown. In the embodiment of the present application, the electronic Device 100 may be a terminal or a server, and the terminal may be, but is not limited to, a Personal Computer (PC), a smart phone, a tablet Computer, a Personal Digital Assistant (PDA), a Mobile Internet Device (MID), and the like. Of course, the above-mentioned devices are only used to facilitate understanding of the embodiments of the present application, and should not be taken as limiting the embodiments.
Structurally, electronic device 100 may include a processor 110 and a memory 120.
The processor 110 and the memory 120 are electrically connected directly or indirectly to enable data transmission or interaction, for example, the components may be electrically connected to each other via one or more communication buses or signal lines. The resource status query device includes at least one software module which can be stored in the memory 120 in the form of software or Firmware (Firmware) or solidified in an Operating System (OS) of the electronic device 100. The processor 110 is used for executing executable modules stored in the memory 120, such as software functional modules and computer programs included in the resource status query device, so as to implement the resource status query method. The processor 110 may execute the computer program upon receiving the execution instruction.
The processor 110 may be an integrated circuit chip having signal processing capabilities. In the embodiment of the present application, the processor 110 may be a GPU (Graphics Processing Unit).
Of course, the Processor 110 may also be a general-purpose Processor, for example, a Central Processing Unit (CPU), a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a discrete gate or transistor logic device, or a discrete hardware component, which can implement or execute the methods, steps, and logic blocks disclosed in the embodiments of the present Application. Further, a general purpose processor may be a microprocessor or any conventional processor or the like.
The Memory 120 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), and an electrically Erasable Programmable Read-Only Memory (EEPROM). The memory 120 is used for storing a program, and the processor 110 executes the program after receiving the execution instruction.
It should be noted that the structure shown in fig. 1 is only an illustration, and the electronic device 100 provided in the embodiment of the present application may also have fewer or more components than those shown in fig. 1, or have a different configuration than that shown in fig. 1.
Referring to fig. 2, fig. 2 is a flowchart illustrating steps of a resource status query method according to an embodiment of the present disclosure, where the method is applied to the electronic device 100 shown in fig. 1. It should be noted that, the resource status query method provided in the embodiment of the present application is not limited by the sequence shown in fig. 2 and the following, and the method includes: step S101-step S102.
Step S101: and triggering to update the one-dimensional array after the resource is updated.
Wherein each element in the one-dimensional array corresponds to a resource of the processor. As shown in FIG. 3, i [0] to i [63] each represent an element in a one-dimensional array. That is, the one-dimensional array includes 64 elements, each element corresponding to one resource in the processor.
It should be explained that a resource is defined as an arithmetic unit in a processor. For example, when the processor is a GPU, which includes 200 operation units, a one-dimensional array including 200 elements is constructed, and each element in the one-dimensional array corresponds to an operation unit in the GPU.
In addition, in the embodiment of the application, the use states of the resources are marked by different characters. Wherein the usage state includes an idle state and a busy state. Specifically, when the element includes the first character, it is characterized that the resource corresponding to the element is in an idle state, and when the element includes the second character, it is characterized that the resource corresponding to the element is in a busy state. Wherein a busy state may be understood as the resource being occupied, and an idle state may be understood as the resource being empty, or the resource being released.
The first character and the second character can be set according to requirements, and for convenience of calculation, the first character can be set to be binary 1, and the second character can be set to be binary 0.
In other embodiments, the first character may be set to binary 0, and the second character may be set to binary 1, which is not limited in this application.
And after each resource update, triggering to update the one-dimensional array. For example, if an element i [63] =1,1 in the one-dimensional array indicates an idle state, the one-dimensional array is triggered to be updated after the resource corresponding to the element i [63] is occupied, so that the element i [63] =0,0 indicates a busy state.
Step S102: and determining the resource use state of the processor based on the updated one-dimensional array.
After the updated one-dimensional array is obtained, the resource use state of the processor can be determined directly based on the characters included in each element in the one-dimensional array.
For example, if an element i [61] =1 in the updated one-dimensional array, it indicates that the resource corresponding to the element i [61] is in an idle state, and if an element i [20] =0 in the updated one-dimensional array, it indicates that the resource corresponding to the element i [20] is in a busy state.
It can be seen that, since the resources of the processor on the hardware may be occupied or released in each clock cycle, in the embodiment of the present application, the update of the one-dimensional array is triggered after the resources are updated, and the use state of each resource is marked by the character of each element in the one-dimensional array. The query of the resource usage state of the processor can be implemented in one clock cycle.
In one embodiment, the order of elements in the one-dimensional array is the same as the order of resources in the processor. Since the sequence of each element in the one-dimensional array is the same as the sequence of the resource in the processor, the use state of each resource of the processor can be directly determined based on the mapping of each element and the resource.
For example, the element i [0] in the one-dimensional array may directly correspond to the first resource (first arithmetic unit) in the processor; the element i [1] in the one-dimensional array may directly correspond to a second resource (second arithmetic unit) in the processor.
When the order of the elements in the one-dimensional array is the same as the order of the resources in the processor, the step S102 may specifically include: constructing a two-dimensional array based on the updated one-dimensional array; based on the two-dimensional array, a resource usage state of the processor is determined.
Wherein, the first row of the two-dimensional array is a one-dimensional array; the second row to the Nth row of the two-dimensional array are obtained by moving one bit in the previous row according to a preset direction; the value of N is equal to the number of elements of the one-dimensional array.
The preset direction may be rightward or leftward, and the application is not limited.
Referring to FIG. 4, FIG. 4 illustrates the expansion process from the updated one-dimensional array to the two-dimensional array. Taking fig. 4 as an example, N has a value of 64. The specific expansion process is that the first row of the two-dimensional array is the one-dimensional array updated before, then the second row to the nth row of the two-dimensional array are all obtained by performing row-cycle right shift by one bit on the previous row, for example, the element i [63] in the second row falls into the second position from left to right of the row after being shifted by one bit to the right, the element i [1] in the second row falls into the last bit after being shifted by one bit to the right, and the element i [0] in the second row is shifted to the first bit to the right. The third row of the two-dimensional array is obtained by right shifting one bit on the basis of the second row, and the like until the 64 th row is generated.
As can be seen from the example of FIG. 4, by constructing the two-dimensional array such that each row element and each column element of the two-dimensional array can represent the usage status of all resources of the processor, the position relationship between the free resources can be analyzed, and the free resources can be reasonably utilized subsequently.
In an embodiment, when the first character is set to binary 1 and the second character is set to binary 0, the process of determining the resource usage status of the processor may further include: constructing a two-dimensional statistical array based on the two-dimensional array; based on the two-dimensional statistical array, a resource usage state of the processor is determined.
Each element in the two-dimensional statistical array is obtained by performing phase and calculation on the element and the element in the same row in the previous row, and the two-dimensional statistical array is generated by performing line-by-line calculation on the two-dimensional array.
It should be noted that, the and-sum calculation means that in a given logic variable, as long as one is 0, the result of two binary number and-sums is 0; only if both are 1, the two binary numbers will either result in a 1. For example, if the phase difference between the element i [1] =1 and the element i [2] =1, the phase difference between the element i [1] and the element i [2] is 1, the phase difference between the element i [1] =1 and the element i [2] =0, the phase difference between the element i [1] and the element i [2] is 0, the phase difference between the element i [1] =0 and the element i [2] =0, and the phase difference between the element i [1] and the element i [2] is 0.
Referring to fig. 5, fig. 5 is a schematic diagram illustrating a two-dimensional statistical array. Wherein the element & i [1:0] in the second row represents the row element i [1] and the element i [0] in the same column as the previous row and is summed. The element & i [2:0] in the third row represents the phase and calculation of the row element i [2] and the element in the previous row and column, and since the phase and calculation is performed row by row, and the element in the previous row and column is the phase and calculation of the row element i [1] and the element in the previous row and column, the element & i [2:0] in the third row can be understood as the phase and calculation of the row element i [2] and the element i [1] in the previous row and column and the element i [0] in the previous row, and is omitted in the description. Correspondingly, the element & i [63] of the 64 th row represents the element phase of the row element i [63] and the previous row and the same column, and the element & i [63] of the 64 th row can also be understood as the element phase and the previous 63 elements of the same column.
It can be seen that in this way, each column in the two-dimensional statistical array may be used to indicate the number of available free resources, for example, an element with 1 appearing in the first column may indicate that resources corresponding to all previous elements are free resources. For example, & i [2:0] =1 in fig. 5, this means that all of the element i [2], the element i [1] and the element i [0] are free elements in the two-dimensional array. This is a set of contiguous free resources. Correspondingly, each row may represent the existence of resources with the same number of idle resources, for example, if four 1 s exist in the third row, it represents that four consecutive idle resources exist, and the number of each consecutive resource is three.
Therefore, by constructing the two-dimensional statistical array, all continuous idle resources in the processor can be effectively determined, so that the continuous idle resources can be reasonably utilized subsequently.
In an embodiment, the determining the resource usage status of the processor based on the two-dimensional statistical array may further include: constructing a one-dimensional statistical array based on the two-dimensional statistical array; based on the one-dimensional statistical array, a resource usage state of the processor is determined.
And the one-dimensional statistical array represents the number of continuous idle resources in each row of elements.
Illustratively, referring to FIG. 6, FIG. 6 illustrates a process from two-dimensional statistical array to one-dimensional statistical array construction. Each element of the one-dimensional statistical array corresponds to one row of the two-dimensional statistical array, and each element of the one-dimensional statistical array corresponds to the number of continuous idle resources of the row of elements.
Illustratively, if the number of 1's existing in the third row of the two-dimensional statistical array is 4, then the element [2] =4 in the one-dimensional statistical array.
And finally, sorting according to the element sequence numbers, namely sorting according to the sequence of [0] to [63] in the figure 6 to generate a one-dimensional statistical array.
Theoretically, the current maximum number of consecutive free resources contains less consecutive free resources than it.
Therefore, in the embodiment of the application, the number of the continuous idle resources can be effectively determined by constructing the one-dimensional statistical array, so that the continuous idle resources can be reasonably distributed subsequently.
In addition, after determining the resource usage state of the processor, the method further comprises: resource allocation is performed based on the resource usage status of the processor.
Finally, the processor can allocate resources according to the resource usage state. For example, a plurality of corresponding continuous resources may be determined according to the size of the processing task, which is not limited in this application.
The following describes the resource status query method by using a complete example, where the method specifically includes:
the method comprises the following steps: triggering and updating the one-dimensional array after the resource is updated; each element in the one-dimensional array corresponds to one resource of the GPU; when the element comprises binary 1, the resource corresponding to the element is characterized as an idle state, and when the element comprises binary 0, the resource corresponding to the element is characterized as a busy state.
Step two: constructing a two-dimensional array based on the updated one-dimensional array; wherein, the first line of the two-dimensional array is a one-dimensional array; the second row to the Nth row of the two-dimensional array are all obtained by moving the previous row one bit to the right; the value of N is equal to the number of elements of the one-dimensional array.
Step three: constructing a two-dimensional statistical array based on the two-dimensional array; each element in the two-dimensional statistical array is obtained by performing phase and calculation on the element and the element in the same row in the previous row, and the two-dimensional statistical array is generated by performing line-by-line calculation on the two-dimensional array.
Step four: constructing a one-dimensional statistical array based on the two-dimensional statistical array; and the one-dimensional statistical array represents the number of continuous idle resources in each row of elements.
Step five: and determining the resource use state of the GPU based on the one-dimensional statistical array.
Step six: and performing resource allocation based on the resource use state of the GPU.
Because the resources of the GPU on the hardware are occupied and released in each clock period, the process can be completed in one clock period, the randomness and the real-time property of GPU resource updating are solved, and accurate and efficient information can be provided for GPU distribution.
It should be noted that, the above steps one to six are already described in the foregoing embodiments, and the same portions may be referred to each other, which is not described herein again.
Referring to fig. 7, based on the same inventive concept, an embodiment of the present invention further provides a resource status query apparatus 200, including:
an update module 210, configured to trigger updating of the one-dimensional array after the resource is updated; wherein each element in the one-dimensional array corresponds to a resource of the processor; when the element comprises the first character, the resource corresponding to the element is represented as an idle state, and when the element comprises the second character, the resource corresponding to the element is represented as a busy state.
A resource status determining module 220, configured to determine a resource usage status of the processor based on the updated one-dimensional array.
Optionally, the order of elements in the one-dimensional array is the same as the order of resources in the processor.
Optionally, the resource status determining module 220 is further specifically configured to construct a two-dimensional array based on the updated one-dimensional array; wherein the first row of the two-dimensional array is the one-dimensional array; the second row to the Nth row of the two-dimensional array are obtained by moving one bit in the previous row according to a preset direction; the numerical value of N is equal to the number of elements of the one-dimensional array; determining a resource usage state of the processor based on the two-dimensional array.
Optionally, the first character is 1, the second character is 0, and the resource state determining module 220 is further specifically configured to construct a two-dimensional statistical array based on the two-dimensional array; each element in the two-dimensional statistical array is obtained by performing AND operation on the element and elements in the same row in the previous row, and the two-dimensional statistical array is generated by performing line-by-line calculation on the two-dimensional array; and determining the resource use state of the processor based on the two-dimensional statistical array.
Optionally, the resource status determining module 220 is further specifically configured to construct a one-dimensional statistical array based on the two-dimensional statistical array; the one-dimensional statistical array represents the number of continuous idle resources in each row of elements; and determining the resource use state of the processor based on the one-dimensional statistical array.
Optionally, the apparatus further comprises: and a resource allocation module.
And the resource allocation module is used for allocating resources based on the resource use state of the processor.
It should be noted that, as those skilled in the art can clearly understand, for convenience and simplicity of description, for a specific working process of the above-described system, apparatus and unit, reference may be made to a corresponding process in the foregoing method embodiment, and details are not repeated herein.
Based on the same inventive concept, embodiments of the present application further provide a computer program product, which includes computer program instructions, and when the computer program instructions are read and executed by a processor, the method provided by the above embodiments is performed.
Based on the same inventive concept, embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the computer program performs the methods provided in the above embodiments.
The storage medium may be any available medium that can be accessed by a computer or a data storage device including one or more integrated servers, data centers, and the like. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist alone, or two or more modules may be integrated to form an independent part.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims (10)
1. A resource state query method is characterized by comprising the following steps:
triggering and updating the one-dimensional array after the resource is updated; wherein each element in the one-dimensional array corresponds to a resource of the processor; when the element comprises a first character, representing that the resource corresponding to the element is in an idle state, and when the element comprises a second character, representing that the resource corresponding to the element is in a busy state;
determining a resource usage state of the processor based on the updated one-dimensional array.
2. The method of claim 1, wherein the order of elements in the one-dimensional array is the same as the order of resources in the processor.
3. The method of claim 2, wherein determining the resource usage state of the processor based on the updated one-dimensional array comprises:
constructing a two-dimensional array based on the updated one-dimensional array; wherein the first row of the two-dimensional array is the one-dimensional array; the second row to the Nth row of the two-dimensional array are obtained by moving one bit in the previous row according to a preset direction; the numerical value of N is equal to the number of elements of the one-dimensional array;
determining a resource usage status of the processor based on the two-dimensional array.
4. The method of claim 3, wherein the first character is 1 and the second character is 0, and wherein determining the resource usage status of the processor based on the two-dimensional array comprises:
constructing a two-dimensional statistical array based on the two-dimensional array; each element in the two-dimensional statistical array is obtained by performing phase and calculation on the element and elements in the same row in the previous row, and the two-dimensional statistical array is generated by performing line-by-line calculation on the two-dimensional array;
and determining the resource use state of the processor based on the two-dimensional statistical array.
5. The method of claim 4, wherein determining the resource usage status of the processor based on the two-dimensional statistical array comprises:
constructing a one-dimensional statistical array based on the two-dimensional statistical array; the one-dimensional statistical array represents the number of continuous idle resources in each row of elements;
and determining the resource use state of the processor based on the one-dimensional statistical array.
6. The method of any of claims 1-5, wherein after said determining the resource usage state of the processor, the method further comprises:
resource allocation is performed based on the resource usage status of the processor.
7. The method of any of claims 1-5, wherein the processor is a GPU.
8. A resource status query apparatus, comprising:
the updating module is used for triggering and updating the one-dimensional array after the resources are updated; wherein each element in the one-dimensional array corresponds to a resource of the processor; when the element comprises a first character, representing that the resource corresponding to the element is in an idle state, and when the element comprises a second character, representing that the resource corresponding to the element is in a busy state;
and the resource state determining module is used for determining the resource use state of the processor based on the updated one-dimensional array.
9. An electronic device, comprising: a processor and a memory, the processor and the memory connected;
the memory is used for storing programs;
the processor is configured to execute a program stored in the memory to perform the method of any of claims 1-7.
10. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program, when being executed by a computer, carries out the method according to any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211299449.3A CN115374188B (en) | 2022-10-24 | 2022-10-24 | Resource state query method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211299449.3A CN115374188B (en) | 2022-10-24 | 2022-10-24 | Resource state query method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115374188A true CN115374188A (en) | 2022-11-22 |
CN115374188B CN115374188B (en) | 2023-01-31 |
Family
ID=84074188
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211299449.3A Active CN115374188B (en) | 2022-10-24 | 2022-10-24 | Resource state query method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115374188B (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102413476A (en) * | 2012-01-04 | 2012-04-11 | 西安电子科技大学 | Dynamic combination and allocation method of CRB (Cognitive Resource Block) resource in cognitive LTE (Long-Term Evolution) system |
CN103559018A (en) * | 2013-10-23 | 2014-02-05 | 东软集团股份有限公司 | String matching method and system based on graphics processing unit (GPU) calculation |
US20140063027A1 (en) * | 2012-09-04 | 2014-03-06 | Massimo J. Becker | Remote gpu programming and execution method |
CN104932930A (en) * | 2015-06-15 | 2015-09-23 | 上海斐讯数据通信技术有限公司 | Method for using resource file in embedded system and system thereof |
CN108241532A (en) * | 2016-12-23 | 2018-07-03 | 北京奇虎科技有限公司 | The management distribution method of GPU resource and management distributor |
CN109152043A (en) * | 2017-06-19 | 2019-01-04 | 北京信威通信技术股份有限公司 | Internet resources concocting method, device, equipment and storage medium |
CN110942188A (en) * | 2019-11-21 | 2020-03-31 | 洪志令 | Time sequence prediction method and device based on temporal linkage mining |
CN111355642A (en) * | 2018-12-24 | 2020-06-30 | 美的集团股份有限公司 | Distributed equipment condition judgment method and system |
CN111369007A (en) * | 2020-03-02 | 2020-07-03 | 第四范式(北京)技术有限公司 | Method and device for enabling artificial intelligence model to be online |
-
2022
- 2022-10-24 CN CN202211299449.3A patent/CN115374188B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102413476A (en) * | 2012-01-04 | 2012-04-11 | 西安电子科技大学 | Dynamic combination and allocation method of CRB (Cognitive Resource Block) resource in cognitive LTE (Long-Term Evolution) system |
US20140063027A1 (en) * | 2012-09-04 | 2014-03-06 | Massimo J. Becker | Remote gpu programming and execution method |
CN103559018A (en) * | 2013-10-23 | 2014-02-05 | 东软集团股份有限公司 | String matching method and system based on graphics processing unit (GPU) calculation |
CN104932930A (en) * | 2015-06-15 | 2015-09-23 | 上海斐讯数据通信技术有限公司 | Method for using resource file in embedded system and system thereof |
CN108241532A (en) * | 2016-12-23 | 2018-07-03 | 北京奇虎科技有限公司 | The management distribution method of GPU resource and management distributor |
CN109152043A (en) * | 2017-06-19 | 2019-01-04 | 北京信威通信技术股份有限公司 | Internet resources concocting method, device, equipment and storage medium |
CN111355642A (en) * | 2018-12-24 | 2020-06-30 | 美的集团股份有限公司 | Distributed equipment condition judgment method and system |
CN110942188A (en) * | 2019-11-21 | 2020-03-31 | 洪志令 | Time sequence prediction method and device based on temporal linkage mining |
CN111369007A (en) * | 2020-03-02 | 2020-07-03 | 第四范式(北京)技术有限公司 | Method and device for enabling artificial intelligence model to be online |
Non-Patent Citations (2)
Title |
---|
CONG GUO 等: "Balancing Efficiency and Flexibility for DNN Acceleration via Temporal GPU-Systolic Array Integration", 《2020 57TH ACM/IEEE DESIGN AUTOMATION CONFERENCE (DAC)》 * |
董莹莹 等: "基于GPU的虚拟植物生长的双尺度自动机模型实现方法", 《农 业 工 程 学 报》 * |
Also Published As
Publication number | Publication date |
---|---|
CN115374188B (en) | 2023-01-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109840142B (en) | Thread control method and device based on cloud monitoring, electronic equipment and storage medium | |
US7996570B1 (en) | Usage of keyboard driver in extensible firmware interface for adding new hot keys at firmware level | |
CN111767143A (en) | Transaction data processing method, device, equipment and system | |
CN110633296A (en) | Data query method, device, medium and electronic equipment | |
CN108334408B (en) | Code execution method and device, terminal equipment and computer readable storage medium | |
JP6446125B2 (en) | Resource leak detection method, apparatus and system | |
CN112667405B (en) | Information processing method, device, equipment and storage medium | |
CN109885786A (en) | Data buffer storage processing method, device, electronic equipment and readable storage medium storing program for executing | |
CN110597865A (en) | Method and device for processing user label, computing equipment and storage medium | |
CN110597879B (en) | Method and device for processing time series data | |
CN115374188B (en) | Resource state query method and device, electronic equipment and storage medium | |
US10061676B2 (en) | Remotely located timing method and device for a processing unit in an information processing system | |
KR20160037737A (en) | Scheduler computing device, data node of distributed computing system having the same, and method thereof | |
CN117540668A (en) | Simulation method and device for digital circuit | |
CN115904740A (en) | GPU resource calling method and system | |
CN113031947B (en) | Configuration data management method and device used in interface design tool | |
CN114466012A (en) | Content initialization method, device, electronic equipment and storage medium | |
CN113760237A (en) | Compiling address updating method and device, terminal equipment and readable storage medium | |
CN108733678B (en) | Data searching method, device and related equipment | |
CN115220910B (en) | Resource scheduling method, device and equipment | |
CN113641479A (en) | Program operation control method, terminal device, and computer-readable storage medium | |
CN111782482B (en) | Interface pressure testing method and related equipment | |
CN113220456B (en) | Bill data processing method and related device | |
CN109408225B (en) | Resource capacity expansion method, device, computer equipment and storage medium | |
CN113935279A (en) | Path-based optical simulation device activation method and device and terminal equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |