Graphic processor monitoring method and device, equipment and storage medium
By obtaining and comparing the device information of the graphics processor, determining the processor type and calling the corresponding dynamic link library, the problem of inconsistent monitoring indicators of different manufacturers is solved, and unified graphics processor monitoring is realized, reducing monitoring costs.
Patent Information
- Application Number
- CN202411524176.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-02-11
AI Technical Summary
The monitoring indicators of graphics processors of different manufacturers are not consistent, resulting in a large amount of additional resources required during monitoring.
By obtaining device information that has supported the graphics processor and writing to the local configuration file, reading the target device information of the graphics processor to be monitored in the host, determining the processor type based on the comparison results, and calling the corresponding dynamic link library to obtain the running data , and normalized to generate monitoring data.
The use of a unified technical route and logical architecture avoids the differences in GPU monitoring capabilities provided by different manufacturers, and realizes unified monitoring of the graphics processors of each manufacturer, effectively reducing monitoring costs.
Smart Images

Figure CN119415358A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud computing, and in particular to a graphics processor monitoring method, device, equipment and storage medium. Background Art
[0002] With the advancement and development of science and technology, especially the development of high-performance computing and artificial intelligence in recent years, the demand for computing power has increased exponentially. In response to the explosive growth in computing power, the traditional method of increasing computing power by increasing the CPU (Central Processing Unit) clock frequency and increasing the number of CPU processing cores is no longer applicable due to power consumption and heat dissipation. The emergence of graphics processing units (GPUs) has effectively solved this problem.
[0003] There are many manufacturers of graphics processors at present, and the monitoring indicators they provide are not consistent. Therefore, when it is necessary to monitor graphics processors from different manufacturers, a large amount of additional resources is required. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a graphics processor monitoring method, device, equipment and storage medium, which can avoid the differences in GPU monitoring capabilities provided by different manufacturers, use a unified technical route and logical architecture, and effectively reduce monitoring costs. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a graphics processor monitoring method, which is applied to a graphics processor monitoring system, comprising:
[0006] Obtain device information of supported graphics processors, and write the device information into a local configuration file;
[0007] Reading target device information of a graphics processor to be monitored in a host machine, and comparing the target device information with the local configuration file to determine the processor type of the graphics processor to be monitored according to the comparison result;
[0008] Calling a dynamic link library corresponding to the processor type to obtain the running data of the graphics processor to be monitored during operation according to the dynamic link library;
[0009] The operation data is normalized to obtain monitoring data corresponding to the graphics processor to be monitored.
[0010] Optionally, obtaining device information of a supported graphics processor and writing the device information into a local configuration file includes:
[0011] Obtain device information of a supported graphics processor, and read a manufacturer identifier and a device identifier from the device information;
[0012] A correspondence between the manufacturer identification and the device identification is established, and the manufacturer identification and the device identification are written into a local configuration file.
[0013] Optionally, the step of reading target device information of a graphics processor to be monitored in a host computer includes:
[0014] Determine the operating system type of the host machine, and if the operating system type is the first type, read the target device information of the graphics processor to be monitored in the host machine based on a preset path;
[0015] If the operating system type is the second type, the target device information of the graphics processor to be monitored in the host machine is read through a preset information reading function.
[0016] Optionally, comparing the target device information with the local configuration file to determine the processor type of the graphics processor to be monitored according to the comparison result includes:
[0017] Extracting the manufacturer identification information from the target device information, and performing coarse-grained matching on the manufacturer identification information and the local configuration file;
[0018] If the manufacturer identification information and the local configuration file match successfully, extracting the device identification information in the target device information, and performing fine-grained matching on the device identification information and the local configuration file;
[0019] If the device identification information and the local configuration file match successfully, the processor type of the graphics processor to be monitored is determined according to the manufacturer identification information and the device identification information.
[0020] Optionally, calling a dynamic link library corresponding to the processor type to obtain the running data of the graphics processor to be monitored during operation according to the dynamic link library includes:
[0021] Calling a dynamic link library corresponding to the processor type and loading the dynamic link library to determine a header file and a library file in the dynamic link library;
[0022] The header file and the library file are analyzed to determine the running data of the graphics processor to be monitored during running.
[0023] Optionally, the normalizing the operating data to obtain monitoring data corresponding to the graphics processor to be monitored includes:
[0024] Normalizing the operation data based on a preset measurement unit to generate resource usage data corresponding to the graphics processor to be monitored;
[0025] Monitoring data corresponding to the to-be-monitored graphics processor is generated based on the resource usage data.
[0026] Optionally, the graphics processor monitoring method further includes:
[0027] If a monitoring extension instruction is received, a newly added graphics processor to be monitored is determined based on the monitoring extension instruction, and new device information corresponding to the newly added graphics processor to be monitored is obtained, so as to write the new device information into the local configuration file;
[0028] Determine a newly added dynamic link library corresponding to the newly added graphics processor to be monitored, and generate a newly added calling interface for calling the newly added dynamic link library;
[0029] The operation data in the newly added dynamic link library is called through the newly added calling interface to monitor the newly added graphics processor to be monitored.
[0030] In a second aspect, the present application discloses a graphics processor monitoring device, which is applied to a graphics processor monitoring system, comprising:
[0031] A data writing module, used for obtaining device information of supported graphics processors and writing the device information into a local configuration file;
[0032] A processor type determination module, used for reading target device information of a graphics processor to be monitored in a host machine, and comparing the target device information with the local configuration file to determine the processor type of the graphics processor to be monitored according to the comparison result;
[0033] A data monitoring module, used for calling a dynamic link library corresponding to the processor type, so as to obtain the operation data of the graphics processor to be monitored during operation according to the dynamic link library;
[0034] The data processing module is used to perform normalization processing on the operation data to obtain monitoring data corresponding to the graphics processor to be monitored.
[0035] In a third aspect, the present application discloses an electronic device, comprising:
[0036] Memory, used to store computer programs;
[0037] The processor is used to execute the computer program to implement the aforementioned graphics processor monitoring method.
[0038] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program, wherein the computer program implements the aforementioned graphics processor monitoring method when executed by a processor.
[0039] In the present application, the device information of the supported graphics processor can be obtained, and the device information can be written into the local configuration file; the target device information of the graphics processor to be monitored in the host machine can be read, and the target device information and the local configuration file can be compared to determine the processor type of the graphics processor to be monitored according to the comparison result; the dynamic link library corresponding to the processor type can be called to obtain the running data of the graphics processor to be monitored at runtime according to the dynamic link library; the running data can be normalized to obtain the monitoring data corresponding to the graphics processor to be monitored. It can be seen that through the method of the present application, after obtaining the device information of the supported graphics processor, it can be written into the local configuration file, and then the target device information of the graphics processor to be monitored in the host machine where the monitoring system is located can be read, and the target device information and the local configuration file can be compared, and then the processor type of the graphics processor to be monitored can be determined according to the comparison result, and then the dynamic link library corresponding to the processor type can be called, and then the running data of the processor can be obtained according to the dynamic link library. Further, the running data needs to be normalized to obtain the corresponding monitoring data. In this way, a unified technical route and logical architecture can be used to avoid differences in GPU monitoring capabilities provided by different manufacturers. GPU usage can be monitored for each manufacturer, effectively reducing monitoring costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] 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 embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0041] Figure 1 A flowchart of a graphics processor monitoring method disclosed in this application;
[0042] Figure 2 A processing timing diagram of a graphics processor monitoring method disclosed in this application;
[0043] Figure 3 A flowchart for identifying a graphics processor model disclosed in this application;
[0044] Figure 4 This is an architecture diagram of a graphics processor monitoring system disclosed in this application;
[0045] Figure 5 A schematic diagram of the structure of a graphics processor monitoring device disclosed in this application;
[0046] Figure 6 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments 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.
[0048] In the prior art, for different graphics processor manufacturers, the monitoring indicators provided by each manufacturer are not consistent. Therefore, when it is necessary to monitor graphics processors of different manufacturers, a large amount of additional resources are required.
[0049] In order to overcome the above technical problems, the present application discloses a graphics processor monitoring method, device, equipment and storage medium, which can avoid the differences in GPU monitoring capabilities provided by different manufacturers, use a unified technical route and logical architecture, and effectively reduce monitoring costs.
[0050] See also Figure 1 As shown, an embodiment of the present invention discloses a graphics processor monitoring method, which is applied to a graphics processor monitoring system, including:
[0051] Step S11, obtaining device information of supported graphics processors, and writing the device information into a local configuration file.
[0052] In this embodiment, it is necessary to obtain the device information of the currently supported graphics processor, and then write the obtained device information into the local configuration file. Specifically, Figure 2 As shown, it is necessary to obtain the device information of the supported graphics processor and read the manufacturer identifier vendor_id and the device identifier device_id or subdevice_id from the device information. It should be noted that for each GPU card, that is, the graphics processor, it has fields that can indicate unique manufacturer information and device information, where the vendor_id corresponding to the graphics processor of each manufacturer is unique and is an identifier set by the manufacturer, and the specific model of the graphics processor of each manufacturer can be uniquely distinguished according to the device_id and subdevice_id.
[0053] Furthermore, after obtaining the manufacturer identification and the device identification, it is necessary to establish a corresponding relationship between the manufacturer identification corresponding to each graphics processor and the device identification. For example, if the manufacturer identification of the graphics processor X is A and the device identification is B1, it is necessary to establish a corresponding relationship between the manufacturer identification A and the device identification B1, so that after determining the device identification B1, it is possible to immediately determine that the manufacturer corresponding to the graphics processor X is A according to the corresponding relationship, and then write the manufacturer identification and the device identification into the local configuration file to record the graphics processor currently supported for monitoring in the local configuration file. In this way, after obtaining the manufacturer identification corresponding to the graphics processor, the graphics processor of the manufacturer currently supported can be quickly determined, or after obtaining the device identification of the graphics processor, the manufacturer corresponding to the graphics processor can be quickly determined according to the established corresponding relationship, thereby effectively improving the monitoring efficiency of the graphics processor.
[0054] Step S12: read the target device information of the graphics processor to be monitored in the host machine, and compare the target device information with the local configuration file to determine the processor type of the graphics processor to be monitored according to the comparison result.
[0055] In this embodiment, it is necessary to read the target device information of the graphics processor to be monitored mounted in the current host machine, and then compare the target device information with the device information in the local configuration file, and determine the processor type of the graphics processor to be monitored according to the comparison result. Specifically, Figure 2 As shown, it is necessary to read the PCI (Peripheral Component Interconnect, a standard that defines a local bus) device information currently mounted in the host, that is, the information of the graphics processor currently mounted in the host, and then it is necessary to determine the operating system type of the host to determine the corresponding method to read the target device information of the graphics processor to be monitored in the host according to the operating system type of the host. Specifically, Figure 3 As shown, if the operating system type is the first type, that is, the operating system is a Linux system, the information file of each PCI device under the preset path / sys / bus / pci / devices is read to determine the target device information of the graphics processor to be monitored in the host machine; in another case, if the operating system type is the second type, that is, the operating system is a Windows system, it is necessary to obtain the hardware information of all PCI devices through the preset information reading function, such as the SetupDiGetClassDevs function, SetupDiEnumDeviceInfo function, SetupDiGetDeviceRegistryProperty function and other functions contained in the setupapi library, and separate the target device information, that is, the manufacturer identification and the device identification, from the obtained hardware information.
[0056] Furthermore, after obtaining the target device information, it is necessary to compare the target device information and the local configuration file to determine the processor type of the graphics processor to be monitored based on the comparison result. Specifically, it is necessary to extract the manufacturer identification information in the target device information, and perform coarse-grained matching on the manufacturer identification information and the local configuration file. It is necessary to perform coarse matching on the first-layer keywords of the manufacturer identification information configuration file. If the match fails, the matching is terminated; if the match is successful, the device identification information and the second-layer keywords of the configuration file are finely matched. After the above two rounds of matching, the manufacturer and model information corresponding to the graphics processor to be monitored can be obtained, and then the processor type of the graphics processor to be monitored can be determined based on the determined manufacturer and model information. In this way, on the one hand, the corresponding method can be selected according to different operating systems to obtain the device information of the graphics processor to be monitored, thereby improving the efficiency of information acquisition; on the other hand, the device information of the graphics processor to be monitored can be matched at different granularities, thereby ensuring the accuracy of information matching.
[0057] Step S13: calling a dynamic link library corresponding to the processor type to obtain the running data of the graphics processor to be monitored during its operation according to the dynamic link library.
[0058] In this embodiment, the running data of the graphics processor to be monitored during operation can be obtained by calling the dynamic link library corresponding to the processor type. Specifically, the dynamic link library corresponding to the processor type can be called and loaded to determine the header file and library file in the dynamic link library. Corresponding to different graphics processor manufacturers, their drivers or driver-related toolkits will provide API (Application Programming Interface) interfaces, and the interface is embodied as a .so dynamic link library and a header file. Among them, the .so dynamic link library is a compiled binary file that contains code and data that can be dynamically loaded by the program and can be called by the application as a plug-in. The .so dynamic link library provided by the driver can be dynamically called during compilation, and the .so dynamic link library can be loaded in a lazy loading manner. When the monitoring program is running, it can be automatically linked to the program, so that the monitoring can be more flexible during operation and save system resources. Therefore, the header file and the library file can be analyzed to determine the running data of the graphics processor to be monitored during operation.
[0059] Step S14: normalize the operation data to obtain monitoring data corresponding to the graphics processor to be monitored.
[0060] In this embodiment, the operation data can be normalized to obtain monitoring data corresponding to the graphics processor to be monitored. Specifically, for different manufacturers, the return values of the API interfaces provided by them are different. In order to form unified monitoring data, it is necessary to normalize the data returned by the API interfaces of each manufacturer, such as normalizing the measurement unit, and then assemble them into monitoring data. Therefore, the operation data can be normalized based on the preset measurement unit to generate resource usage data corresponding to the graphics processor to be monitored. Further, the monitoring data can include single-card data and whole-machine data to cover the monitoring requirements of a single machine single card and a single machine multiple cards. The single-card index can indicate the information and resource usage of a single graphics processor. Table 1 shows some single-card monitoring indicators of the graphics processor. The whole-machine index can indicate the number of multiple graphics processors and the overall resource usage. Table 2 shows some multi-card monitoring indicators of the graphics processor, which is suitable for scenarios where multiple GPUs are used to run AI (Artificial Intelligence) applications. It not only provides monitoring indicators for resource usage, but also provides monitoring indicators for the number of GPU cards, which is beneficial for users to monitor card drop events. Among them, the contents in Table 1 and the contents in Table 2 are as follows:
[0061] Table 1
[0062] Indicator name unit Chinese name gpu_instance_utilization % GPU Utilization gpu_instance_power_usage W GPU Power gpu_instance_temperature ℃ GPU Temperature gpu_instance_memory_total GB Total GPU memory gpu_instance_memory_used GB GPU memory usage gpu_instance_memory_utilization % GPU memory usage gpu_instance_decoder_utilization % GPU decoder usage gpu_instance_encoder_utilization % GPU encoder usage
[0063] Table 2
[0064] Indicator name unit Chinese name cps_gpu_pci_devices_count indivual Number of GPU cards in the machine cps_gpu_memory_total GB Total GPU memory of the whole machine cps_gpu_memory_used GB GPU memory usage of the whole machine cps_gpu_memory_utilization % GPU memory usage of the whole machine cps_gpu_utilization % Average GPU usage of the whole machine cps_gpu_power_usage W Average GPU power of the whole machine
[0065] After obtaining the resource usage data, the resource usage data can be assembled to obtain the monitoring data corresponding to the graphics processor to be monitored, and after the monitoring data is assembled, it can be reported to the management side database. In this embodiment, the specific database type is not limited. Taking the time series database influxdb as an example, the data format of some monitoring indicators output is as follows:
[0066] >gpu,bus_id=xxx,host=xxx,resource_id=xxx,service_type=xxx,uuid=xxx,model=Atlas 300T pro
[0067] instance_decoder_utilization=0i,instance_encoder_utilization=0i,instance_memory_total=22.48828125,instance_memory_used=0.4536132 8125,instance_memory_utilization=0.02017109605697412,instance_power_usage=19.148,instance_temperature=31i,instance_utilization=0i <timestamp>.
[0068] Among them, bus_id indicates the unique PCIe slot location of the GPU card, resource_id indicates the UUID of the physical machine or virtual machine, service_type indicates the service type, such as the cloud server ECS, uuid indicates the unique UUID of the GPU card, model indicates the card model, and indicators such as instance_decoder_utilization indicate the resource usage of the GPU card, etc.
[0069] It should be noted that, through the method of the present application, when it is necessary to adapt and add monitoring of graphics processors from new manufacturers, plug-in expansion can also be performed on the graphics processor. Specifically, if a monitoring expansion instruction is received, the newly added graphics processor to be monitored is determined based on the monitoring expansion instruction, and the newly added device information corresponding to the newly added graphics processor to be monitored is obtained, so as to write the newly added device information into the local configuration file, and then the newly added dynamic link library corresponding to the newly added graphics processor to be monitored needs to be determined, and a new calling interface for calling the newly added dynamic link library is generated, and finally the operating data in the newly added dynamic link library is called through the new calling interface to monitor the newly added graphics processor to be monitored.
[0070] It can be seen that through the method of the present application, after obtaining the device information of the supported graphics processor, it can be written into the local configuration file, and then the target device information of the graphics processor to be monitored in the host machine where the monitoring system is located is read, and the target device information and the local configuration file are compared, and then the processor type of the graphics processor to be monitored is determined according to the comparison result, and then the dynamic link library corresponding to the processor type can be called, and then the operation data of the processor can be obtained according to the dynamic link library. Further, the operation data needs to be normalized to obtain the corresponding monitoring data. In this way, a unified technical route and logical architecture can be used to avoid the differences in GPU monitoring capabilities provided by different manufacturers, and the GPU usage can be monitored for each manufacturer, effectively reducing the monitoring cost.
[0071] See also Figure 4 As shown, an embodiment of the present invention discloses a graphics processor monitoring system, including: a compilation and packaging module, which is used to compile the computer language implementation of the graphics processor monitoring method of the present application into an executable file, and package the executable file according to the usage scenario to generate a medium; a monitoring and acquisition module, which is used to place the medium into a physical machine or a virtual machine with a graphics processor and a driver installed, and run the medium to collect monitoring data; a data display module, which is used to display the monitoring data on the console interface.
[0072] Specifically, compile and encapsulate the module: The computer language implemented by the graphics processor monitoring method in this application is not restricted. The difference in implementation lies in the different coding specifications of different computer languages, and the method of calling the .so dynamic link library is different. In the specific implementation and compilation, the coding is performed according to the characteristics of the computer language, and the corresponding compilation tool is used for compilation. During compilation, it is not required that the source code contain the .so dynamic link library to improve the independence of the code. During actual operation, the .so is linked to the program to improve compatibility with the driver. The compiled executable file supports a variety of packaging methods, can be used alone, can be packaged into a service service, can be packaged together with a docker image, etc., can be packaged according to actual use requirements to obtain a release medium, and there is no restriction in this application.
[0073] Monitoring and acquisition module: Place the above-mentioned publishing media in a physical machine or virtual machine with a graphics processor and driver installed, and transmit it online or offline according to the actual network conditions. The monitoring program startup method is different for different packaging media. For example, for the single packaging method, the binary executable file can be run directly; for the form of packaging into a service service, it can be run through the systemctl start monitor-agent command, which varies according to the service name and system type of the packaging medium; for the method of packaging with a docker image, the startup command can be encapsulated in the image startup command for execution. In particular, this system can be used independently or as an extension plug-in for conventional monitoring data, and can be used in conjunction with common monitoring software such as QGA (Qemu-Guest-Agent) or telegraf.
[0074] Data display module: Displays the reported monitoring data on the console page. The default display is for the whole machine indicators. Administrators and users can query the monitoring data of a single GPU through search items. It supports precise query and fuzzy query, and supports query based on model, GPU UUID, GPU Bus-ID and other conditions. It supports querying historical data of different lengths, and can display curves to facilitate querying information such as GPU usage trends.
[0075] See also Figure 5 As shown, an embodiment of the present invention discloses a graphics processor monitoring device, which is applied to a graphics processor monitoring system, including:
[0076] The data writing module 11 is used to obtain device information of supported graphics processors and write the device information into a local configuration file;
[0077] The processor type determination module 12 is used to read the target device information of the graphics processor to be monitored in the host machine, and compare the target device information with the local configuration file to determine the processor type of the graphics processor to be monitored according to the comparison result;
[0078] The data monitoring module 13 is used to call a dynamic link library corresponding to the processor type to obtain the running data of the graphics processor to be monitored during operation according to the dynamic link library;
[0079] The data processing module 14 is used to perform normalization processing on the operation data to obtain monitoring data corresponding to the graphics processor to be monitored.
[0080] In this embodiment, the device information of the supported graphics processor can be obtained, and the device information can be written into the local configuration file; the target device information of the graphics processor to be monitored in the host machine can be read, and the target device information and the local configuration file can be compared to determine the processor type of the graphics processor to be monitored according to the comparison result; the dynamic link library corresponding to the processor type can be called to obtain the running data of the graphics processor to be monitored at runtime according to the dynamic link library; the running data can be normalized to obtain the monitoring data corresponding to the graphics processor to be monitored. It can be seen that through the method of the present application, after obtaining the device information of the supported graphics processor, it can be written into the local configuration file, and then the target device information of the graphics processor to be monitored in the host machine where the monitoring system is located can be read, and the target device information and the local configuration file can be compared, and then the processor type of the graphics processor to be monitored can be determined according to the comparison result, and then the dynamic link library corresponding to the processor type can be called, and then the running data of the processor can be obtained according to the dynamic link library. Further, the running data needs to be normalized to obtain the corresponding monitoring data. In this way, a unified technical route and logical architecture can be used to avoid differences in GPU monitoring capabilities provided by different manufacturers. GPU usage can be monitored for each manufacturer, effectively reducing monitoring costs.
[0081] In some embodiments, the data writing module 11 may specifically include:
[0082] An identification acquisition unit, used to acquire device information of a supported graphics processor, and read a manufacturer identification and a device identification from the device information;
[0083] The data writing unit is used to establish a corresponding relationship between the manufacturer identification and the device identification, and write the manufacturer identification and the device identification into a local configuration file.
[0084] In some embodiments, the processor type determination module 12 may specifically include:
[0085] A first information reading unit, configured to determine the operating system type of the host machine, and if the operating system type is the first type, read the target device information of the graphics processor to be monitored in the host machine based on a preset path;
[0086] The second information reading unit is used to read the target device information of the graphics processor to be monitored in the host machine through a preset information reading function if the operating system type is the second type.
[0087] In some embodiments, the processor type determination module 12 may specifically include:
[0088] A first information matching unit, configured to extract the manufacturer identification information from the target device information, and perform a coarse-grained matching between the manufacturer identification information and the local configuration file;
[0089] a second information matching unit, configured to extract the device identification information in the target device information and perform fine-grained matching on the device identification information and the local configuration file if the manufacturer identification information and the local configuration file match successfully;
[0090] A processor type determination unit is configured to determine the processor type of the to-be-monitored graphics processor according to the manufacturer identification information and the device identification information if the device identification information and the local configuration file match successfully.
[0091] In some embodiments, the data monitoring module 13 may specifically include:
[0092] A link library calling unit, used for calling a dynamic link library corresponding to the processor type and loading the dynamic link library to determine a header file and a library file in the dynamic link library;
[0093] The file analysis unit is used to analyze the header file and the library file to determine the running data of the graphics processor to be monitored during running.
[0094] In some embodiments, the data processing module 14 may specifically include:
[0095] A data normalization unit, configured to normalize the operation data based on a preset measurement unit to generate resource usage data corresponding to the graphics processor to be monitored;
[0096] The monitoring data generating unit is used to generate monitoring data corresponding to the graphics processor to be monitored based on the resource usage data.
[0097] In some embodiments, the graphics processor monitoring device may further include:
[0098] A monitoring device adding unit, configured to determine a newly added graphics processor to be monitored based on the monitoring extension instruction if a monitoring extension instruction is received, and obtain newly added device information corresponding to the newly added graphics processor to be monitored, so as to write the newly added device information into the local configuration file;
[0099] A link library adding unit, used to determine a new dynamic link library corresponding to the newly added graphics processor to be monitored, and generate a new calling interface for calling the new dynamic link library;
[0100] The device monitoring unit is used to call the operation data in the newly added dynamic link library through the newly added calling interface to monitor the newly added graphics processor to be monitored.
[0101] Furthermore, the present application also discloses an electronic device. Figure 6 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0102] Figure 6 The present invention provides a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the graphics processor monitoring method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0103] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0104] In addition, the memory 22 as a carrier for resource storage may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.
[0105] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the graphics processor monitoring method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0106] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned disclosed graphics processor monitoring method. The specific steps of the method can refer to the corresponding contents disclosed in the aforementioned embodiments, and will not be repeated here.
[0107] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0108] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0109] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0110] 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 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 device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0111] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A graphics processor monitoring method, characterized in that: Applied to graphics processor monitoring systems, including: Obtain device information of supported graphics processors, and write the device information into a local configuration file; Reading target device information of a graphics processor to be monitored in a host machine, and comparing the target device information with the local configuration file to determine the processor type of the graphics processor to be monitored according to the comparison result; Calling a dynamic link library corresponding to the processor type to obtain the running data of the graphics processor to be monitored during operation according to the dynamic link library; The operation data is normalized to obtain monitoring data corresponding to the graphics processor to be monitored.
2. The method for monitoring a graphics processor according to claim 1, wherein: The step of obtaining device information of a supported graphics processor and writing the device information into a local configuration file includes: Obtain device information of a supported graphics processor, and read a manufacturer identifier and a device identifier from the device information; A correspondence between the manufacturer identification and the device identification is established, and the manufacturer identification and the device identification are written into a local configuration file.
3. The method for monitoring a graphics processor according to claim 1, wherein: The step of reading target device information of a graphics processor to be monitored in a host machine includes: Determine the operating system type of the host machine, and if the operating system type is the first type, read the target device information of the graphics processor to be monitored in the host machine based on a preset path; If the operating system type is the second type, the target device information of the graphics processor to be monitored in the host machine is read through a preset information reading function.
4. The method for monitoring a graphics processor according to claim 1, wherein: The comparing the target device information and the local configuration file to determine the processor type of the graphics processor to be monitored according to the comparison result includes: Extracting the manufacturer identification information from the target device information, and performing coarse-grained matching on the manufacturer identification information and the local configuration file; If the manufacturer identification information and the local configuration file match successfully, extracting the device identification information in the target device information, and performing fine-grained matching on the device identification information and the local configuration file; If the device identification information and the local configuration file match successfully, the processor type of the graphics processor to be monitored is determined according to the manufacturer identification information and the device identification information.
5. The method for monitoring a graphics processor according to claim 1, wherein: The calling of a dynamic link library corresponding to the processor type to obtain the running data of the graphics processor to be monitored during operation according to the dynamic link library includes: Calling a dynamic link library corresponding to the processor type and loading the dynamic link library to determine a header file and a library file in the dynamic link library; The header file and the library file are analyzed to determine the running data of the graphics processor to be monitored during running.
6. The method for monitoring a graphics processor according to claim 1, wherein: The normalizing the operation data to obtain monitoring data corresponding to the graphics processor to be monitored includes: Normalizing the operation data based on a preset measurement unit to generate resource usage data corresponding to the graphics processor to be monitored; Monitoring data corresponding to the to-be-monitored graphics processor is generated based on the resource usage data.
7. The method for monitoring a graphics processor according to any one of claims 1 to 6, characterized in that: Also includes: If a monitoring extension instruction is received, a newly added graphics processor to be monitored is determined based on the monitoring extension instruction, and new device information corresponding to the newly added graphics processor to be monitored is obtained, so as to write the new device information into the local configuration file; Determine a newly added dynamic link library corresponding to the newly added graphics processor to be monitored, and generate a newly added calling interface for calling the newly added dynamic link library; The operation data in the newly added dynamic link library is called through the newly added calling interface to monitor the newly added graphics processor to be monitored.
8. A graphics processor monitoring device, characterized in that: Applied to graphics processor monitoring systems, including: A data writing module, used for obtaining device information of supported graphics processors and writing the device information into a local configuration file; A processor type determination module, used for reading target device information of a graphics processor to be monitored in a host machine, and comparing the target device information with the local configuration file to determine the processor type of the graphics processor to be monitored according to the comparison result; A data monitoring module, used for calling a dynamic link library corresponding to the processor type, so as to obtain the operation data of the graphics processor to be monitored during operation according to the dynamic link library; The data processing module is used to perform normalization processing on the operation data to obtain monitoring data corresponding to the graphics processor to be monitored.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the graphics processor monitoring method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein when the computer program is executed by a processor, the graphics processor monitoring method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Virtual machine cluster monitoring method and system, electronic equipment, storage medium and computer program product
CN120929333A