CN115374188B - 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 PDF

Info

Publication number
CN115374188B
CN115374188B CN202211299449.3A CN202211299449A CN115374188B CN 115374188 B CN115374188 B CN 115374188B CN 202211299449 A CN202211299449 A CN 202211299449A CN 115374188 B CN115374188 B CN 115374188B
Authority
CN
China
Prior art keywords
resource
array
dimensional
dimensional array
processor
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.)
Active
Application number
CN202211299449.3A
Other languages
Chinese (zh)
Other versions
CN115374188A (en
Inventor
请求不公布姓名
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Muxi Technology Chengdu Co ltd
Original Assignee
Muxi Technology Chengdu Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Muxi Technology Chengdu Co ltd filed Critical Muxi Technology Chengdu Co ltd
Priority to CN202211299449.3A priority Critical patent/CN115374188B/en
Publication of CN115374188A publication Critical patent/CN115374188A/en
Application granted granted Critical
Publication of CN115374188B publication Critical patent/CN115374188B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2474Sequence data queries, e.g. querying versioned data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE 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/00Energy 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 resource is updated, and the using state of each resource is marked through the characters of each element in the one-dimensional array.

Description

Resource state query method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of hardware resource query technologies, and in particular, to a resource status query method and apparatus, an electronic device, and a 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 the 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; each element in the one-dimensional array corresponds to one 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 determining the resource use 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 application, the one-dimensional array is triggered and updated 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 implementations, 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 state 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 resource is updated; each element in the one-dimensional array corresponds to one 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.
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
In order 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, for example, 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 application, 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 order, 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 computing units, a one-dimensional array including 200 elements is constructed, and each element in the one-dimensional array corresponds to one computing 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.
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, after the resource corresponding to the element i [63] is occupied, the one-dimensional array is triggered to be updated, 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.
Therefore, in the embodiment of the application, after the resources are updated, the one-dimensional array is triggered to be updated, and the use state of each resource is marked by the characters 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 each element in the one-dimensional array is the same as the resource order 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; and determining the resource use state of the processor based on the two-dimensional statistical 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.
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] in the second row represents the summation of the element i [1] of the row and the element i [0] of the same column of the previous row. The element & i [2] in the third row represents the element phase of the row element i [2] and the previous row and column, and since it is calculated row by row, and the element of the previous row and column is the element phase of the row element i [1] and the previous row and column, the element & i [2] in the third row can be understood as the element phase of the row element i [2] and the previous row and column, i [1] and the previous row and column, i [0], and is omitted in the description herein. Correspondingly, the element & i [63] of the 64 th row means that the element i [63] of the row is summed with the element of the previous row in the same column, and the element & i [63] of the 64 th row is also understood to be summed with the first 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, in fig. 5, & i [2] =1, this means that the element i [2], the element i [1], and the element i [0] are all free elements in the two-dimensional array. This is a contiguous set of free resources. Accordingly, 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 indicates 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; and determining the resource use state of the processor based on the one-dimensional statistical array.
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 row 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 application further provides a resource status query apparatus 200, including:
an update module 210, configured to trigger an update of the one-dimensional array after the resource is updated; each element in the one-dimensional array corresponds to one 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 status 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 brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
Based on the same inventive concept, the present application further provides 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 foregoing embodiment 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.
Furthermore, the functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, 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 (8)

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; each element in the one-dimensional array corresponds to one 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;
wherein the determining a 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;
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.
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 1, 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.
4. The method of any of claims 1-3, 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.
5. The method of any of claims 1-3, wherein the processor is a GPU.
6. A resource status query apparatus, comprising:
the updating module is used for 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 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;
a resource state determination module, configured to determine a resource usage state of the processor based on the updated one-dimensional array;
the resource state determining module is 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; 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.
7. 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-5.
8. A computer-readable storage medium, on which a computer program is stored which, when executed by a computer, performs the method of any one of claims 1-5.
CN202211299449.3A 2022-10-24 2022-10-24 Resource state query method and device, electronic equipment and storage medium Active CN115374188B (en)

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 CN115374188A (en) 2022-11-22
CN115374188B true 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 (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102413476B (en) * 2012-01-04 2014-04-02 西安电子科技大学 Dynamic combination and allocation method of CRB (Cognitive Resource Block) resource in cognitive LTE (Long-Term Evolution) system
US9019286B2 (en) * 2012-09-04 2015-04-28 Massimo J. Becker Remote GPU programming and execution method
CN103559018B (en) * 2013-10-23 2016-05-04 东软集团股份有限公司 Character string matching method and the system calculated based on GPU
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
CN111355642B (en) * 2018-12-24 2021-04-16 美的集团股份有限公司 Distributed equipment condition judgment method and system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Also Published As

Publication number Publication date
CN115374188A (en) 2022-11-22

Similar Documents

Publication Publication Date Title
CN111767143A (en) Transaction data processing method, device, equipment and system
CN108334408B (en) Code execution method and device, terminal equipment and computer readable storage medium
JP6446125B2 (en) Resource leak detection method, apparatus and system
CN110597865A (en) Method and device for processing user label, computing equipment and storage medium
CN112667405B (en) Information processing method, device, 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
CN115905040B (en) Counter processing method, graphics processor, device and storage medium
CN112199404A (en) Report creating method and device, electronic equipment and computer readable storage medium
CN111427887A (en) Method, device and system for rapidly scanning HBase partition table
CN114466012B (en) Content initialization method, device, electronic equipment and storage medium
CN115904740A (en) GPU resource calling method and system
CN114238157A (en) Device and method for acquiring workload certification, electronic equipment and storage medium
CN114860460A (en) Database acceleration method and device and computer equipment
CN108733678B (en) Data searching method, device and related equipment
CN113641479A (en) Program operation control method, terminal device, and computer-readable storage medium
CN115220910B (en) Resource scheduling method, device and equipment
CN111858542B (en) Data processing method, device, equipment and computer readable storage medium
CN111782482B (en) Interface pressure testing method and related equipment
CN113448958B (en) Data processing method and device, electronic equipment and storage medium
CN113392110A (en) Data processing method and device, electronic equipment and storage medium
JP2018165956A (en) Information processing device, information processing system, and information processing program
JP2018120323A (en) Information processing system, information processing apparatus, peripheral device, data transfer method and data transfer program
CN113935279A (en) Path-based optical simulation device activation method and device and terminal equipment
CN115016848A (en) Instruction processing method, device, chip, board card, equipment and medium

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