Resource scheduling method, device, equipment and storage medium
By determining the number of CPUs of the child nodes in the terminal device according to the resource utilization rate in parallel operation operators, the problem of low processing efficiency caused by serial operation of neural networks is solved, and more efficient CPU utilization and neural network operation efficiency are achieved.
Patent Information
- Application Number
- CN202111333756.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-11
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2041-11-11
AI Technical Summary
In the prior art, although the method of neural networks in serial running child nodes in terminal devices reduces the CPU operation pressure, it reduces the processing efficiency of neural networks.
The resource utilization rate of the terminal device is obtained through the resource scheduling device. When the resource utilization rate is lower than a certain threshold, the number of CPUs of each child node is determined and the respective operators are run in parallel to improve the processing efficiency of the neural network.
While rationally utilizing the CPU of the terminal device, the parallel operation method is adopted, which significantly improves the operation efficiency of the neural network, and is significantly improved compared with the serial method.
Smart Images

Figure CN114153597B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of neural network technology, and in particular to a resource scheduling method, device, equipment and storage medium. Background Art
[0002] A parent node of a neural network is usually connected to multiple child nodes. Each child node can include one or more operators. When the terminal device runs the multiple child nodes, it generally uses a serial method. For example, a parent node has two child nodes, namely child node 1 and child node 2. The terminal device first runs child node 1, and then runs child node 2 after running child node 1.
[0003] However, the terminal device is generally provided with multiple central processing units (CPUs). The terminal device runs the multiple sub-nodes in a serial manner, which can reduce the operating pressure of the CPU, but may reduce the processing efficiency of the neural network. Summary of the invention
[0004] The present disclosure provides a resource scheduling method, apparatus, device and storage medium, which can improve the processing efficiency of a neural network.
[0005] The technical solution of the embodiment of the present disclosure is as follows:
[0006] According to a first aspect of an embodiment of the present disclosure, a resource scheduling method is provided, which may include: a resource scheduling device obtains resource utilization of a terminal device; when the resource utilization of the terminal device is less than a first threshold, determines the number of CPUs configured for each of a plurality of child nodes of a parent node in a neural network; wherein the neural network is run in the terminal device; the resource scheduling device runs the plurality of child nodes in parallel, wherein each child node uses the CPU configured for the child node to run an operator in the child node.
[0007] Optionally, the above-mentioned "determining the number of CPUs configured for each of the multiple child nodes of the parent node in the neural network" may specifically include: determining the single-threaded running time of each of the multiple child nodes of the parent node of the neural network; determining the number of CPUs configured for each child node based on the single-threaded running time of each child node and the total number of CPUs and resource utilization of the terminal device.
[0008] Optionally, the number of CPUs configured for each child node satisfies a preset formula, which is M*(1-N)*t / T, where M represents the total number of CPUs of the terminal device, N represents the resource utilization of the terminal device, t represents the single-threaded running time of the child node, and T represents the sum of the single-threaded running time of multiple child nodes.
[0009] Optionally, the method also includes: when the resource utilization of the terminal device is greater than a second threshold and less than a first threshold, the resource scheduling device uses a first preset number of CPUs to process each child node in the parent node, the first preset number is less than the total number of CPUs of the terminal device, and the second threshold is less than the first threshold.
[0010] Optionally, the above-mentioned "determining the single-threaded running time of each child node among multiple child nodes of the parent node of the neural network" may specifically include: obtaining the computing amount of one or more operators of each child node; determining the single-threaded running time of the corresponding child node based on the computing amount of one or more operators and the resources of the terminal device.
[0011] Optionally, the method may further include: when the resource utilization of the terminal device is greater than or equal to a first threshold, the resource scheduling device uses a second preset number of CPUs to run each operator in multiple sub-nodes in sequence, and the second preset number is less than the first preset number.
[0012] According to a second aspect of an embodiment of the present disclosure, a resource scheduling device is provided, which may include: an acquisition unit, a determination unit, and a processing unit; the acquisition unit is used to acquire the resource utilization of a terminal device; the determination unit is used to determine the number of CPUs configured for each of a plurality of child nodes of a parent node in a neural network when the resource utilization of the terminal device is less than a first threshold; the neural network is actually running in the terminal device; the processing unit is further used to use the CPU configured for each child node to run each operator in the corresponding child node in parallel.
[0013] Optionally, the determination unit is specifically used to determine the single-threaded running time of each child node among multiple child nodes of the parent node of the neural network; determine the number of CPUs configured for each child node based on the single-threaded running time of each child node and the total number of CPUs and resource utilization of the found device.
[0014] Optionally, the number of CPUs configured for each child node satisfies a preset formula, which is M*(1-N)*t / T, where M represents the total number of CPUs of the terminal device, N represents the resource utilization of the terminal device, t represents the single-threaded running time of the child node, and T represents the sum of the single-threaded running time of multiple child nodes.
[0015] Optionally, the processing unit is specifically used to use a first preset number of CPUs to process each child node in the parent node when the resource utilization of the terminal device is greater than a second threshold and less than a first threshold, the first preset number is less than the total number of CPUs of the terminal device, and the second threshold is less than the first threshold.
[0016] Optionally, the processing unit is specifically used to: obtain the computing amount of one or more operators of each child node; determine the single-threaded running time of the corresponding child node according to the computing amount of one or more operators and the resources of the found device.
[0017] According to a third aspect of an embodiment of the present disclosure, a computing device is provided, which may include: a processor and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement any one of the optional resource scheduling methods in the above-mentioned first aspect.
[0018] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which instructions are stored. When the instructions in the computer-readable storage medium are executed by a processor of a computing device, the computing device is enabled to execute any one of the optional resource scheduling methods in the above-mentioned first aspect.
[0019] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, which includes computer instructions. When the computer instructions are executed on a computing device, the computing device executes the resource scheduling method as described in any optional implementation of the first aspect.
[0020] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure.
[0021] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0022] Based on any of the above aspects, in the present disclosure, the resource scheduling device can determine the number of CPUs configured for each child node of the parent node of the neural network when the resource utilization rate of the currently found device is low, and use the CPU configured for each child node to run the operators of the corresponding child nodes in parallel. In this way, compared with the serial method in the prior art to run the operator of each child node in sequence, the present application can adopt a parallel operation method, which can improve the operation efficiency of the neural network while reasonably utilizing the CPU of the terminal device. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0024] Figure 1 A schematic diagram of the structure of a parent node of a neural network provided by an embodiment of the present disclosure is shown;
[0025] Figure 2 A schematic diagram of the structure of a communication system provided by an embodiment of the present disclosure is shown;
[0026] Figure 3 A schematic diagram of a process of a resource scheduling method provided by an embodiment of the present disclosure is shown;
[0027] Figure 4 A schematic diagram showing a flow chart of another resource scheduling method provided by an embodiment of the present disclosure;
[0028] Figure 5 A schematic diagram showing a flow chart of another resource scheduling method provided by an embodiment of the present disclosure;
[0029] Figure 6 A schematic diagram showing a flow chart of another resource scheduling method provided by an embodiment of the present disclosure;
[0030] Figure 7 A schematic diagram showing a flow chart of another resource scheduling method provided by an embodiment of the present disclosure;
[0031] Figure 8 A schematic diagram of the structure of a resource scheduling device provided by an embodiment of the present disclosure is shown;
[0032] Fig. 9 A schematic diagram of the structure of another resource scheduling device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0033] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0034] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0035] It should also be understood that the term “comprising” indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements and / or components.
[0036] The data involved in the present disclosure may be data authorized by the user or fully authorized by all parties.
[0037] As described in the background technology, when the neural network runs in the terminal device, the terminal device usually runs the operator of each child node of the parent node in sequence in a serial manner. Although the serial method can reduce the operating pressure of the CPU, it reduces the processing efficiency of the neural network to a certain extent. Among them, the neural network can include multiple parent nodes, each parent node can include one or more child nodes. The child node can also be called a subgraph. Each child node can include one or more operators.
[0038] In a neural network, an operator is a mapping from a function space to a function space. In a broad sense, any operation on a function can be considered an operator. In short, an operator can be a mapping, a relationship, or a transformation. The deep learning framework needs to concretize the deep learning task expressed by the computational graph structure of the neural network mapping into instructions and data that can be executed on the CPU. In this process, the deep learning framework uses operators as specific elements to implement computing tasks, and provides a kernel function for each operator to be executed on the CPU. According to the computational graph, the deep learning framework schedules the execution of the kernel function corresponding to each operator in the computational graph to complete the calculation of the entire neural network.
[0039] For example, Figure 1 As shown, a parent node (node A) may include two child nodes (such as child node 1 and child node 2). Child node 1 may include three operators, namely operator B, operator C, and operator D. Child node 2 may include two operators, namely operator E and operator F. Child node 1 and child node 2 may be connected to operator G respectively. Alternatively, operator G may also be used as an operator in child node 1 or child node 2.
[0040] In view of this, the present disclosure provides a resource scheduling method, which includes: a resource scheduling device obtains resource utilization of a terminal device; when the resource utilization of the terminal device is lower than a first threshold, the resource scheduling device determines the number of CPUs configured for each child node of a parent node of a neural network; the resource scheduling device uses the CPUs configured for each child node to run the operators of the corresponding child nodes in parallel.
[0041] The resource scheduling method provided by the embodiment of the present disclosure is exemplarily described below with reference to the accompanying drawings:
[0042] Figure 2 A communication system schematic diagram provided in an embodiment of the present disclosure is shown in FIG. Figure 2 As shown, the communication system may include: a server 110 and a terminal device 120. The server 110 may establish a connection with the terminal device 120 via a wired network or a wireless network.
[0043] The server 110 may be used to send a computing task to the terminal device 120. For example, the computing task may include one or more neural networks.
[0044] In some embodiments, the server may be a single server, or a server cluster composed of multiple servers (or micro servers). In some implementations, the server cluster may also be a distributed cluster. The present disclosure does not limit the specific implementation of the server 110.
[0045] The terminal device 120 can be used to run a neural network. For example, the terminal device 120 can include multiple CPUs. The terminal device 120 can use the multiple CPUs to run a neural network.
[0046] In some embodiments, the terminal device may be a mobile phone, tablet computer, desktop, laptop, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, cellular phone, personal digital assistant (PDA), augmented reality (AR)\virtual reality (VR) device, etc., which can install and use content community applications (such as Kuaishou), and the present disclosure does not impose any special restrictions on the specific form of the terminal. It can interact with the user through one or more methods such as keyboard, touchpad, touch screen, remote control, voice interaction or handwriting device.
[0047] Optionally, the above Figure 2 In the communication system shown, the server 110 may be connected to at least one terminal device 120. The present disclosure does not limit the number and type of the terminal devices 120.
[0048] The resource scheduling method provided in the embodiment of the present disclosure can be applied to the aforementioned Figure 2 The terminal equipment shown.
[0049] It should be noted that the execution subject of the resource scheduling method provided in the present disclosure is a resource scheduling device. The resource scheduling device can be a terminal device, or a chip or system on chip in the terminal device, etc., without limitation.
[0050] like Figure 3 As shown, the resource scheduling method provided by the embodiment of the present disclosure may include:
[0051] S301. The resource scheduling device obtains resource utilization of the terminal device.
[0052] Among them, the resource scheduling device can be Figure 2The terminal device 120 in the embodiment may also be a device in the terminal device 120, for example, a chip of the terminal device 120. The terminal device may be Figure 2 The terminal device 120 in the embodiment of the present invention can be used to run a neural network.
[0053] The resource utilization of the terminal device can reflect the load of the terminal device. The higher the resource utilization, the greater the load of the terminal device; the lower the resource utilization, the smaller the load of the terminal device. For example, the resource utilization of the terminal device can be the CPU utilization of the terminal device, or the memory utilization of the terminal device, etc., without limitation.
[0054] In one example, the resource scheduling apparatus may periodically obtain the resource utilization of the terminal device, or the resource scheduling apparatus may obtain the resource utilization of the terminal device in response to the operation of downloading the neural network of the terminal device.
[0055] S302: When the resource utilization rate of the terminal device is less than a first threshold, the resource scheduling device determines the number of CPUs configured for multiple child nodes of the parent node in the neural network.
[0056] The neural network is run in the terminal device. The first threshold can be set as required, for example, 70%, without limitation.
[0057] The CPU configured in the subnode can be used to run the operator in the subnode.
[0058] In one example, the resource scheduling device may allocate the CPU of the terminal device to each sub-node according to the computing amount of each sub-node. Specifically, a detailed description will be given later. No further description will be given here.
[0059] S303: The resource scheduling device runs multiple sub-nodes in parallel.
[0060] Each subnode uses the CPU configured for the subnode to run the operator in the subnode. Parallel operation may refer to the resource scheduling device running simultaneously, that is, the resource scheduling device may use the CPU configured for each subnode to run the operator of the corresponding subnode at the same time. For example, in combination Figure 1 , the resource scheduling device configures CPU1, CPU2, and CPU3 for subnode 1, and CPU4 and CPU5 for subnode 2. The resource scheduling device can use CPU1, CPU2, and CPU3 to run each operator of subnode 1, while using CPU3 and CPU4 to run each operator of subnode 2.
[0061] The technical solution provided by the above embodiment brings at least the following beneficial effects: From S201-S203, it can be known that the resource scheduling device can determine the number of CPUs configured for each child node of the parent node of the neural network when the resource utilization rate of the currently found device is low, and use the CPU configured for each child node to run the operators of the corresponding child nodes in parallel. In this way, compared with the serial method in the prior art to run the operator of each child node in sequence, the parallel operation method can be adopted in this application, which can improve the operation efficiency of the neural network while reasonably utilizing the CPU of the terminal device.
[0062] In one embodiment, in combination Figure 3 ,like Figure 4 As shown, in the above S302, the method in which the resource scheduling device determines the number of CPUs configured for each of the multiple child nodes of the parent node in the neural network may specifically include S401 and S402.
[0063] S401. A resource scheduling device determines a single-threaded running time of each of a plurality of child nodes of a parent node of a neural network.
[0064] The single-threaded running time of a child node may refer to the sum of the running times of all operators of the child node. Figure 1 , the single-threaded running time of child node 1 may be the sum of the running times of operator B, operator C, and operator D. The running time of each operator may refer to the time it takes for the terminal device to run the operator using a preset number of CPUs.
[0065] S402: The resource scheduling device determines the CPU configured for each sub-node according to the single-threaded running time of each sub-node and the total number of CPUs and resource utilization of the terminal device.
[0066] The technical solution provided by the above embodiments brings at least the following beneficial effects: It can be seen from S401 and S402 that the resource scheduling device can determine the total number of CPUs configured for the sub-nodes based on multiple dimensions such as the single-threaded running time of the sub-nodes, the total number of CPUs of the terminal device, and resource utilization, which is comprehensive and accurate.
[0067] In one embodiment, the number of CPUs configured in each sub-node may satisfy a preset formula, the parameters of which may include the single-threaded running time of the sub-node, the total number of CPUs of the terminal device, and the resource utilization of the terminal device.
[0068] In one example, the preset formula may be M*(1-N)*t / T, where M represents the total number of CPUs of the terminal device, N represents the resource utilization of the terminal device, t represents the single-threaded running time of the child node, and T represents the sum of the single-threaded running time of multiple child nodes.
[0069] For example, if the total number of CPUs in the terminal device is 8, the parent node is Figure 1 For example, in node A, the single-threaded running time of subnode 1 is 50 seconds, the single-threaded running time of subnode 2 is 60 seconds, and the current resource utilization rate of the terminal device is 70%. The number of CPUs configured for subnode 1 is 8*(1-70%)*50 / 110≈1, and the number of CPUs configured for subnode 2 is 8*(1-70%)*60 / 110≈1. That is, the terminal device can use one CPU each to run each operator of subnode 1 and subnode 2 in parallel. The CPUs used by the terminal device can be the two CPUs with the smallest amount of computing among the multiple CPUs of the terminal device.
[0070] The technical solution provided by the above embodiment brings at least the following beneficial effects: It can be seen from the above technical solution that the terminal device can directly determine the number of CPUs configured for each sub-node according to a preset formula, which is simple and convenient.
[0071] In one embodiment, in combination Figure 3 ,like Figure 5 As shown, the method may further include S501.
[0072] S501: When the resource utilization rate of the terminal device is greater than the second threshold and less than the first threshold, the resource scheduling apparatus uses a first preset number of CPUs to process each child node in the parent node.
[0073] The first preset number is less than the total number of CPUs of the terminal device. The second threshold is less than the first threshold. The first preset number and the second threshold can be set as needed. For example, when the number of CPUs of the terminal device is 8 and the first threshold is 70%, the first preset number can be 6 and the second threshold can be 50%. That is, in the above preset formula, the total number of CPUs of the terminal device can be replaced by the first preset number.
[0074] In one example, if the resource utilization of the terminal device increases from 40% to 60%, that is, the resource utilization of the terminal device increases, then the resource scheduling device can reduce the number of CPUs configured for each node. Specifically, the terminal device can use the above preset formula to determine the number of CPUs configured for each subnode again.
[0075] The technical solution provided by the above embodiment brings at least the following beneficial effects: As can be seen from S501, the resource scheduling device can reduce the number of CPUs configured for each sub-node when the resource utilization of the terminal device increases, so as to reduce the computing pressure of the CPU of the terminal device.
[0076] In one embodiment, in combination Figure 4 ,like Figure 6As shown, in the above S401, the method in which the resource scheduling device determines the single-threaded running time of each of the multiple child nodes of the parent node of the neural network may specifically include S601 and S602.
[0077] S601: The resource scheduling device obtains the computational load of one or more operators of each child node.
[0078] The computational amount of an operator can reflect the size of the operator's computational data. For example, an operator corresponds to a kernel function, and the running amount of the kernel function can be the computational amount of the operator. For example, the computational amount of an operator can be the number of floating point operations per second (FLOPS).
[0079] S602: The resource scheduling device determines the single-threaded running time of the corresponding sub-node according to the computational load of the one or more operators and the resources of the terminal device.
[0080] The resources of the terminal device may be used to run the one or more operators. For example, the resources of the terminal device may include a CPU used to run the multiple sub-nodes.
[0081] In one example, the terminal device may use the ratio between the terminal device resources and the sum of the computational workload of one or more operators of the child node as the single-threaded running time of the child node.
[0082] In another example, the terminal device may use the ratio of the sum of the computational amounts of operators of multiple sub-nodes as the ratio of the single-threaded running time of the multiple sub-nodes. Figure 1 In the formula, the sum of the computational load of operators of child node 1 is the computational load of operator B + the computational load of operator C + the computational load of operator D, and the sum of the computational load of operators of child node 2 is the computational load of operator E + the computational load of operator F. That is, the ratio of the single-threaded running time of child node 1 and child node 2 is (the sum of the computational load of operators is the computational load of operator B + the computational load of operator C + the computational load of operator D) / (the sum of the computational load of operators is the computational load of operator B + the computational load of operator C + the computational load of operator D). At this time, in the above preset formula, the running time of the child node can be replaced by the computational load of the operator of the child node.
[0083] The technical solution provided by the above embodiment brings at least the following beneficial effects: As can be seen from S601 and S602, the resource scheduling device can determine the single-threaded running time of the subnode according to the computing amount of one or more operators of each subnode and the resources of the terminal device. Since the computing amount of the operator of each subnode and the resources of the terminal device are known, the terminal device can quickly and accurately determine the single-threaded running time of the subnode.
[0084] In one embodiment, in combination Figure 6 ,like Figure 7 As shown, the method may also include:
[0085] S701: When the resource utilization rate of the terminal device is greater than or equal to a first threshold, the resource scheduling apparatus uses a second preset number of CPUs to sequentially run each operator in a plurality of subnodes.
[0086] The second preset number is smaller than the first preset number. The size of the second preset number can be set as needed. For example, when the first preset number is 6, the second preset number can be 4 without limitation.
[0087] The technical solution provided by the above embodiment brings at least the following beneficial effects: It can be seen from S701 that when the resource load of the terminal device is high, the terminal device can still use a serial method to run each sub-node in sequence, which reduces the pressure on the CPU and can also include the operation of the neural network.
[0088] It can be understood that in actual implementation, the resource scheduling device described in the embodiment of the present disclosure may include one or more hardware structures and / or software modules for implementing the aforementioned corresponding resource scheduling method, and these execution hardware structures and / or software modules may constitute an electronic device. Those skilled in the art should easily realize that, in combination with the algorithm steps of each example described in the embodiment disclosed herein, the present disclosure can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present disclosure.
[0089] Based on such understanding, the embodiments of the present disclosure also provide a resource scheduling device. Figure 8 FIG. 1 shows a schematic diagram of the structure of a resource scheduling device provided by an embodiment of the present disclosure. Figure 8 As shown, the resource scheduling device may include: an acquisition unit 801, a determination unit 802, and a processing unit 803.
[0090] The acquisition unit 801 is used to acquire the resource utilization of the terminal device; the determination unit 802 is used to determine the number of CPUs configured for multiple child nodes of the parent node in the neural network when the resource utilization is less than the first threshold; the processing unit 803 is used to run the multiple child nodes in parallel, wherein each child node uses the CPU configured for the child node to run the operator in the child node. For example, combined with Figure 3 , the processing unit 803 is used to execute S303.
[0091] Optionally, the determination unit 802 is specifically used to: determine the single-threaded running time of each child node among multiple child nodes of the parent node of the neural network; determine the number of CPUs configured for each child node based on the single-threaded running time of each child node and the total number of CPUs and resource utilization of the found device.
[0092] Optionally, determine the single-threaded running time of each of the multiple child nodes of the parent node of the neural network; determine the number of CPUs configured for each child node based on the single-threaded running time of each child node and the total number of CPUs and resource utilization of the found device.
[0093] Optionally, the processing unit 803 is specifically used to: when the resource utilization of the terminal device is greater than a second threshold and less than a first threshold, use a first preset number of CPUs to process each child node in the parent node, the first preset number is less than the total number of CPUs of the terminal device, and the second threshold is less than the first threshold.
[0094] Optionally, the processing unit 803 is specifically used to: obtain the computing amount of one or more operators of each child node; and determine the single-threaded running time of the corresponding child node according to the computing amount of one or more operators and the resources of the found device.
[0095] As described above, the embodiment of the present disclosure can divide the resource scheduling device into functional modules according to the above method example. Among them, the above integrated modules can be implemented in the form of hardware or in the form of software functional modules. In addition, it should be noted that the division of modules in the embodiment of the present disclosure is schematic and is only a logical function division. There may be other division methods in actual implementation. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module.
[0096] Regarding the resource scheduling device in the above embodiment, the specific manner in which each module performs operations and the beneficial effects possessed have been described in detail in the above method embodiment and will not be repeated here.
[0097] The disclosed embodiment also provides a resource scheduling device. Fig. 9 The schematic diagram of the structure of the resource scheduling device provided by the embodiment of the present disclosure is shown. The resource scheduling device may include at least one processor 91, a communication bus 92, a memory 93 and at least one communication interface 94.
[0098] Processor 91 may be a processor (central processing unit, CPU), microprocessor unit, ASIC, or one or more integrated circuits for controlling the execution of the program of the disclosed solution. Fig. 9The function implemented by the determination unit 802 in the resource scheduling device is similar to Fig. 9 The functions implemented by processor 91 in are the same.
[0099] Communications bus 92 may include a pathway for transmitting information between the above-described components.
[0100] The communication interface 94 uses any transceiver or other device for communicating with other devices or communication networks, such as servers, Ethernet, radio access networks (RAN), wireless local area networks (WLAN), etc. As an example, in combination with Figure 8 The function implemented by the acquisition unit 801 in the resource scheduling device is similar to Fig. 9 The communication interface 94 in FIG.
[0101] The memory 93 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processing unit through a bus. The memory may also be integrated with the processing unit.
[0102] The memory 93 is used to store application code for executing the solution of the present disclosure, and the execution is controlled by the processor 91. The processor 91 is used to execute the application code stored in the memory 93, so as to realize the functions in the method of the present disclosure.
[0103] In a specific implementation, as an embodiment, the processor 91 may include one or more CPUs, such as Fig. 9 CPU0 and CPU1 in.
[0104] In a specific implementation, as an embodiment, the terminal may include multiple processors, such as Fig. 991 and processor 95 in the embodiment of the present invention. Each of these processors can be a single-CPU processor or a multi-CPU processor. The processor here can refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0105] In a specific implementation, as an embodiment, the resource scheduling device may further include an input device 96 and an output device 97. The input device 96 communicates with the output device 97 and may accept user input in a variety of ways. For example, the input device 96 may be a mouse, a keyboard, a touch screen device, or a sensor device. The output device 97 communicates with the processor 91 and may display information in a variety of ways. For example, the output device 91 may be a liquid crystal display (LCD), a light emitting diode (LED) display device, or the like.
[0106] Those skilled in the art will understand that Fig. 9 The structure shown in the figure does not constitute a limitation on the resource scheduling device, and may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0107] The present disclosure also provides a computer-readable storage medium including instructions, and the computer-readable storage medium stores instructions. When the instructions in the computer-readable storage medium are executed by the processor of a computer device, the computer can execute the resource scheduling method provided in the above-mentioned embodiment. For example, the computer-readable storage medium may be a memory 93 including instructions, and the above instructions may be executed by the processor 91 of the resource scheduling device to complete the above method. For another example, the computer-readable storage medium may be a memory 93 including instructions, and the above instructions may be executed by the processor 91 of the server to complete the above method. Optionally, the computer-readable storage medium may be a non-temporary computer-readable storage medium, for example, the non-temporary computer-readable storage medium may be a ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
[0108] The present disclosure also provides a computer program product, which includes computer instructions. When the computer instructions are executed on a resource scheduling device, the resource scheduling device executes the above Figure 3-Figure 7 A resource scheduling method as shown in any one of the accompanying drawings.
[0109] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0110] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A resource scheduling method, characterized in that: The method comprises: Obtain resource utilization of terminal devices; When the resource utilization rate of the terminal device is less than the first threshold, the number of central processing units (CPUs) configured for each of the multiple child nodes of the parent node in the neural network is determined; the neural network is run in the terminal device; wherein the determination of the number of CPUs configured for each of the multiple child nodes of the parent node in the neural network comprises: determining the single-threaded running time of each of the multiple child nodes of the parent node of the neural network; determining the number of CPUs configured for each child node according to the single-threaded running time of each child node and the total number of CPUs and resource utilization rate of the terminal device; When the resource utilization of the terminal device is greater than a second threshold and less than the first threshold, use a first preset number of CPUs to process each child node in the parent node, the first preset number is less than the total number of CPUs of the terminal device, and the second threshold is less than the first threshold; run the multiple child nodes in parallel, wherein each child node uses the CPU configured for the child node to run the operator in the child node.
2. The method according to claim 1, characterized in that The number of CPUs configured for each subnode satisfies a preset formula, which is M*(1-N)*t / T, wherein M represents the total number of CPUs of the terminal device, N represents the resource utilization of the terminal device, t represents the single-threaded running time of the subnode, and T represents the sum of the single-threaded running time of multiple subnodes.
3. The method according to claim 1, characterized in that The determining of the single-threaded running time of each of the plurality of child nodes of the parent node of the neural network comprises: Get the computational amount of one or more operators of each child node; The single-threaded running time of the corresponding sub-node is determined according to the computation amount of the one or more operators and the resources of the terminal device.
4. The method according to claim 1, characterized in that: The method further comprises: When the resource utilization of the terminal device is greater than or equal to the first threshold, a second preset number of CPUs is used to sequentially run each operator in the multiple subnodes, and the second preset number is smaller than the first preset number.
5. A resource scheduling device, characterized in that: The device comprises an acquisition unit, a determination unit and a processing unit; The acquisition unit is used to acquire the resource utilization rate of the terminal device; The determining unit is used to determine the number of CPUs configured for each of the multiple child nodes of the parent node in the neural network when the resource utilization rate of the terminal device is less than a first threshold; the neural network is run in the terminal device; the determining unit is specifically used to determine the single-threaded running time of each of the multiple child nodes of the parent node of the neural network; the number of CPUs configured for each child node is determined according to the single-threaded running time of each child node and the total number of CPUs and resource utilization rate of the terminal device; The processing unit is further configured to: when the resource utilization rate of the terminal device is greater than a second threshold and less than the first threshold, use a first preset number of CPUs to process each child node in the parent node, the first preset number is less than the total number of CPUs of the terminal device, and the second threshold is less than the first threshold; The processing unit is used to run the multiple sub-nodes in parallel, wherein each sub-node uses a CPU configured for the sub-node to run the operator in the sub-node.
6. The device according to claim 5, characterized in that The number of CPUs configured for each subnode satisfies a preset formula, which is M*(1-N)*t / T, wherein M represents the total number of CPUs of the terminal device, N represents the resource utilization of the terminal device, t represents the single-threaded running time of the subnode, and T represents the sum of the single-threaded running time of multiple subnodes.
7. The device according to claim 5, characterized in that The determining unit is specifically configured to: Get the computational amount of one or more operators of each child node; The single-threaded running time of the corresponding sub-node is determined according to the computation amount of the one or more operators and the resources of the terminal device.
8. The device according to claim 7, characterized in that The processing unit is further used for: When the resource utilization of the terminal device is greater than or equal to the first threshold, a second preset number of CPUs is used to sequentially run each operator in the multiple subnodes, and the second preset number is smaller than the first preset number.
9. A computing device, characterized in that The computing device comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the resource scheduling method according to any one of claims 1 to 4.
10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of a computing device, the computing device is enabled to execute the resource scheduling method according to any one of claims 1 to 4.
11. A computer program product comprising instructions, characterized in that When the instructions are executed on a computing device, the computing device is caused to execute the resource scheduling method according to any one of claims 1 to 4.