A method, device, equipment and storage medium for obtaining graphics processor information

Through the cooperation of the polling flag mechanism and the polling thread, the blocking and delay problems when BMC reads GPU information are solved, the stability and efficiency of information reading are improved, and the smooth operation of GPU monitoring is ensured.

CN115599561BActive Publication Date: 2024-10-18NETTRIX INFORMATION IND CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202211327399.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-27
Publication Date
2024-10-18
Estimated Expiration
2042-10-27

AI Technical Summary

Technical Problem

The existing method of BMC reading GPU information has insufficient stability and delay problems, especially when the GPU does not respond, it will cause blocking, affecting the efficiency and speed of the monitoring process.

Method used

Using the polling flag mechanism, the main thread sends an information reading request and obtains the polling identifier. When the polling flag is in the second state, the polling thread performs status polling to ensure the success and effectiveness of information reading. , to avoid blocking and delays caused by invalid responses.

Benefits of technology

It improves the stability and efficiency of BMC reading GPU information, ensures the smooth progress of GPU monitoring work, reduces waiting delays, and enhances system security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115599561B_ABST
    Figure CN115599561B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, equipment and storage medium for obtaining graphics processor information. The present invention relates to the field of data processing technology. The method comprises: when the polling flag is in the first state, sending an information read request to at least one graphics processor through a main thread, and obtaining a polling identifier according to an information read response returned by the graphics processor; when the polling flag is in the second state, sending a status polling request to at least one graphics processor according to the polling identifier through a polling thread; and obtaining graphics processor information according to a status polling response returned by the graphics processor through a polling thread. The technical solution of the present invention eliminates the process of BMC blocking and waiting for GPU to return information, reduces the time delay of BMC waiting for GPU to return information, improves the efficiency of BMC reading GPU information and the stability of the program, is conducive to ensuring the smooth progress of GPU monitoring work, and improves the security of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a method, device, equipment and storage medium for obtaining graphics processor information. Background Art

[0002] With the development of high-tech technologies such as artificial intelligence, deep learning, and cloud computing, the market share of GPU servers is increasing rapidly and is widely used in professional graphics visualization, data centers, consumer entertainment games and other fields.

[0003] Due to necessity, BMC will exchange a lot of information with GPU. The existing technology adopts the method of synchronously reading GPU information, that is, BMC sends request information to GPU and waits for GPU's response, and GPU responds to BMC after receiving the request information.

[0004] However, the existing BMC method of reading GPU information lacks certain stability. When the BMC sends a request to the GPU, if one of the GPUs fails to respond and the request fails, the BMC process of reading GPU information will be blocked. Since other GPU information cannot be read, subsequent GPU monitoring work cannot be carried out. At the same time, the existing BMC method of reading GPU information is to block a single thread and wait for the GPU's response, which has a certain delay and will affect the running speed of the entire GPU monitoring process, and it is impossible to obtain all GPU information to be monitored in time. Summary of the invention

[0005] The present invention provides a method, device, equipment and storage medium for obtaining graphics processor information, so as to solve the blocking and delay problems of single-threaded reading of GPU information.

[0006] According to one aspect of the present invention, a method for obtaining graphics processor information is provided, comprising:

[0007] When the polling flag is in the first state, sending an information read request to at least one graphics processor through the main thread, and acquiring a polling identifier according to an information read response returned by the graphics processor;

[0008] When the polling flag is in the second state, sending a status polling request to the at least one graphics processor according to the polling identifier through a polling thread;

[0009] The graphics processor information is acquired through the polling thread according to the status polling response returned by the graphics processor.

[0010] Optionally, sending an information read request to at least one graphics processor through a main thread, and acquiring a polling identifier according to an information read response returned by the graphics processor, includes:

[0011] Sending, by the main thread, an information reading request of a corresponding type to the at least one graphics processor according to the type of graphics processor information to be obtained;

[0012] Acquire, through the main thread, an information read response returned by the graphics processor, wherein the information read response includes a reception status and a polling identifier of the graphics processor for the information read request;

[0013] The polling identifier in the information read response is obtained according to the receiving status through the main thread.

[0014] By implementing the above method, after the main thread sends the information reading request, checking whether the information reading request is successfully received according to the information reading response can reduce the possibility of program errors and improve the stability of the program.

[0015] Optionally, obtaining, by the main thread, a polling identifier in the information read response according to the receiving state includes:

[0016] When the receiving status is successful reception, obtaining a polling identifier in the information reading response through the main thread;

[0017] When the receiving status is reception failure, the execution is returned to send a corresponding type of information reading request to the at least one graphics processor through the main thread according to the type of the graphics processor information to be obtained.

[0018] Through the above method, the main thread will obtain the polling identifier only when the information reading request is successfully received. If it is not received successfully, the main thread will resend the information reading request to avoid the situation where the graphics processor information of the graphics processor cannot be obtained because the information reading request is not successfully received by the graphics processor.

[0019] Optionally, after obtaining the polling identifier according to the information reading response returned by the graphics processor, the method further includes:

[0020] The polling flag is modified to a second state through the main thread.

[0021] In this way, after obtaining the polling identifier, the polling flag is modified to the second state through the main thread to start the polling thread.

[0022] Optionally, acquiring the graphics processor information according to a status polling response returned by the graphics processor through the polling thread includes:

[0023] Acquire a status polling response returned by the graphics processor through the polling thread;

[0024] Determining, by the polling thread, the validity of the polling identifier and the preparation progress of the graphics processor information according to the status polling response;

[0025] For a target graphics processor whose polling identifier is a valid polling identifier and whose preparation progress is ready, the graphics processor information of the target graphics processor is obtained through a polling thread.

[0026] The validity check of the polling identifier is implemented in the above manner to avoid the situation where the polling thread cannot poll the graphics processor information due to the GPU providing an invalid polling identifier.

[0027] Optionally, determining the validity of the polling identifier according to the status polling response by the polling thread includes:

[0028] Determining, by the polling thread, whether the status polling response includes the preparation progress of the graphics processor information;

[0029] If yes, determining that the polling identifier is a valid polling identifier;

[0030] Otherwise, the polling thread uses the polling identifier as the target polling identifier, continues to execute polling, and determines whether the target polling identifier is valid according to the status polling response returned by the graphics processor corresponding to the target polling identifier;

[0031] If the number of polling times for the graphics processor corresponding to the target polling identifier does not exceed the set number, and the corresponding status polling response is detected to include the preparation progress of the graphics processor information, then the target polling identifier is determined to be a valid polling identifier;

[0032] If the number of polling times for the graphics processor corresponding to the target polling identifier reaches or exceeds the set number, and the corresponding status polling response including the preparation progress of the graphics processor information is not detected, the target polling identifier is determined to be an invalid polling identifier, and the polling flag is modified to the first state through the polling thread.

[0033] By detecting the GPU whose status polling response does not contain GPU information, and whether the GPU information is returned in the set number of polling operations, the validity of the polling identifier is verified to avoid program blocking due to the failure of the polling thread to consistently poll the GPU information.

[0034] Optionally, it also includes:

[0035] When the graphics processor information obtained by the polling thread meets the monitoring requirements, the polling flag is modified to a first state by the polling thread.

[0036] Through the above method, after obtaining various types of graphics processor information to be obtained, the polling flag is modified to the first state to end the polling work.

[0037] According to another aspect of the present invention, there is provided a device for obtaining graphics processor information, comprising:

[0038] A polling identifier acquisition module, configured to send an information read request to at least one graphics processor through a main thread when the polling flag is in a first state, and acquire a polling identifier according to an information read response returned by the graphics processor;

[0039] A status polling request sending module, configured to send a status polling request to the at least one graphics processor according to the polling identifier through a polling thread when the polling flag is in the second state;

[0040] The information acquisition module is used to acquire the graphics processor information according to the status polling response returned by the graphics processor through the polling thread.

[0041] Optionally, the polling identifier acquisition module 410 includes:

[0042] The information reading request sending unit is used to send a corresponding type of information reading request to the at least one graphics processor according to the type of graphics processor information to be obtained through the main thread.

[0043] The information reading response obtaining unit is used to obtain the information reading response returned by the graphics processor through the main thread, wherein the information reading response includes the reception status and polling mark of the graphics processor for the information reading request.

[0044] A polling identifier reading unit is used to obtain the polling identifier in the information reading response according to the receiving state through the main thread.

[0045] Optionally, the polling identification reading unit includes:

[0046] The polling identifier reading subunit is used to obtain the polling identifier in the information reading response through the main thread when the receiving status is successful reception.

[0047] The information read request sending subunit is used to return to execution and send a corresponding type of information read request to the at least one graphics processor according to the type of graphics processor information to be obtained through the main thread when the receiving status is reception failure.

[0048] Optionally, the device further comprises:

[0049] The first modification module is used to modify the polling flag to a second state through the main thread.

[0050] Optionally, the information acquisition module 430 includes:

[0051] The status polling response acquiring unit is used to acquire the status polling response returned by the graphics processor through the polling thread.

[0052] A progress and validity determination unit is used to determine the validity of the polling identifier and the preparation progress of the graphics processor information according to the status polling response through the polling thread.

[0053] The information acquisition unit is configured to acquire the graphics processor information of the target graphics processor through a polling thread for the target graphics processor whose polling identifier is a valid polling identifier and whose preparation progress is preparation completed.

[0054] Optionally, the progress and effectiveness determination unit is specifically used to:

[0055] Determining, by the polling thread, whether the status polling response includes the preparation progress of the graphics processor information;

[0056] If yes, determining that the polling identifier is a valid polling identifier;

[0057] Otherwise, the polling thread uses the polling identifier as the target polling identifier, continues to execute polling, and determines whether the target polling identifier is valid according to the status polling response returned by the graphics processor corresponding to the target polling identifier;

[0058] If the number of polling times for the graphics processor corresponding to the target polling identifier does not exceed the set number, and the corresponding status polling response is detected to include the preparation progress of the graphics processor information, then the target polling identifier is determined to be a valid polling identifier;

[0059] If the number of polling times for the graphics processor corresponding to the target polling identifier reaches or exceeds the set number, and the corresponding status polling response including the preparation progress of the graphics processor information is not detected, the target polling identifier is determined to be an invalid polling identifier, and the polling flag is modified to the first state through the polling thread.

[0060] Optionally, it also includes:

[0061] The second modification module is used to modify the polling flag bit to a first state through the polling thread when the graphics processor information obtained through the polling thread meets the monitoring requirements.

[0062] According to another aspect of the present invention, there is provided an electronic device, the electronic device comprising:

[0063] at least one processor; and

[0064] a memory communicatively connected to the at least one processor; wherein,

[0065] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for obtaining graphics processor information according to any embodiment of the present invention.

[0066] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, wherein the computer instructions are used to enable a processor to implement the method for obtaining graphics processor information according to any embodiment of the present invention when executed.

[0067] The technical solution of the embodiment of the present invention solves the blocking and delay problems of single-threaded information acquisition, and compared with the prior art of synchronously reading GPU information with a single thread, eliminates the process of BMC blocking and waiting for GPU to return information, reduces the delay of BMC waiting for GPU to return information, improves the efficiency of BMC reading GPU information and the stability of the program, and is conducive to ensuring the smooth progress of GPU monitoring work and improving the security of the system.

[0068] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. 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 creative work.

[0070] Figure 1 A flowchart of a method for obtaining graphics processor information provided by an embodiment of the present invention;

[0071] Figure 2 A flowchart of a main thread execution method in a method for obtaining a polling identifier provided by an embodiment of the present invention;

[0072] Figure 3 A flowchart of a polling thread execution method in a method for obtaining graphics processor information provided by an embodiment of the present invention;

[0073] Figure 4 A flowchart of another method for obtaining graphics processor information provided by an embodiment of the present invention;

[0074] Figure 5 A schematic diagram of the structure of a device for obtaining graphics processor information provided by an embodiment of the present invention;

[0075] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0076] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme 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 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 should fall within the scope of protection of the present invention.

[0077] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0078] Figure 1A flowchart of a method for obtaining graphics processor information provided by an embodiment of the present invention is provided. This embodiment is applicable to the case where a BMC reads GPU information. The method can be executed by a device for obtaining graphics processor information. The device for obtaining graphics processor information can be implemented in the form of hardware and / or software. The device for obtaining graphics processor information can be configured in an electronic device. For example, the electronic device can be a server or a server cluster.

[0079] like Figure 1 As shown, the method includes:

[0080] Step 110: When the polling flag is in the first state, send an information read request to at least one graphics processor through the main thread, and obtain a polling identifier according to an information read response returned by the graphics processor.

[0081] Typically, a baseboard management controller (BMC) is responsible for monitoring server status information and needs to perform a large amount of information interaction with a graphics processing unit (GPU), such as obtaining temperature information of the GPU for fan speed control and obtaining asset information of the GPU for administrators to review.

[0082] The polling flag is a flag for adjusting the working status of the main thread and the polling thread. The cooperation between the main thread and the polling thread is carried out in an orderly manner through the state of the polling flag. The state of the polling flag is changed by setting or clearing operations. For example, after the polling flag is cleared, the polling flag is in the first state. After the polling flag is set, the polling flag is in the second state.

[0083] In the present invention, when the polling flag is in the first state, the baseboard management controller sends an information read request to the graphics processor information through the main thread, and the graphics processor returns an information read response according to the information read request sent by the baseboard management controller to the graphics processor information. If the information read request sent by the baseboard management controller is valid, the polling flag can be read according to the information read response returned by the graphics processor. After receiving the polling flag, the main thread writes it into the global variable and changes the polling flag from the first state to the second state.

[0084] After obtaining the polling identifier according to the information reading response returned by the graphics processor, the method further includes:

[0085] The polling flag is modified to the second state through the main thread. For example, the polling flag is set through the main thread to modify the polling flag to the second state.

[0086] Step 120: When the polling flag is in the second state, send a status polling request to the at least one graphics processor according to the polling identifier through a polling thread.

[0087] It should be noted that after the polling flag changes from the first state to the second state, the polling thread starts polling. At this time, the main thread does not need to wait for the graphics processor to return the information to be read, but continues to send commands to read other information. The polling thread works in parallel with the main thread.

[0088] Specifically, when the polling thread monitors that the polling flag bit changes from the first state to the second state, the polling flag is obtained from the global variable, and then a status polling request is sent to the graphics processor to obtain the status of the information to be read, and whether the polling flag is valid is determined according to the return status of the request command. If the polling flag is valid, the status polling request is continued to be sent to the next graphics processor. If it is not certain that the polling flag is valid, the polling number of the graphics processor is recorded before the status polling request is continued to be sent to the next graphics processor. If the polling number of the graphics processor is equal to or exceeds the set number, and the status polling response containing the graphics processor information is still not obtained, it is determined that the polling flag is invalid.

[0089] Step 130: Obtaining graphics processor information according to the status polling response returned by the graphics processor through the polling thread.

[0090] Specifically, according to the polling thread sending a status polling request to the graphics processor, the graphics processor will return a status polling response. If the graphics processor has prepared the status information data to be read by the baseboard management controller in the memory, the graphics processor information in the memory of the graphics processor can be read through the polling thread, and the read data can be written into the shared memory. If the GPU information of the target type in all graphics processors whose GPU information is to be obtained is read by the polling thread, it is determined that the graphics processor information obtained by the polling thread meets the monitoring requirements, the polling flag is cleared, and the polling work is completed. The baseboard management controller can obtain the corresponding data through the shared memory.

[0091] In the embodiment of the present invention, when the polling flag is in the first state, an information read request is sent to at least one graphics processor through the main thread, and a polling identifier is obtained according to an information read response returned by the graphics processor; when the polling flag is in the second state, a status polling request is sent to the at least one graphics processor according to the polling identifier through the polling thread; and graphics processor information is obtained according to the status polling response returned by the graphics processor through the polling thread, thereby solving the blocking and delay problems of single-thread acquisition of information. Compared with the single-thread synchronous reading of GPU information in the prior art, the blocking and delay problems of single-thread acquisition of information are solved. Compared with the single-thread synchronous reading of GPU information in the prior art, the process of BMC blocking waiting for GPU to return information is eliminated, the delay of BMC waiting for GPU to return information is reduced, the efficiency of BMC reading GPU information and the stability of the program are improved, which is conducive to ensuring the smooth progress of GPU monitoring work and improving the security of the system.

[0092] Figure 2 This is a flowchart of a method for executing a main thread in a method for obtaining a polling identifier provided by an embodiment of the present invention. This embodiment further refines the method of sending an information read request to at least one graphics processor through the main thread and obtaining the polling identifier according to the information read response returned by the graphics processor based on the above embodiment. Figure 2 As shown, the method includes:

[0093] Step 210: Sending a corresponding type of information read request to the at least one graphics processor according to the type of graphics processor information to be obtained by the main thread.

[0094] Specifically, the graphics processor information to be obtained may include information such as temperature, power consumption, and utilization rate. The baseboard management controller cyclically sends different information reading requests to each graphics processor according to different types of graphics processor information to be obtained.

[0095] Assume that there are 4 GPUs, GPU1, GPU2, GPU3 and GPU4, and the types of graphics processor information to be obtained include temperature, power consumption, etc., then the main thread sends temperature information reading requests to GPU1, GPU2, GPU3 and GPU4 in turn, without blocking and waiting for the GPU to return the information reading response. Similarly, the main thread sends power consumption information reading requests to GPU1, GPU2, GPU3 and GPU4 in turn, and uses a similar method to send information reading requests cyclically for other types of graphics processor information to be obtained.

[0096] Step 220: Obtain, through the main thread, an information read response returned by the graphics processor, wherein the information read response includes a reception status of the graphics processor for the information read request and a polling identifier.

[0097] Specifically, after receiving the information read request sent by the baseboard management controller through the main thread, the graphics processor will return a corresponding information read response, which includes the reception status of the graphics processor for the information read request, and the reception status can be reception success or reception failure. If the reception status is reception success, the information read response will also include a polling flag.

[0098] Step 230: Obtain, through the main thread, a polling identifier in the information read response according to the receiving status.

[0099] Specifically, obtaining the polling identifier in the information reading response according to the receiving state through the main thread includes:

[0100] When the receiving status is a successful reception, the polling identifier in the information reading response is obtained through the main thread; when the receiving status is a failed reception, the execution is returned to send a corresponding type of information reading request to the at least one graphics processor through the main thread according to the type of graphics processor information to be obtained.

[0101] Specifically, if the receiving status is successful, the information read response returned by the graphics processor will also include a polling identifier corresponding to the information read request, and the baseboard management controller can read the polling identifier in the response through the main thread. If the receiving status is failed, the baseboard management controller resends the request to read the information.

[0102] The embodiment of the present invention adds an error checking mechanism to avoid the situation where the polling identifier cannot be returned due to the probabilistic failure of the GPU to receive the request, and thus the graphics processor information cannot be obtained. The information reading request is checked based on the information reading response to see whether it is successfully received. If the request fails, the main thread resends the request, which is conducive to timely troubleshooting and improving the stability of program operation.

[0103] Figure 3 This is a flowchart of a polling thread execution method in a method for obtaining graphics processor information provided by an embodiment of the present invention. This embodiment further refines the method of obtaining graphics processor information by the polling thread according to the status polling response returned by the graphics processor based on the above embodiment. Figure 3 As shown, the method includes:

[0104] Step 310: Obtain a status polling response returned by the graphics processor through the polling thread.

[0105] Specifically, according to the polling thread sending a status polling request to the graphics processor, the graphics processor returns a status polling response, and the status polling response includes the preparation progress of the graphics processor information.

[0106] Using the above four GPU examples, the polling thread sends status polling requests for temperature information to GPU1, GPU2, GPU3, and GPU4 in turn, without blocking and waiting for the GPU to return a status polling response. The polling thread sends status polling requests for power consumption information to GPU1, GPU2, GPU3, and GPU4 in turn, and similarly sends status polling requests for other types of graphics processor information to be obtained.

[0107] Step 320: Determine the validity of the polling identifier and the preparation progress of the graphics processor information according to the status polling response through the polling thread.

[0108] Exemplarily, determining the validity of the polling identifier according to the status polling response by the polling thread includes:

[0109] Determine, by the polling thread, whether the status polling response contains the preparation progress of the graphics processor information; if so, determine that the polling identifier is a valid polling identifier; otherwise, use the polling identifier as a target polling identifier through the polling thread, continue to execute polling, and determine whether the target polling identifier is valid according to the status polling response returned by the graphics processor corresponding to the target polling identifier;

[0110] If the number of polling times for the graphics processor corresponding to the target polling identifier does not exceed the set number, and the corresponding status polling response is detected to include the preparation progress of the graphics processor information, then the target polling identifier is determined to be a valid polling identifier;

[0111] If the number of polling times for the graphics processor corresponding to the target polling identifier reaches or exceeds the set number, and the corresponding status polling response including the preparation progress of the graphics processor information is not detected, the target polling identifier is determined to be an invalid polling identifier, and the polling flag is modified to the first state through the polling thread.

[0112] Specifically, after receiving the status polling request, the graphics processor immediately starts to prepare the status information data to be read by the baseboard management controller in the memory, and at the same time returns a status polling response containing preparation progress information to the polling thread to determine that the polling identifier corresponding to the graphics processor is valid. If the polling thread receives the progress information of the execution returned by the graphics processor, it will continue to send the status polling request to the next graphics processor. After one round of polling (assuming there are 4 GPUs, one round of polling means sending a status polling request to GPU1, GPU2, GPU3 and GPU4 respectively), the polling thread will continue to send status polling requests to the graphics processor whose polling result in the previous round is that GPU information is being prepared to query the data preparation progress until the graphics processor returns a progress information of preparation completion. If the status polling response returned by the graphics processor does not contain the preparation progress of the information, it cannot be determined that the polling identifier is a valid identifier, and the polling identifier is used as the target polling identifier to continue polling, and determine whether the target polling identifier is valid according to the status polling response returned by the graphics processor corresponding to the target polling identifier. For example, if the polling is pre-set to 10 times and the status polling response containing the preparation progress of the graphics processor information is not obtained, the corresponding polling identifier is determined to be an invalid identifier. If the graphics processor corresponding to the target polling identifier is polled for the fifth time, and the status polling response containing the preparation progress of the graphics processor is obtained, the target polling identifier is determined to be a valid identifier. If the graphics processor corresponding to the target polling identifier is polled 10 times and the status polling response obtained in any polling does not contain the preparation progress of the graphics processor information, the target polling identifier is determined to be an invalid identifier, and the polling flag is modified from the second state to the first state. After monitoring that the polling flag is in the first state, the baseboard management controller will send an information read request to the graphics processor information again through the main thread.

[0113] Step 330: For a target GPU whose polling identifier is a valid polling identifier and whose preparation progress is ready, obtain GPU information of the target GPU through a polling thread.

[0114] Specifically, when the polling thread receives the progress information of the preparation completed returned by the graphics processor, it can read the prepared data from the memory of the graphics processor, and write the read data into the shared memory to facilitate the baseboard management controller to obtain it.

[0115] Step 340: When the GPU information obtained through the polling thread meets the monitoring requirements, the polling flag is modified to a first state through the polling thread.

[0116] The monitoring requirement is used to specify each monitored GPU and the GPU information to be obtained in each GPU. For example, the monitoring requirement may be to obtain the temperature information and power consumption information of GPU1, GPU2, GPU3 and GPU4 respectively. Meeting the monitoring requirement can be understood as obtaining the temperature information and power consumption information of all GPUs with valid polling identifiers in GPU1, GPU2, GPU3 and GPU4.

[0117] The embodiment of the present invention adds an error checking mechanism to avoid the situation where the polling thread fails to continuously poll data due to the GPU probabilistically providing an invalid polling identifier. By verifying the validity of the polling identifier, the invalid polling identifier is eliminated, and the valid polling identifier is re-acquired, thereby avoiding program blocking due to the polling thread consistently failing to poll the graphics processor information, which is conducive to timely troubleshooting and improving the stability of program operation.

[0118] Figure 4 A flowchart of another method for obtaining graphics processor information provided by an embodiment of the present invention. The method includes:

[0119] S401, the main thread monitors the polling flag.

[0120] S402: The polling thread monitors the polling flag.

[0121] Specifically, the main thread and the polling thread exist in parallel and monitor the polling flag respectively.

[0122] S403 , the main thread cyclically sends information read requests to GPUi, where i=1, 2, ..., n.

[0123] S404. GPUi sends an information reading response to the main thread, where the information reading response includes a polling identifier.

[0124] S405. The main thread determines whether the information reading request is a valid request. If so, execute S406; otherwise, execute S403.

[0125] Exemplarily, the main thread determines whether the information read request is successfully received by GPUi according to the information read response, thereby determining whether the information read request is a valid request.

[0126] S406: The main thread writes the polling identifier into a global variable and sets the polling flag.

[0127] Exemplarily, if the information read request is a valid request, the main thread writes the polling identifier returned by the graphics processor in response to the information read request into the global variable, and sets the polling flag to a second state.

[0128] S407: The polling thread obtains a polling identifier from a global variable.

[0129] S408: The polling thread sends a status polling request to GPUi.

[0130] S409: GPUi sends a status polling response to the polling thread.

[0131] S410, the polling thread determines whether the polling identifier is valid, if so, execute S408, otherwise execute S411.

[0132] S411, when the polling mark is an invalid mark, the polling thread clears the polling flag and continues to execute S403 to notify the main thread to resend the information reading request to the graphics processor corresponding to the invalid mark.

[0133] S412: The polling thread determines, according to the preparation progress of the GPU information in the status polling response, a target GPU whose preparation progress of the GPU information is ready.

[0134] S413: The polling thread sends a memory read request to the target GPU.

[0135] S414. The target GPU sends a memory read response to the polling thread, wherein the memory read response includes GPU information.

[0136] S415: The polling thread writes the GPU information into the shared memory.

[0137] Figure 5 A schematic diagram of the structure of a device for obtaining graphics processor information provided by an embodiment of the present invention. Figure 5 As shown, the device comprises:

[0138] The polling identifier acquisition module 510 is used to send an information read request to at least one graphics processor through a main thread when the polling flag is in a first state, and acquire a polling identifier according to an information read response returned by the graphics processor.

[0139] The status polling request sending module 520 is configured to send a status polling request to the at least one graphics processor according to the polling identifier through a polling thread when the polling flag is in the second state.

[0140] The information acquisition module 530 is configured to acquire the graphics processor information according to the status polling response returned by the graphics processor through the polling thread.

[0141] Optionally, the polling identifier acquisition module 510 includes:

[0142] The information reading request sending unit is used to send a corresponding type of information reading request to the at least one graphics processor according to the type of graphics processor information to be obtained through the main thread.

[0143] The information reading response obtaining unit is used to obtain the information reading response returned by the graphics processor through the main thread, wherein the information reading response includes the reception status and polling mark of the graphics processor for the information reading request.

[0144] A polling identifier reading unit is used to obtain the polling identifier in the information reading response according to the receiving state through the main thread.

[0145] Optionally, the polling identification reading unit includes:

[0146] The polling identifier reading subunit is used to obtain the polling identifier in the information reading response through the main thread when the receiving status is successful reception.

[0147] The information read request sending subunit is used to return to execution and send a corresponding type of information read request to the at least one graphics processor according to the type of graphics processor information to be obtained through the main thread when the receiving status is reception failure.

[0148] Optionally, the device further comprises:

[0149] The first modification module is used to modify the polling flag to a second state through the main thread.

[0150] Optionally, the information acquisition module 530 includes:

[0151] The status polling response acquiring unit is used to acquire the status polling response returned by the graphics processor through the polling thread.

[0152] A progress and validity determination unit is used to determine the validity of the polling identifier and the preparation progress of the graphics processor information according to the status polling response through the polling thread.

[0153] The information acquisition unit is configured to acquire the graphics processor information of the target graphics processor through a polling thread for the target graphics processor whose polling identifier is a valid polling identifier and whose preparation progress is preparation completed.

[0154] Optionally, the progress and effectiveness determination unit is specifically used to:

[0155] Determining, by the polling thread, whether the status polling response includes the preparation progress of the graphics processor information;

[0156] If yes, determining that the polling identifier is a valid polling identifier;

[0157] Otherwise, the polling thread uses the polling identifier as the target polling identifier, continues to execute polling, and determines whether the target polling identifier is valid according to the status polling response returned by the graphics processor corresponding to the target polling identifier;

[0158] If the number of polling times for the graphics processor corresponding to the target polling identifier does not exceed the set number, and the corresponding status polling response is detected to include the preparation progress of the graphics processor information, then the target polling identifier is determined to be a valid polling identifier;

[0159] If the number of polling times for the graphics processor corresponding to the target polling identifier reaches or exceeds the set number, and the corresponding status polling response including the preparation progress of the graphics processor information is not detected, the target polling identifier is determined to be an invalid polling identifier, and the polling flag is modified to the first state through the polling thread.

[0160] Optionally, it also includes:

[0161] The second modification module is used to modify the polling flag bit to a first state through the polling thread when the graphics processor information obtained through the polling thread meets the monitoring requirements.

[0162] In the embodiment of the present invention, when the polling flag is in the first state, an information read request is sent to at least one graphics processor through the main thread, and a polling identifier is obtained according to an information read response returned by the graphics processor; when the polling flag is in the second state, a status polling request is sent to the at least one graphics processor according to the polling identifier through the polling thread; and graphics processor information is obtained according to the status polling response returned by the graphics processor through the polling thread, thereby solving the blocking and delay problems of single-thread information acquisition. Compared with the prior art of synchronously reading GPU information by a single thread, the process of BMC blocking and waiting for GPU to return information is eliminated, the delay of BMC waiting for GPU to return information is reduced, the efficiency of BMC reading GPU information and the stability of the program are improved, which is conducive to ensuring the smooth progress of GPU monitoring work and improving the security of the system.

[0163] The device for obtaining graphics processor information provided by the embodiment of the present invention can execute the method for obtaining graphics processor information provided by any embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method.

[0164] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 6A schematic diagram of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as servers, blade servers, mainframe computers, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0165] like Figure 6 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0166] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0167] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a method for obtaining graphics processor information.

[0168] In some embodiments, the method of obtaining the graphics processor information may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the method of obtaining the graphics processor information described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the method of obtaining the graphics processor information in any other appropriate manner (e.g., by means of firmware).

[0169] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0170] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0171] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0172] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0173] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0174] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0175] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0176] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for obtaining graphics processor information, characterized in that: include: When the polling flag is in the first state, sending an information read request to at least one graphics processor through the main thread, and acquiring a polling identifier according to an information read response returned by the graphics processor; When the polling flag is in the second state, sending a status polling request to the at least one graphics processor according to the polling identifier through a polling thread; Acquiring graphics processor information according to a status polling response returned by the graphics processor through the polling thread; The sending of an information read request to at least one graphics processor through a main thread, and obtaining a polling identifier according to an information read response returned by the graphics processor, includes: Sending, by the main thread, an information reading request of a corresponding type to the at least one graphics processor according to the type of graphics processor information to be obtained; Acquire, through the main thread, an information read response returned by the graphics processor, wherein the information read response includes a reception status and a polling identifier of the graphics processor for the information read request; Acquire, by the main thread, a polling identifier in the information reading response according to the receiving status; The obtaining the graphics processor information according to the status polling response returned by the graphics processor through the polling thread includes: Acquire a status polling response returned by the graphics processor through the polling thread; Determining, by the polling thread, the validity of the polling identifier and the preparation progress of the graphics processor information according to the status polling response; For a target graphics processor whose polling identifier is a valid polling identifier and whose preparation progress is ready, the graphics processor information of the target graphics processor is obtained through a polling thread.

2. The method according to claim 1, characterized in that The obtaining, by the main thread according to the receiving state, the polling identifier in the information reading response includes: When the receiving status is successful reception, obtaining a polling identifier in the information reading response through the main thread; When the receiving status is reception failure, the execution is returned to send a corresponding type of information reading request to the at least one graphics processor through the main thread according to the type of the graphics processor information to be obtained.

3. The method according to claim 1, characterized in that After obtaining the polling identifier according to the information reading response returned by the graphics processor, the method further includes: The polling flag is modified to a second state through the main thread.

4. The method according to claim 1, characterized in that: Determining the validity of the polling identifier according to the status polling response by the polling thread includes: Determining, by the polling thread, whether the status polling response includes the preparation progress of the graphics processor information; If yes, determining that the polling identifier is a valid polling identifier; Otherwise, the polling thread uses the polling identifier as the target polling identifier, continues to execute polling, and determines whether the target polling identifier is valid according to the status polling response returned by the graphics processor corresponding to the target polling identifier; If the number of polling times for the graphics processor corresponding to the target polling identifier does not exceed the set number, and the corresponding status polling response is detected to include the preparation progress of the graphics processor information, then the target polling identifier is determined to be a valid polling identifier; If the number of polling times for the graphics processor corresponding to the target polling identifier reaches or exceeds the set number, and the corresponding status polling response including the preparation progress of the graphics processor information is not detected, the target polling identifier is determined to be an invalid polling identifier, and the polling flag is modified to the first state through the polling thread.

5. The method according to any one of claims 1 to 4, characterized in that Also includes: When the graphics processor information obtained through the polling thread meets the monitoring requirements, the polling flag is modified to a first state through the polling thread.

6. A device for obtaining graphics processor information, characterized in that: include: A polling identifier acquisition module, configured to send an information read request to at least one graphics processor through a main thread when the polling flag is in a first state, and acquire a polling identifier according to an information read response returned by the graphics processor; A status polling request sending module, configured to send a status polling request to the at least one graphics processor according to the polling identifier through a polling thread when the polling flag is in the second state; An information acquisition module, configured to acquire graphics processor information according to a status polling response returned by the graphics processor through the polling thread; Wherein, the polling identification acquisition module includes: an information reading request sending unit, configured to send, through the main thread, an information reading request of a corresponding type to the at least one graphics processor according to the type of graphics processor information to be obtained; An information reading response acquiring unit, configured to acquire, through the main thread, an information reading response returned by the graphics processor, wherein the information reading response includes a reception status and a polling identifier of the graphics processor for the information reading request; A polling identifier reading unit, configured to obtain the polling identifier in the information reading response according to the receiving state through the main thread; The information acquisition module comprises: A status polling response acquiring unit, configured to acquire a status polling response returned by the graphics processor through the polling thread; a progress and validity determination unit, configured to determine the validity of the polling identifier and the preparation progress of the graphics processor information according to the status polling response through the polling thread; The information acquisition unit is configured to acquire the graphics processor information of the target graphics processor through a polling thread for the target graphics processor whose polling identifier is a valid polling identifier and whose preparation progress is preparation completed.

7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for obtaining graphics processor information according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for obtaining graphics processor information according to any one of claims 1 to 5 when executed.

Citation Information

Patent Citations

  • Control method for single frequency network adapters of digital television

    CN103336712A

  • Polling / interruption-based real-time virtual radio data synchronization method

    CN106294235A

  • Graphic processor management method and device and storage medium

    CN114968862A

  • Method, Apparatus, and Chip for Implementing Mutually-Exclusive Operation of Multiple Threads

    US20160019100A1

  • Processors and methods for managing cache tiering with gather-scatter vector semantics

    US20180095880A1