Program debugging method, device and computer equipment
By obtaining the executable programs generated by general-purpose processors and artificial intelligence processors, and using preset debugging tools to simultaneously debug, the problem of program debugging complexity in heterogeneous chip systems is solved, and debugging efficiency and accuracy are improved.
Patent Information
- Application Number
- CN201910869011.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-09-12
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2040-01-11
AI Technical Summary
In heterogeneous chip systems, program debugging is complex, and the prior art requires repeated modification of code and compilation, which is inefficient and prone to errors. Especially due to the different data accuracy of different data types, the power consumption and running time generated by the calculation are increased.
By obtaining two executable programs generated by a general-purpose processor and an artificial intelligence processor, the debugging process is simplified by using preset debugging tools to execute and debug simultaneously without manually switching the debugging interface.
It realizes efficient debugging of executable programs of artificial intelligence processors, improves debugging efficiency, simplifies operational processes, and reduces the occurrence of manual errors.
Smart Images

Figure CN112486799B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a program debugging method, device and computer equipment. Background Art
[0002] Since the data types processed by heterogeneous chips may be different from those of general-purpose CPUs, it is very labor-intensive to add printing and debugging tools. The data precision of different data types is different. The greater the data precision in heterogeneous systems, the greater the power consumption and running time generated by the calculation. The operation of low-precision data can bring huge benefits to the program's running performance and the power consumption generated by the operation. In some calculations, low-precision calculations can greatly improve the running speed under the premise of smaller running results. However, debugging programs in heterogeneous systems is more complicated. In the prior art, debugging using methods such as printing requires repeated code modification and compilation, and requires manual review or manual script writing for calculation accuracy, which is inefficient and prone to errors. Summary of the invention
[0003] The embodiments of the present application provide a program debugging method, apparatus, computer device and storage medium, which can simultaneously execute two executable programs generated by different processors through a preset debugging tool, and then debug the executable program corresponding to the artificial intelligence processor.
[0004] In a first aspect, an embodiment of the present application provides a program debugging method, the method comprising:
[0005] A first executable program and a second executable program are obtained, wherein the first executable program and the second executable program are programs compiled from codes to be debugged.
[0006] In a second aspect, an embodiment of the present application provides a program debugging device, which may include:
[0007] An acquiring unit, configured to acquire a first executable program and a second executable program, wherein the first executable program and the second executable program are programs compiled from codes to be debugged;
[0008] A debugging unit is used to debug the first executable program and the second executable program based on a first debugging operation on the first executable program or the second executable program.
[0009] In a third aspect, an embodiment of the present application provides a computer device, comprising a processor and a memory, wherein the processor and the memory are interconnected, wherein the processor comprises a general-purpose processor and an artificial intelligence processor, and the memory is used to store a computer program that supports the computer device to execute the above-mentioned method, and the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method of the above-mentioned first aspect.
[0010] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the method of the first aspect above.
[0011] In a fifth aspect, an embodiment of the present application provides a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the method of the first aspect.
[0012] By implementing the embodiment of the present application, the debugging tool can obtain the first executable program and the second executable program, and based on the first debugging operation on the first executable program or the second executable program, debug the first executable program and the second executable program. In this way, the two executable programs generated by different processors can be executed simultaneously through the preset debugging tool, and then the executable program corresponding to the artificial intelligence processor can be debugged; the debugging method of the embodiment of the present application can debug multiple programs at the same time without the need for technicians to manually switch the debugging interface. The debugging method is simple and easy to use. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required for describing the embodiments.
[0014] Figure 1 is a structural schematic diagram of a computer device provided in an embodiment of the present application;
[0015] Figure 2A It is a flowchart of a program debugging method provided by an embodiment of the present application;
[0016] Figure 2B is a schematic flow chart of steps for debugging the first executable program and the second executable program based on a first debugging operation provided by an embodiment of the present application;
[0017] Figure 2C It is a schematic flow chart of a step of obtaining at least one first variable value in a first executable program and at least one second variable value in a second executable program provided by an embodiment of the present application;
[0018] Figure 2D It is another step flow diagram of obtaining at least one first variable value in a first executable program and at least one second variable value in a second executable program provided by an embodiment of the present application;
[0019] Figure 2EIt is a schematic flow chart of a step of determining the running result of a second executable program according to at least one first variable value and at least one second variable value provided by an embodiment of the present application;
[0020] Figure 3 It is a flowchart of another program debugging method disclosed in an embodiment of the present application;
[0021] Figure 4 It is a flowchart of another program debugging method disclosed in an embodiment of the present application;
[0022] Figure 5 It is a structural diagram of a program debugging device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0024] It should be understood that the terms "first", "second", etc. in the claims, specifications and drawings of the present disclosure are used to distinguish different objects rather than to describe a specific order. The terms "include" and "comprise" used in the specifications and claims of the present disclosure indicate the presence of the described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their collections.
[0025] It should also be understood that the terms used in this disclosure are only for the purpose of describing specific embodiments and are not intended to limit the disclosure. As used in this disclosure and claims, the singular forms of "a", "an", and "the" are intended to include the plural forms unless the context clearly indicates otherwise. It should also be further understood that the term "and / or" used in this disclosure and claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations.
[0026] As used in this specification and claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0027] See also Figure 1 , is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 1As shown, the computer device 10 may include a general processor 101, a memory 102, a communication bus 103, a communication interface 104 and an artificial intelligence processor 105, wherein the general processor 101 and the artificial intelligence processor 105 are connected to the memory 102 and the communication interface 103 via the communication bus 103.
[0028] The general processor 101 may be a central processing unit (CPU), or other general processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general processor may be a microprocessor or the general processor 101 may be any conventional processor, etc.
[0029] The general processor 101 may also be an integrated circuit chip with signal processing capability. In the implementation process, each step of the resource configuration method of the present application may be completed by hardware integrated logic circuits in the general processor 101 or software instructions.
[0030] The memory 102 may be a read-only memory (ROM), a random access memory (RAM) or other memory. In the embodiment of the present application, the memory 102 is used to store data and various software programs, such as the target program running during the performance analysis process in the embodiment of the present application.
[0031] Optionally, in the embodiment of the present application, the memory may include a physical device for storing information, which is usually to digitize the information and then store it in a medium using electrical, magnetic or optical methods. The memory described in this embodiment may also include: a device that stores information using electrical energy, such as RAM, ROM, etc.; a device that stores information using magnetic energy, such as a hard disk, a floppy disk, a magnetic tape, a magnetic core memory, a magnetic bubble memory, a USB flash drive; a device that stores information using optical means, such as a CD or a DVD. Of course, there are other types of memory, such as quantum memory, graphene memory, etc.
[0032] The communication interface 104 uses a transceiver device such as, but not limited to, a transceiver to implement communication between the computer device 10 and other devices or a communication network.
[0033] The artificial intelligence processor 105 can be mounted on a general-purpose processor (such as a host CPU) as a coprocessor, and the general-purpose processor assigns tasks to it. In practical applications, the artificial intelligence processor 105 can be an application-specific integrated circuit (ASIC), which can implement one or more operations, such as operations related to artificial neural networks. In other embodiments, the artificial intelligence processor 105 can be replaced by other processors such as a GPU or a DSP, which is only used as an example here and is not intended to limit this application.
[0034] It should be understood that the computer device 10 is only an example provided in the embodiment of the present application, and the computer device 10 may have more or fewer components than those shown, may combine two or more components, or may have different configurations of components.
[0035] like Figure 2A As shown, Figure 2A A flowchart of a program debugging method provided in an embodiment of the present application is provided. The method can be applied to a debugging tool that can be run on a general-purpose processor such as a CPU to implement corresponding debugging functions. Optionally, the debugging tool can be a debugging tool such as GDB, which is not specifically limited here. The method includes:
[0036] 201. A debugging tool obtains a first executable program and a second executable program, wherein the first executable program and the second executable program are programs compiled from codes to be debugged.
[0037] In the embodiment of the present application, the computer device may first obtain the code to be debugged, and then compile the code to be debugged through a debugging tool to obtain a first executable program and a second executable program.
[0038] The above-mentioned code to be debugged may be a code written for a dedicated processor in a high-level programming language (e.g., C language). Optionally, the dedicated processor may be an artificial intelligence processor, a GPU, or a TPU, etc., which is not specifically limited here. Optionally, the code to be debugged may also be a code written for a general-purpose processor in a high-level programming language.
[0039] Optionally, the first executable program is an executable program corresponding to the general processor obtained by compiling the code to be debugged, and the second executable program is an executable program corresponding to a processor such as an artificial intelligence processor, a GPU or a TPU obtained by compiling the code to be debugged. In the embodiment of the present application, the debugging tool can compile the code to be debugged through different compilation and linking options to obtain the first executable program corresponding to the general processor and the second executable program corresponding to the processor such as an artificial intelligence processor, a GPU or a TPU.
[0040] Optionally, the first executable program and the second executable program may be executable programs corresponding to the same processor obtained after compiling the code to be debugged. For example, the first executable program and the second executable program are both executable programs corresponding to an artificial intelligence processor. Alternatively, the first executable program and the second executable program are both executable programs corresponding to a GPU or a TPU. The first executable program and the second executable program may have different precisions, so that the execution precision debugging of the program can be implemented through the debugging tool.
[0041] Optionally, the first data precision corresponding to the first executable program may be greater than the second data precision corresponding to the second executable program. For example, the first executable program may implement operations on 32-bit floating-point data, and the second executable program may implement operations on 8-bit fixed-point data.
[0042] Optionally, the first executable program generated by the general processor may be a program that meets the accuracy requirements, and the accuracy debugging of the first executable program may be debugged by the simulator described below, or may be debugged by the debugging tool GDB (GNU Debugger). Therefore, the debugging tool may debug the second executable program according to the obtained first executable program, so that the running result of the second executable program meets the preset requirements.
[0043] Optionally, a simulator or compiler running in a computer device can obtain the above-mentioned code to be debugged, and compile the above-mentioned code to be debugged into a first executable program and a second executable program according to the preset compilation link options in the simulator or compiler. Specifically, the above-mentioned simulator can compile the code to be debugged into different versions based on the code to be debugged by macro definition, so as to obtain the above-mentioned first executable program and second executable program. In other embodiments, the compilation process of the first executable program and the second executable program can also be obtained by other means, which are not specifically limited here.
[0044] 202. The debugging tool debugs the first executable program and the second executable program based on a first debugging operation on the first executable program or the second executable program.
[0045] Among them, the above-mentioned debugging tool can be a pre-set debugging tool, and the debugging tool can be, for example, a GDB debugger. The GDB debugger can implement operations for one program on two programs at the same time. For example, when a breakpoint is inserted in one of the programs, the GDB debugger can automatically insert a breakpoint at the corresponding position of the other program.
[0046] In an embodiment of the present application, after receiving a first debugging operation for the first executable program or the second executable program, the debugging tool can debug the first executable program and the second executable program at the same time according to the first debugging operation, that is, the same first debugging operation can be effective for the first executable program and the second executable program at the same time, thereby controlling the synchronous debugging of the first executable program and the second executable program more conveniently and intelligently.
[0047] It can be seen that the first debugging operation for the first executable program or the second executable program can be implemented through the debugging tool, and it can act on the first executable program and the second executable program at the same time. The two executable programs can be debugged at the same time through the debugging tool, thereby realizing debugging of the two programs with faster operations, without the need for printing, manual viewing or script comparison, thereby improving debugging efficiency.
[0048] Optionally, in the above step 202, the first debugging operation includes an inserted checkpoint; the debugging tool debugging the first executable program and the second executable program based on the first debugging operation for the first executable program or the second executable program may include the following steps:
[0049] 21. The debugging tool obtains at least one first variable value in the first executable program and at least one second variable value in the second executable program according to the first checkpoint inserted into the first executable program or the second executable program, wherein the at least one first variable value corresponds to the at least one second variable value one by one;
[0050] 22. The debugging tool determines the running result of the second executable program according to the at least one first variable value and the at least one second variable value;
[0051] 23. When the running result of the second executable program does not meet the preset condition, returning to execute the debugging tool based on the first debugging operation on the first executable program or the second executable program, debugging the first executable program and the second executable program until the running result of the second executable program meets the preset condition.
[0052] See also Figure 2B , Figure 2BA schematic flow chart of the steps of debugging the first executable program and the second executable program based on a first debugging operation provided for an embodiment of the present application, wherein the first debugging operation may be an operation input by a debugger, specifically, during the debugging process, the debugging tool simultaneously runs the first executable program and the second executable program, and during the running of the first executable program and the second executable program, the computer device may receive a checkpoint inserted by the debugger. Optionally, the first debugging operation may also be an operation pre-set in the debugging process, specifically, the computer device may pre-set a checkpoint for a program node that needs to be checked in the program to be debugged, and a first debugging operation of inserting a checkpoint, so that during the debugging process, when running to a program node where the first checkpoint is set, the first debugging operation may be executed, and a checkpoint may be inserted through the first debugging operation.
[0053] In an embodiment of the present application, at least one first variable value in the first executable program and at least one second variable value in the second executable program can be obtained based on a first checkpoint inserted into the first executable program or the second executable program. In this way, at least one first variable value and at least one second variable value that correspond one to one can be obtained for the first executable program or the second executable program through a first debugging operation.
[0054] Among them, the above-mentioned variable values may include data that need to be calculated in the deep learning neural network, specifically including weights, output data of each layer of the neural network, gradient values of each layer of the neural network (the gradient values may include weight gradients and input data gradients), etc.
[0055] For example, the above variable value can be a weight. In the neural network operation, the weight in the neural network can be updated to obtain the updated weight, and a new operation is performed according to the updated weight. Therefore, by continuously updating the weight, the neural network can be trained to make the operation result of the neural network more accurate. In the embodiment of the present application, in the first executable program and the second executable program generated by the debugged code, the data types of the same weight in the first executable program and the second executable program may be different. For example, the same weight is represented as 16-bit floating-point data in the first executable program and represented as 8-bit fixed-point data in the second executable program. Therefore, through a first debugging operation, for the value of the same variable, the value in the first executable program and the value in the second executable program can be obtained, and then, the precision difference between the data of the first executable program and the data of the second executable program can be determined by at least one first variable value and at least one second variable value. When the running result of the second executable program does not meet the preset condition, the execution of the first executable program and the second executable program is suspended. Further, the debugging tool can be returned to execute the first debugging operation on the first executable program or the second executable program, debugging the first executable program and the second executable program until the running result of the second executable program meets the preset condition. Optionally, the debugging process of the gradient value and the output data is similar to the debugging process of the weight value, and the details can be found in the above description, which will not be repeated here.
[0056] Optionally, the operation result includes precision loss, and the above step 202 may further include the following steps:
[0057] If the precision loss of the second executable program does not meet the preset condition, the execution of the first executable program and the second executable program is suspended, and then the debugging tool is returned to debug the first executable program and the second executable program based on the first debugging operation for the first executable program or the second executable program.
[0058] Among them, the debugging tool can determine whether the precision loss of the second executable program meets the preset conditions according to at least one first variable value and at least one second variable value, wherein the second data precision of the second executable program is lower than the first data precision of the first executable program. If the precision loss of the second executable program does not meet the preset conditions, it indicates that the precision error of the second executable program is large. Therefore, the debugging tool can debug the second executable program when the precision loss of the second executable program does not meet the preset conditions. Specifically, the debugging tool can suspend the execution of the first executable program and the second executable program, receive a first debugging operation for the second executable program, debug the second executable program according to the second debugging operation, and after debugging, return to execute the debugging of the first executable program and the second executable program based on the first debugging operation for the first executable program or the second executable program by the debugging tool.
[0059] Among them, the first debugging operation can be an operation input by the debugger. Specifically, the computer device can receive the first debugging operation input by the debugger. Or, it can also be an operation pre-set in the debugging process. Specifically, the computer device can pre-set the first debugging operation for the precision loss of the second executable program not meeting the preset conditions. Thus, after determining that the precision loss of the second executable program does not meet the preset conditions, the first debugging operation can be triggered, and the second executable program can be debugged according to the first debugging operation.
[0060] Optionally, in the above step 21, obtaining at least one first variable value in the first executable program and at least one second variable value in the second executable program according to the first checkpoint inserted into the first executable program or the second executable program may include the following steps A1 to A3:
[0061] A1. The debugging tool obtains at least one first variable value in the first executable program according to the first checkpoint inserted into the first executable program;
[0062] A2. The debugging tool obtains at least one second variable value in the second executable program according to the first checkpoint inserted in the first executable program and the preset association relationship between the first executable program and the second executable program; or
[0063] A3. The debugging tool determines a second checkpoint for the second executable program according to the first checkpoint; and obtains at least one second variable value in the second executable program according to the second checkpoint.
[0064] See also Figure 2C , Figure 2CA flowchart diagram of the steps for obtaining at least one first variable value in a first executable program and at least one second variable value in a second executable program is provided for an embodiment of the present application. The computer device can obtain first running data of the first executable program running to the first checkpoint inserted in the first executable program, and obtain at least one first variable value in the first executable program from the first running data.
[0065] The debugging tool may pre-set a preset association relationship between the first executable program and the second executable program, and the preset association relationship is a semantic association relationship. Specifically, after obtaining the first checkpoint inserted in the first executable program, the first code position where the first checkpoint is located in the first executable program may be determined, and then the second code position in the second executable program that is semantically the same as the first code position may be determined, and the second running data of the second executable program running to the second code position may be obtained, and finally, at least one second variable value in the second executable program may be obtained from the second running data.
[0066] Alternatively, the debugging tool may determine a second checkpoint for the second executable program based on the first checkpoint, then obtain the second running data of the second executable program running to the second checkpoint, and obtain at least one second variable value in the second executable program from the second running data. Specifically, after obtaining the first checkpoint inserted in the first executable program, the debugging tool may determine the first code position where the first checkpoint is located in the first executable program, and then determine the second code position in the second executable program that has the same semantics as the first code position, and automatically insert the second checkpoint near the second code position accordingly. In this way, when the second executable program runs to the second checkpoint, the debugging tool can obtain the second running data and obtain at least one second variable value in the second executable program from the second running data.
[0067] Optionally, in the above step 21, obtaining at least one first variable value in the first executable program and at least one second variable value in the second executable program according to the first checkpoint inserted into the first executable program or the second executable program may include the following steps A4 to A6:
[0068] A4. The debugging tool obtains at least one second variable value in the second executable program according to the first checkpoint inserted into the second executable program;
[0069] A5. The debugging tool obtains at least one first variable value in the first executable program according to the first checkpoint inserted in the second executable program and the preset association relationship between the first executable program and the second executable program; or
[0070] A6. The debugging tool determines a second checkpoint for the first executable program according to the first checkpoint; and obtains at least one first variable value in the first executable program according to the second checkpoint.
[0071] See also Figure 2D , Figure 2D Another step flow diagram for obtaining at least one first variable value in a first executable program and at least one second variable value in a second executable program is provided for an embodiment of the present application, wherein the debugging tool can obtain second running data of the second executable program running to the first checkpoint inserted in the second executable program, and obtain at least one second variable value in the second executable program from the second running data.
[0072] Among them, the debugging tool can pre-set a preset association relationship between the first executable program and the second executable program, and the preset association relationship is a semantic association relationship. Specifically, after obtaining the first checkpoint inserted in the second executable program, the debugging tool can determine the second code position corresponding to the first checkpoint in the second executable program. Then, the debugging tool can determine the first code position in the first executable program that is semantically the same as the second code position, thereby obtaining the first running data of the first executable program running to the first code position. Finally, the debugging tool obtains at least one first variable value in the first executable program from the first running data.
[0073] Alternatively, the debugging tool may determine a second checkpoint for the first executable program based on the first checkpoint, then obtain first running data of the first executable program running to the second checkpoint, and obtain at least one first variable value in the first executable program from the first running data.
[0074] It can be seen that the debugging tool can obtain at least one first variable value in the first executable program and at least one second variable value in the second executable program according to the first checkpoint inserted into the first executable program or the second executable program. Furthermore, it can determine whether the precision loss of the second executable program meets the preset conditions according to the at least one first variable value and the at least one second variable value. In this way, the synchronous debugging of the first executable program and the second executable program can be controlled more conveniently and intelligently through a relatively simple first debugging operation.
[0075] Optionally, in the above step 22, determining the running result of the second executable program according to the at least one first variable value and the at least one second variable value may include the following steps:
[0076] B1. The debugging tool determines the difference between each first variable value and the corresponding second variable value in the at least one first variable value to obtain a plurality of difference values;
[0077] B2. If there is a difference greater than the preset error threshold among the multiple differences, determining that the precision loss of the second executable program does not meet a preset condition;
[0078] B3. If the multiple differences are all smaller than or equal to the difference of the preset error threshold, it is determined that the precision loss of the second executable program meets the preset condition.
[0079] See also Figure 2E , Figure 2E A schematic flow chart of the steps for determining the running result of a second executable program according to at least one first variable value and at least one second variable value is provided for an embodiment of the present application, wherein the debugging tool can determine the difference between each first variable value and the corresponding second variable value in the at least one first variable value, and if the difference is greater than a preset error threshold, it can be determined that the precision loss of the second executable program does not meet the preset conditions; if the difference between each first variable value and the corresponding second variable value in the at least one first variable value is determined, and after obtaining multiple differences, the multiple differences are less than or equal to the preset error threshold, it can be determined that the precision loss of the second executable program meets the preset conditions.
[0080] Optionally, in the embodiment of the present application, after executing step 22, the following steps may also be included:
[0081] If the precision loss of the second executable program meets the preset condition, the first executable program and the second executable program continue to be executed.
[0082] If the precision loss of the second executable program meets the preset condition, it indicates that the first debugging operation is debugged, the part between the first detection points in the second executable program runs correctly, and the first executable program and the second executable program can continue to be executed.
[0083] It can be seen that the technical solution provided by the present application is that the computer device obtains the code to be debugged, generates a first executable program corresponding to the general processor according to the code to be debugged, and generates a second executable program corresponding to the artificial intelligence processor according to the code to be debugged, and debugs the first executable program and the second executable program based on the first debugging operation for the first executable program or the second executable program through the debugging tool. In this way, the two executable programs can be debugged at the same time through the debugging tool, thereby realizing debugging of the two programs with faster operations, without the need for printing, manual viewing or script comparison, thereby improving debugging efficiency.
[0084] like Figure 3 As shown, Figure 3 A flowchart of another program debugging method provided in an embodiment of the present application is used in a debugging tool, which can be run on a computer device to implement the function of debugging the code to be debugged, etc. The debugging tool can be a debugging tool such as GDB. The embodiment of the present application takes a heterogeneous system formed by an artificial intelligence processor and a general processor as an example to illustrate the working process of the GDB debugging tool. Specifically, the method includes:
[0085] 301. The debugging tool obtains a first executable program and a second executable program, wherein the first executable program is an executable program obtained by compiling the code to be debugged and corresponding to a general-purpose processor, and the second executable program is an executable program obtained by compiling the code to be debugged and corresponding to an artificial intelligence processor.
[0086] The specific implementation process of step 301 can be referred to Figure 2A The corresponding description in the method shown will not be repeated here.
[0087] 302. The debugging tool obtains at least one first variable value in the first executable program and at least one second variable value in the second executable program according to the first checkpoint inserted into the first executable program or the second executable program, and the at least one first variable value corresponds to the at least one second variable value one by one.
[0088] 303. Determine a running result of the second executable program according to the at least one first variable value and the at least one second variable value.
[0089] 304. When the running result of the second executable program does not meet the preset condition, return to executing by using a debugging tool based on the first debugging operation on the first executable program or the second executable program, debugging the first executable program and the second executable program until the running result of the second executable program meets the preset condition.
[0090] In the debugging process, the debugging tool can run the first executable program and the second executable program at the same time, and in the process of running the first executable program and the second executable program, the debugging tool can receive the checkpoints inserted by the debugger. Optionally, the debugging tool can pre-set checkpoints for program nodes that need to be checked in the program to be debugged, and a first debugging operation of inserting the checkpoints, so that in the debugging process, the first executable program and the second executable program can be run at the same time, and when the program node with the first checkpoint set is run, the first debugging operation can be executed, and the checkpoint can be inserted through the first debugging operation.
[0091] In an embodiment of the present application, the debugging tool can obtain at least one first variable value in the first executable program and at least one second variable value in the second executable program based on a first checkpoint inserted into the first executable program or the second executable program. In this way, through a first debugging operation, at least one first variable value and at least one second variable value that correspond one to one can be obtained for the first executable program or the second executable program.
[0092] Further, the debugging tool can determine whether the running result of the second executable program meets the preset conditions based on at least one first variable value and at least one second variable value. The running result may be the precision loss of the second executable program, wherein the second data precision of the second executable program is lower than the first data precision of the first executable program. If the precision loss of the second executable program does not meet the preset conditions, it indicates that the precision error of the second executable program is large. Therefore, when the precision loss of the second executable program does not meet the preset conditions, the second executable program can be debugged. Specifically, the execution of the first executable program and the second executable program can be suspended, a second debugging operation for the second executable program can be received, and the second executable program can be debugged according to the second debugging operation. After debugging, the execution of the first executable program and the second executable program based on the first debugging operation for the first executable program or the second executable program by the debugging tool is returned to be debugged.
[0093] Among them, the second debugging operation can be an operation input by the debugger. Specifically, the computer device can receive the second debugging operation input by the debugger. Or, it can also be an operation pre-set in the debugging process. Specifically, the computer device can pre-set the second debugging operation for the precision loss of the second executable program that does not meet the preset conditions. Thus, after determining that the precision loss of the second executable program does not meet the preset conditions, the second debugging operation can be triggered, and the second executable program can be debugged according to the second debugging operation.
[0094] It can be seen that the technical solution provided by the present application is that the computer device obtains the code to be debugged, generates a first executable program corresponding to the general processor according to the code to be debugged, and generates a second executable program corresponding to the artificial intelligence processor according to the code to be debugged, and obtains at least one first variable value in the first executable program and at least one second variable value in the second executable program according to the first checkpoint inserted in the first executable program or the second executable program through the debugging tool, and determines whether the running result of the second executable program meets the preset condition according to the at least one first variable value and the at least one second variable value; if the running result of the second executable program does not meet the preset condition, it returns to execute the debugging operation based on the first debugging operation for the first executable program or the second executable program through the debugging tool, and debugs the first executable program and the second executable program. In this way, the two executable programs are debugged at the same time through the debugging tool, and the synchronous debugging of the first executable program and the second executable program is controlled more conveniently and intelligently, so as to realize debugging of the two programs with faster operations, without the need for printing, manual viewing or script comparison, thereby improving debugging efficiency.
[0095] like Figure 4 As shown, Figure 4 This is a flowchart of another program debugging method provided in an embodiment of the present application. The present application embodiment takes a heterogeneous system formed by an artificial intelligence processor and a general-purpose processor as an example to illustrate the working process of the GDB debugging tool. The method includes:
[0096] 401. The debugging tool obtains a first executable program and a second executable program, wherein the first executable program is an executable program obtained by compiling the code to be debugged and corresponding to a general-purpose processor, the second executable program is an executable program obtained by compiling the code to be debugged and corresponding to an artificial intelligence processor, and a first data precision corresponding to the first executable program is greater than a second data precision corresponding to the second executable program.
[0097] 402. The debugging tool obtains at least one first variable value in the first executable program according to a first checkpoint inserted into the first executable program.
[0098] The specific implementation process of the above steps 401-402 can be referred to Figure 2A The corresponding description in the method shown will not be repeated here.
[0099] 403. The debugging tool obtains at least one second variable value in the second executable program according to the first checkpoint inserted in the first executable program and the preset association relationship between the first executable program and the second executable program; or, determines a second checkpoint for the second executable program according to the first checkpoint; obtains at least one second variable value in the second executable program according to the second checkpoint, and the at least one first variable value corresponds to the at least one second variable value one by one.
[0100] 404. The debugging tool determines whether the precision loss of the second executable program meets a preset condition according to the at least one first variable value and the at least one second variable value.
[0101] 405. If the precision loss of the second executable program does not meet a preset condition, suspend the execution of the first executable program and the second executable program, receive a second debugging operation for the second executable program, debug the second executable program according to the second debugging operation, and then return to executing the debugging tool based on the first debugging operation for the first executable program or the second executable program to debug the first executable program and the second executable program.
[0102] The debugging tool may obtain first running data of the first executable program running to the first checkpoint according to the first checkpoint inserted in the first executable program, and obtain at least one first variable value in the first executable program from the first running data.
[0103] Among them, the debugging tool can pre-set a preset association relationship between the first executable program and the second executable program, and the preset association relationship is a semantic association relationship. Specifically, after obtaining the first checkpoint inserted in the first executable program, the debugging tool can determine the first code position corresponding to the first checkpoint in the first executable program. Then, the debugging tool can determine the second code position in the second executable program that is semantically the same as the first code position, obtain the second running data of the second executable program running to the second code position, and finally, obtain at least one second variable value in the second executable program from the second running data.
[0104] Alternatively, the debugging tool may determine a second checkpoint for the second executable program based on the first checkpoint, then obtain second running data of the second executable program running to the second checkpoint, and obtain at least one second variable value in the second executable program from the second running data.
[0105] It can be seen that the technical solution provided by the present application is that the computer device obtains the code to be debugged, generates a first executable program corresponding to the general processor according to the code to be debugged, and generates a second executable program corresponding to the artificial intelligence processor according to the code to be debugged, obtains at least one first variable value in the first executable program according to the first checkpoint inserted in the first executable program, obtains at least one second variable value in the second executable program according to the first checkpoint inserted in the first executable program and the preset association relationship between the first executable program and the second executable program; or determines a second checkpoint for the second executable program according to the first checkpoint; obtains at least one second variable value in the second executable program according to the second checkpoint, and determines the second variable value according to the at least one first variable value and the at least one second variable value. Whether the precision loss of the second executable program meets the preset condition; if the precision loss of the second executable program does not meet the preset condition, suspend the execution of the first executable program and the second executable program, receive the second debugging operation for the second executable program, debug the second executable program according to the second debugging operation, and then return to execute the debugging tool based on the first debugging operation for the first executable program or the second executable program to debug the first executable program and the second executable program. In this way, the two executable programs with different precisions can be debugged at the same time through the debugging tool, and the synchronous debugging of the first executable program and the second executable program can be controlled more conveniently and intelligently, so as to realize debugging of two programs with different precisions with faster operation, without the need for printing, manual viewing or script comparison, thereby improving debugging efficiency.
[0106] It should be clear that when the first executable program and the second executable program are two executable programs corresponding to the same processor, and the first executable program and the second executable program have different execution precisions, the precision debugging process of the debugging tool for these two executable programs is basically the same as the precision debugging process of the above embodiment. For details, please refer to the above description and will not be repeated here.
[0107] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should know that the present disclosure is not limited by the order of the actions described, because according to the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present disclosure.
[0108] It should be further explained that although Figure 2A-Figure 4The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2A-Figure 4 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0109] The program debugging device provided by this application is introduced below.
[0110] See also Figure 5 , Figure 5 500 is a schematic diagram of a program debugging device provided in an embodiment of the present application. The debugging device may be a debugging tool such as GDB. The device 500 may include at least an acquisition unit 501 and a debugging unit 502, wherein:
[0111] The acquisition unit 501 is used to acquire a first executable program and a second executable program, wherein the first executable program and the second executable program are programs compiled from codes to be debugged.
[0112] The debugging unit 502 is configured to debug the first executable program and the second executable program based on a first debugging operation on the first executable program or the second executable program through a debugging tool.
[0113] In a possible implementation, the first debugging operation includes an inserted checkpoint; in debugging the first executable program and the second executable program based on the first debugging operation on the first executable program or the second executable program by using a debugging tool, the debugging unit 503 is specifically used to:
[0114] According to the first checkpoint inserted into the first executable program or the second executable program, obtaining at least one first variable value in the first executable program and at least one second variable value in the second executable program, wherein the at least one first variable value corresponds to the at least one second variable value one by one;
[0115] Determining the running result of the second executable program according to the at least one first variable value and the at least one second variable value;
[0116] When the running result of the second executable program does not meet the preset condition, the execution is returned to debugging the first executable program and the second executable program through the debugging tool based on the first debugging operation on the first executable program or the second executable program until the running result of the second executable program meets the preset condition.
[0117] In a possible implementation, the operation result includes precision loss; the debugging unit 502 is further configured to:
[0118] If the precision loss of the second executable program does not meet the preset condition, the execution of the first executable program and the second executable program is suspended, and then the execution is returned to debug the first executable program and the second executable program based on the first debugging operation on the first executable program or the second executable program through the debugging tool.
[0119] In a possible implementation, in the aspect of obtaining at least one first variable value in the first executable program and at least one second variable value in the second executable program according to the first checkpoint inserted into the first executable program or the second executable program, the debugging unit 502 is specifically configured to:
[0120] Acquire at least one first variable value in the first executable program according to a first checkpoint inserted into the first executable program;
[0121] According to the first checkpoint inserted into the first executable program and the preset association relationship between the first executable program and the second executable program, obtaining at least one second variable value in the second executable program; or,
[0122] A second checkpoint for the second executable program is determined according to the first checkpoint; and at least one second variable value in the second executable program is acquired according to the second checkpoint.
[0123] In a possible implementation, in the aspect of obtaining at least one first variable value in the first executable program and at least one second variable value in the second executable program according to the first checkpoint inserted into the first executable program or the second executable program, the debugging unit 502 is specifically configured to:
[0124] Acquire at least one second variable value in the second executable program according to the first checkpoint inserted into the second executable program;
[0125] According to the first checkpoint inserted into the second executable program and the preset association relationship between the first executable program and the second executable program, obtaining at least one first variable value in the first executable program; or,
[0126] A second checkpoint for the first executable program is determined according to the first checkpoint; and at least one first variable value in the first executable program is obtained according to the second checkpoint.
[0127] In a possible implementation, in determining the running result of the second executable program according to the at least one first variable value and the at least one second variable value, the debugging unit 502 is specifically configured to:
[0128] Determine a difference between each first variable value and a corresponding second variable value in the at least one first variable value to obtain a plurality of difference values;
[0129] If there is a difference greater than the preset error threshold among the multiple differences, determining that the precision loss of the second executable program does not meet a preset condition;
[0130] If the multiple differences are all smaller than the difference of the preset error threshold, it is determined that the precision loss of the second executable program meets the preset condition.
[0131] In a possible implementation, the debugging unit 502 is further configured to:
[0132] When the precision loss of the second executable program meets the preset condition, the first executable program and the second executable program continue to be executed.
[0133] It can be seen that the technical solution provided by the present application is that the computer device obtains the code to be debugged, generates a first executable program corresponding to the general processor according to the code to be debugged, and generates a second executable program corresponding to the artificial intelligence processor according to the code to be debugged, and debugs the first executable program and the second executable program based on the first debugging operation for the first executable program or the second executable program through the debugging tool. In this way, the two executable programs can be debugged at the same time through the debugging tool, thereby realizing debugging of the two programs with faster operations, without the need for printing, manual viewing or script comparison, thereby improving debugging efficiency.
[0134] It should be understood that the above-mentioned device embodiments are only illustrative, and the device disclosed herein may also be implemented in other ways. For example, the division of units / modules described in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components may be combined, or may be integrated into another system, or some features may be ignored or not executed.
[0135] The units or modules described as separate components may or may not be physically separated. The components described as units or modules may or may not be physical units, that is, they may be located in one device or distributed on multiple devices. The schemes of the embodiments in this disclosure may be implemented by selecting some or all of the units therein according to actual needs.
[0136] The present application also provides a computer storage medium for storing the above Figure 2A-Figure 4 The computer software instructions used by the computer device shown include the programs involved in executing the above method embodiments. By executing the stored programs, the steps of the program debugging method of any of the above embodiments can be implemented.
[0137] The present application also provides a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the above Figure 2A-Figure 4 The computer software instructions used by the computer device shown include the programs involved in executing the above method embodiments. By executing the stored programs, the steps of the program debugging method of any of the above embodiments can be implemented.
[0138] As can be seen from the above, the embodiments of the present application provide a program debugging method, apparatus, computer device and storage medium. The method can conveniently verify the forward propagation of the online model by randomly generating the verification input data required for the online model without preparing the input data set in advance.
[0139] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.
[0140] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0141] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0142] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0143] If the integrated unit / module in the embodiment of the present application is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. Unless otherwise specified, the artificial intelligence processor may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, and an ASIC, etc. Unless otherwise specified, the memory may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc.
[0144] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution disclosed herein is essentially or partly contributed to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the disclosure. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0145] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution disclosed herein is essentially or partly contributed to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the disclosure. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0146] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0147] Furthermore, the foregoing content can be better understood according to the following terms:
[0148] Clause A1, a program debugging method, the method comprising:
[0149] Obtaining a first executable program and a second executable program, wherein the first executable program and the second executable program are programs compiled from codes to be debugged;
[0150] Based on a first debugging operation on the first executable program or the second executable program, the first executable program and the second executable program are debugged.
[0151] Clause A2. The method of clause A1, wherein the first debugging operation includes an inserted checkpoint; and debugging the first executable program and the second executable program based on the first debugging operation for the first executable program or the second executable program, comprising:
[0152] According to the first checkpoint inserted into the first executable program or the second executable program, obtaining at least one first variable value in the first executable program and at least one second variable value in the second executable program, wherein the at least one first variable value corresponds to the at least one second variable value one by one;
[0153] Determining a running result of the second executable program according to the at least one first variable value and the at least one second variable value;
[0154] When the running result of the second executable program does not meet the preset condition, the execution is returned to debugging the first executable program and the second executable program through the debugging tool based on the first debugging operation on the first executable program or the second executable program until the running result of the second executable program meets the preset condition.
[0155] Clause A3. The method according to clause A2, wherein the operating result includes a loss of precision; the method further comprising:
[0156] If the precision loss of the second executable program does not meet the preset condition, the execution of the first executable program and the second executable program is suspended, and then the execution is returned to debug the first executable program and the second executable program based on the first debugging operation on the first executable program or the second executable program through the debugging tool.
[0157] Clause A4. The method according to A3, wherein the step of obtaining at least one first variable value in the first executable program and at least one second variable value in the second executable program according to a first checkpoint inserted into the first executable program or the second executable program comprises:
[0158] Acquire at least one first variable value in the first executable program according to a first checkpoint inserted into the first executable program;
[0159] According to the first checkpoint inserted into the first executable program and the preset association relationship between the first executable program and the second executable program, obtaining at least one second variable value in the second executable program; or,
[0160] A second checkpoint for the second executable program is determined according to the first checkpoint; and at least one second variable value in the second executable program is acquired according to the second checkpoint.
[0161] Clause A5. The method according to A3, wherein the step of obtaining at least one first variable value in the first executable program and at least one second variable value in the second executable program according to a first checkpoint inserted into the first executable program or the second executable program comprises:
[0162] Acquire at least one second variable value in the second executable program according to the first checkpoint inserted into the second executable program;
[0163] According to the first checkpoint inserted into the second executable program and the preset association relationship between the first executable program and the second executable program, obtaining at least one first variable value in the first executable program; or,
[0164] A second checkpoint for the first executable program is determined according to the first checkpoint; and at least one first variable value in the first executable program is obtained according to the second checkpoint.
[0165] Clause A6. The method according to any one of clauses A3 to A5, wherein determining the running result of the second executable program according to the at least one first variable value and the at least one second variable value comprises:
[0166] Determine a difference between each first variable value and a corresponding second variable value in the at least one first variable value to obtain a plurality of difference values;
[0167] If there is a difference greater than the preset error threshold among the multiple differences, determining that the precision loss of the second executable program does not meet a preset condition;
[0168] If the multiple differences are all smaller than the difference of the preset error threshold, it is determined that the precision loss of the second executable program meets the preset condition.
[0169] Clause A7. A method according to any one of clauses A4 to A6, further comprising:
[0170] If the precision loss of the second executable program meets the preset condition, the first executable program and the second executable program continue to be executed.
[0171] B1. A program debugging device, comprising:
[0172] An acquiring unit, configured to acquire a first executable program and a second executable program, wherein the first executable program and the second executable program are programs compiled from codes to be debugged;
[0173] The debugging unit is configured to debug the first executable program and the second executable program based on a first debugging operation on the first executable program or the second executable program through a debugging tool.
[0174] B2. The apparatus according to B1, wherein the first debugging operation includes an inserted checkpoint; and in the debugging of the first executable program and the second executable program based on the first debugging operation for the first executable program or the second executable program, the debugging unit is specifically configured to:
[0175] According to the first checkpoint inserted into the first executable program or the second executable program, obtaining at least one first variable value in the first executable program and at least one second variable value in the second executable program, wherein the at least one first variable value corresponds to the at least one second variable value one by one;
[0176] Determining the running result of the second executable program according to the at least one first variable value and the at least one second variable value;
[0177] When the running result of the second executable program does not meet the preset condition, the execution is returned to debugging the first executable program and the second executable program through the debugging tool based on the first debugging operation on the first executable program or the second executable program until the running result of the second executable program meets the preset condition.
[0178] B3. According to the device described in B2, the operation result includes precision loss; and the debugging unit is further used for:
[0179] If the precision loss of the second executable program does not meet the preset condition, the execution of the first executable program and the second executable program is suspended, and then the execution is returned to debug the first executable program and the second executable program based on the first debugging operation on the first executable program or the second executable program through the debugging tool.
[0180] B4. The device according to B3, characterized in that, in the aspect of obtaining at least one first variable value in the first executable program and at least one second variable value in the second executable program according to the first checkpoint inserted into the first executable program or the second executable program, the debugging unit is specifically used to:
[0181] Acquire at least one first variable value in the first executable program according to a first checkpoint inserted into the first executable program;
[0182] According to the first checkpoint inserted into the first executable program and the preset association relationship between the first executable program and the second executable program, obtaining at least one second variable value in the second executable program; or,
[0183] A second checkpoint for the second executable program is determined according to the first checkpoint; and at least one second variable value in the second executable program is acquired according to the second checkpoint.
[0184] B5. According to the apparatus of B3, in the aspect of obtaining at least one first variable value in the first executable program and at least one second variable value in the second executable program according to the first checkpoint inserted into the first executable program or the second executable program, the debugging unit is specifically used to:
[0185] Acquire at least one second variable value in the second executable program according to the first checkpoint inserted into the second executable program;
[0186] According to the first checkpoint inserted into the second executable program and the preset association relationship between the first executable program and the second executable program, obtaining at least one first variable value in the first executable program; or,
[0187] A second checkpoint for the first executable program is determined according to the first checkpoint; and at least one first variable value in the first executable program is obtained according to the second checkpoint.
[0188] B6. According to any one of B3-B5, in the apparatus, in determining the running result of the second executable program according to the at least one first variable value and the at least one second variable value, the debugging unit is specifically used to:
[0189] Determine a difference between each first variable value and a corresponding second variable value in the at least one first variable value to obtain a plurality of difference values;
[0190] If there is a difference greater than the preset error threshold among the multiple differences, determining that the precision loss of the second executable program does not meet a preset condition;
[0191] If the multiple differences are all smaller than the difference of the preset error threshold, it is determined that the precision loss of the second executable program meets the preset condition.
[0192] B7. According to any one of B4-B6, the debugging unit is further used for:
[0193] When the precision loss of the second executable program meets the preset condition, the first executable program and the second executable program continue to be executed.
[0194] C1. A computer device, characterized in that it comprises a processor and a memory, wherein the processor and the memory are interconnected, wherein the processor comprises a general-purpose processor and an artificial intelligence processor, the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method described in any one of claims A1-A7.
[0195] D1. A computer-readable storage medium, characterized in that the computer storage medium stores a computer program, the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the method as described in any one of claims A1-A7.
[0196] The embodiments of the present disclosure are described in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present disclosure. The description of the above embodiments is only used to help understand the method and its core idea of the present disclosure. At the same time, changes or deformations made by those skilled in the art based on the ideas of the present disclosure, the specific implementation methods and the scope of application of the present disclosure, all belong to the scope of protection of the present disclosure. In summary, the content of this specification should not be understood as a limitation on the present disclosure.
Claims
1. A program debugging method, characterized in that: The method comprises: Obtaining a first executable program and a second executable program, wherein the first executable program and the second executable program are programs compiled from codes to be debugged; debugging the first executable program and the second executable program based on a first debugging operation on the first executable program or the second executable program; The first debugging operation includes an inserted checkpoint; and debugging the first executable program and the second executable program based on the first debugging operation for the first executable program or the second executable program includes: According to the first checkpoint inserted into the first executable program or the second executable program, obtaining at least one first variable value in the first executable program and at least one second variable value in the second executable program, wherein the at least one first variable value corresponds to the at least one second variable value one by one; Determining a running result of the second executable program according to the at least one first variable value and the at least one second variable value; When the running result of the second executable program does not meet the preset condition, the execution is returned to debugging the first executable program and the second executable program through the debugging tool based on the first debugging operation on the first executable program or the second executable program until the running result of the second executable program meets the preset condition.
2. The method according to claim 1, characterized in that: The operation result includes precision loss; the method further includes: If the precision loss of the second executable program does not meet the preset condition, the execution of the first executable program and the second executable program is suspended, and then the first debugging operation based on the first executable program or the second executable program is returned to debug the first executable program and the second executable program.
3. The method according to claim 2, characterized in that The acquiring, according to the first checkpoint inserted into the first executable program or the second executable program, at least one first variable value in the first executable program and at least one second variable value in the second executable program comprises: Acquire at least one first variable value in the first executable program according to a first checkpoint inserted into the first executable program; According to the first checkpoint inserted into the first executable program and the preset association relationship between the first executable program and the second executable program, obtaining at least one second variable value in the second executable program; or, A second checkpoint for the second executable program is determined according to the first checkpoint; and at least one second variable value in the second executable program is acquired according to the second checkpoint.
4. The method according to claim 2, characterized in that: The acquiring, according to the first checkpoint inserted into the first executable program or the second executable program, at least one first variable value in the first executable program and at least one second variable value in the second executable program comprises: Acquire at least one second variable value in the second executable program according to the first checkpoint inserted into the second executable program; According to the first checkpoint inserted into the second executable program and the preset association relationship between the first executable program and the second executable program, obtaining at least one first variable value in the first executable program; or, A second checkpoint for the first executable program is determined according to the first checkpoint; and at least one first variable value in the first executable program is obtained according to the second checkpoint.
5. The method according to any one of claims 2 to 4, characterized in that: The step of determining the running result of the second executable program according to the at least one first variable value and the at least one second variable value includes: Determine a difference between each first variable value and a corresponding second variable value in the at least one first variable value to obtain a plurality of difference values; If there is a difference greater than the preset error threshold among the multiple differences, determining that the precision loss of the second executable program does not meet a preset condition; If the multiple differences are all smaller than the difference of the preset error threshold, it is determined that the precision loss of the second executable program meets the preset condition.
6. The method according to claim 5, characterized in that The method further comprises: If the precision loss of the second executable program meets the preset condition, the first executable program and the second executable program continue to be executed.
7. A program debugging device, characterized in that: The device comprises: An acquiring unit, configured to acquire a first executable program and a second executable program, wherein the first executable program and the second executable program are programs compiled from codes to be debugged; a debugging unit, configured to debug the first executable program and the second executable program based on a first debugging operation on the first executable program or the second executable program; The first debugging operation includes an inserted checkpoint; in the debugging of the first executable program and the second executable program based on the first debugging operation for the first executable program or the second executable program, the debugging unit is specifically used for: According to the first checkpoint inserted into the first executable program or the second executable program, obtaining at least one first variable value in the first executable program and at least one second variable value in the second executable program, wherein the at least one first variable value corresponds to the at least one second variable value one by one; Determining the running result of the second executable program according to the at least one first variable value and the at least one second variable value; When the running result of the second executable program does not meet the preset condition, the execution is returned to debugging the first executable program and the second executable program through the debugging tool based on the first debugging operation on the first executable program or the second executable program until the running result of the second executable program meets the preset condition.
8. The device according to claim 7, characterized in that The operation result includes precision loss; the debugging unit is further used for: If the precision loss of the second executable program does not meet the preset condition, the execution of the first executable program and the second executable program is suspended, and then the execution is returned to debug the first executable program and the second executable program based on the first debugging operation on the first executable program or the second executable program through the debugging tool.
9. The device according to claim 8, characterized in that In the aspect of obtaining at least one first variable value in the first executable program and at least one second variable value in the second executable program according to the first checkpoint inserted into the first executable program or the second executable program, the debugging unit is specifically used to: Acquire at least one first variable value in the first executable program according to a first checkpoint inserted into the first executable program; Acquiring at least one second variable value in the second executable program according to a first checkpoint inserted into the first executable program and a preset association relationship between the first executable program and the second executable program; or, determining a second checkpoint for the second executable program according to the first checkpoint; At least one second variable value in the second executable program is obtained according to the second checkpoint.
10. The device according to claim 8, characterized in that In the aspect of obtaining at least one first variable value in the first executable program and at least one second variable value in the second executable program according to the first checkpoint inserted into the first executable program or the second executable program, the debugging unit is specifically used to: Acquire at least one second variable value in the second executable program according to the first checkpoint inserted into the second executable program; Acquiring at least one first variable value in the first executable program according to the first checkpoint inserted into the second executable program and a preset association relationship between the first executable program and the second executable program; or, determining a second checkpoint for the first executable program according to the first checkpoint; At least one first variable value in the first executable program is obtained according to the second checkpoint.
11. The device according to any one of claims 8 to 10, characterized in that: In the aspect of determining the running result of the second executable program according to the at least one first variable value and the at least one second variable value, the debugging unit is specifically used for: Determine a difference between each first variable value and a corresponding second variable value in the at least one first variable value to obtain a plurality of difference values; If there is a difference greater than the preset error threshold among the multiple differences, determining that the precision loss of the second executable program does not meet a preset condition; If the multiple differences are all smaller than the difference of the preset error threshold, it is determined that the precision loss of the second executable program meets the preset condition.
12. The device according to claim 11, characterized in that The debugging unit is also used for: When the precision loss of the second executable program meets the preset condition, the first executable program and the second executable program continue to be executed.
13. A computer device, characterized in that: The method comprises a processor and a memory, wherein the processor and the memory are connected to each other, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1 to 6.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 6.
