A calling method and a response method for a GPU device
By introducing UDP and RPC service modules into the GPU driver layer, GPU devices in the local network are automatically identified and used, which solves the problems of cumbersome use and inflexibility in the existing technology, and realizes the indiscriminate use of GPU devices and automatic cluster construction. , improving usage efficiency and flexibility.
Patent Information
- Application Number
- CN202410874517.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-07-02
AI Technical Summary
The existing technology is cumbersome and inflexible when using GPU devices in the local network, and can only use GPU devices on a single host at the same time. It requires manual configuration and familiarity with professional software, which limits usage methods and scenarios.
The UDP service module and RPC service module are introduced in the GPU driver layer to automatically identify and use GPU devices in the local network through broadcast messages, achieving undifferentiated GPU device use and automatic cluster construction, simplifying the use process of GPU applications.
It enables GPU applications to use all GPU devices in the local network without manual configuration, simplifying the usage process, supporting automatic recognition of GPU devices and cluster construction, and improving usage flexibility and efficiency.
Smart Images

Figure CN118449990B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of GPU calling technology, and in particular to a calling method and a response method for a GPU device. Background Art
[0002] In a local network environment, we often need to use a GPU device or multiple GPU devices in the local network to complete our rendering or computing tasks. The current technical solutions are:
[0003] 1. Use remote management tools such as SSH or VNC to connect to the host in the local network and use remote operations to use the GPU device on the host. 2. Use third-party GPU application software or framework to use the GPU device in the local network environment. 3. Containerize GPU applications through Docker and use GPU devices in the local network through Docker.
[0004] However, the inventors found in the process of studying related technologies that the use process of the above-mentioned existing solution 1 is relatively cumbersome, and can only use the GPU device on a single host at the same time. The above-mentioned existing solution 2 requires familiarity with professional software, and the use of these professional software limits the usage methods and scenarios, which is not flexible enough. The above-mentioned existing solution 3 also requires the development of a set of supporting software tools for Docker to use GPU devices, which is cumbersome to use and complex to configure, and also requires GPU devices to support Docker. Summary of the invention
[0005] The present invention aims to at least solve the technical problems existing in the prior art. To this end, the first aspect of the present invention provides a method for calling a GPU device. The method is applied to a first host, and a first UDP service module and a first RPC service module are installed in the GPU driver layer of the first host. The method includes:
[0006] Sending a broadcast message for enumerating GPU devices to the local network where the first host is located through the first UDP service module;
[0007] Receiving a response message from a second host located in the local network through the first UDP service module, wherein the response message includes a list of GPU devices on the second host; the second host is a host having a GPU device installed and having a second UDP service module and a second RPC service module installed in the GPU driver layer;
[0008] According to the task to be executed, determining an available target GPU device from the GPU device list through the first UDP service module;
[0009] Sending a request message for opening the target GPU device to the second host where the target GPU device is located through the first UDP service module, so that the GPU driver of the target GPU device opens the target GPU device and starts the RPC service of the second RPC service module;
[0010] Receiving, through the first UDP service module, a start success message sent by the second host, and in response to the start success message, starting the RPC service of the first host;
[0011] A call request is sent to a second RPC module of the second host through the first RPC service module of the first host, so that the second host executes the task to be executed according to the call request.
[0012] Optionally, before sending a broadcast message for querying GPU devices to the local network where the first host is located through the first UDP service module, the method further includes:
[0013] Calling a GPU enumeration interface to obtain all GPU device information of the first host;
[0014] After receiving the response messages from the second hosts in the local network, the method further includes:
[0015] Combine all GPU device information of the first host and GPU device information of the second host to obtain a GPU device list;
[0016] Determine an available target GPU device according to the task to be executed and the GPU device information in the GPU device list;
[0017] If the target GPU device includes the GPU device of the first host, the GPU interface of the GPU device of the first host is loaded.
[0018] Optionally, determining an available target GPU device from the GPU device list by the first UDP service module according to the task to be executed includes:
[0019] Querying the attribute information of the GPU device in the device list; the attribute information includes the functions supported by the GPU device;
[0020] Determining the target functions required for the task to be performed;
[0021] A GPU device including the target function is determined as an available target GPU device.
[0022] Optionally, sending a call request to a second RPC module of the second host through a first RPC service module of the first host includes:
[0023] A call request is sent through the first RPC service module of the first host to the interface under the Stub object in the second RPC module of the second host.
[0024] A second aspect of the present invention provides a response method of a GPU device, which is applied to a second host, wherein the second host includes a GPU device, and a second UDP service module and a second RPC service module are installed in a GPU driver layer of the second host, and the method includes:
[0025] receiving, through the second UDP service module, a broadcast message for enumerating GPU devices sent by the first host; the first host and the second host are located in the same network;
[0026] In response to the broadcast message, sending a response message to the first host through the second UDP service module, wherein the response message includes GPU device information on the second host;
[0027] receiving, through the second UDP service module, a request message for opening a target GPU device sent by the first host, opening the target GPU device according to the request message, and starting the RPC service of the second RPC service module; the target GPU device is a GPU device on the second host that meets the task type of the task to be executed;
[0028] Sending a start success message to the first host through the second UDP service module, so that the first host starts the RPC service of the first host according to the start success message;
[0029] The calling request sent by the first host is received through the second RPC service module, and the task to be executed is executed according to the calling request.
[0030] Optionally, the receiving, by the second RPC service module, a call request sent by the first host includes:
[0031] The call request sent by the first host is received through the interface under the Stub object in the second RPC service module.
[0032] A third aspect of the present invention provides a first host, wherein a first UDP service module and a first RPC service module are installed in a GPU driver layer of the first host, and the first UDP service module is used to:
[0033] Sending a broadcast message to enumerate GPU devices to the local network where the first host is located;
[0034] Receive a response message from a second host located in the local network, wherein the response message includes a list of GPU devices on the second host; the second host is a host having a GPU device installed and having a second UDP service module and a second RPC service module installed in the GPU driver layer;
[0035] According to the task to be executed, determining an available target GPU device from the GPU device list through the first UDP service module;
[0036] Sending a request message for opening the target GPU device to the second host where the target GPU device is located, so that the GPU driver of the target GPU device opens the target GPU device and starts the RPC service of the second RPC service module;
[0037] Receiving a start success message sent by the second host, and in response to the start success message, starting the RPC service of the first host;
[0038] The first RPC service module is used for:
[0039] A call request is sent to a second RPC module of the second host, so that the second host executes the task to be executed according to the call request.
[0040] A fourth aspect of the present invention provides a second host, the second host includes a GPU device, a first UDP service module and a first RPC service module are installed in the GPU driver layer of the second host, and the first UDP service module is used to:
[0041] receiving a broadcast message for enumerating GPU devices sent by a first host; the first host and the second host are located in the same network;
[0042] In response to the broadcast message, sending a response message to the first host, wherein the response message includes GPU device information on the second host;
[0043] receiving a request message for opening a target GPU device sent by the first host, opening the target GPU device according to the request message, and starting the RPC service of the second RPC service module; the target GPU device is a GPU device on the second host that meets the task type of the task to be executed;
[0044] Sending a start success message to the first host, so that the first host starts the RPC service of the first host according to the start success message;
[0045] The first RPC service module is used for:
[0046] Receive a call request sent by the first host, and execute the task to be executed according to the call request.
[0047] A fifth aspect of the present invention proposes an electronic device, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the calling method of the GPU device as described in the first aspect, and / or the responding method of the GPU device as described in the second aspect.
[0048] A sixth aspect of the present invention proposes a computer-readable storage medium, wherein the storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the calling method of the GPU device as described in the first aspect, and / or the responding method of the GPU device as described in the second aspect.
[0049] The embodiments of the present invention have the following beneficial effects:
[0050] In the calling method of the GPU device provided in the embodiment of the present invention, a broadcast message enumerating GPU devices is sent to the local network where the first host is located through the first UDP service module; a response message of the second host located in the local network is received through the first UDP service module, and the response message includes a list of GPU devices on the second host; the second host is a host installed with a GPU device and a second UDP service module and a second RPC service module are installed in the GPU driver layer; according to the task to be executed, an available target GPU device is determined from the GPU device list through the first UDP service module; a request message for opening the target GPU device is sent to the second host where the target GPU device is located through the first UDP service module, so that the GPU driver of the target GPU device opens the target GPU device and starts the RPC service of the second RPC service module; a successful opening message sent by the second host is received, and in response to the successful opening message, the RPC service of the first host is started; a call request is sent to the second RPC module of the second host through the first RPC service module of the first host, so that the second host executes the task to be executed according to the call request. In this way, the first host realizes the function of using the GPU device in the local network at the GPU driver layer, so that the GPU application can directly use the GPU device in the local network through the GPU interface, simplifying the method of using the GPU device in the local network by the GPU application. In addition, the method of automatic identification of the GPU device in the local network is realized at the GPU driver layer, which does not require any manual configuration, nor does it require any changes to the GPU interface. The GPU application can use the GPU device of the local machine and the GPU device in the local network indiscriminately, without configuring the GPU application, and without restrictions on usage methods and scenarios. In addition, the function of using the GPU device in the local network is realized at the GPU driver layer, so that all GPU devices in the local network can be automatically built into a GPU cluster, and the GPU cluster can be conveniently used using the existing local network. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 A flowchart of a method for calling a GPU device provided by an embodiment of the present invention;
[0052] Figure 2 A schematic diagram of the structure of a GPU device calling system provided by an embodiment of the present invention;
[0053] Figure 3 A schematic diagram of a calling process of a GPU device provided by an embodiment of the present invention;
[0054] Figure 4A data flow diagram of a calling method of a GPU device provided by an embodiment of the present invention;
[0055] Figure 5 A flowchart of a response method of a GPU device provided by an embodiment of the present invention;
[0056] Figure 6 A structural block diagram of a first host provided by an embodiment of the present invention;
[0057] Figure 7 A structural block diagram of a second host provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0058] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0059] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present disclosure, unless otherwise specified, "multiple" means two or more. In addition, the use of "based on" or "according to" means openness and inclusiveness, because the process, steps, calculations or other actions "based on" or "according to" one or more of the conditions or values may be based on additional conditions or values beyond the described values in practice.
[0060] In a local network environment, we often need to use a GPU device or multiple GPU devices in the local network to complete our rendering or computing tasks. The current technical solutions are:
[0061] 1. Use remote management tools such as SSH or VNC to connect to the host in the local network and use remote operations to use the GPU device on the host;
[0062] 2. Use GPU devices in the local network environment through third-party GPU application software or framework;
[0063] 3. Containerize GPU applications through Docker and use GPU devices in the local network through Docker.
[0064] However, the inventor discovered in the process of studying related technologies that the above existing solution 1 requires the installation of remote management tools such as SSH or VNC, and then the connection to the remote host through the tool, and the copying of the GPU rendering or computing application to the remote host for execution. If GPUs with different configurations are installed in the local network, it is necessary to manually check the configurations of the GPU devices on different hosts, and then select the appropriate GPU device to use. It can be seen that the use process of this method is relatively cumbersome, and this method can only use the GPU device on a single host at the same time.
[0065] The above existing solution 2 uses third-party GPU application software or frameworks, such as Blender and TensorFlow. When using it, you need to install the corresponding software on all hosts in the local network, and configure the GPU device node. After the configuration is completed, start the software. In this way, you can use the GPU device in the local network when using third-party software or frameworks for calculations or rendering. This method requires familiarity with the software in these professional fields, and the learning curve is steep. In addition, the use of software in these professional fields limits the usage methods and scenarios, is not flexible enough, and each such third-party software or framework must implement a copy of the GPU device access function in the local network, which adds a burden to the third-party software or framework.
[0066] The above existing solution 3 requires the use of Docker containerized deployment and distributed framework, building Docker images, configuring Docker nodes, and developing a set of supporting software tools for Docker to use GPU devices. It can be seen that the use is cumbersome and the configuration is complex, and the support of GPU devices for Docker is also required.
[0067] This proposal proposes a new method for using GPU devices in the local network, namely, implementing the function of using GPU devices in the local network at the GPU driver layer, automatically identifying all GPU devices in the local network in the GPU driver, and GPU applications can use local GPU devices and GPU devices in the local network without distinction through the GPU interface. This method solves all the shortcomings of the above three existing solutions.
[0068] Figure 1 A flowchart of a method for calling a GPU device provided by an embodiment of the present invention. The method is applied to a first host, and a first UDP service module and a first RPC service module are installed in the GPU driver layer of the first host. The method includes:
[0069] Step 101: Send a broadcast message for enumerating GPU devices to the local network where the first host is located through the first UDP service module.
[0070] GPU applications use GPU devices through GPU interfaces. GPU interfaces have industry-wide interface specifications, such as OpenGL, Vulkan, and OpenCL, as well as some manufacturers' own interfaces. GPU applications use GPU devices through GPU interfaces, and the functions of GPU interfaces are implemented by GPU drivers. GPU drivers are the bridge between GPU applications and GPU hardware devices. To use GPU hardware devices, you must install the corresponding GPU device driver.
[0071] In this solution, two modules are added to the GPU driver layer without changing the GPU interface: UDP (User Datagram Protocol) service module and RPC (Remote Procedure Call) service module. Through these two modules, GPU applications can use any GPU device in the local network by directly using the GPU interface.
[0072] The first UDP service module is responsible for automatic identification of GPU devices in the local network and other loading and initialization services, etc. The first RPC service module is mainly responsible for remote calls of GPU interfaces in the local network.
[0073] Figure 2 It is a structural diagram of a calling system of a GPU device provided by an embodiment of the present invention.
[0074] like Figure 2 As shown, host 1, host 2, and host 3 are three hosts in the local network. GPU devices are installed in the three hosts, and a GPU application is installed on host 1. The GPU application calls the GPU interface to use the GPU device to implement its own functions. The function of the GPU interface is implemented in the GPU driver, and the GPU driver implements the function of the interface by calling the GPU device hardware. The GPU drivers of the three hosts all include UDP service modules and RPC service modules. Both the UDP service module and the RPC service module can communicate with Ethernet.
[0075] In the first UDP service module, the UDP protocol is used to bind the IP address of the local machine and the designated port number, so that the first UDP service module can monitor the UDP message on the port.
[0076] Figure 3 A schematic diagram of a calling process of a GPU device provided in an embodiment of the present invention.
[0077] like Figure 3As shown in the figure, the UDP service modules of the three hosts are bound to the IP address 0.0.0.0, indicating that the UDP service module is bound to the local machine. In addition, the UDP service module is bound to the port number 6000 specified by the local machine, so that the UDP service module can monitor the UDP messages on the local port 6000.
[0078] In addition, 255.255.255.255:6000 indicates sending a broadcast message to the local network on port 6000. The content of the broadcast message is to enumerate GPU devices, which means that the host receiving the broadcast message needs to enumerate the GPU device on the host to host 1.
[0079] Step 102: Receive a response message from a second host located in the local network through the first UDP service module, wherein the response message includes a list of GPU devices on the second host; the second host is a host having a GPU device installed and having a second UDP service module and a second RPC service module installed in the GPU driver layer.
[0080] After receiving the broadcast message for enumerating GPU devices sent by the first host, each host in the local network sends a response message to the first host through the first UDP service module in response to the broadcast message, and the response message includes GPU device information on the host.
[0081] The second host is one of the hosts in the local network that has a GPU device installed and a second UDP service module and a second RPC service module installed in the GPU driver layer. The second host sends a response message to the first host through the second UDP service module, and the response message includes the GPU device information on the host.
[0082] The GPU device information specifically includes a GPU device list on the second host.
[0083] like Figure 3 As shown in the figure, when the GPU application on host 1 enumerates the GPU device through the GPU interface, the GPU driver uses the UDP service module to broadcast a UDP broadcast message to query the GPU device after enumerating the local GPU device. At this time, the UDP service module in the GPU driver on other hosts (such as host 2 and host 3) in the local network will receive the broadcast message. After receiving the broadcast message, each host enumerates its own GPU device information, and then returns the enumerated GPU device information to the requesting host, that is, host 1. The GPU driver on host 1 will obtain a list of all GPU devices in the local network.
[0084] Step 103: According to the task to be executed, determine an available target GPU device from the GPU device list through the first UDP service module.
[0085] The GPU application of the first host queries the properties of each GPU device according to the returned list of all GPU devices, and then selects an available target GPU device according to the matching of the properties of each GPU device and the task to be executed.
[0086] In a possible implementation, step 103 includes:
[0087] Step 1031, querying the attribute information of the GPU device in the device list; the attribute information includes the functions supported by the GPU device;
[0088] Step 1032: determine the target function required for the task to be performed;
[0089] Step 1033: Determine a GPU device that includes the target function as an available target GPU device.
[0090] In step 1031-step 1033, first, by querying the attribute information of the GPU device, the functions supported by each GPU device are determined. For example, the supported functions include rendering, computing, etc. Then, the function required by the task to be executed of the first host is determined, such as the function required by the task to be executed is rendering.
[0091] Finally, the GPU device including the target function is determined as the target GPU device. For example, the GPU device A on the second host including the rendering function and the GPU device B on the third host are determined as the target GPU devices.
[0092] Step 104: Send a request message for opening the target GPU device to the second host where the target GPU device is located through the first UDP service module, so that the GPU driver of the target GPU device opens the target GPU device and starts the RPC service of the second RPC service module.
[0093] If the first host finds that the GPU device on the second host is available, it sends a request message to the second host to open the GPU device. After receiving the request message, the GPU driver of the second host opens its own GPU device and starts the RPC server service of the corresponding GPU device.
[0094] Step 105: Receive a start success message sent by the second host, and start the RPC service of the first host in response to the start success message.
[0095] The second host returns the opening result information to the first host. The first host parses the result information, and if it is found that it is a successful opening message, it opens the RPC client service of the first host.
[0096] Step 106: Send a call request to the second RPC module of the second host through the first RPC service module of the first host, so that the second host executes the task to be executed according to the call request.
[0097] The first host executes the task by sending a call request to the second host and calling the remote GPU device on the second host like calling the local GPU interface.
[0098] After using the remote GPU device, the first host calls the GPU interface on the second host to perform cleanup.
[0099] In a possible implementation, step 106 includes:
[0100] A call request is sent through the first RPC service module of the first host to the interface under the Stub object in the second RPC module of the second host.
[0101] Specifically, all GPU interfaces of each GPU device are loaded into a Stub object, and the GPU interface of the corresponding GPU device can be called through the Stub object.
[0102] In a possible implementation manner, before sending a broadcast message for querying GPU devices to the local network where the first host is located through the first UDP service module, the method further includes:
[0103] Step 107: Calling a GPU enumeration interface to obtain all GPU device information of the first host;
[0104] After receiving the response messages from the second hosts in the local network, the method further includes:
[0105] Step 108: Combine all GPU device information of the first host and the GPU device information of the second host to obtain a GPU device list;
[0106] Step 109: Determine an available target GPU device according to the task to be executed and the GPU device information in the GPU device list;
[0107] Step 110: If the target GPU device includes the GPU device of the first host, then load the GPU interface of the GPU device of the first host.
[0108] In an embodiment of the present invention, when the GPU application on the first host enumerates GPU devices through the GPU interface, the GPU driver will first enumerate the local GPU devices. After enumerating the local GPU devices, it uses the first UDP service module to send a UDP broadcast message to query the GPU devices in a broadcast manner.
[0109] After receiving the response messages from the second hosts in the local network, the first host combines all the GPU device information of the first host with the GPU device information on the second hosts to obtain a GPU device list. The first host queries the available target GPU devices from the GPU device list. If the target GPU devices include the GPU device of the first host, the first host turns on its own GPU device to perform related tasks.
[0110] Figure 4 A data flow diagram of a calling method for a GPU device provided in an embodiment of the present invention.
[0111] like Figure 4 As shown, there are three hosts in the local network: host 1, host 2 and host 3. A GPU device and the GPU driver of this proposal are installed on each host. Now the GPU application on host 1 needs to use multiple GPU devices to complete the rendering task. The approximate process is shown in the figure:
[0112] S1: The GPU application calls some GPU initialization interfaces to complete some initialization operations.
[0113] S2: The GPU application calls the GPU enumeration interface to enumerate all GPU devices. When enumerating GPU devices, the GPU driver first enumerates all GPU devices on the local machine, and then sends a broadcast message to query GPU devices to query all GPU devices on the local network. After receiving the broadcast message to query GPU devices, the UDP listening modules of host 2 and host 3 query the GPU devices on their respective machines, and then return the queried GPU device information to host 1. After host 1 completes enumerating GPU devices, it returns the GPU device information list to the GPU application.
[0114] S3: The GPU application queries the properties of each GPU device based on the returned list of all GPU devices.
[0115] S4: Select a suitable GPU device according to the properties of each GPU device.
[0116] S5: Assuming that the three GPU devices queried are all available, all GPU devices are now turned on. When a GPU device is turned on, all GPU interfaces of the GPU device will be loaded. If it is a GPU device of host 1, all GPU interfaces on host 1 will be directly loaded. If it is a GPU device on host 2 or host 3, a request message for turning on the GPU device is sent to the host address of the GPU device. After receiving the request message, the GPU driver of the destination host turns on its own GPU device and starts the RPC server service of the corresponding GPU device, and then returns the turning-on result to host 1. Host 1 determines that the turning-on result is successful, and turns on the corresponding RPC client service. All GPU interfaces of each GPU device will be loaded into a Stub object, and the GPU interface of the corresponding GPU device can be called through the Stub object.
[0117] S6: GPU applications use the interfaces of different GPU devices according to their own business logic. If the GPU device is a remote GPU device in the local network, the GPU driver will automatically call the remote GPU device, and the GPU application only needs to call it like calling the local GPU interface.
[0118] S7: After use, call the GPU interface to clean up.
[0119] This solution implements the function of using GPU devices in the local network at the GPU driver layer, so that GPU applications can use GPU devices in the local network directly through the GPU interface, without having to implement the function of using GPU devices in the local network by themselves. This simplifies the method of GPU applications using GPU devices in the local network, allowing GPU applications to focus more on the implementation of their own business.
[0120] In addition, a method for automatically identifying GPU devices in the local network is implemented at the GPU driver layer. No manual configuration is required, and no changes are required to the GPU interface. GPU applications can use local GPU devices and GPU devices in the local network without distinction.
[0121] In addition, the function of using GPU devices in the local network is implemented at the GPU driver layer, so that all GPU devices in the local network can be automatically built into a GPU cluster, and the GPU cluster can be conveniently used using the existing local network.
[0122] In summary, in an embodiment of the present invention, a broadcast message enumerating GPU devices is sent to a local network where the first host is located through the first UDP service module; a response message of a second host located in the local network is received through the first UDP service module, and the response message includes a list of GPU devices on the second host; the second host is a host installed with a GPU device and a second UDP service module and a second RPC service module are installed in the GPU driver layer; according to the task to be executed, an available target GPU device is determined from the GPU device list through the first UDP service module; a request message for opening the target GPU device is sent to the second host where the target GPU device is located through the first UDP service module, so that the GPU driver of the target GPU device opens the target GPU device and starts the RPC service of the second RPC service module; a successful opening message sent by the second host is received, and in response to the successful opening message, the RPC service of the first host is started; a call request is sent to the second RPC module of the second host through the first RPC service module of the first host, so that the second host executes the task to be executed according to the call request. In this way, the first host realizes the function of using the GPU device in the local network at the GPU driver layer, so that the GPU application can directly use the GPU device in the local network through the GPU interface, simplifying the method of using the GPU device in the local network by the GPU application. In addition, the method of automatic identification of the GPU device in the local network is realized at the GPU driver layer, which does not require any manual configuration, nor does it require any changes to the GPU interface. The GPU application can use the GPU device of the local machine and the GPU device in the local network indiscriminately, without configuring the GPU application, and without restrictions on usage methods and scenarios. In addition, the function of using the GPU device in the local network is realized at the GPU driver layer, so that all GPU devices in the local network can be automatically built into a GPU cluster, and the GPU cluster can be conveniently used using the existing local network.
[0123] Figure 5 It is a step flow chart of a response method of a GPU device provided by an embodiment of the present invention.
[0124] like Figure 5 As shown, the method is applied to a second host, the second host includes a GPU device, a second UDP service module and a second RPC service module are installed in the GPU driver layer of the second host, and the method includes:
[0125] Step 201: receiving a broadcast message for enumerating GPU devices sent by a first host through the second UDP service module; the first host and the second host are located in the same network;
[0126] Step 202: In response to the broadcast message, a response message is sent to the first host through the second UDP service module, wherein the response message includes GPU device information on the second host;
[0127] Step 203: receiving, through the second UDP service module, a request message for opening a target GPU device sent by the first host, opening the target GPU device according to the request message, and starting the RPC service of the second RPC service module; the target GPU device is a GPU device on the second host that meets the task type of the task to be executed;
[0128] Step 204: Send an enable success message to the first host through the second UDP service module, so that the first host enables the RPC service of the first host according to the enable success message;
[0129] Step 205: Receive the call request sent by the first host through the second RPC service module, and execute the task to be executed according to the call request.
[0130] In step 201-step 205, after receiving the broadcast message for enumerating GPU devices sent by the first host, each host in the local network sends a response message to the first host through the second UDP service module in response to the broadcast message, and the response message includes the GPU device information on the host.
[0131] The second host is one of the hosts in the local network that has a GPU device installed and a second UDP service module and a second RPC service module installed in the GPU driver layer. The second host sends a response message to the first host through the second UDP service module, and the response message includes the GPU device information on the host.
[0132] The GPU device information specifically includes a GPU device list on the second host.
[0133] If the first host finds that the GPU device on the second host is available through the attribute information of the GPU device list, a request message to open the GPU device is sent to the second host. After receiving the request message, the GPU driver of the second host opens its own GPU device and starts the RPC server service of the corresponding GPU device.
[0134] The second host returns a successful start message to the first host. The first host parses the result information, and if it is a successful start message, it opens the RPC client service of the first host.
[0135] The second host receives the call request sent by the first host, and the second RPC service module of the second host executes the task according to the call request.
[0136] In a possible implementation, step 205 includes: receiving a call request sent by the first host through an interface under a Stub object in the second RPC service module.
[0137] All GPU interfaces of each GPU device are loaded into a Stub object, and the GPU interface of the corresponding GPU device can be called through the Stub object. The GPU device of the second host is no exception, and it receives the call request through the interface under the Stub object.
[0138] In summary, in an embodiment of the present invention, a broadcast message for enumerating GPU devices sent by the first host is received through the second UDP service module; the first host and the second host are located in the same network; in response to the broadcast message, a response message is sent to the first host through the second UDP service module, and the response message includes GPU device information on the second host; a request message for opening the target GPU device sent by the first host is received through the second UDP service module, the target GPU device is opened according to the request message, and the RPC service of the second RPC service module is opened; the target GPU device is a GPU device on the second host that meets the task type of the task to be executed; an opening success message is sent to the first host through the second UDP service module, so that the first host opens the RPC service of the first host according to the opening success message; a call request sent by the first host is received through the second RPC service module, and the task to be executed is executed according to the call request. In this way, the first host realizes the function of using the GPU device in the local network at the GPU driver layer, so that the GPU application can directly use the GPU device in the local network through the GPU interface, and simplifies the method for the GPU application to use the GPU device in the local network. In addition, the GPU driver layer implements a method for automatically identifying GPU devices in the local network, which does not require any manual configuration or any changes to the GPU interface. GPU applications can use local GPU devices and GPU devices in the local network without distinction. In addition, the GPU driver layer implements the function of using GPU devices in the local network, so that all GPU devices in the local network can be automatically built into a GPU cluster, and the GPU cluster can be conveniently used using the existing local network.
[0139] Figure 6 A structural block diagram of a first host provided by an embodiment of the present invention. Figure 6 As shown, a first UDP service module 301 and a first RPC service module 302 are installed in the GPU driver layer of the first host, and the first UDP service module 301 is used to:
[0140] Sending a broadcast message to enumerate GPU devices to the local network where the first host is located;
[0141] Receive a response message from a second host located in the local network, wherein the response message includes a list of GPU devices on the second host; the second host is a host having a GPU device installed and having a second UDP service module and a second RPC service module installed in the GPU driver layer;
[0142] According to the task to be executed, determining an available target GPU device from the GPU device list through the first UDP service module;
[0143] Sending a request message for opening the target GPU device to the second host where the target GPU device is located, so that the GPU driver of the target GPU device opens the target GPU device and starts the RPC service of the second RPC service module;
[0144] Receiving a start success message sent by the second host, and in response to the start success message, starting the RPC service of the first host;
[0145] The first RPC service module 302 is used for:
[0146] A call request is sent to a second RPC module of the second host, so that the second host executes the task to be executed according to the call request.
[0147] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0148] Figure 7 A structural block diagram of a second host provided by an embodiment of the present invention. Figure 7 As shown, a second UDP service module 401 and a second RPC service module 402 are installed in the GPU driver layer of the second host, and the second UDP service module 401 is used to:
[0149] receiving a broadcast message for enumerating GPU devices sent by a first host; the first host and the second host are located in the same network;
[0150] In response to the broadcast message, sending a response message to the first host, wherein the response message includes GPU device information on the second host;
[0151] receiving a request message for opening a target GPU device sent by the first host, opening the target GPU device according to the request message, and starting the RPC service of the second RPC service module; the target GPU device is a GPU device on the second host that meets the task type of the task to be executed;
[0152] Sending a start success message to the first host, so that the first host starts the RPC service of the first host according to the start success message;
[0153] The second RPC service module 402 is used for:
[0154] Receive a call request sent by the first host, and execute the task to be executed according to the call request.
[0155] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0156] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0157] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that comply with the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0158] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for calling a GPU device, characterized in that: Applied to a first host, a first UDP service module and a first RPC service module are installed in a GPU driver layer of the first host, and the method includes: Sending a broadcast message for enumerating GPU devices to the local network where the first host is located through the first UDP service module; receiving a response message from a second host located in the local network through the first UDP service module, wherein the response message includes a list of GPU devices on the second host; the second host is a host having a GPU device installed and having the first UDP service module and the first RPC service module installed in the GPU driver layer; According to the task to be executed, determining an available target GPU device from the GPU device list through the first UDP service module; the available target GPU device is a GPU device including a target function required by the task to be executed; Sending a request message for opening the target GPU device to the second host where the target GPU device is located through the first UDP service module, so that the GPU driver of the target GPU device opens the target GPU device and starts the RPC service of the first RPC service module; Receiving, through the first UDP service module, a start success message sent by the second host, and in response to the start success message, starting the RPC service of the first host; A call request is sent to the RPC module of the second host through the first RPC service module of the first host, so that the second host executes the task to be executed according to the call request.
2. The method according to claim 1, characterized in that Before sending a broadcast message for querying GPU devices to the local network where the first host is located through the first UDP service module, the method further includes: Calling a GPU enumeration interface to obtain all GPU device information of the first host; After receiving the response messages from the second hosts in the local network, the method further includes: Combine all GPU device information of the first host and GPU device information of the second host to obtain a GPU device list; Determine an available target GPU device according to the task to be executed and the GPU device information in the GPU device list; If the target GPU device includes the GPU device of the first host, the GPU interface of the GPU device of the first host is loaded.
3. The method according to claim 1, characterized in that The step of determining an available target GPU device from the GPU device list by the first UDP service module according to the task to be executed includes: Querying the attribute information of the GPU device in the device list; the attribute information includes the functions supported by the GPU device; Determining the target functions required for the task to be performed; A GPU device including the target function is determined as an available target GPU device.
4. The method according to claim 1, characterized in that: The sending a call request to the RPC module of the second host through the first RPC service module of the first host includes: A call request is sent to an interface under a Stub object in an RPC module of the second host through the first RPC service module of the first host.
5. A response method of a GPU device, characterized in that: Applied to a second host, the second host includes a GPU device, a second UDP service module and a second RPC service module are installed in the GPU driver layer of the second host, the method includes: receiving, through the second UDP service module, a broadcast message for enumerating GPU devices sent by the first host; the first host and the second host are located in the same network; In response to the broadcast message, sending a response message to the first host through the second UDP service module, wherein the response message includes GPU device information on the second host; receiving, through the second UDP service module, a request message for opening a target GPU device sent by the first host, opening the target GPU device according to the request message, and starting the RPC service of the second RPC service module; the target GPU device is a GPU device on the second host that meets the task type of the task to be executed; Sending a start success message to the first host through the second UDP service module, so that the first host starts the RPC service of the first host according to the start success message; The calling request sent by the first host is received through the second RPC service module, and the task to be executed is executed according to the calling request.
6. The method according to claim 5, characterized in that The receiving, through the second RPC service module, a call request sent by the first host, comprises: The call request sent by the first host is received through the interface under the Stub object in the second RPC service module.
7. A first host, characterized in that: A first UDP service module and a first RPC service module are installed in the GPU driver layer of the first host, and the first UDP service module is used to: Sending a broadcast message to enumerate GPU devices to the local network where the first host is located; Receive a response message from a second host located in the local network, wherein the response message includes a GPU device list on the second host; the second host is a host having a GPU device installed and having a first UDP service module and a first RPC service module installed in a GPU driver layer; According to the task to be executed, determining an available target GPU device from the GPU device list through the first UDP service module; the available target GPU device is a GPU device including a target function required by the task to be executed; Sending a request message for opening the target GPU device to the second host where the target GPU device is located, so that the GPU driver of the target GPU device opens the target GPU device and starts the RPC service of the first RPC service module; Receiving a start success message sent by the second host, and in response to the start success message, starting the RPC service of the first host; The first RPC service module is used for: A call request is sent to the RPC module of the second host, so that the second host executes the task to be executed according to the call request.
8. A second host, characterized in that: The second host includes a GPU device, and a second UDP service module and a second RPC service module are installed in the GPU driver layer of the second host, and the second UDP service module is used to: receiving a broadcast message for enumerating GPU devices sent by a first host; the first host and the second host are located in the same network; In response to the broadcast message, sending a response message to the first host, wherein the response message includes GPU device information on the second host; receiving a request message for opening a target GPU device sent by the first host, opening the target GPU device according to the request message, and starting the RPC service of the second RPC service module; the target GPU device is a GPU device on the second host that meets the task type of the task to be executed; Sending a start success message to the first host, so that the first host starts the RPC service of the first host according to the start success message; The second RPC service module is used for: Receive a call request sent by the first host, and execute the task to be executed according to the call request.
9. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by the processor to implement the calling method of the GPU device as described in any one of claims 1-4, and / or the responding method of the GPU device as described in any one of claims 5-6.
10. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by the processor to implement the calling method of the GPU device as described in any one of claims 1-4, and / or the responding method of the GPU device as described in any one of claims 5-6.
Citation Information
Patent Citations
Machine learning automatic process management and optimization system and method based on micro-service
CN111913715A
Multi-entity resource, security, and service management in edge computing deployments
CN114026834A
Method and device for realizing remote scheduling and use of GPU (Graphics Processing Unit) of kubernetes container
CN116680035A
GPU remote call-oriented fine-grained resource pool scheduling method and system
CN117056041A
Method, apparatus, and computer program product for optimization in distributed system
US20190324817A1
