Algorithm task operation control method and device and computer readable storage medium

Through estimate and historical record management, the detection of whether the algorithm tasks meet the video memory operation conditions, solve the problem of multi-task preemption of video memory resources, and realize the rational allocation of video memory resources and the stable operation of tasks.

CN119829227APending Publication Date: 2025-04-15QUECTEL WIRELESS SOLUTIONS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411690892.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

When multiple algorithm tasks are running at the same time, preemption of video memory resources may occur, resulting in insufficient video memory and the program crash.

Method used

By determining the expected capacity of the target algorithm task to be run for the graphics card memory, obtain the historical estimated capacity in the expected occupancy history, detect whether the target algorithm task meets the preset task operation conditions, and controls its operation when the conditions are met.

Benefits of technology

It avoids the situation of preempting video memory resources between different algorithm tasks, ensures the reasonable allocation of video memory resources, and prevents program crashes caused by insufficient video memory.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829227A_ABST
    Figure CN119829227A_ABST
Patent Text Reader

Abstract

The invention provides an algorithm task operation control method and device and a computer readable storage medium. The method comprises the steps of determining a predicted occupied capacity of a to-be-run target algorithm task for a video memory of a video card; obtaining a predicted occupancy historical record, wherein the predicted occupancy historical record comprises historical predicted occupancy capacities of a plurality of historical algorithm tasks in a running state for a video memory of the video card; based on the predicted occupation capacity and the historical predicted occupation capacity, detecting whether the target algorithm task meets a preset task operation condition or not; and if the target algorithm task meets the task operation condition, controlling the target algorithm task to operate. According to the embodiment of the invention, program crash caused by preempting video memory resources among a plurality of algorithm tasks can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of algorithmic tasks, and in particular to an algorithmic task operation control method, device and computer-readable storage medium. Background Art

[0002] When running algorithm tasks such as model training and model verification through the algorithm platform, the algorithm tasks need to occupy the memory resources of the GPU (graphics processing unit, also known as graphics card) in the algorithm platform. However, the size of the video memory occupied by the algorithm task during operation is not always a fixed value, but changes. For example, some algorithm tasks do not occupy too much video memory during the early stage of data set preprocessing, but when the model training or verification is officially carried out after dozens of minutes, the video memory occupied will increase significantly.

[0003] Therefore, when running multiple algorithm tasks at the same time, multiple algorithm tasks may compete for video memory resources. For example, when an algorithm task has not occupied too much video memory, the newly running algorithm task will mistakenly believe that the current video memory resources are sufficient. If the newly running algorithm task does not perform data set preprocessing, or the data set preprocessing speed is faster, and the model training or verification is performed earlier than the previous algorithm task, the video memory resources required by the previous algorithm task will be preempted. If the previous algorithm task requires too much video memory for model training or verification, insufficient video memory may cause the program to crash. Summary of the invention

[0004] The present application provides an algorithm task execution control method, device and computer-readable storage medium, aiming to avoid program crashes caused by multiple algorithm tasks competing for video memory resources.

[0005] On the one hand, the present application provides a method for controlling the operation of an algorithm task, the method comprising:

[0006] Determine the estimated occupied capacity of the graphics card memory by the target algorithm task to be run;

[0007] Acquire estimated occupation history records, wherein the estimated occupation history records include historical estimated occupation capacities of a graphics card memory by a plurality of historical algorithm tasks in operation;

[0008] Based on the estimated occupied capacity and the historical estimated occupied capacity, detecting whether the target algorithm task meets a preset task running condition;

[0009] If the target algorithm task meets the task running condition, the target algorithm task is controlled to run.

[0010] In a possible implementation of the present application, after detecting whether the target algorithm task meets the preset task running conditions, the method further includes:

[0011] If the target algorithm task meets the task running conditions, the target algorithm task and the expected occupied capacity are associated and stored in the expected occupancy history record, wherein the target algorithm task is recorded as a historical algorithm task, and the expected occupied capacity is recorded as a historical expected occupied capacity.

[0012] In a possible implementation of the present application, detecting whether the target algorithm task meets a preset task running condition based on the estimated occupied capacity and the historical estimated occupied capacity includes:

[0013] Determine a target graphics card from among multiple preset graphics cards of a preset algorithm platform;

[0014] Obtaining the available capacity of the video memory of the target graphics card and using it as the first capacity;

[0015] Determine the historical estimated occupation capacity of the target graphics card memory in the estimated occupation history record and use it as the second capacity;

[0016] Based on the first capacity, the second capacity and the estimated occupied capacity, determine whether the target graphics card supports running the target algorithm task, wherein the task running condition includes that the target graphics card supports running the target algorithm task.

[0017] In a possible implementation of the present application, determining whether the target graphics card supports running the target algorithm task based on the first capacity, the second capacity, and the estimated occupied capacity includes:

[0018] Obtaining a difference between the first capacity and the second capacity;

[0019] Based on the difference and the estimated occupied capacity, it is determined whether the target graphics card supports running the target algorithm task.

[0020] In a possible implementation of the present application, if the target algorithm task satisfies the task running condition, controlling the target algorithm task to run includes:

[0021] If the target algorithm task meets the task running condition, then using the target graphics card to control the target algorithm task to run;

[0022] After detecting whether the target algorithm task meets the preset task running conditions, the method further includes:

[0023] If the target algorithm task meets the task running condition, the estimated occupied capacity of the target graphics card memory by the target algorithm task is stored in the estimated occupation history record as a historical estimated occupied capacity of the target graphics card memory by a historical algorithm task.

[0024] In a possible implementation of the present application, determining a target graphics card from a plurality of preset graphics cards of a preset algorithm platform includes:

[0025] Obtaining the available capacity of the video memory of each of the preset graphics cards and using it as the third capacity;

[0026] Determine the historical estimated occupation capacity of the preset graphics card memory in the estimated occupation history records, and use it as the fourth capacity;

[0027] Based on the difference between the third capacity and the fourth capacity, the target graphics card is determined from a plurality of preset graphics cards.

[0028] In a possible implementation of the present application, after obtaining the available capacity of the video memory of each of the preset graphics cards and using it as the third capacity, the method further includes:

[0029] For each of the preset graphics cards, detecting whether the estimated occupation history records store a historical estimated occupation capacity of the graphics memory of the preset graphics card;

[0030] If the estimated occupation history record stores the historical estimated occupation capacity of the preset graphics card memory, then executing the step of determining the historical estimated occupation capacity of the preset graphics card memory in the estimated occupation history record;

[0031] If the historical estimated occupation capacity of the video memory of the preset graphics card is not stored in the estimated occupation history record, the preset graphics card is used as the target graphics card.

[0032] In a possible implementation of the present application, after the target algorithm task and the estimated occupied capacity are stored in association with the estimated occupied capacity history record, the method further includes:

[0033] Detecting whether the target running task meets the preset graphics card memory release condition;

[0034] If the target running task satisfies the graphics card memory de-occupancy condition, the associated target running task and the estimated occupied capacity are deleted from the estimated occupation history record.

[0035] In a possible implementation of the present application, after the estimated occupied capacity of the target graphics card memory by the target algorithm task is stored in the estimated occupied capacity history record as a historical estimated occupied capacity of the target graphics card memory by the historical algorithm task, the method further includes:

[0036] Detecting whether the target running task meets the preset graphics card memory release condition;

[0037] If the target running task satisfies the graphics card memory de-occupancy condition, the estimated occupation capacity of the target graphics card memory by the target algorithm task is deleted from the estimated occupation history record.

[0038] In a possible implementation of the present application, before determining the estimated occupied capacity of the graphics card memory of the target algorithm task to be executed, the method further includes:

[0039] A global read-write lock is set for the estimated occupancy history record to restrict read and write operations on the estimated occupancy history record.

[0040] In a possible implementation of the present application, after the target algorithm task and the estimated occupied capacity are stored in association with the estimated occupied capacity history record, the method further includes:

[0041] The global read-write lock is canceled to remove restrictions on read and write operations of the estimated occupancy history record.

[0042] In a possible implementation of the present application, after the estimated occupied capacity of the target graphics card memory by the target algorithm task is stored in the estimated occupied capacity history record as a historical estimated occupied capacity of the target graphics card memory by the historical algorithm task, the method further includes:

[0043] The global read-write lock is canceled to remove restrictions on read and write operations of the estimated occupancy history record.

[0044] On the other hand, the present application also provides an algorithm task operation control device, the algorithm task operation control device comprising:

[0045] A determination unit, used to determine the estimated occupied capacity of the graphics card memory of the target algorithm task to be executed;

[0046] A reading unit, used for obtaining a predicted occupation history record, wherein the predicted occupation history record includes a historical predicted occupation capacity of a graphics card memory by a plurality of historical algorithm tasks in operation;

[0047] A detection unit, configured to detect whether the target algorithm task meets a preset task running condition based on the estimated occupied capacity and the historical estimated occupied capacity;

[0048] A control unit is used to control the execution of the target algorithm task if the target algorithm task meets the task execution condition.

[0049] On the other hand, the present application also provides a terminal device, the terminal device comprising:

[0050] one or more processors;

[0051] Memory; and

[0052] One or more applications, wherein one or more of the applications are stored in the memory and configured to be executed by the processor to implement any of the above methods.

[0053] On the other hand, the present application also provides a computer-readable storage medium on which a software program is stored, and the software program is loaded by a processor to execute the steps in any of the above methods.

[0054] On the other hand, an embodiment of the present application provides a computer program product, including a computer program or instructions, where the computer program or instructions are executed by a processor to implement any of the above methods.

[0055] The algorithm task operation control method, device and computer-readable storage medium provided in the embodiments of the present application determine the estimated occupied capacity of the graphics card memory of the target algorithm task to be run, judge whether the target algorithm task meets the preset task running conditions based on the estimated occupied capacity and the historical estimated occupied capacity in the estimated occupied history records, and control the target algorithm task to run when the task running conditions are met. In this way, under the limitation of the historical estimated occupied capacity, there will be no situation of competing for graphics memory resources between different algorithm tasks, so as to avoid program crashes caused by insufficient graphics memory. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0057] Figure 1 It is a flowchart of an embodiment of the operation control method of the algorithm task provided in the embodiments of the present application;

[0058] Figure 2 It is a flowchart of another embodiment of the operation control method of the algorithm task provided in the embodiments of the present application;

[0059] Figure 3It is a flowchart of another embodiment of the operation control method of the algorithm task provided in the embodiments of the present application;

[0060] Figure 4 It is a schematic diagram of the structure of an embodiment of the operation control device of the algorithm task provided in the embodiments of the present application;

[0061] Figure 5 It is a schematic diagram of the structure of an embodiment of the terminal device provided in the embodiments of the present application. DETAILED DESCRIPTION

[0062] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0063] In the description of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically limited. In the present application, the term "in some embodiments" is used to mean "used as an example, illustration or description". Any embodiment described as "in some embodiments" in the present application is not necessarily interpreted as being more preferred or more advantageous than other embodiments. In order to enable any technician in the field to implement and use the present application, the following description is given. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present application can also be implemented without using these specific details. In other examples, well-known principles and processes will not be elaborated in detail to avoid unnecessary details that make the description of the present application obscure. Therefore, the present application is not intended to be limited to the embodiments shown, but is consistent with the widest range of principles and features disclosed in the present application.

[0064] The embodiments of the present application provide a method, device and computer-readable storage medium for controlling the operation of an algorithm task, which are described in detail below.

[0065] See also Figure 1 , Figure 1 The following is a flow chart of an embodiment of the operation control method of the algorithm task provided in the embodiment of the present application. The execution subject of the operation control method of the algorithm task is the operation control device of the algorithm task, and the operation control device of the algorithm task can be set in a terminal device, and the terminal device can specifically be a PC, a server, and other devices. The operation control method of the algorithm task includes:

[0066] 101. Determine the estimated occupied capacity of the graphics card memory by the target algorithm task to be run.

[0067] In the embodiments of the present application, an algorithm task refers to a task that needs to be calculated based on an algorithm, such as model training, model verification, and other algorithm tasks. The target algorithm task to be run can be manually set by the user, for example, the user can set a preset queue of algorithm tasks to sequentially use the algorithm tasks in the preset queue as the target algorithm task to be run.

[0068] Since the target algorithm task needs to occupy the graphics card memory resources for calculation during operation, the graphics card memory occupied by the target algorithm task can be estimated to obtain the corresponding estimated occupied capacity. The graphics card memory refers to the memory of the GPU (graphics processing unit, also known as graphics card) configured in the preset algorithm platform, such as the AI ​​(Artificial Intelligence) cloud platform.

[0069] In some embodiments of the present application, the estimation process of the expected occupied capacity is described. Specifically, determining the expected occupied capacity of the graphics card memory for the target algorithm task to be run may include: determining the target task type to which the target algorithm task belongs; using a machine learning algorithm to determine the expected occupied capacity corresponding to the target task type. Among them, the machine learning algorithm may be, for example, a support vector machine (Support Vector Machine, SVM) algorithm, etc. It can be understood that since the target algorithm tasks of the same task type have similar occupied capacity for the graphics card memory during actual operation, the corresponding expected occupied capacity can be determined based on the target task type.

[0070] The machine learning algorithm can be obtained through a prior training process. Specifically, the sampling method can be used to first determine the preset task types to which multiple preset algorithm tasks belong, as well as the actual occupied capacity of the graphics card memory of multiple preset algorithm tasks, and the preset task types and the corresponding actual occupied capacity can be used to train the machine learning algorithm, so that the machine learning algorithm can predict the estimated occupied capacity corresponding to the target task type. After each target algorithm task is completed, the target task type to which the target algorithm task belongs, as well as the actual occupied capacity of the graphics card memory of the target algorithm task, can also be used to continuously update the machine learning algorithm to make the prediction of the machine learning algorithm more accurate. In addition, the above-mentioned actual occupied capacity generally refers to the maximum value of the occupied capacity of the graphics card memory of the corresponding algorithm task during the actual operation process.

[0071] 102. Obtain an estimated occupation history record, where the estimated occupation history record includes an estimated historical occupation capacity of a graphics card memory by multiple historical algorithm tasks in operation.

[0072] In the embodiment of the present application, the estimated occupation history record refers to the estimated occupation status of the graphics card memory, and the history record includes the historical estimated occupation capacity of the graphics card memory by multiple historical algorithm tasks in operation. The estimated occupation history record can be continuously expanded and updated as multiple algorithm tasks are run in sequence. The expansion and update steps are detailed in step 105.

[0073] Among them, the historical algorithm task is relative to the target algorithm task to be run currently, that is, at a certain historical moment, the historical algorithm task is a target algorithm task, and the historical estimated occupied capacity is an estimated occupied capacity.

[0074] 103. Based on the estimated occupied capacity and the historical estimated occupied capacity, detect whether the target algorithm task meets the preset task running conditions.

[0075] In the embodiment of the present application, since the estimated occupied capacity represents the graphics card memory capacity that the target algorithm task needs to occupy, and the historical estimated occupied capacity represents the graphics card memory capacity that the historical algorithm task needs to occupy, it is possible to judge whether the remaining graphics card memory in the preset algorithm platform is sufficient to support the operation of the target algorithm task based on the estimated occupied capacity and the historical estimated occupied capacity. The judgment condition for judging whether the remaining graphics card memory in the preset algorithm platform is sufficient to support the operation of the target algorithm task is the preset task operation condition, which can be set based on actual needs and is not limited here.

[0076] 104. If the target algorithm task meets the task running conditions, the target algorithm task is controlled to run.

[0077] In the embodiment of the present application, if the target algorithm task meets the task running conditions, it indicates that the target algorithm task can run smoothly and there will be no shortage of video memory, so the target algorithm can be controlled to run on the preset algorithm platform. If the target algorithm task does not meet the task running conditions, it indicates that the target algorithm task may not run smoothly and there may be a shortage of video memory, so a prompt message of insufficient video memory can be output to prompt the corresponding user.

[0078] The operation control method of the algorithm task provided in the embodiment of the present application determines the estimated occupied capacity of the graphics card memory of the target algorithm task to be run, judges whether the target algorithm task meets the preset task running conditions based on the estimated occupied capacity and the historical estimated occupied capacity in the estimated occupied history records, and controls the target algorithm task to run when the task running conditions are met. In this way, under the limitation of the historical estimated occupied capacity, there will be no situation of competing for graphics memory resources between different algorithm tasks, so as to avoid program crashes caused by insufficient graphics memory.

[0079] In some embodiments of the present application, step 105 may also be included after step 103. Step 105 includes: if the target algorithm task meets the task running conditions, the target algorithm task and the expected occupied capacity are associated and stored in the expected occupancy history record (that is, before, after or at the same time as the step of controlling the running of the target algorithm task, the target algorithm task and the expected occupied capacity are associated and stored in the expected occupancy history record). In the step of associating and storing the target algorithm task and the expected occupied capacity in the expected occupancy history record, specifically, the expected occupied capacity of the target algorithm task for the graphics card memory is stored in the expected occupancy history record as the historical expected occupied capacity of a historical algorithm task for the graphics card memory, so as to expand and update the expected occupancy history record. In this way, when a new target algorithm task to be run is obtained, it is possible to detect whether the new target algorithm task meets the task running conditions based on the historical expected occupied capacity in the latest expected occupancy history record.

[0080] In some embodiments of the present application, after step 105, the following may also be included: detecting whether the target running task meets the preset graphics card memory release condition; if the target running task meets the graphics card memory release condition, deleting the associated target running task and the estimated occupied capacity from the estimated occupation history record to release the graphics card memory resources occupied by the target running task. Among them, the graphics card memory release condition may be, for example, the completion of the target running task, the reaching of the preset duration of the target running task, the occurrence of a preset unexpected scenario during the execution of the target running task, the receipt of abnormal signals such as SIGTERM and SIGINT during the execution of the target running task, etc.

[0081] In some embodiments of the present application, since multiple different users may use the preset algorithm platform to run algorithm tasks at the same time, for example, after the current user obtains the estimated occupancy history record, another user executes step 105 to modify the estimated occupancy history record, so that the estimated occupancy history record obtained by the current user is not the latest. In this regard, a global read-write lock can also be set for the estimated occupancy history record to avoid this situation. Specifically, before step 101, it can also include: setting a global read-write lock for the estimated occupancy history record to limit the read and write operations on the estimated occupancy history record, so that only the current user who has set the global read-write lock for the estimated occupancy history record can read and write the estimated occupancy history record. After step 105, it can also include: canceling the global read-write lock to remove the restrictions on the read and write operations of the estimated occupancy history record, so that all users who have logged in to the preset algorithm platform can read and write the estimated occupancy history record. It can be seen that by setting a global read-write lock for the estimated occupancy history record, only one user can read and write the estimated occupancy history record at the same time, thereby ensuring the consistency of the estimated occupancy history record at different users.

[0082] See also Figure 2 , Figure 2 This is a flow chart of another embodiment of the operation control method of the algorithm task provided in the embodiment of the present application. Figure 1 Based on the operation control method of the algorithm task shown in the embodiment, step 103 may include:

[0083] 201. Determine a target graphics card from among a plurality of preset graphics cards of a preset algorithm platform.

[0084] In the embodiment of the present application, a plurality of preset graphics cards are configured in the preset algorithm platform at the same time, and each preset graphics card can be used to run the algorithm task, so a target graphics card can be determined from the plurality of preset graphics cards. The target graphics card can be selected manually by the user, or automatically selected based on a preset selection rule, which is not limited here.

[0085] 202. Obtain available video memory capacity of a target graphics card and use it as a first capacity.

[0086] In an embodiment of the present application, the available video memory capacity of the target graphics card refers to the capacity of the remaining video memory of the target graphics card, and the available video memory capacity can be queried from a preset algorithm platform, for example, by using the nvidia-smi command to query from the preset algorithm platform.

[0087] 203. Determine the historical estimated occupation capacity of the target graphics card memory in the estimated occupation history record, and use it as the second capacity.

[0088] In an embodiment of the present application, the estimated occupation history records include the historical estimated occupation capacity of the preset graphics card memory of multiple historical algorithm tasks in operation. For the target graphics card, if there is only one historical algorithm task in the estimated occupation history records for the target graphics card memory, it is directly used as the historical estimated occupation capacity of the target graphics card memory. If there are multiple historical algorithm tasks in the estimated occupation history records for the target graphics card memory, the sum of the historical estimated occupation capacities of the target graphics card memory of the multiple historical algorithm tasks can be used as the historical estimated occupation capacity of the target graphics card memory.

[0089] 204. Determine whether the target graphics card supports running the target algorithm task based on the first capacity, the second capacity, and the estimated occupied capacity.

[0090] In an embodiment of the present application, the task running condition includes whether the target graphics card supports running the target algorithm task. Since the first capacity is the available capacity of the graphics memory of the target graphics card, the second capacity is the graphics memory capacity required by multiple historical algorithm tasks for the target graphics card, and the estimated occupied capacity is the graphics memory capacity required by the target algorithm task for the target graphics card, it can be determined based on the calculation between the first capacity, the second capacity, and the estimated occupied capacity whether the target graphics card supports running the target algorithm task in addition to supporting running multiple historical algorithm tasks.

[0091] In some embodiments of the present application, step 204 may include: obtaining the difference between the first capacity and the second capacity; determining whether the target graphics card supports running the target algorithm task based on the difference and the estimated occupied capacity, for example, when the difference is greater than or equal to the estimated occupied capacity, determining that the target graphics card supports running the target algorithm task. If the difference is less than the estimated occupied capacity, determining that the target graphics card does not support running the target algorithm task.

[0092] In some embodiments of the present application, in step 201, if there are multiple target graphics cards determined at the same time, steps 202 and 203 are performed in sequence for each target graphics card. Step 204 may include: based on the expected occupied capacity, determining the sub-estimated occupied capacity corresponding to each target graphics card, for example, the expected occupied capacity may be divided into multiple sub-estimated occupied capacities according to a preset ratio; for each target graphics card, obtaining the difference between the first capacity and the second capacity, and determining whether the target graphics card supports running the target algorithm task based on the difference and the sub-estimated occupied capacity corresponding to the target graphics card, for example, when the difference is greater than or equal to the sub-estimated occupied capacity corresponding to the target graphics card, determining that the target graphics card supports running the target algorithm task. If the difference is less than the sub-estimated occupied capacity corresponding to the target graphics card, determining that the target graphics card does not support running the target algorithm task. If all target graphics cards support running the target algorithm task, determining that the target algorithm task meets the task running conditions.

[0093] The operation control method of the algorithm task provided in the embodiment of the present application realizes the detection of whether the target algorithm task meets the task running conditions through the available capacity of the target graphics card's video memory, the historical estimated occupied capacity of the target graphics card's video memory in the estimated occupied history records, and the estimated occupied capacity of the graphics card's video memory by the target algorithm task.

[0094] In a further embodiment, when the target graphics card supports running the target algorithm task, step 105 may include: if the target algorithm task meets the task running conditions, then using the target graphics card to control the running of the target algorithm task, that is, using the video memory resources of the target graphics card to perform the calculation of the target algorithm task. Correspondingly, after step 103, it may also include: if the target algorithm task meets the task running conditions, storing the estimated occupied capacity of the target algorithm task for the target graphics card video memory as a historical estimated occupied capacity of a historical algorithm task for the target graphics card video memory in the estimated occupied history record (that is, step 105 may include: storing the estimated occupied capacity of the target algorithm task for the target graphics card video memory as a historical estimated occupied capacity of a historical algorithm task for the target graphics card video memory in the estimated occupied history record). It can be seen that the estimated occupied history record stores the association between the target algorithm task, the target graphics card, and the estimated occupied capacity.

[0095] See also Figure 3 , Figure 3 This is another embodiment of the flow chart of the operation control method of the algorithm task provided in the embodiment of the present application. Figure 2 Based on the operation control method of the algorithm task shown in the embodiment, step 201 may include:

[0096] 301. Obtain available video memory capacity of each preset graphics card and use it as the third capacity.

[0097] In an embodiment of the present application, the available capacity of the video memory of the preset graphics card refers to the capacity of the remaining video memory of the preset graphics card, and the available capacity of the video memory can be queried from the preset algorithm platform, for example, it can be queried from the preset algorithm platform using the nvidia-smi command.

[0098] In some embodiments of the present application, after step 301, the following may be included: for each preset graphics card, detecting whether the historical estimated occupation capacity of the video memory of the preset graphics card is stored in the estimated occupation history record; if the historical estimated occupation capacity of the video memory of the preset graphics card is stored in the estimated occupation history record, executing step 302 and subsequent steps, thereby determining the target graphics card in the preset graphics cards. If the historical estimated occupation capacity of the video memory of the preset graphics card is not stored in the estimated occupation history record, the preset graphics card can be directly used as the idle graphics card described below to avoid errors in the execution of step 302.

[0099] 302. Determine, in the estimated occupation history records, the historical estimated occupation capacity of the preset graphics card memory and use it as the fourth capacity.

[0100] In an embodiment of the present application, the estimated occupation history records include the historical estimated occupation capacity of the preset graphics card memory by multiple historical algorithm tasks in operation. For each preset graphics card, if there is only one historical estimated occupation capacity of the preset graphics card memory by a historical algorithm task in the estimated occupation history records, it is directly used as the historical estimated occupation capacity of the preset graphics card memory. If there are multiple historical estimated occupation capacities of the preset graphics card memory by multiple historical algorithm tasks in the estimated occupation history records, the sum of the historical estimated occupation capacities of the preset graphics card memory by multiple historical algorithm tasks can be used as the historical estimated occupation capacity of the preset graphics card memory.

[0101] 303. Determine a target graphics card from a plurality of preset graphics cards based on a difference between the third capacity and the fourth capacity.

[0102] In the embodiment of the present application, based on the difference between the third capacity and the fourth capacity, idle graphics cards from a plurality of preset graphics cards are screened out, and then a target graphics card is determined from the idle graphics cards.

[0103] In some embodiments of the present application, based on the difference between the third capacity and the fourth capacity, screening out idle graphics cards from a plurality of preset graphics cards may include: obtaining the difference between the third capacity and the fourth capacity; based on the difference between the third capacity and the fourth capacity and the expected occupied capacity, determining whether each preset graphics card is an idle graphics card, for example, when the difference between the third capacity and the fourth capacity is greater than or equal to the expected occupied capacity, determining that the preset graphics card is an idle graphics card. If the difference between the third capacity and the fourth capacity is less than the expected occupied capacity, determining that the preset graphics card is not an idle graphics card.

[0104] In some embodiments of the present application, determining a target graphics card from idle graphics cards may include: outputting summary information of multiple idle graphics cards, so that a user can select at least one of the idle graphics cards as a target graphics card.

[0105] In some embodiments of the present application, determining a target graphics card from among the idle graphics cards may include: sorting a plurality of idle graphics cards from large to small according to the difference between the third capacity and the fourth capacity to obtain a ranking of the plurality of idle graphics cards; and selecting the first N idle graphics cards from the ranking of the plurality of idle graphics cards as the target graphics card, where N is a positive integer greater than or equal to 1.

[0106] The following is an example of the operation control method of the algorithm task in the embodiment of the present application:

[0107] This example uses the tool "Logical Lock" to avoid program crashes caused by multiple algorithm tasks competing for video memory resources: store the number of one or more graphics cards, total video memory capacity, estimated occupied capacity, and algorithm task number that each algorithm task is about to occupy in the estimated occupation history record, which is used for real-time query before each target algorithm task runs. When the video memory corresponding to the estimated occupied capacity is actually used, delete the associated target running task and estimated occupied capacity from the estimated occupation history record. That is, before the target algorithm task actually uses the video memory resources, an estimated occupied capacity is used to occupy the place, so that when judging whether the new target algorithm task meets the preset task running conditions, the estimated occupied capacity of the previous algorithm task can be taken into account.

[0108] Specifically, before running the target algorithm task, it is necessary to first obtain the available video memory capacity of multiple preset graphics cards in the preset algorithm platform to filter out idle graphics cards from the multiple preset graphics cards, and then select the target graphics card from the idle graphics cards to run the target algorithm task.

[0109] The estimated occupancy history records can be saved in the form of redis cache. By connecting to the redis cache database, the estimated occupancy history records in the redis cache database are read, and then the historical estimated occupancy capacity in the estimated occupancy history records is used to determine the idle graphics card from multiple preset graphics cards. For example, multiple preset graphics cards can be divided into two categories, one is the preset graphics cards that exist in the estimated occupancy history records, and the other is the preset graphics cards that do not exist in the estimated occupancy history records. For the preset graphics cards that exist in the estimated occupancy history records and the preset graphics cards that do not exist in the estimated occupancy history records, the idle graphics card can be determined based on Figure 3 The method in the illustrated embodiment filters out idle graphics cards (if the preset algorithm platform also sets which preset graphics cards are invisible to the current user, these preset graphics cards will also be filtered out and not used as idle graphics cards).

[0110] After determining the idle graphics cards, the first N largest idle cards can be locked as target graphics cards according to the number of graphics cards. Specifically, determine whether the number of graphics cards required for the target algorithm task is less than or equal to the number of idle graphics cards. For example, if the target algorithm task requires 2 graphics cards, but the number of idle graphics cards is 1, then it is determined that the target algorithm task does not meet the preset task running conditions. If the number of graphics cards required for the target algorithm task is less than or equal to the number of idle graphics cards, refer to Figure 3 In the embodiment shown, the first N idle graphics cards are selected as target graphics cards from the ranking of multiple idle graphics cards. Alternatively, after the idle graphics cards are determined, the current user may specify N idle graphics cards as target graphics cards.

[0111] Setting a "logical lock" on the target graphics card means storing the estimated memory capacity of the target graphics card by the target algorithm task as a historical estimated memory capacity of the target graphics card by a historical algorithm task in the estimated memory capacity history record, for use in determining whether the next algorithm task meets the task running conditions. Specifically, if the target graphics card does not exist in the estimated memory capacity history record, the estimated memory capacity of the target graphics card by the target algorithm task can be directly stored in the estimated memory capacity history record. If the target graphics card exists in the estimated memory capacity history record, the target algorithm task is executed according to the historical estimated memory capacity of the target graphics card in the estimated memory capacity history record. Figure 2 In the illustrated embodiment, steps 203 to 204 are performed, and after step 204 is performed, the estimated occupied capacity of the target algorithm task for the target graphics card memory is stored in the estimated occupied history record.

[0112] After setting the "logical lock" successfully, if the target running task meets the conditions for releasing the graphics card memory occupation, the associated target running task and the estimated occupation capacity will be deleted from the estimated occupation history record to release the "logical lock". If the estimated occupation capacity of a graphics card memory in the estimated occupation history record is zero, the record can be deleted directly, indicating that the graphics card has not been set with a "logical lock" by any algorithm task.

[0113] In order to better implement the operation control method of the algorithm task in the embodiment of the present application, on the basis of the operation control method of the algorithm task, the embodiment of the present application also provides an operation control device for the algorithm task, such as Figure 4 As shown, the operation control device 400 of the algorithm task includes:

[0114] A determination unit 401 is used to determine the estimated occupied capacity of the graphics card memory of the target algorithm task to be executed;

[0115] A reading unit 402 is used to obtain a predicted occupation history record, wherein the predicted occupation history record includes a historical predicted occupation capacity of a graphics card memory by a plurality of historical algorithm tasks in operation;

[0116] A detection unit 403, used to detect whether the target algorithm task meets the preset task running conditions based on the estimated occupied capacity and the historical estimated occupied capacity;

[0117] The control unit 404 is used to control the target algorithm task to run if the target algorithm task meets the task running conditions.

[0118] The operation control device for algorithm tasks provided in the embodiment of the present application determines the estimated occupied capacity of the graphics card memory of the target algorithm task to be run, judges whether the target algorithm task meets the preset task running conditions based on the estimated occupied capacity and the historical estimated occupied capacity in the estimated occupied history records, and controls the target algorithm task to run when the task running conditions are met. In this way, under the limitation of the historical occupied capacity, there will be no situation of competing for graphics memory resources between different algorithm tasks, so as to avoid program crashes caused by insufficient graphics memory.

[0119] In some embodiments of the present application, the operation control device 400 of the algorithm task further includes:

[0120] The writing unit is used to associate and store the target algorithm task and the estimated occupied capacity in the estimated occupied history record if the target algorithm task meets the task running conditions, wherein the target algorithm task is taken as a historical algorithm task, and the estimated occupied capacity is taken as a historical estimated occupied capacity.

[0121] In some embodiments of the present application, the detection unit 403 is further configured to:

[0122] Determine a target graphics card from among multiple preset graphics cards of a preset algorithm platform;

[0123] Obtain the available capacity of the video memory of the target graphics card and use it as the first capacity;

[0124] Determine the historical estimated occupation capacity of the target graphics card memory in the estimated occupation history records, and use it as the second capacity;

[0125] Based on the first capacity, the second capacity and the estimated occupied capacity, it is determined whether the target graphics card supports running the target algorithm task, wherein the task running condition includes that the target graphics card supports running the target algorithm task.

[0126] In some embodiments of the present application, the detection unit 403 is further configured to:

[0127] Obtaining a difference between the first capacity and the second capacity;

[0128] Based on the difference and the estimated occupied capacity, determine whether the target graphics card supports running the target algorithm task.

[0129] In some embodiments of the present application, the control unit 404 is further configured to:

[0130] If the target algorithm task meets the task running conditions, the target graphics card is used to control the target algorithm task running.

[0131] In some embodiments of the present application, the writing unit is further used for:

[0132] If the target algorithm task meets the task running conditions, the estimated occupied capacity of the target graphics card memory by the target algorithm task is stored in the estimated occupied history record as a historical estimated occupied capacity of the target graphics card memory by a historical algorithm task.

[0133] In some embodiments of the present application, the detection unit 403 is further configured to:

[0134] Obtain the available capacity of the video memory of each preset graphics card and use it as the third capacity;

[0135] In the estimated occupation history records, the historical estimated occupation capacity of the preset graphics card memory is determined and used as the fourth capacity;

[0136] Based on the difference between the third capacity and the fourth capacity, a target graphics card is determined from a plurality of preset graphics cards.

[0137] In some embodiments of the present application, the detection unit 403 is further configured to:

[0138] For each preset graphics card, detecting whether the estimated occupation history record stores the historical estimated occupation capacity of the preset graphics card memory;

[0139] If the estimated occupation history record stores the historical estimated occupation capacity of the preset graphics card memory, then executing the step of determining the historical estimated occupation capacity of the preset graphics card memory in the estimated occupation history record;

[0140] If the historical estimated occupation capacity of the video memory of the preset graphics card is not stored in the estimated occupation history record, the preset graphics card is used as the target graphics card.

[0141] In some embodiments of the present application, the writing unit is further used for:

[0142] Check whether the target running task meets the preset graphics card memory release conditions;

[0143] If the target running task meets the graphics card memory release condition, the associated target running task and the estimated occupied capacity are deleted from the estimated occupation history record.

[0144] In some embodiments of the present application, the writing unit is further used for:

[0145] A global read-write lock is set on the estimated occupancy history to restrict read and write operations on the estimated occupancy history.

[0146] In some embodiments of the present application, the writing unit is further used for:

[0147] Cancel the global read-write lock to remove restrictions on read and write operations that are expected to consume history.

[0148] In addition to the algorithm task operation control device and method described above, the embodiment of the present application also provides a terminal device, which integrates any algorithm task operation control device provided in the embodiment of the present application. The terminal device can be, for example, a PC, a server, or other device. The terminal device includes:

[0149] one or more processors;

[0150] Memory; and

[0151] One or more applications, wherein the one or more applications are stored in the memory and configured to execute the steps in any embodiment of the operation control method of the above algorithm tasks by the processor.

[0152] The embodiment of the present application also provides a terminal device, which integrates the operation control device of any algorithm task provided in the embodiment of the present application. Figure 5 As shown, it shows a schematic diagram of the structure of the terminal device involved in the embodiment of the present application, specifically:

[0153] The terminal device may include one or more processing core processors 501, one or more computer-readable storage medium storage units 502, a power supply 503, an input unit 504 and other components. Those skilled in the art will appreciate that Figure 5 The terminal device structure shown in the figure does not constitute a limitation on the terminal device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:

[0154] The processor 501 is the control center of the terminal device. It uses various interfaces and lines to connect various parts of the entire terminal device. By running or executing software programs and / or modules stored in the storage unit 502 and calling data stored in the storage unit 502, it executes various functions of the terminal device and processes data, thereby monitoring the terminal device as a whole. Optionally, the processor 501 may include one or more processing cores; preferably, the processor 501 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 501.

[0155] The storage unit 502 can be used to store software programs and modules. The processor 501 executes various functional applications and data processing by running the software programs and modules stored in the storage unit 502. The storage unit 502 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the terminal device, etc. In addition, the storage unit 502 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the storage unit 502 may also include a memory controller to provide the processor 501 with access to the storage unit 502.

[0156] The terminal device also includes a power supply 503 for supplying power to each component. Preferably, the power supply 503 can be logically connected to the processor 501 through a power management system, so as to manage charging, discharging, power consumption management and other functions through the power management system. The power supply 503 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators and other arbitrary components.

[0157] The terminal device may further include an input unit 504, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0158] Although not shown, the terminal device may further include a display unit, etc., which will not be described in detail herein. Specifically, in the embodiment of the present application, the processor 501 in the terminal device will load the executable file corresponding to the process of one or more application programs into the storage unit 502 according to the following instructions, and the processor 501 will run the application program stored in the storage unit 502, thereby realizing various functions, such as:

[0159] Determine the estimated occupied capacity of the graphics card memory by the target algorithm task to be run; obtain the estimated occupied historical record, which includes the historical estimated occupied capacity of the graphics card memory by multiple historical algorithm tasks in operation; based on the estimated occupied capacity and the historical estimated occupied capacity, detect whether the target algorithm task meets the preset task running conditions; if the target algorithm task meets the task running conditions, control the target algorithm task to run.

[0160] To this end, an embodiment of the present application provides a computer-readable storage medium, which may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc. The storage medium stores multiple instructions, which can be loaded by a processor to execute the steps in the operation control method of any algorithm task provided in the embodiment of the present application. For example, the instruction can execute the following steps:

[0161] Determine the estimated occupied capacity of the graphics card memory by the target algorithm task to be run; obtain the estimated occupied historical record, which includes the historical estimated occupied capacity of the graphics card memory by multiple historical algorithm tasks in operation; based on the estimated occupied capacity and the historical estimated occupied capacity, detect whether the target algorithm task meets the preset task running conditions; if the target algorithm task meets the task running conditions, control the target algorithm task to run.

[0162] The embodiment of the present application provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the terminal device reads the computer instruction from the computer-readable storage medium and executes the computer instruction, so that the terminal device executes to implement the operation control method of the algorithm task as described in any one of the above.

[0163] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0164] The above is a detailed introduction to the operation control method, device and computer-readable storage medium of an algorithm task provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for controlling the operation of an algorithm task, characterized in that: The operation control method of the algorithm task includes: Determine the estimated occupied capacity of the graphics card memory by the target algorithm task to be run; Acquire estimated occupation history records, wherein the estimated occupation history records include historical estimated occupation capacities of a graphics card memory by a plurality of historical algorithm tasks in operation; Based on the estimated occupied capacity and the historical estimated occupied capacity, detecting whether the target algorithm task meets a preset task running condition; If the target algorithm task meets the task running condition, the target algorithm task is controlled to run.

2. The operation control method of the algorithm task according to claim 1, characterized in that: After detecting whether the target algorithm task meets the preset task running conditions, the method further includes: If the target algorithm task meets the task running conditions, the target algorithm task and the expected occupied capacity are associated and stored in the expected occupancy history record, wherein the target algorithm task is recorded as a historical algorithm task, and the expected occupied capacity is recorded as a historical expected occupied capacity.

3. The operation control method of the algorithm task according to claim 1, characterized in that: The detecting whether the target algorithm task meets a preset task running condition based on the estimated occupied capacity and the historical estimated occupied capacity includes: Determine a target graphics card from among multiple preset graphics cards of a preset algorithm platform; Obtaining the available capacity of the video memory of the target graphics card and using it as the first capacity; Determine the historical estimated occupation capacity of the target graphics card memory in the estimated occupation history record and use it as the second capacity; Based on the first capacity, the second capacity and the estimated occupied capacity, determine whether the target graphics card supports running the target algorithm task, wherein the task running condition includes that the target graphics card supports running the target algorithm task.

4. The operation control method of the algorithm task as claimed in claim 3, characterized in that: The determining, based on the first capacity, the second capacity, and the estimated occupied capacity, whether the target graphics card supports running the target algorithm task includes: obtaining a difference between the first capacity and the second capacity; Based on the difference and the estimated occupied capacity, it is determined whether the target graphics card supports running the target algorithm task.

5. The operation control method of the algorithm task as claimed in claim 3, characterized in that: If the target algorithm task satisfies the task running condition, controlling the target algorithm task to run includes: If the target algorithm task meets the task running condition, then using the target graphics card to control the target algorithm task to run; After detecting whether the target algorithm task meets the preset task running conditions, the method further includes: If the target algorithm task meets the task running condition, the estimated occupied capacity of the target graphics card memory by the target algorithm task is stored in the estimated occupation history record as a historical estimated occupied capacity of the target graphics card memory by a historical algorithm task.

6. The operation control method of the algorithm task as claimed in claim 3, characterized in that: The step of determining a target graphics card from among a plurality of preset graphics cards of a preset algorithm platform comprises: Obtaining the available capacity of the video memory of each of the preset graphics cards and using it as the third capacity; Determine the historical estimated occupation capacity of the preset graphics card memory in the estimated occupation history records, and use it as the fourth capacity; Based on the difference between the third capacity and the fourth capacity, the target graphics card is determined from a plurality of preset graphics cards.

7. The operation control method of the algorithm task according to claim 6, characterized in that: After obtaining the available capacity of the video memory of each preset graphics card and using it as the third capacity, the method further includes: For each of the preset graphics cards, detecting whether the estimated occupation history records store a historical estimated occupation capacity of the graphics memory of the preset graphics card; If the estimated occupation history record stores the historical estimated occupation capacity of the preset graphics card memory, then executing the step of determining the historical estimated occupation capacity of the preset graphics card memory in the estimated occupation history record; If the historical estimated occupation capacity of the video memory of the preset graphics card is not stored in the estimated occupation history record, the preset graphics card is used as the target graphics card.

8. The operation control method of the algorithm task as claimed in claim 2, characterized in that: After the target algorithm task and the estimated occupied capacity are stored in association with each other in the estimated occupied history record, the method further includes: Detecting whether the target running task meets the preset graphics card memory release condition; If the target running task satisfies the graphics card memory de-occupancy condition, the associated target running task and the estimated occupied capacity are deleted from the estimated occupation history record.

9. The operation control method of the algorithm task according to any one of claims 1 to 8, characterized in that: Before determining the estimated occupied capacity of the graphics card memory of the target algorithm task to be executed, the method further includes: A global read-write lock is set for the estimated occupancy history record to restrict read and write operations on the estimated occupancy history record.

10. A terminal device, characterized in that: The terminal device comprises: one or more processors; Memory; and One or more application programs, wherein one or more of the application programs are stored in the memory and configured to be executed by the processor to implement the operation control method of the algorithm task described in any one of claims 1 to 9.

11. A computer-readable storage medium, characterized in that: A software program is stored thereon, and the software program is loaded by a processor to execute the steps in the operation control method of the algorithm task described in any one of claims 1 to 9.