CN114296942A - Memory management method and device, electronic equipment and storage medium - Google Patents

Memory management method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114296942A
CN114296942A CN202111674182.7A CN202111674182A CN114296942A CN 114296942 A CN114296942 A CN 114296942A CN 202111674182 A CN202111674182 A CN 202111674182A CN 114296942 A CN114296942 A CN 114296942A
Authority
CN
China
Prior art keywords
memory
type
model
size
allocated
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.)
Pending
Application number
CN202111674182.7A
Other languages
Chinese (zh)
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.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology 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 Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN202111674182.7A priority Critical patent/CN114296942A/en
Publication of CN114296942A publication Critical patent/CN114296942A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention provides a memory management method, a memory management device, electronic equipment and a storage medium, which are applied to the technical field of intelligent algorithms and comprise the following steps: aiming at each network model in a plurality of network models of memories to be allocated, acquiring the size of each type of memory required by the network model in the operation process; aiming at each type of memory, calculating the size of a shared memory corresponding to each type of memory according to the size of each type of memory required by the network model of the plurality of memories to be allocated in the operation process; and establishing the shared memory corresponding to each type according to the calculated size of the shared memory corresponding to each type of memory. By the method, the shared memory can be calculated and established according to the sizes of various types of memories required by the network model of the memories to be allocated, so that the model is trained through the shared memory, and the memory pressure in the model training process is reduced.

Description

Memory management method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of intelligent algorithm technologies, and in particular, to a memory management method and apparatus, an electronic device, and a storage medium.
Background
At present, the application of artificial intelligence is becoming more and more extensive. In the field of artificial intelligence, face recognition, data prediction, target classification and the like can be carried out through a trained network model, so that great convenience is brought to the daily life of people.
However, in the training process of the current network model, a large amount of training data sets are often needed, and dozens or even millions of loop iterations are performed to obtain an ideal neural network model. The data required in the training process is often more, which results in occupying a large amount of memory, thereby causing great pressure on hardware equipment.
Disclosure of Invention
The embodiment of the invention aims to provide a memory management method, a memory management device, electronic equipment and a storage medium, so as to reduce the memory pressure in the model training process. The specific technical scheme is as follows:
in a first aspect of the embodiments of the present application, a method for memory management is provided, including:
aiming at each network model in a plurality of network models of memories to be allocated, acquiring the size of each type of memory required by the network model in the operation process;
aiming at each type of memory, calculating the size of a shared memory corresponding to each type of memory according to the size of each type of memory required by the network model of the plurality of memories to be allocated in the operation process;
and establishing the shared memory corresponding to each type according to the calculated size of the shared memory corresponding to each type of memory.
Optionally, after the shared memory corresponding to each type is created according to the calculated size of the shared memory corresponding to each type of memory, the method further includes:
and running the network model of the plurality of memories to be allocated through the shared memory corresponding to each type.
Optionally, the obtaining, for each network model of the plurality of network models of the memory to be allocated, the size of each type of memory required by the network model in the operation process includes:
the method comprises the steps of calculating at least one of a model weight memory, an inference calculation memory, a model input memory, a model output memory and a calculation instruction memory required by the network model calculation process of each memory to be allocated aiming at each network model of a plurality of memories to be allocated, wherein the model weight memory represents the memory required by storing the trained model weight, the model input memory represents the memory required by storing external input data of the model, the model output memory represents the memory required by storing output data of the model, and the calculation instruction memory represents the memory required by storing calculation instructions of the model.
Optionally, the calculating, for each type of memory, a size of a shared memory corresponding to the type of memory according to a size of each type of memory required by the network model of the multiple memories to be allocated in the operation process includes:
and aiming at the reasoning calculation memory, selecting the maximum value of the type of memory corresponding to the network model of each memory to be allocated as the size of the shared memory corresponding to the type of memory.
Optionally, the calculating, for each type of memory, a size of a shared memory corresponding to the type of memory according to a size of each type of memory required by the network model of the multiple memories to be allocated in the operation process includes:
and aiming at the model input memory and the model output memory, calculating the sum of the model input memory and the model output memory corresponding to the network model of each memory to be allocated, and calculating the size of the shared memory corresponding to the calculation result.
Optionally, the calculating, for each type of memory, a size of a shared memory corresponding to the type of memory according to a size of each type of memory required by the network model of the multiple memories to be allocated in the operation process includes:
identifying the same network model in the network models of the plurality of memories to be allocated;
and regarding the model weight memory or the calculation instruction memory respectively, taking the size of the model weight memory or the calculation instruction memory corresponding to any one of the same network models as the size of the shared memory corresponding to the model weight memory or the calculation instruction memory.
Optionally, the calculating, for each type of memory, a size of a shared memory corresponding to the type of memory according to a size of each type of memory required by the network model of the multiple memories to be allocated in the operation process includes:
identifying whether the network models of the memories to be allocated are of a basic flow type or a multi-channel concurrent type;
and calculating the size of the shared memory corresponding to the type of memory according to the identification result and the size of each type of memory required by the network model of the plurality of memories to be allocated in the operation process.
In a second aspect of the embodiments of the present application, there is provided a memory management device, including:
the memory acquisition module is used for acquiring the size of each type of memory required by the network model in the operation process aiming at each network model in the network models of the plurality of memories to be allocated;
the shared memory calculation module is used for calculating the size of the shared memory corresponding to each type of memory according to the size of each type of memory required by the network models of the memories to be allocated in the operation process;
and the shared memory creating module is used for creating the shared memory corresponding to each type according to the calculated size of the shared memory corresponding to each type of memory.
Optionally, the apparatus further comprises:
and the model operation module is used for operating the network models of the memories to be allocated through the shared memory corresponding to each type.
Optionally, the memory obtaining module is specifically configured to calculate, for each network model of the network models of the multiple memories to be allocated, a size of at least one of a model weight memory, an inference calculation memory, a model input memory, a model output memory, and a calculation instruction memory, which are required by the network model calculation process of each memory to be allocated, where the model weight memory represents a memory required by storing a trained model weight, the model input memory represents a memory required by storing external input data of the model, the model output memory represents a memory required by storing output data of the model, and the calculation instruction memory represents a memory required by storing a calculation instruction of the model.
Optionally, the shared memory calculation module is specifically configured to select, for the inferential calculation memory, a maximum value of the type of memory corresponding to the network model of each to-be-allocated memory as a size of the shared memory corresponding to the type of memory.
Optionally, the shared memory calculation module is specifically configured to calculate, for the model input memory and the model output memory, a sum of the model input memory and the model output memory, which corresponds to the network model of each memory to be allocated, and calculate a size of a shared memory corresponding to a calculation result.
Optionally, the shared memory computing module includes:
the model identification submodule is used for identifying the same network model in the network models of the plurality of memories to be allocated;
and the shared memory calculation submodule is used for taking the size of the model weight memory or the calculation instruction memory corresponding to any one of the same network models as the size of the shared memory corresponding to the model weight memory or the calculation instruction memory respectively.
Optionally, the shared memory computing module includes:
the type identification module is used for identifying whether the network models of the memories to be allocated are the network models of the basic flow type or the network models of the multi-channel concurrent type;
and the type memory calculation module is used for calculating the size of the shared memory corresponding to the type of memory according to the identification result and the size of each type of memory required by the network model of the plurality of memories to be allocated in the operation process.
On the other hand, the embodiment of the present application further provides an electronic device, which includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing any memory management method step when executing the program stored in the memory.
In another aspect of the embodiments of the present application, a computer-readable storage medium is further provided, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements any of the above-mentioned steps of the memory management method.
In another aspect of the embodiments of the present application, there is also provided a computer program product including instructions, which when run on a computer, cause the computer to perform any of the above memory management method steps.
The embodiment of the invention has the following beneficial effects:
the embodiment of the invention provides a memory management method, a memory management device, electronic equipment and a storage medium, wherein the memory management method comprises the following steps: aiming at each network model in a plurality of network models of memories to be allocated, acquiring the size of each type of memory required by the network model in the operation process; aiming at each type of memory, calculating the size of a shared memory corresponding to each type of memory according to the size of each type of memory required by the network model of the plurality of memories to be allocated in the operation process; and establishing the shared memory corresponding to each type according to the calculated size of the shared memory corresponding to each type of memory. By the method, the shared memory can be calculated and established according to the sizes of various types of memories required by the network model of the memories to be allocated, so that the model is trained through the shared memory, and the memory pressure in the model training process is reduced.
Of course, not all of the advantages described above need to be achieved at the same time in the practice of any one product or method of the invention.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other embodiments can be obtained by referring to these drawings.
Fig. 1 is a schematic flowchart of a memory management method according to an embodiment of the present disclosure;
fig. 2 is a schematic flow chart illustrating obtaining sizes of various types of memories according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart illustrating a process of calculating a size of a shared memory according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a network model concatenation according to an embodiment of the present disclosure;
fig. 5 is a schematic diagram of a multi-path concurrency model provided in an embodiment of the present application;
fig. 6 is a schematic structural diagram of a memory management device according to an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived from the embodiments given herein by one of ordinary skill in the art, are within the scope of the invention.
First, terms of art that may be used in the embodiments of the present application are explained:
artificial intelligence: artificial Intelligence (AI) is a new technical science to study and develop theories, methods, techniques and application systems for simulating, extending and expanding human Intelligence.
Artificial neural networks: artificial Neural Networks (ans) are algorithmic mathematical models that mimic the behavioral characteristics of animal Neural Networks and perform distributed parallel information processing. The aim of processing information is achieved by adjusting the interconnection relationship among a large number of nodes in the system according to the complexity of the system.
Deep learning: an artificial neural network with multiple hidden layers is a deep learning network structure, and deep learning forms more abstract high-level representation attribute categories or features by combining low-level features so as to find distributed feature representation of data. For example, a Convolutional Neural Network (CNN) is a machine learning model under deep supervised learning, and a Deep Belief Network (DBN) is a neural network model under unsupervised learning.
Deep learning training: the deep learning training process is to send a group of training data sets into the neural network, adjust the connection weight of each layer of network according to the difference between the actual output and the expected output of the network, and obtain an ideal neural network model through large-scale training data sets and dozens of or even millions of times of loop iteration.
Deep learning reasoning: also known as inference, a trained neural network can easily perform a variety of tasks in the digital world, according to its knowledge, such as: identifying images, identifying a language in which to record dictations, detecting a disease in the blood, or recommending a pair of shoes that fit a certain style, etc. Through sophisticated training, the trained neural network can "infer" various conclusions from new data quickly and efficiently.
In a first aspect of the embodiments of the present application, a method for memory management is provided, including:
aiming at each network model in a plurality of network models of memories to be allocated, acquiring the size of each type of memory required by the network model in the operation process;
aiming at each type of memory, calculating the size of a shared memory corresponding to each type of memory according to the size of each type of memory required by a plurality of network models of the memory to be allocated in the operation process;
and establishing the shared memory corresponding to each type according to the calculated size of the shared memory corresponding to each type of memory.
By the method, the shared memory can be calculated and established according to the sizes of various types of memories required by the network model of the memories to be allocated, so that the model is trained through the shared memory, and the memory pressure in the model training process is reduced.
Referring to fig. 1, fig. 1 is a schematic flow chart of a memory management method provided in an embodiment of the present application, including:
step S11, for each of the network models of the multiple memories to be allocated, obtain the size of each type of memory required by the network model in the operation process.
The network model of the memory to be allocated in the embodiment of the present application may be various types of network models, for example, a feature recognition model, a target classification model, a feature extraction model, and the like. The method of the embodiment of the application can be applied to the deployment process of the model, the network model of the plurality of memories to be allocated can be a pre-trained network model, and in the deployment process of the model, a certain memory can be allocated for each model for storing data. For example, the model parameters, the input data, the output data, and the like of the model of the memory to be allocated may be stored during the operation of the model of the memory to be allocated.
The method provided by the embodiment of the application is applied to a server or an intelligent terminal, and the model can be operated through the server or the intelligent terminal, specifically, the intelligent terminal can be a computer and the like.
Step S12, for each type of memory, calculating the size of the shared memory corresponding to the type of memory according to the size of each type of memory required by the network model of the multiple memories to be allocated in the operation process.
In the embodiment of the application, the size of each type of memory required by the network model in the operation process is obtained, and the sizes of multiple preset types of memories required by the network model in the operation process can be obtained. For example, the memories required by the network models in the operation process may be classified according to preset memory types, and then the size of the memory required by each network model for each type of memory may be calculated. For example, the size of a memory required for storing model parameters and the size of a memory required for storing data to be calculated, which are required during the operation of the network model, may be obtained.
The size of the shared memory corresponding to the type of memory is calculated according to the size of each type of memory required by the network models of the plurality of memories to be allocated in the operation process, and the size of the memory required by the network models of the plurality of memories to be allocated in the operation process for the type of memory can be calculated for each type of memory respectively, and then the size of the shared memory corresponding to the type of memory is calculated.
Step S13, creating a shared memory corresponding to each type according to the calculated size of the shared memory corresponding to each type of memory.
And creating the shared memory corresponding to each type according to the calculated size of the shared memory corresponding to each type of memory, and dividing a memory area in the hardware memory to serve as the shared memory corresponding to the type of memory. After creating the shared memory, the network model may store or read the corresponding type of data in the shared memory. For example, for the model input memory, the memory required by the network model storage model output data of the multiple memories to be allocated may be obtained, and then the sum of the memories required by the network model storage model input data is calculated to obtain the size of the shared memory corresponding to the model input memory. If the memories required by the network models of the three memories to be allocated corresponding to the inferential computation memory are 100mb, 185mb, and 112mb, respectively, for the inferential computation memory, the maximum value 185mb may be selected as the shared memory size of the inferential computation memory corresponding to the three network models.
Optionally, after the shared memory corresponding to each type is created according to the calculated size of the shared memory corresponding to each type of memory, the method further includes: and running a plurality of network models of the memories to be allocated through the shared memory corresponding to each type. The running of the network models of the multiple memories to be allocated through the shared memory corresponding to each type may refer to that, in the running process of the network models of the multiple memories to be allocated, data corresponding to each type is stored in the shared memory corresponding to the type, and the model is run. For example, for the inferential computation memory, in the model operation process, the input data of the model is stored into the shared memory corresponding to the model input memory.
Therefore, by the method of the embodiment of the application, the shared memory can be calculated and created according to the sizes of the various types of memories required by the network models of the memories to be allocated, so that the model is trained through the shared memory, and the memory pressure in the model training process is reduced.
Optionally, referring to fig. 2, in step S11, for each network model of the multiple network models to be allocated with memory, obtaining the size of each type of memory required by the network model in the operation process includes:
step S111, calculating at least one of a model weight memory, an inference calculation memory, a model input memory, a model output memory, and a calculation instruction memory required in the network model calculation process of each to-be-allocated memory for each of the plurality of network models of to-be-allocated memories.
The model weight memory represents a memory required for storing the trained model weight, the inference calculation memory represents a memory required by the model when executing calculation, the model input memory represents a memory required for storing external input data of the model, the model output memory represents a memory required for storing output data of the model, and the calculation instruction memory represents a memory required for storing a calculation instruction of the model.
Optionally, for each type of memory, calculating the size of the shared memory corresponding to the type of memory according to the size of each type of memory required by the network model of the multiple memories to be allocated in the operation process, including: and aiming at the inferential calculation memory, selecting the maximum value of the type of memory corresponding to the network model of each memory to be allocated as the size of the shared memory corresponding to the type of memory.
Optionally, for each type of memory, calculating the size of the shared memory corresponding to the type of memory according to the size of each type of memory required by the network model of the multiple memories to be allocated in the operation process, including: and calculating the sum of the model input memory and the model output memory corresponding to the network model of each memory to be allocated according to the model input memory and the model output memory, and calculating the size of the shared memory corresponding to the calculation result.
Optionally, for each type of memory, calculating the size of the shared memory corresponding to the type of memory according to the size of each type of memory required by the network model of the multiple memories to be allocated in the operation process, including: identifying the same network model in the network models of the plurality of memories to be allocated; and respectively aiming at the model weight memory or the calculation instruction memory, taking the size of the corresponding model weight memory or the calculation instruction memory of any one network model in the same network model as the size of the shared memory corresponding to the model weight memory or the calculation instruction memory.
Optionally, referring to fig. 3, in step S12, for each type of memory, calculating the size of the shared memory corresponding to the type of memory according to the size of each type of memory required by the network model of multiple memories to be allocated in the operating process, where the calculating includes:
step S121, identifying whether the network models of the memories to be allocated are the network models of the basic flow type or the network models of the multi-channel concurrent type;
step S122, calculating the size of the shared memory corresponding to the type of memory according to the identification result and the size of each type of memory required by the network model of the multiple memories to be allocated in the operation process.
In the actual use process, for each type of memory, the size of the shared memory corresponding to the type of memory is calculated according to the size of each type of memory required by the network models of the multiple memories to be allocated in the operation process, and whether the network models of the multiple memories to be allocated are multiple models of a basic flow type or multiple models of a multi-path concurrent type can also be identified. For example, a typical face recognition process includes face detection, face analysis whether a real face is analyzed, face feature extraction, and the like. The multiple concurrent models can be referred to fig. 5, and multiple concurrent models need to execute the same algorithm flow at the same time, and may be multiple threads or multiple processes.
Therefore, by the method of the embodiment of the application, the shared memory can be calculated and created according to the sizes of the various types of memories required by the network models of the memories to be allocated, so that the model is trained through the shared memory, and the memory pressure in the model training process is reduced.
In a second aspect of the embodiments of the present application, there is provided a memory management device, referring to fig. 6, including:
a memory obtaining module 601, configured to obtain, for each network model of multiple network models of memories to be allocated, a size of each type of memory required by the network model in an operation process;
a shared memory calculation module 602, configured to calculate, for each type of memory, a size of a shared memory corresponding to each type of memory, according to a size of each type of memory required by a network model of multiple memories to be allocated in an operation process;
a shared memory creating module 603, configured to create a shared memory corresponding to each type according to the calculated size of the shared memory corresponding to each type of memory.
Optionally, the apparatus further comprises:
and the model operation module is used for operating a plurality of network models of the memories to be allocated through the shared memory corresponding to each type.
Optionally, the memory obtaining module 601 is specifically configured to calculate, for each network model of the network models of the multiple memories to be allocated, a size of at least one of a model weight memory, an inference calculation memory, a model input memory, a model output memory, and a calculation instruction memory, which are required by the network model calculation process of each memory to be allocated, where the model weight memory represents a memory required by storing a trained model weight, the inference calculation memory represents a memory required by the model when performing calculation, the model input memory represents a memory required by storing external input data of the model, the model output memory represents a memory required by storing output data of the model, and the calculation instruction memory represents a memory required by storing a calculation instruction of the model.
Optionally, the shared memory calculation module 602 is specifically configured to select, for the inferential calculation memory, a maximum value of the type of memory corresponding to the network model of each to-be-allocated memory as a size of the shared memory corresponding to the type of memory.
Optionally, the shared memory calculation module 602 is specifically configured to calculate, for the model input memory and the model output memory, a sum of the model input memory and the model output memory corresponding to the network model of each memory to be allocated, and calculate a size of the shared memory corresponding to a calculation result.
Optionally, the shared memory calculation module 602 includes:
the model identification submodule is used for identifying the same network model in the network models of the plurality of memories to be allocated;
and the shared memory calculation submodule is used for taking the size of the model weight memory or the calculation instruction memory corresponding to any one of the same network models as the size of the shared memory corresponding to the model weight memory or the calculation instruction memory respectively aiming at the model weight memory or the calculation instruction memory.
Optionally, the shared memory calculation module 602 includes:
the type identification module is used for identifying whether the network models of the memories to be allocated are the network models of the basic flow type or the network models of the multi-channel concurrent type;
and the type memory calculation module is used for calculating the size of the shared memory corresponding to the type of memory according to the identification result and the size of each type of memory required by the network model of the plurality of memories to be allocated in the operation process.
By the device, the shared memory can be calculated and established according to the sizes of various types of memories required by the network models of the memories to be allocated, so that the model is trained through the shared memory, and the memory pressure in the model training process is reduced.
An embodiment of the present invention further provides an electronic device, as shown in fig. 7, including a processor 701, a communication interface 702, a memory 703 and a communication bus 704, where the processor 701, the communication interface 702, and the memory 703 complete mutual communication through the communication bus 704,
a memory 703 for storing a computer program;
the processor 701 is configured to implement the following steps when executing the program stored in the memory 703:
aiming at each network model in a plurality of network models of memories to be allocated, acquiring the size of each type of memory required by the network model in the operation process;
aiming at each type of memory, calculating the size of a shared memory corresponding to each type of memory according to the size of each type of memory required by the network model of the plurality of memories to be allocated in the operation process;
and establishing the shared memory corresponding to each type according to the calculated size of the shared memory corresponding to each type of memory.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In another embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of any of the above memory management methods.
In another embodiment, the present invention further provides a computer program product containing instructions, which when run on a computer, causes the computer to execute any of the memory management methods in the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. 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.
It is noted that, herein, 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. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. The term "comprising", without further limitation, means that the element so defined is not excluded from the group consisting of additional identical elements in the process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus, the electronic device, the storage medium and the computer program product embodiment, since they are substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A memory management method, comprising:
aiming at each network model in a plurality of network models of memories to be allocated, acquiring the size of each type of memory required by the network model in the operation process;
aiming at each type of memory, calculating the size of a shared memory corresponding to each type of memory according to the size of each type of memory required by the network model of the plurality of memories to be allocated in the operation process;
and establishing the shared memory corresponding to each type according to the calculated size of the shared memory corresponding to each type of memory.
2. The method according to claim 1, wherein after the creating the shared memory corresponding to each type according to the calculated size of the shared memory corresponding to each type of memory, the method further comprises:
and running the network model of the plurality of memories to be allocated through the shared memory corresponding to each type.
3. The method according to claim 1, wherein the obtaining, for each of the plurality of network models to which the memory is to be allocated, the size of each type of memory required by the network model in the operating process comprises:
the method comprises the steps of calculating at least one of a model weight memory, an inference calculation memory, a model input memory, a model output memory and a calculation instruction memory required by the network model calculation process of each memory to be allocated aiming at each network model of a plurality of memories to be allocated, wherein the model weight memory represents the memory required by storing the trained model weight, the model input memory represents the memory required by storing external input data of the model, the model output memory represents the memory required by storing output data of the model, and the calculation instruction memory represents the memory required by storing calculation instructions of the model.
4. The method according to claim 3, wherein for each type of memory, calculating a size of a shared memory corresponding to each type of memory according to a size of each type of memory required by the network model of the plurality of memories to be allocated in an operation process includes:
and aiming at the reasoning calculation memory, selecting the maximum value of the type of memory corresponding to the network model of each memory to be allocated as the size of the shared memory corresponding to the type of memory.
5. The method according to claim 3, wherein for each type of memory, calculating a size of a shared memory corresponding to each type of memory according to a size of each type of memory required by the network model of the plurality of memories to be allocated in an operation process includes:
and aiming at the model input memory and the model output memory, calculating the sum of the model input memory and the model output memory corresponding to the network model of each memory to be allocated, and calculating the size of the shared memory corresponding to the calculation result.
6. The method according to claim 3, wherein for each type of memory, calculating a size of a shared memory corresponding to each type of memory according to a size of each type of memory required by the network model of the plurality of memories to be allocated in an operation process includes:
identifying the same network model in the network models of the plurality of memories to be allocated;
and regarding the model weight memory or the calculation instruction memory respectively, taking the size of the model weight memory or the calculation instruction memory corresponding to any one of the same network models as the size of the shared memory corresponding to the model weight memory or the calculation instruction memory.
7. The method according to claim 1, wherein for each type of memory, calculating a size of a shared memory corresponding to each type of memory according to a size of each type of memory required by the network model of the plurality of memories to be allocated in an operation process includes:
identifying whether the network models of the memories to be allocated are of a basic flow type or a multi-channel concurrent type;
and calculating the size of the shared memory corresponding to the type of memory according to the identification result and the size of each type of memory required by the network model of the plurality of memories to be allocated in the operation process.
8. A memory management device, comprising:
the memory acquisition module is used for acquiring the size of each type of memory required by the network model in the operation process aiming at each network model in the network models of the plurality of memories to be allocated;
the shared memory calculation module is used for calculating the size of the shared memory corresponding to each type of memory according to the size of each type of memory required by the network models of the memories to be allocated in the operation process;
and the shared memory creating module is used for creating the shared memory corresponding to each type according to the calculated size of the shared memory corresponding to each type of memory.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 7 when executing a program stored in the memory.
10. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1 to 7.
CN202111674182.7A 2021-12-28 2021-12-28 Memory management method and device, electronic equipment and storage medium Pending CN114296942A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111674182.7A CN114296942A (en) 2021-12-28 2021-12-28 Memory management method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111674182.7A CN114296942A (en) 2021-12-28 2021-12-28 Memory management method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114296942A true CN114296942A (en) 2022-04-08

Family

ID=80975646

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111674182.7A Pending CN114296942A (en) 2021-12-28 2021-12-28 Memory management method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114296942A (en)

Similar Documents

Publication Publication Date Title
US11741361B2 (en) Machine learning-based network model building method and apparatus
Shang et al. Democratizing data science through interactive curation of ml pipelines
CA3118083C (en) Techniques for recommending items to users
US20180336453A1 (en) Domain specific language for generation of recurrent neural network architectures
US11087086B2 (en) Named-entity recognition through sequence of classification using a deep learning neural network
US20220129791A1 (en) Systematic approach for explaining machine learning predictions
CN110929752B (en) Grouping method based on knowledge driving and data driving and related equipment
US20200242736A1 (en) Method for few-shot unsupervised image-to-image translation
US20230095606A1 (en) Method for training classifier, and data processing method, system, and device
CN110659742A (en) Method and device for acquiring sequence representation vector of user behavior sequence
US20170286979A1 (en) Architecture for predicting network access probability of data files accessible over a computer network
CN114565196B (en) Multi-event trend prejudging method, device, equipment and medium based on government affair hotline
Yan et al. A clustering algorithm for multi-modal heterogeneous big data with abnormal data
WO2020190951A1 (en) Neural network trained by homographic augmentation
CN112445914A (en) Text classification method, device, computer equipment and medium
KR102413588B1 (en) Object recognition model recommendation method, system and computer program according to training data
CN114296942A (en) Memory management method and device, electronic equipment and storage medium
CN116029760A (en) Message pushing method, device, computer equipment and storage medium
US20220164659A1 (en) Deep Learning Error Minimizing System for Real-Time Generation of Big Data Analysis Models for Mobile App Users and Controlling Method for the Same
CN113094504A (en) Self-adaptive text classification method and device based on automatic machine learning
Kapoor et al. Bell-Pepper Leaf Bacterial Spot Detection Using AlexNet and VGG-16
KR102650574B1 (en) Method, apparatus and system for planning and creating company-related media reports and promotional materials based on trend and issue data collection and analysis
WO2019149375A1 (en) Method and system for processing input data and propagating variance in a neural network
CN113792163B (en) Multimedia recommendation method and device, electronic equipment and storage medium
CN114449701B (en) Light type regulation and control method and device based on medical record information and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination