Lightweight non-intrusive GPU behavior observation method, apparatus and device, and storage medium

By using the extended Berkeley packet filter at the entry point of the GPU process to track GPU behavior data, it solves the problem that GPU performance monitoring in the existing technology is difficult to meet the fine-grained, low-overhead and real-time requirements, and achieves more efficient GPU performance monitoring. Improved application effects of deep learning and data analysis tasks.

CN118567952APending Publication Date: 2024-08-30SUN YAT SEN UNIV

Patent Information

Application Number
CN202410942419.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-15
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Existing GPU behavior performance monitoring technology is difficult to meet the requirements of fine-grained, low-overhead and real-time performance, and performance bottlenecks are prone to occur when processing large-scale data.

Method used

By obtaining the dynamic library called by the GPU process, determine the entry point of the function to be monitored, and use the extended Berkeley packet filter to track the function to be monitored at the entry point, obtain the tracking information, save it as a preset format file, and conduct behavioral analysis to generate Visualize behavioral information.

Benefits of technology

It improves the fine-grainedness of GPU performance monitoring, reduces overhead, and improves real-time performance, thus improving the application effect of GPU in high-performance computing tasks such as deep learning and data analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567952A
    Figure CN118567952A
Patent Text Reader

Abstract

The invention discloses a lightweight non-intrusive GPU behavior observation method, device and equipment and a storage medium, which are used for solving the technical problems that the existing GPU behavior performance monitoring technology is difficult to meet the requirements of fine granularity, low overhead and real-time performance, and performance bottlenecks are easy to occur when large-scale data are processed. The method comprises the steps of obtaining a dynamic library called by a GPU process, and determining an entry point of a to-be-monitored function according to the dynamic library; tracking the function to be monitored at the entry point through an extended Berkley packet filter to obtain tracking information; storing the tracking information as a preset format file; and performing behavior analysis on the GPU process according to the preset format file to obtain visual behavior information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of GPU behavior observation technology, and in particular to a lightweight non-intrusive GPU behavior observation method, device, equipment and storage medium. Background Art

[0002] In recent years, with the rapid development of artificial intelligence (AI) technology, especially the widespread application of large language models (LLM), the demand for computing resources has increased significantly. As an important component of high-performance computing, GPU is widely used in fields such as deep learning and data analysis.

[0003] However, in large-scale computing tasks, efficiently utilizing and optimizing GPU performance has always been an important challenge. Due to the powerful parallel computing capabilities of GPUs and their widespread application in data processing and high-performance computing, GPU performance monitoring and analysis have become particularly important. GPU behavior tracing is a commonly used performance analysis technique that involves capturing and analyzing GPU operations to help developers optimize code and diagnose performance bottlenecks. Existing GPU observability tools can be roughly divided into three categories:

[0004] 1. Application-level monitoring and analysis: By intercepting the application's high-level call interface, the execution efficiency of specific application code on the GPU is observed, allowing developers to adjust the code to improve performance. Such as PyTorch Profiler and Kineto.

[0005] 2. System-level monitoring and analysis: Through the operating environment interface provided by the GPU manufacturer, it provides real-time monitoring and analysis of the overall system operating status and performance, including CPU and GPU utilization, memory usage, etc. Such as Meta Dynolog, DCGM (Data Center GPU Manager), and NVIDIA Nsight.

[0006] 3. Hardware-level monitoring and analysis: including temperature monitoring, power monitoring, performance counters, event tracking, etc. Such as: NVML (NVIDIA Management Library), CUPTI (CUDA Profiling Tools Interface).

[0007] However, although these tools can provide a certain degree of performance data, they are difficult to meet the requirements of fine-grainedness, low overhead and real-time performance, and are prone to performance bottlenecks when processing large-scale data. Summary of the invention

[0008] The present invention provides a lightweight and non-intrusive GPU behavior observation method, device, equipment and storage medium, which are used to solve the technical problem that the existing GPU behavior performance monitoring technology is difficult to meet the requirements of fine granularity, low overhead and real-time performance, and is prone to performance bottlenecks when processing large-scale data.

[0009] The present invention provides a lightweight non-intrusive GPU behavior observation method, comprising:

[0010] Obtain a dynamic library called by a GPU process, and determine an entry point of a function to be monitored based on the dynamic library;

[0011] By extending the Berkeley packet filter, the function to be monitored is tracked at the entry point to obtain tracking information;

[0012] Saving the tracking information as a file in a preset format;

[0013] The behavior of the GPU process is analyzed according to the preset format file to obtain visual behavior information.

[0014] Optionally, the step of obtaining a dynamic library called by the GPU process and determining an entry point of a function to be detected according to the dynamic library includes:

[0015] Determine the loading path of the dynamic library;

[0016] Acquire the library file of the dynamic library according to the loading path;

[0017] Extract the function symbol table from the obtained library file;

[0018] The entry point of the function to be detected is determined according to the function symbol table.

[0019] Optionally, the step of tracing the function to be monitored at the entry point by extending the Berkeley packet filter to obtain tracing information includes:

[0020] inserting a spatial probe of the extended Berkeley packet filter at the inlet;

[0021] When the function to be monitored is called, key information of the function to be monitored is intercepted by the spatial probe to obtain tracking information.

[0022] Optionally, the visualized behavior information includes a timeline chart; and the step of performing behavior analysis on the GPU process according to the preset format file to obtain the visualized behavior information includes:

[0023] Read the preset formatted file through a visualization tool to obtain behavior data;

[0024] A timeline chart is generated using the behavioral data.

[0025] The present invention also provides a lightweight non-intrusive GPU behavior observation device, comprising:

[0026] An entry point determination module, used to obtain a dynamic library called by a GPU process, and determine an entry point of a function to be monitored based on the dynamic library;

[0027] A tracing module, used for tracing the function to be monitored at the entry point by extending the Berkeley packet filter to obtain tracing information;

[0028] A saving module, used for saving the tracking information as a file in a preset format;

[0029] The visualization module is used to perform behavior analysis on the GPU process according to the preset format file to obtain visualized behavior information.

[0030] Optionally, the entry point determination module includes:

[0031] A loading path determination submodule, used to determine the loading path of the dynamic library;

[0032] A library file acquisition submodule, used to acquire the library file of the dynamic library according to the loading path;

[0033] A function symbol table extraction submodule is used to extract a function symbol table from a library file;

[0034] The entry point determination submodule is used to determine the entry point of the function to be detected according to the function symbol table.

[0035] Optionally, the tracking module includes:

[0036] A spatial probe insertion submodule, used for inserting the spatial probe of the extended Berkeley packet filter at the inlet;

[0037] The tracking submodule is used to intercept the key information of the function to be monitored through the space probe when the function to be monitored is called, so as to obtain tracking information.

[0038] Optionally, the visualized behavior information includes a timeline chart; and the visualization module includes:

[0039] A reading submodule, used for reading the preset formatted file through a visualization tool to obtain behavior data;

[0040] The timeline chart generation submodule is used to generate a timeline chart using the behavior data.

[0041] The present invention also provides an electronic device, the device comprising a processor and a memory:

[0042] The memory is used to store program code and transmit the program code to the processor;

[0043] The processor is used to execute the lightweight non-intrusive GPU behavior observation method as described in any one of the above items according to the instructions in the program code.

[0044] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store program code, and the program code is used to execute the lightweight non-intrusive GPU behavior observation method as described in any one of the above items.

[0045] It can be seen from the above technical scheme that the present invention has the following advantages: the present invention discloses a lightweight and non-intrusive GPU behavior observation method, and specifically discloses: obtaining a dynamic library called by a GPU process, and determining the entry point of a function to be monitored based on the dynamic library; tracking the function to be monitored at the entry point by extending the Berkeley packet filter to obtain tracing information; saving the tracing information as a preset format file; performing behavior analysis on the GPU process according to the preset format file to obtain visual behavior information.

[0046] The present invention extends the Berkeley packet filter to track the behavior data of the GPU at the function entrance, thereby improving the fine-grainedness of GPU performance monitoring, reducing overhead, and improving real-time performance, thereby enhancing the application effect of the GPU in high-performance computing tasks such as deep learning and data analysis. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0048] Figure 1 A flowchart of a lightweight non-intrusive GPU behavior observation method provided by an embodiment of the present invention;

[0049] Figure 2 Common flowchart for AI training reasoning;

[0050] Figure 3 A flowchart of a lightweight non-intrusive GPU behavior observation method provided by another embodiment of the present invention;

[0051] Figure 4 A lightweight and non-intrusive GPU behavior observation device is provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0052] The embodiments of the present invention provide a lightweight and non-intrusive GPU behavior observation method, apparatus, device and storage medium, which are used to solve the technical problem that the existing GPU behavior performance monitoring technology is difficult to meet the requirements of fine-grainedness, low overhead and real-time, and is prone to performance bottlenecks when processing large-scale data.

[0053] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0054] See also Figure 1 , Figure 1 A flowchart of the steps of a lightweight non-intrusive GPU behavior observation method provided by an embodiment of the present invention.

[0055] The present invention provides a lightweight non-intrusive GPU behavior observation method, which may specifically include the following steps:

[0056] Step 101, obtaining a dynamic library called by a GPU process, and determining an entry point of a function to be monitored according to the dynamic library;

[0057] GPU (Graphics Processing Unit): A specialized electronic circuit designed for rapid operation and modification of memory, originally designed to accelerate graphics rendering. Due to its powerful parallel computing capabilities, GPU is now widely used in high-performance computing fields such as deep learning, data analysis, and scientific computing.

[0058] GPU Activities: Refers to various operations and tasks performed on the GPU, including but not limited to executing compute kernels (functions running on the GPU), rendering graphics and synchronization operations between the CPU and the GPU. Monitoring GPU activities is critical for optimizing performance and diagnosing problems in applications that use GPU acceleration.

[0059] Dynamic library: a shared library, a library file that is dynamically loaded at runtime. Dynamic libraries allow programs to load and use the functions and data defined in them at runtime, thereby achieving code sharing and modularization.

[0060] Take AI training and reasoning tasks as an example. Figure 2 As shown, Figure 2This is a common flowchart for AI training and reasoning. First, after the data is preprocessed on the CPU, it will be transferred to the GPU. Secondly, the model weights and parameters are loaded into the GPU. For tasks such as forward propagation, loss calculation, and backward propagation (loss calculation and backward propagation are only in the training phase), the GPU will start the kernel function for accelerated calculation. Finally, the calculation results will be transmitted back to the CPU. Therefore, in the entire computing task, the GPU behavior mainly includes application release, data copying, kernel function startup, etc. To monitor the GPU behavior, you can intercept the CUDA Driver API call at the entrance of the function to be monitored, thereby achieving efficient GPU behavior tracking.

[0061] CUDA (Compute Unified Device Architecture): is a parallel computing platform and application programming interface (API). It allows developers to use CUDA-enabled GPUs for computing tasks. CUDA provides two main APIs: CUDA Driver API and CUDA Runtime API.

[0062] CUDA Driver API: CUDA's low-level API, the underlying interface used in the CUDA architecture to directly control and manage GPU resources. The common file name is "libcuda.so".

[0063] CUDA Runtime API: A higher-level API of CUDA, a high-level interface built on top of the CUDA Driver API, which abstracts some details of managing devices and memory allocation and provides a simplified and friendly programming interface. The common file name is "libcudart.so".

[0064] Step 102, tracing the function to be monitored at the entry point by extending the Berkeley packet filter to obtain tracing information;

[0065] Extended Berkeley Packet Filter (eBPF): is a powerful kernel technology that can run sandboxed programs in privileged contexts (such as the operating system kernel). eBPF allows kernel functionality to be extended safely and efficiently without changing the kernel source code or loading kernel modules. By running programs at predefined hook points such as system calls, function entry / exit, kernel tracepoints, network events, etc., high-performance network and load balancing, fine-grained security observability data extraction, application tracking, performance troubleshooting, etc. are achieved.

[0066] In an embodiment of the present invention, the function to be monitored may be traced at the entry point through eBPF to obtain corresponding tracing information.

[0067] In one example, the function to be monitored can be a CUDA function, and eBPF can be hooked to the entry and exit points of the CUDA Driver API, and by writing custom eBPF code, it can automatically intercept and record tracing information when the CUDA function is called. The tracing information includes but is not limited to function parameters, return values, timestamps, etc.

[0068] The interception points of the CUDA Driver API are as follows:

[0069] "cuMemAlloc_v2": video memory application, records the video memory size and timestamp of each application.

[0070] "cuMemFree_v2": video memory release, records the video memory size and timestamp of the release operation.

[0071] "cuLaunchKernel": Kernel function startup, detailed recording of kernel function startup parameters and execution time.

[0072] "cuMemcpyHtoDAsync_v2" and "cuMemcpyDtoHAsync_v2": data copy, recording the source and destination addresses of the data, the size of the copied data, and the related timestamps.

[0073] "cuStreamSynchronize": Wait for synchronization and record the specific duration and timestamp of waiting for synchronization.

[0074] In addition, other interception functions can be flexibly added to cover more GPU behavior observations. For example: cuDeviceGetName and cuDeviceGetUuid are used to obtain various attributes and states of the device, cuDevicePrimaryCtxGetState and cuDevicePrimaryCtxRelease are used to manage the primary context of the device, cuModuleGetLoadingMode and cuLibraryGetModule are used to manage CUDA modules and libraries, cuStreamIsCapturing is used for stream capture, and cuEventCreate is used to create and manage events.

[0075] Step 103, saving the tracking information as a file in a preset format;

[0076] Step 104 , performing behavior analysis on the GPU process according to a preset format file to obtain visualized behavior information.

[0077] After obtaining the tracing information, the tracing information recorded by the eBPF program can be output and stored as a preset format file, such as a standard format JSON file. Then, the obtained JSON file is behaviorally analyzed and visualized to obtain corresponding visualized behavior information.

[0078] The present invention extends the Berkeley packet filter to track the behavior data of the GPU at the function entrance, thereby improving the fine-grainedness of GPU performance monitoring, reducing overhead, and improving real-time performance, thereby enhancing the application effect of the GPU in high-performance computing tasks such as deep learning and data analysis.

[0079] See also Figure 3 , Figure 3 A flowchart of a lightweight non-intrusive GPU behavior observation method provided by another embodiment of the present invention. Specifically, it may include:

[0080] Step 301, determine the loading path of the dynamic library;

[0081] Step 302, obtaining the library file of the dynamic library according to the loading path;

[0082] Step 303, extracting the function symbol table from the obtained library file;

[0083] Step 304, determining the entry point of the function to be detected according to the function symbol table;

[0084] In a specific implementation, the dynamic library may be a CUDA dynamic library. The embodiment of the present invention may use the strace tool to determine the loading path of the CUDA dynamic library, and then use the objdump tool to analyze and obtain the function symbol table of the CUDA API, thereby determining the key function entry point.

[0085] strace is a diagnostic tool in Linux that tracks system calls and signals between processes and the system. By intercepting and recording the system calls executed by the process, you can determine the path of the CUDA dynamic library file called by the process. The CUDADriver API dynamic library is " / lib64 / libcuda.so.1".

[0086] objdump is a multi-functional tool for displaying target file information, often used for disassembling and analyzing binary files. It can display file headers, segment contents, symbol tables, disassembled code, etc. Analyze CUDA dynamic library files and extract the function symbol tables contained therein. Mainly API functions related to GPU resource management and task scheduling, such as cuMemAlloc (video memory application), cuMemFree (video memory release), cuLaunchKernel (kernel function launch), etc.

[0087] In an example, strace can be replaced by tools such as ltrace and ptrace. objdump can be replaced by tools such as readelf.

[0088] Step 305, tracing the function to be monitored at the entry point by extending the Berkeley packet filter to obtain tracing information;

[0089] In one example, the step of obtaining the tracking information by tracking the function to be monitored at the entry point by extending the Berkeley packet filter may include the following sub-steps:

[0090] S51, a spatial probe that inserts an extended Berkeley packet filter at the ingress;

[0091] S52, when the function to be monitored is called, key information of the function to be monitored is intercepted by the space probe to obtain tracking information.

[0092] The extended Berkeley Packet Filter space probe, or eBPF uprobe, allows dynamic stubs in user space programs, including at function entry, specific offsets, and function return. When we define an uprobe, the kernel will create a fast breakpoint instruction (int3 instruction on x86 machines) on the attached instruction. When the program executes the instruction, the kernel will trigger an event, the program will fall into kernel state, and call the probe function as a callback function. After executing the probe function, it will return to user state to continue executing subsequent instructions. Uprobe is file-based. When a function in a binary file is traced, all processes that use this file will be instrumented, including those that have not yet been started, so that system calls can be tracked system-wide.

[0093] The present invention can use eBPF uprobe to insert space probes at specific function entry and exit points of user space programs to collect information such as parameters, return values, execution time, etc. of the calling function, thereby realizing function interception and monitoring.

[0094] Step 306, saving the tracking information as a file in a preset format;

[0095] Step 307: Perform behavior analysis on the GPU process according to the preset format file to obtain visualized behavior information.

[0096] In an embodiment of the present invention, the tracing information recorded by the eBPF program can be output and stored as a preset format file, such as a JSON file in a standard format. Then, the obtained JSON file is behaviorally analyzed and visualized to obtain corresponding visualized behavior information.

[0097] In one example, the visualized behavior information includes a timeline chart; the visualized behavior information includes a timeline chart; and the step of performing behavior analysis on the GPU process according to a preset format file to obtain the visualized behavior information may include the following sub-steps:

[0098] S71, reading a preset formatted file through a visualization tool to obtain behavior data;

[0099] S72, using the behavior data to generate a timeline chart.

[0100] In the specific implementation, the chrome: / / tracing / visualization tool can be used to read standard format files and generate timeline charts. It can intuitively display the behavior and time distribution of the GPU, helping users analyze and optimize GPU performance. Among them, chrome: / / tracing / is a lightweight tracing tool built into the Chrome browser, which can load tracing data files in a specific format, display and analyze various types of timeline data, and identify possible performance bottlenecks.

[0101] In an example, chrome: / / tracing / can be replaced by tools such as FlameGraph and Perfetto, which can also provide efficient performance data visualization and analysis.

[0102] The present invention extends the Berkeley packet filter to track the behavior data of the GPU at the function entrance, thereby improving the fine-grainedness of GPU performance monitoring, reducing overhead, and improving real-time performance, thereby enhancing the application effect of the GPU in high-performance computing tasks such as deep learning and data analysis.

[0103] See also Figure 4 , Figure 4 A lightweight and non-intrusive GPU behavior observation device is provided in an embodiment of the present invention.

[0104] An embodiment of the present invention provides a lightweight non-intrusive GPU behavior observation device, including:

[0105] An entry point determination module 401 is used to obtain a dynamic library called by a GPU process and determine an entry point of a function to be monitored according to the dynamic library;

[0106] A tracing module 402 is used to trace the function to be monitored at the entry point by extending the Berkeley packet filter to obtain tracing information;

[0107] A saving module 403 is used to save the tracking information as a file in a preset format;

[0108] The visualization module 404 is used to perform behavior analysis on the GPU process according to a preset format file to obtain visualized behavior information.

[0109] In the embodiment of the present invention, the entry point determination module 401 includes:

[0110] The loading path determination submodule is used to determine the loading path of the dynamic library;

[0111] The library file acquisition submodule is used to obtain the library file of the dynamic library according to the loading path;

[0112] A function symbol table extraction submodule is used to extract a function symbol table from a library file;

[0113] The entry point determination submodule is used to determine the entry point of the function to be detected according to the function symbol table.

[0114] In the embodiment of the present invention, the tracking module 402 includes:

[0115] A spatial probe insertion submodule for inserting a spatial probe extending the Berkeley packet filter at the ingress;

[0116] The tracking submodule is used to intercept the key information of the monitored function through the space probe when the monitored function is called to obtain the tracking information.

[0117] In the embodiment of the present invention, the visualized behavior information includes a timeline chart; the visualization module 404 includes:

[0118] The reading submodule is used to read the preset formatted file through the visualization tool to obtain the behavior data;

[0119] The timeline chart generation submodule is used to generate a timeline chart using behavioral data.

[0120] An embodiment of the present invention further provides an electronic device, the device comprising a processor and a memory:

[0121] The memory is used to store the program code and transmit the program code to the processor;

[0122] The processor is used to execute the lightweight non-intrusive GPU behavior observation method according to the instructions in the program code.

[0123] The embodiment of the present invention further provides a computer-readable storage medium, which is used to store program codes, and the program codes are used to execute the lightweight non-intrusive GPU behavior observation method of the embodiment of the present invention.

[0124] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0125] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0126] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0127] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks 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 terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0128] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including 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.

[0129] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement 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.

[0130] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0131] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0132] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A lightweight and non-intrusive GPU behavior observation method, It is characterized in that include: Obtain a dynamic library called by a GPU process, and determine an entry point of a function to be monitored based on the dynamic library; By extending the Berkeley packet filter, the function to be monitored is tracked at the entry point to obtain tracking information; Saving the tracking information as a file in a preset format; The behavior of the GPU process is analyzed according to the preset format file to obtain visual behavior information.

2. The method according to claim 1, It is characterized in that The step of obtaining a dynamic library called by the GPU process and determining the entry point of the function to be detected according to the dynamic library includes: Determine the loading path of the dynamic library; Acquire the library file of the dynamic library according to the loading path; Extract the function symbol table from the obtained library file; The entry point of the function to be detected is determined according to the function symbol table.

3. The method according to claim 1, It is characterized in that The step of tracking the function to be monitored at the entry point by extending the Berkeley packet filter to obtain tracking information includes: inserting a spatial probe of the extended Berkeley packet filter at the inlet; When the function to be monitored is called, key information of the function to be monitored is intercepted by the spatial probe to obtain tracking information.

4. The method according to claim 1, It is characterized in that The visualized behavior information includes a timeline chart; the step of performing behavior analysis on the GPU process according to the preset format file to obtain the visualized behavior information includes: Read the preset formatted file through a visualization tool to obtain behavior data; A timeline chart is generated using the behavioral data.

5. A lightweight and non-intrusive GPU behavior observation device, It is characterized in that include: An entry point determination module, used to obtain a dynamic library called by a GPU process, and determine an entry point of a function to be monitored based on the dynamic library; A tracing module, used for tracing the function to be monitored at the entry point by extending the Berkeley packet filter to obtain tracing information; A saving module, used for saving the tracking information as a file in a preset format; The visualization module is used to perform behavior analysis on the GPU process according to the preset format file to obtain visualized behavior information.

6. The device according to claim 5, It is characterized in that The entry point determination module comprises: A loading path determination submodule, used to determine the loading path of the dynamic library; A library file acquisition submodule, used to acquire the library file of the dynamic library according to the loading path; A function symbol table extraction submodule is used to extract a function symbol table from a library file; The entry point determination submodule is used to determine the entry point of the function to be detected according to the function symbol table.

7. The device according to claim 5, It is characterized in that The tracking module comprises: A spatial probe insertion submodule, used for inserting the spatial probe of the extended Berkeley packet filter at the inlet; The tracking submodule is used to intercept the key information of the function to be monitored through the space probe when the function to be monitored is called, so as to obtain tracking information.

8. The device according to claim 5, It is characterized in that The visual behavior information includes a timeline chart; the visualization module includes: A reading submodule, used for reading the preset formatted file through a visualization tool to obtain behavior data; The timeline chart generation submodule is used to generate a timeline chart using the behavior data.

9. An electronic device, It is characterized in that The device comprises a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the lightweight non-intrusive GPU behavior observation method according to any one of claims 1-4 according to the instructions in the program code.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium is used to store program codes, and the program codes are used to execute the lightweight non-intrusive GPU behavior observation method according to any one of claims 1-4.

Citation Information

Patent Citations

  • Visual analysis method and visual analysis device for graphics processor chip

    CN112445855A

  • GPU (Graphics Processing Unit) resource allocation method, device and equipment and readable storage medium

    CN114168344A

  • Process crash information collection method and device based on eBPF

    CN116594796A

  • Database load analysis method and device based on eBPF, electronic equipment and medium

    CN118093335A

Cited By

  • Performance monitoring method and device, storage medium and program product

    CN119782096A

  • Performance Monitoring Method, Device, Storage Medium, and Program Product

    CN119782096B

  • Method and system for realizing CUDA call tracking based on eBPF

    CN120723587A

  • Method and device for supporting custom GPU metadata based on NVML interception

    CN121704926A