Custom graphics card distribution method, device and system

By injecting DLLs into the graphics card driver and redirecting the graphics card adapter interface, the flexibility of graphics card allocation is solved, custom graphics card allocation and cross-machine allocation is realized, the operation process is simplified, and the monitoring and alarm of graphics card occupation is supported.

CN120407173APending Publication Date: 2025-08-01BEIJING JINGWEI HIRAIN TECH CO INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510488068.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-17
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

In the prior art, the graphics card driver cannot customize graphics card allocation without the preset strategy, and it is difficult to achieve flexible graphics card allocation without modifying the rendering process source code.

Method used

By obtaining the adapter interface of the target machine and graphics card, using the dynamic link library DLL to inject the rendering process and redirecting the graphics card adapter interface, realizing custom allocation of graphics card.

Benefits of technology

It realizes custom graphics card allocation without modifying the source code of the rendering process, simplifying operations, supporting cross-machine graphics card allocation, and monitoring and alarming graphics card occupation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120407173A_ABST
    Figure CN120407173A_ABST
Patent Text Reader

Abstract

The invention discloses a custom graphics card distribution method, device and system. Responding to the rendering process starting command, obtaining a target machine and a target video card in the target machine, and obtaining a video card adapter interface of the target video card; the display card adapter interface contained in the rendering process corresponding to the rendering process starting command is redirected to the display card adapter interface of the target display card, then the rendering process starting command is executed, and the rendering process can be completed through the target display card. Therefore, a default graphics card distribution strategy is separated, and the rendering process is completed through the target graphics card in a user-defined mode. According to the method, interface redirection is adopted, operation is simple, and source codes of the rendering process do not need to be changed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of data processing, and particularly relates to a method, device, and system for customizing graphics card allocation. Background Art

[0002] A graphics card is a chip specifically used for processing operations related to graphics and images. It has multiple parallel processing units that can process a large amount of data simultaneously and has high performance in graphics and image processing. Multi-graphics card rendering is to use multiple graphics cards to work together to complete one or more rendering tasks. In actual use, multi-graphics card rendering can be achieved by multiple graphics cards on one machine or by multiple graphics cards on multiple machines.

[0003] In the prior art, there is an allocation strategy in which the graphics card driver assigns new tasks to a certain graphics card. However, for the sake of security and stability, most graphics card drivers and application programs do not give users the permission to select graphics cards and only expose them to developers through low-level interfaces. The running positions of new tasks on each graphics card are generally automatically assigned by the operating system or graphics card driver of the machine according to a preset strategy. Therefore, how to break away from the preset strategy, achieve custom graphics card allocation, and allocate the target graphics card for its operation without modifying the source code of the rendering process has become an urgent problem to be solved. Summary of the Invention

[0004] Based on the above problems, this application provides a method, device, and system for customizing graphics card allocation to break away from the preset strategy, achieve custom graphics card allocation, and allocate the target graphics card for its operation without modifying the source code of the rendering process.

[0005] This application discloses a method for customizing graphics card allocation, and the method includes:

[0006] Respond to the rendering process startup command, obtain the target machine and the target graphics card in the target machine, and obtain the graphics card adapter interface of the target graphics card;

[0007] Redirect the graphics card adapter interface included in the rendering process corresponding to the rendering process startup command to the graphics card adapter interface of the target graphics card;

[0008] Execute the rendering process startup command to complete the rendering process through the target graphics card.

[0009] Optionally, the obtaining the graphics card adapter interface of the target graphics card includes:

[0010] Send the target graphics card number obtained by numbering the target graphics card and the rendering process startup command to the device controller on the target machine;

[0011] The device controller injects a Dynamic Link Library (DLL) into the rendering process corresponding to the rendering process startup command;

[0012] The DLL obtains the target graphics card adapter interface of the target graphics card corresponding to the target graphics card number through the multimedia programming interface DirectX.

[0013] Optionally, redirecting the graphics card adapter interface included in the rendering process corresponding to the rendering process startup command to the graphics card adapter interface of the target graphics card includes:

[0014] The DLL replaces the function in DirectX that includes the graphics card adapter parameter with a custom function through the Detour function library; the custom function is used to redirect the graphics card adapter interface in the graphics card adapter parameter to the target graphics card adapter interface.

[0015] Optionally, the target machine and the target graphics card are obtained according to the graphics card occupancy situation. Obtaining the target machine and the target graphics card in the target machine includes:

[0016] According to the graphics card occupancy situation, calculate the total occupancy rate of the graphics cards in each machine as the total machine occupancy rate; the graphics card occupancy situation includes the occupancy rate of each graphics card on each machine.

[0017] Use the machine with the lowest total machine occupancy rate as the target machine, and obtain the graphics card with the lowest occupancy rate in the target machine according to the graphics card occupancy situation as the target graphics card.

[0018] Optionally, the target machine and the target graphics card are obtained according to user-defined requirements. Obtaining the target machine and the target graphics card in the target machine includes:

[0019] Receive the user's selection command, and obtain the target machine and the target graphics card from the selection command.

[0020] Optionally, after sending the target graphics card number obtained from the target graphics card number and the rendering process startup command to the device controller on the target machine, the method further includes:

[0021] Record the correspondence between the rendering process, the target machine, and the target graphics card number.

[0022] Optionally, after completing the rendering process through the target graphics card, the method further includes:

[0023] Respond to the rendering process shutdown command, and determine the target machine and the rendering process corresponding to the rendering process startup command according to the correspondence.

[0024] Send a termination command including the corresponding relationship to the device controller on the target machine;

[0025] The device controller responds to the termination command and terminates the rendering process.

[0026] Optionally, after the device controller injects a dynamic link library (DLL) into the rendering process corresponding to the rendering process start command, the method further includes:

[0027] The DLL obtains the process graphics card occupancy rate of the rendering process; the process graphics card occupancy rate is the occupancy rate of the graphics card required by the rendering process.

[0028] Optionally, after the rendering process is completed by the target graphics card, the method further includes:

[0029] Obtain the process graphics card occupancy rate, the total machine occupancy rate of the target machine, and the target graphics card occupancy rate of the target graphics card; the process graphics card occupancy rate is the occupancy rate of the graphics card required by the rendering process;

[0030] In response to the process graphics card occupancy rate being greater than the preset process occupancy rate, alarm that the rendering process occupancy is abnormal;

[0031] In response to the total machine occupancy rate of the target machine exceeding the preset machine occupancy rate, alarm that the target machine occupancy is abnormal;

[0032] In response to the target graphics card occupancy rate exceeding the preset graphics card occupancy rate, alarm that the target graphics card occupancy is abnormal.

[0033] Based on the above method for custom graphics card allocation, the present application also discloses a device for custom graphics card allocation, including: a target interface acquisition unit, a redirection unit, and an execution unit;

[0034] The target interface acquisition unit is configured to respond to a rendering process start command, acquire a target machine and a target graphics card in the target machine, and acquire a graphics card adapter interface of the target graphics card;

[0035] The redirection unit is configured to redirect the graphics card adapter interface included in the rendering process corresponding to the rendering process start command to the graphics card adapter interface of the target graphics card;

[0036] The execution unit is configured to execute the rendering process start command to complete the rendering process through the target graphics card.

[0037] Optionally, the target interface acquisition unit includes:

[0038] A numbering subunit, configured to send the target graphics card number obtained by numbering the target graphics card and the rendering process startup command to the device controller on the target machine;

[0039] An injection subunit, configured to enable the device controller to inject a dynamic link library (DLL) into the rendering process corresponding to the rendering process startup command;

[0040] An interface acquisition subunit, configured to enable the DLL to obtain the target graphics card adapter interface of the target graphics card corresponding to the target graphics card number through a multimedia programming interface (DirectX).

[0041] Optionally, the redirection unit includes:

[0042] A replacement subunit, configured to enable the DLL to replace the function in DirectX that includes graphics card adapter parameters with a custom function through a Detour function library; the custom function is configured to redirect the graphics card adapter interface in the graphics card adapter parameters to the target graphics card adapter interface.

[0043] Optionally, the target machine and the target graphics card are obtained according to the graphics card occupancy situation, and the target interface acquisition unit includes:

[0044] An overall occupancy rate acquisition subunit, configured to calculate the total occupancy rate of the graphics cards in each machine as the overall machine occupancy rate according to the graphics card occupancy situation; the graphics card occupancy situation includes the occupancy rate of each graphics card on each machine;

[0045] A target graphics card determination subunit, configured to use the machine with the lowest overall machine occupancy rate as the target machine, and obtain the graphics card with the lowest occupancy rate in the target machine as the target graphics card according to the graphics card occupancy situation.

[0046] Optionally, the target machine and the target graphics card are obtained according to user-defined requirements, and the target interface acquisition unit includes:

[0047] A selection subunit, configured to receive a selection command from the user and obtain the target machine and the target graphics card from the selection command.

[0048] Optionally, the device further includes:

[0049] A relationship recording unit, configured to record the correspondence between the rendering process, the target machine, and the target graphics card number.

[0050] Optionally, the device further includes:

[0051] A relationship determination unit, configured to respond to a rendering process shutdown command, and determine, according to the corresponding relationship, the rendering process corresponding to the target machine and the rendering process startup command;

[0052] A termination command sending unit, configured to send a termination command including the corresponding relationship to a device controller on the target machine;

[0053] A termination unit, configured to terminate the rendering process when the device controller responds to the termination command.

[0054] Optionally, the device further includes:

[0055] A process occupancy rate acquisition unit, configured for the DLL to acquire the process graphics card occupancy rate of the rendering process; the process graphics card occupancy rate is the occupancy rate that the rendering process needs to occupy the graphics card.

[0056] Optionally, the device further includes:

[0057] An occupancy rate monitoring unit, configured to acquire the process graphics card occupancy rate, the total machine occupancy rate of the target machine, and the target graphics card occupancy rate of the target graphics card; the process graphics card occupancy rate is the occupancy rate that the rendering process needs to occupy the graphics card;

[0058] A first alarm unit, configured to alarm that the rendering process occupancy is abnormal in response to the process graphics card occupancy rate being greater than a preset process occupancy rate;

[0059] A second alarm unit, configured to alarm that the target machine occupancy is abnormal in response to the total machine occupancy rate of the target machine exceeding a preset machine occupancy rate;

[0060] A third alarm unit, configured to alarm that the target graphics card occupancy is abnormal in response to the target graphics card occupancy rate exceeding a preset graphics card occupancy rate.

[0061] Based on the above method for custom graphics card allocation, the present application also discloses a custom graphics card allocation system, including: a load balancing entry and a device controller in each machine;

[0062] The load balancing entry and the device controller establish a communication connection;

[0063] The load balancing entry receives an external command, and controls the device controller to execute the external command according to the method described in claims 1-9; the external command includes a rendering process startup command and a rendering process shutdown command.

[0064] Optionally, during the process of controlling the device controller to execute the external command,

[0065] The load balancing entry is used to count the occupancy rate of each machine and each graphics card in each machine, as well as the occupancy rate of the graphics card required by each rendering process, and obtain the rendering process corresponding to the external command, as well as the target machine and the target graphics card in the target machine;

[0066] The device controller is used to redirect the graphics card adapter interface included in the rendering process corresponding to the rendering process start command to the graphics card adapter interface of the target graphics card, so as to complete the rendering process through the target graphics card,

[0067] and terminate the rendering process according to the rendering process shutdown command.

[0068] This application discloses a method, device and system for customizing graphics card allocation. In response to a rendering process start command, a target machine and the target graphics card therein are obtained, and the graphics card adapter interface of the target graphics card is obtained. By redirecting the graphics card adapter interface included in the rendering process corresponding to the rendering process start command to the graphics card adapter interface of the target graphics card, and then executing the rendering process start command, the rendering process can be completed through the target graphics card. Thus, it is possible to break away from the default graphics card allocation strategy and customize the rendering process to be completed through the target graphics card. The method described in this application uses interface redirection, which is simple to operate and does not require changing the source code of the rendering process. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to the provided drawings.

[0070] Figure 1 It is a schematic flowchart of a method for customizing graphics card allocation disclosed in an embodiment of the present application;

[0071] Figure 2a It is a schematic flowchart of another method for customizing graphics card allocation disclosed in an embodiment of the present application;

[0072] Figure 2b It is a schematic flowchart of the termination of the rendering process disclosed in an embodiment of the present application;

[0073] Figure 3 It is a schematic structural diagram of a device for customizing graphics card allocation disclosed in an embodiment of the present application;

[0074] Figure 4a It is a schematic system diagram of a method for customizing graphics card allocation disclosed in an embodiment of the present application;

[0075] Figure 4b The system schematic diagram of another method for customizing graphics card allocation disclosed in the embodiments of the present application. Detailed implementation manners

[0076] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0077] First, the implementation conditions of the method described in the present application are introduced: the system described in the present application can exist in a cluster server environment with multiple machines and multiple graphics cards. The method described in the present application is applicable to the Windows operating system platform and is applicable to the rendering process that calls the graphics card using the DirectX multimedia programming interface of the Windows operating system platform. The rendering process in the method described in the present application is a full-screen or window program under the Windows operating system platform.

[0078] The dependent technologies of the method described in the present application include: the DirectX multimedia programming interface under the Windows operating system platform, the Detour function library, and the DLL (Dynamic-Link Libraries) dynamic link library.

[0079] Next, a method, device, and system for customizing graphics card allocation in the present application will be introduced in detail through embodiments. Among them, the device described in the present application is a virtual device corresponding to the method described in the present application, and the system described in the present application is used to implement the method described in the present application.

[0080] Embodiment 1: The present application discloses a method for customizing graphics card allocation.

[0081] Specifically, please refer to Figure 1 , a method for customizing graphics card allocation disclosed in this embodiment includes the following steps:

[0082] Step 101: Respond to the rendering process startup command, obtain the target machine and the target graphics card in the target machine, and obtain the graphics card adapter interface of the target graphics card.

[0083] In the method described in this embodiment, as an alternative method, the target machine and the target graphics card are obtained according to the graphics card occupancy. The graphics card occupancy includes the occupancy rate of each graphics card on each machine. According to the graphics card occupancy, the total occupancy rate of the graphics cards in each machine can be calculated and used as the total machine occupancy rate. Then, the machine with the lowest total machine occupancy rate among all machines is used as the target machine. Similarly, according to the graphics card occupancy, the graphics card with the lowest occupancy rate in the target machine can be obtained and used as the target graphics card. As an implementable method, here, the machine with the total machine occupancy rate equal to the preset occupancy rate can also be used as the target machine, and the graphics card with the occupancy rate equal to the preset occupancy rate in the target machine can be used as the target graphics card. The setting of the preset occupancy rate can be in various forms such as ranking (e.g., the second lowest occupancy rate), range (e.g., ≤80%), value (e.g., 30%±2%), etc. Here, by default, the target machine and the target graphics card with the lowest occupancy rate are selected. No specific limitations are imposed on the selection method of the target machine and the target graphics card, the form or value of the preset occupancy rate. As long as the target machine and the target graphics card can be automatically selected.

[0084] As another alternative method, the target machine and the target graphics card are obtained according to user-defined requirements. Specifically, the user-defined method can be to receive the user's selection command and obtain the target machine and the target graphics card from the selection command. The selection command can include the preset occupancy rate (such as value, range, ranking), or the identification numbers of the target machine and the target graphics card. No specific limitations are imposed on the content of the selection command. As long as the target machine and the target graphics card can be user-defined.

[0085] In the method described in this embodiment, as an alternative method, the obtained target graphics card number and the rendering process start command are sent to the device controller on the target machine. At the same time, the corresponding relationship among the rendering process corresponding to the rendering process start command, the target machine, and the target graphics card number is recorded. The device controller then injects the DLL into the rendering process corresponding to the rendering process start command. The rendering process to be executed is usually in a suspended state, and the DLL resumes the rendering process from the suspended state to the running state. The process graphics card occupancy rate is the occupancy rate that the rendering process needs to occupy the graphics card. After the rendering process resumes the running state, it will first execute the code contained in the injected DLL, and then execute the code of the rendering process itself. The injection technology of the DLL can be, but is not limited to, the remote thread injection technology and the registry injection technology. No specific limitations are imposed on the injection technology here. As long as the DLL can be implanted. It should be noted that different injection technologies have different effects on the injection effect and the injection success rate. Finally, the DLL can obtain the process graphics card occupancy rate of the rendering process through the operating system interface or third-party software, and can also obtain the target graphics card adapter interface of the target graphics card corresponding to the target graphics card number through DirectX.

[0086] Step 102: Redirect the graphics adapter interface included in the rendering process corresponding to the rendering process startup command to the graphics adapter interface of the target graphics card.

[0087] In the method described in this embodiment, the DLL replaces the functions in DirectX that contain graphics adapter parameters with custom functions through the Detour function library. Among them, the custom function is used to redirect the graphics adapter interface in the graphics adapter parameters to the target graphics adapter interface. After successful redirection, when the rendering process calls all functions in DirectX that involve graphics adapter parameters, it will be redirected to this custom function.

[0088] Step 103: Execute the rendering process startup command to complete the rendering process through the target graphics card.

[0089] In the method described in this embodiment, in response to the rendering process shutdown command, according to the corresponding relationship recorded in step 101, determine the rendering process corresponding to the target machine and the rendering process startup command. Send a termination command including this corresponding relationship to the device controller on the target machine, and the device controller thus responds to the termination command to terminate the rendering process.

[0090] In the method described in this embodiment, the graphics card occupancy rate of the process, the total occupancy rate of the target machine, and the target graphics card occupancy rate of the target graphics card can be continuously obtained and monitored. In response to the graphics card occupancy rate of the process being greater than the preset process occupancy rate, alarm that the rendering process occupancy is abnormal. In response to the total occupancy rate of the target machine exceeding the preset machine occupancy rate, alarm that the target machine occupancy is abnormal. In response to the target graphics card occupancy rate exceeding the preset graphics card occupancy rate, alarm that the target graphics card occupancy is abnormal. Among them, the preset process occupancy rate, the preset machine occupancy rate, and the preset graphics card occupancy rate can all be adjusted according to the actual situation, and specific values are not limited here.

[0091] The method described in this embodiment realizes custom graphics card allocation by injecting DLLs and redirecting graphics card interfaces to break away from the default graphics card allocation strategy. Moreover, the method is easy to operate and does not require changing the source code inside the rendering process, achieving control from the outside. The method described in this embodiment can automatically select the target machine and the target graphics card according to the graphics card occupancy situation, realizing cross-machine graphics card allocation. At the same time, it can also monitor, count, and give early warnings about the graphics card occupancy situations of machines, graphics cards, and rendering processes in the entire server.

[0092] Embodiment 2: The present application discloses another method for custom graphics card allocation. Please refer to Figure 2a , and this embodiment describes the process of custom graphics card allocation in the case where the target machine and the target graphics card are automatically selected by the system described in the present application.

[0093] Step 201: Continuously obtain the graphics card occupancy of the server.

[0094] In the method described in this embodiment, the graphics card occupancy includes the occupancy rate of each graphics card on each machine of the server.

[0095] Step 202: Calculate the total occupancy rate of the graphics cards in each machine based on the graphics card occupancy, and use it as the total machine occupancy rate.

[0096] Step 203: Select the machine with the lowest total machine occupancy rate among all the machines of the server as the target machine.

[0097] Step 204: Select the graphics card with the lowest occupancy rate in the target machine as the target graphics card.

[0098] Step 205: Send the rendering process start command and the number of the target graphics card to the target machine.

[0099] In the method described in this embodiment, the corresponding relationship between the rendering process, the target graphics card, and the target machine in the rendering process start command can also be recorded to search for the target graphics card and the target machine.

[0100] Step 206: Inject the DLL into the rendering process corresponding to the rendering process start command, and redirect the graphics card adapter interface to the adapter interface of the target graphics card through the DLL.

[0101] Step 207: Execute the rendering process start command, and repeat the operation of Step 201.

[0102] The method described in this embodiment introduces the process of customizing graphics card allocation in the case where the target machine and the target graphics card are automatically selected by the system of the present application. By injecting the DLL and redirecting the graphics card interface, the default graphics card allocation policy is bypassed to achieve custom graphics card allocation. Moreover, the method is easy to operate, does not require changing the source code inside the rendering process, and realizes control from the outside. It can also automatically select the target machine and the target graphics card with the lowest occupancy rate according to the graphics card occupancy to achieve cross-machine graphics card allocation. At the same time, it can monitor the graphics card occupancy of the machines, graphics cards, and rendering processes in the entire server.

[0103] Embodiment 3: In another method for customizing graphics card allocation disclosed in the present application, the method for terminating the rendering process is described. Please refer to Figure 2b , the method described in this embodiment introduces the process of terminating the rendering process in the case of customizing graphics card allocation.

[0104] Step 208: Respond to the rendering process close command and obtain the rendering process corresponding to the rendering process close command.

[0105] Step 209: Based on the rendering process, determine the target graphics card and the target machine according to the recorded corresponding relationship among the rendering process, the target graphics card, and the target machine.

[0106] Step 210: Send a termination command including this corresponding relationship to the target machine.

[0107] Step 211: The target machine responds to the termination command and terminates the rendering process.

[0108] The method described in this embodiment introduces the process of terminating the rendering process in the case of custom graphics card allocation. Through the corresponding relationship among the rendering process, the target machine, and the target graphics card obtained when the rendering process is started, when receiving the rendering process shutdown command, the target machine and the target graphics card can be found, and the rendering process executed on the target graphics card can be terminated.

[0109] Based on the method for custom graphics card allocation disclosed in the above embodiment, this embodiment correspondingly discloses a device for custom graphics card allocation. Please refer to Figure 3 , the device for custom graphics card allocation includes: a target interface acquisition unit 301, a redirection unit 302, and an execution unit 303;

[0110] The target interface acquisition unit 301 is configured to, in response to a rendering process start command, acquire the target machine and the target graphics card in the target machine, and acquire the graphics card adapter interface of the target graphics card;

[0111] The redirection unit 302 is configured to redirect the graphics card adapter interface included in the rendering process corresponding to the rendering process start command to the graphics card adapter interface of the target graphics card;

[0112] The execution unit 303 is configured to execute the rendering process start command to complete the rendering process through the target graphics card.

[0113] Optionally, the target interface acquisition unit 301 includes:

[0114] A numbering subunit is configured to send the target graphics card number obtained by numbering the target graphics card and the rendering process start command to the device controller on the target machine;

[0115] An injection subunit is configured to inject a dynamic link library DLL into the rendering process corresponding to the rendering process start command by the device controller;

[0116] An interface acquisition subunit is configured to obtain the target graphics card adapter interface of the target graphics card corresponding to the target graphics card number by the DLL through DirectX.

[0117] Optionally, the redirection unit 302 includes:

[0118] A replacement subunit, configured to enable the DLL to replace the functions in DirectX that contain graphics adapter parameters with custom functions through the Detour function library; the custom function is configured to redirect the graphics adapter interface in the graphics adapter parameters to the target graphics adapter interface.

[0119] Optionally, the target machine and the target graphics card are obtained according to the graphics card occupancy situation. The target interface obtaining unit 301 includes:

[0120] A total occupancy rate obtaining subunit, configured to calculate the total occupancy rate of the graphics cards in each machine according to the graphics card occupancy situation as the total machine occupancy rate; the graphics card occupancy situation includes the occupancy rate of each graphics card on each machine.

[0121] A target graphics card determining subunit, configured to use the machine with the lowest total machine occupancy rate as the target machine, and obtain the graphics card with the lowest occupancy rate in the target machine according to the graphics card occupancy situation as the target graphics card.

[0122] Optionally, the target machine and the target graphics card are obtained according to user-defined requirements. The target interface obtaining unit 301 includes:

[0123] A selection subunit, configured to receive a user's selection command and obtain the target machine and the target graphics card from the selection command.

[0124] Optionally, the device further includes:

[0125] A relationship recording unit, configured to record the correspondence between the rendering process, the target machine, and the target graphics card number.

[0126] Optionally, the device further includes:

[0127] A relationship determining unit, configured to respond to a rendering process closing command and determine the target machine and the rendering process corresponding to the rendering process start command according to the correspondence.

[0128] A termination command sending unit, configured to send a termination command including the correspondence to the device controller on the target machine.

[0129] A termination unit, configured to enable the device controller to respond to the termination command and terminate the rendering process.

[0130] Optionally, the device further includes:

[0131] A process occupancy rate acquisition unit is used for the DLL to acquire the process graphics card occupancy rate of the rendering process; the process graphics card occupancy rate is the occupancy rate that the rendering process needs to occupy the graphics card.

[0132] Optionally, the device further includes:

[0133] An occupancy rate monitoring unit is used to acquire the process graphics card occupancy rate, the total machine occupancy rate of the target machine, and the target graphics card occupancy rate of the target graphics card; the process graphics card occupancy rate is the occupancy rate that the rendering process needs to occupy the graphics card;

[0134] A first alarm unit is used to respond that the process graphics card occupancy rate is greater than a preset process occupancy rate and alarm that the rendering process occupancy is abnormal;

[0135] A second alarm unit is used to respond that the total machine occupancy rate of the target machine exceeds a preset machine occupancy rate and alarm that the target machine occupancy is abnormal;

[0136] A third alarm unit is used to respond that the target graphics card occupancy rate exceeds a preset graphics card occupancy rate and alarm that the target graphics card occupancy is abnormal.

[0137] Based on the above method for customizing graphics card allocation, the present application also discloses a system for customizing graphics card allocation. Please refer to Figure 4a , the system for customizing graphics card allocation includes: a load balancing entry 401 and a device controller 402 in each machine;

[0138] The load balancing entry 401 and the device controller 402 establish a communication connection;

[0139] The load balancing entry 401 receives an external command and controls the device controller 402 to execute the external command according to the method described in claims 1-9; the external command includes a rendering process start command and a rendering process stop command.

[0140] Optionally, during the process of controlling the device controller 402 to execute the external command,

[0141] The load balancing entry 401 is used to count the occupancy rate of each machine and each graphics card in each machine, as well as the occupancy rate that each rendering process needs to occupy the graphics card, and acquire the rendering process corresponding to the external command, as well as the target machine and the target graphics card in the target machine;

[0142] The device controller 402 is used to redirect the graphics card adapter interface included in the rendering process corresponding to the rendering process start command to the graphics card adapter interface of the target graphics card, so as to complete the rendering process through the target graphics card,

[0143] and terminating the rendering process according to the rendering process shutdown command.

[0144] Embodiment 4: The present application discloses another method for customizing graphics card allocation. Figure 4b It is a system schematic diagram of another method for customizing graphics card allocation disclosed in the embodiments of the present application. The method in this embodiment is directed to the process of customizing graphics card allocation in the system for customizing graphics card allocation of the present application, and is introduced in combination with Figure 4b for description.

[0145] Step 501: Start the system for customizing graphics card allocation of the present application, and open the load balancing entry and the device controllers in each machine.

[0146] In the method described in this embodiment, the load balancing entry and the device controller can establish a communication connection through Socket (a network communication interface).

[0147] Step 502: The load balancing entry continuously receives external commands, and each device controller continuously obtains the graphics card occupancy situation and sends it to the load balancing entry.

[0148] In the method described in this embodiment, the external command is a rendering process start command, and the rendering process start command includes the entry path and command line parameters of the rendering process. The load balancing entry can analyze the entry path and command line parameters of the rendering process from the external instruction.

[0149] In the method described in this embodiment, the graphics card occupancy situation is the occupancy rate of each graphics card on each machine. The device controller on one machine can only obtain the occupancy rate of each graphics card on the machine where it is located.

[0150] Step 503: The load balancing entry counts the graphics card occupancy situation and automatically selects a target machine and a target graphics card on the target machine.

[0151] Step 504: The load balancing entry sends the number of the target graphics card and the rendering process corresponding to the rendering process start command to the device controller of the target machine.

[0152] Step 505: The device controller receives the data from the load balancing entry, and injects the DLL into a suspended rendering program through an injector, and resumes the rendering process from the suspended state to the running state.

[0153] Step 506: The DLL connects to the injector through shared memory technology, and obtains the process graphics card occupancy rate of the current rendering process and sends it to the injector.

[0154] Step 507: Based on the number of the target graphics card, the DLL obtains the graphics card adapter interface of the target graphics card through the interface provided by DirectX.

[0155] Step 508: The DLL, through the Detour function library, redirects the included graphics adapter interface to the graphics adapter interface of the target graphics card in the function in DirectX that includes the graphics adapter parameters.

[0156] Step 509: The rendering process calls the functions in DirectX that involve graphics adapter parameters and executes them through the target graphics card.

[0157] The embodiments in this specification are described in a progressive manner. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple. For related parts, please refer to the description in the method section.

[0158] It should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.

[0159] The steps of the methods or algorithms described in connection with the embodiments disclosed herein can be implemented directly in hardware, software modules executed by a processor, or a combination of both. The software modules can be placed in random access memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0160] The features described in the embodiments in this specification can be replaced or combined with each other, enabling those skilled in the art to implement or use the present application.

[0161] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for customizing graphics card allocation, characterized in that, Including: In response to a rendering process startup command, obtain a target machine and a target graphics card in the target machine, and obtain a graphics adapter interface of the target graphics card; Redirect a graphics adapter interface included in a rendering process corresponding to the rendering process startup command to the graphics adapter interface of the target graphics card; Execute the rendering process startup command to complete the rendering process through the target graphics card.

2. The method according to claim 1, characterized in that, The obtaining the graphics adapter interface of the target graphics card includes: Send a target graphics card number obtained by numbering the target graphics card and the rendering process startup command to a device controller on the target machine; The device controller injects a dynamic link library DLL into the rendering process corresponding to the rendering process startup command; The DLL obtains a target graphics adapter interface of the target graphics card corresponding to the target graphics card number through a multimedia programming interface DirectX.

3. The method according to claim 2, wherein The redirecting a graphics adapter interface included in a rendering process corresponding to the rendering process startup command to the graphics adapter interface of the target graphics card includes: The DLL replaces a function including a graphics adapter parameter in the DirectX with a custom function through a Detour function library; the custom function is used to redirect the graphics adapter interface in the graphics adapter parameter to the target graphics adapter interface.

4. The method according to claim 1, wherein The target machine and the target graphics card are obtained according to the graphics card occupancy situation. The obtaining the target machine and the target graphics card in the target machine includes: According to the graphics card occupancy situation, calculate a total occupancy rate of the graphics cards in each machine as the total machine occupancy rate; the graphics card occupancy situation includes the occupancy rate of each graphics card on each machine; Use the machine with the lowest total machine occupancy rate as the target machine, and obtain the graphics card with the lowest occupancy rate in the target machine according to the graphics card occupancy situation as the target graphics card.

5. The method according to claim 1, wherein The target machine and the target graphics card are obtained according to user-defined requirements. The obtaining the target machine and the target graphics card in the target machine includes: Receive a selection command from the user, and obtain the target machine and the target graphics card from the selection command.

6. The method according to claim 2, wherein After sending the target graphics card number obtained by numbering the target graphics card and the rendering process startup command to the device controller on the target machine, the method further includes: Record the correspondence between the rendering process, the target machine, and the target graphics card number.

7. The method according to claim 6, characterized in that, After completing the rendering process through the target graphics card, the method further includes: In response to a rendering process shutdown command, determine the target machine and the rendering process corresponding to the rendering process startup command according to the correspondence; Send a termination command including the correspondence to the device controller on the target machine; The device controller responds to the termination command and terminates the rendering process.

8. The method according to claim 2, wherein After the device controller injects a dynamic link library DLL into the rendering process corresponding to the rendering process startup command, the method further includes: The DLL obtains the process GPU occupancy rate of the rendering process; the process GPU occupancy rate is the occupancy rate of the GPU required by the rendering process.

9. The method according to claim 4, wherein After the rendering process is completed through the target GPU, the method further includes: Obtaining the process GPU occupancy rate, the total machine occupancy rate of the target machine, and the target GPU occupancy rate of the target GPU; the process GPU occupancy rate is the occupancy rate of the GPU required by the rendering process; In response to the process GPU occupancy rate being greater than the preset process occupancy rate, alarming that the rendering process occupancy is abnormal; In response to the total machine occupancy rate of the target machine exceeding the preset machine occupancy rate, alarming that the target machine occupancy is abnormal; In response to the target GPU occupancy rate exceeding the preset GPU occupancy rate, alarming that the target GPU occupancy is abnormal.

10. A device for customizing graphics card allocation, characterized in that, It includes: A target interface acquisition unit, a redirection unit, and an execution unit; The target interface acquisition unit is configured to, in response to a rendering process start command, acquire a target machine and a target GPU in the target machine, and acquire the GPU adapter interface of the target GPU; The redirection unit is configured to redirect the GPU adapter interface included in the rendering process corresponding to the rendering process start command to the GPU adapter interface of the target GPU; The execution unit is configured to execute the rendering process start command to complete the rendering process through the target GPU.