Data processing device, method and electronic equipment
By designing a data processing device including a virtual machine and a container, using the first virtual driver application interface and the driver application interface to call the processing resources in the graphics processor host, it solves the problem that the GPU in the existing technology cannot support virtualization at the same time. It solves the problems of machines and containers and realizes full utilization of resources and saving of hardware resources.
Patent Information
- Application Number
- CN202210192214.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-28
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2042-02-28
AI Technical Summary
The existing GPU hardware does not support SRIOV technology, which causes the same GPU host to be unable to set up virtual machines and containers at the same time, and cannot make full use of GPU resources, which increases hardware resource consumption.
Design a data processing device, including at least one virtual machine and a container. Through the first virtual driver application program interface and the driver application program interface, it receives the data to be processed generated by the virtual machine and the container respectively, and calls the graphics processor host computer. processing resources to realize the sharing of virtual machines and containers.
It is possible to set up virtual machines and containers on the same GPU host at the same time, making full use of host resources and reducing hardware resource consumption.
Smart Images

Figure CN114546600B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and more specifically, to a data processing device, method and electronic device. Background Art
[0002] Currently, mainstream GPU (Graphics Processing Unit) hardware does not support SRIOV (Single Root I / O Virtualization) technology. Different virtualization technologies need to be used to share GPUs for multiple virtual machines / containers. As a result, the same GPU host can only be used for virtual machines or containers, and virtual machines and containers cannot be set up on the same GPU host.
[0003] Therefore, when it is necessary to set up virtual machines and containers separately, it is necessary to set up only virtual machines on one GPU and only containers on the other GPU. However, the set up virtual machines may only occupy part of the resources of their corresponding GPUs and / or the containers may only occupy part of the resources of their corresponding GPUs, resulting in inability to fully utilize GPU resources and increasing additional hardware resource consumption. Summary of the invention
[0004] In view of this, the present application provides a data processing device as follows:
[0005] A data processing device, applied to a graphics processor host, comprising:
[0006] at least one virtual machine, used to generate first data to be processed;
[0007] at least one container, used to generate second data to be processed;
[0008] a first virtual driver application program interface, connected to the virtual machine and the container, respectively, for receiving the first data to be processed and the second data to be processed;
[0009] a driver application interface, connected to the first virtual driver application interface, and configured to receive the first data to be processed and the second data to be processed transmitted by the first virtual driver application interface, and to call processing resources in a graphics processor host machine based on the first data to be processed and the second data to be processed, respectively, and the processing resources respectively process the first data to be processed and the second data to be processed to obtain a first processing result and a second processing result;
[0010] The virtual machine includes an application module, a second virtual driver application interface and a virtual graphics processor; the first data to be processed generated by the application module is forwarded to the virtual graphics processor through the second virtual driver application interface, and the virtual graphics processor loads the first data to be processed into the first virtual driver application interface.
[0011] Optionally, the above device further includes:
[0012] A forwarding module is called, which is arranged between the virtual machine and the first virtual driver application interface, receives the first data to be processed sent by the virtual machine, converts the first data to be processed from a first protocol format to a second protocol format, and sends the first data to be processed in the second protocol format to the first virtual driver application interface, wherein the first protocol format is the protocol format adopted by the first data to be processed output by the virtual machine, and the second protocol format is the protocol format adopted by the second data to be processed output by the container.
[0013] Optionally, the above device further includes:
[0014] The graphics processor driver module is connected to the driver application program interface and is used to provide processing resources for the driver application program interface.
[0015] Optionally, in the above device, the first virtual driver application program interface includes:
[0016] a receiving unit connected to the virtual machine and the container respectively, the receiving unit receiving the first data to be processed and the second data to be processed;
[0017] An allocating unit connected to the receiving unit, the allocating unit allocating processing resources in a graphics processor host machine to the virtual machine and the container.
[0018] Optionally, in the above device, the virtual machine further includes:
[0019] The first proxy module is arranged between the application module and the second virtual driver application program interface. The first proxy module intercepts the first data to be processed generated by the application module and sends the first data to be processed to the second virtual driver application program interface.
[0020] Optionally, the above device further includes:
[0021] at least one second proxy module, disposed between the call forwarding module and the first virtual driver application program interface, the second proxy module sending the first to-be-processed data to the first virtual driver application program interface based on the first processing resources and the resources required for processing the first to-be-processed data;
[0022] The first processing resource is a resource allocated by a graphics processor host to a first virtual machine, and the first virtual machine is a virtual machine that generates the first data to be processed.
[0023] Optionally, in the above-mentioned device, the call forwarding module also receives a first processing result transmitted by a first virtual driver application program interface, converts the first processing result from a second protocol format to a first protocol format, and outputs the first processing result in the first protocol format to a virtual graphics processor of a first virtual machine, where the first virtual machine is the virtual machine that generates the first data to be processed.
[0024] A data processing method, the method being applied to a graphics processor host, comprising:
[0025] Receive first data to be processed generated by an application in at least one virtual machine and / or second data to be processed generated by at least one container; wherein the first data to be processed generated by an application module in the virtual machine is forwarded to a virtual graphics processor through a second virtual driver application interface in the virtual machine, and the virtual graphics processor outputs the first data to be processed to a graphics processor host machine;
[0026] Transmitting the first data to be processed and / or the second data to be processed to a first virtual driver application program interface of the graphics processor host machine respectively;
[0027] The first virtual driver application program interface calls processing resources in a graphics processor host based on the first data to be processed and / or the second data to be processed, and the processing resources process the first data to be processed and / or the second data to be processed to obtain a first processing result and / or a second processing result respectively.
[0028] Optionally, the above-mentioned device and the above-mentioned method, wherein the first to-be-processed data is transmitted to the first virtual driver application program interface of the graphics processor host machine, comprises:
[0029] Determining resources required by the graphics processor host to process the first data to be processed;
[0030] Acquire a first processing resource allocated to a first virtual machine in the graphics processor host, where the first virtual machine is a virtual machine that generates the first data to be processed;
[0031] The first to-be-processed data is transmitted to a first virtual driver application program interface of the graphics processor host machine according to the first processing resource and the required resource.
[0032] An electronic device is provided, the electronic device serving as a graphics processor host, the graphics processor host comprising the data processing device as described in any one of the above items.
[0033] It can be known from the above technical solution that the present application provides a data processing device, which is applied to a graphics processor host, including at least one virtual machine, at least one container, a first virtual driver application interface and a driver application interface, wherein the first virtual driver application interface is connected to the virtual machine and the container respectively, and is used to receive the first to-be-processed data generated by the virtual machine and the second to-be-processed data generated by the container; the driver application interface is used to receive the first to-be-processed data and the second to-be-processed data transmitted by the first virtual driver application interface, and based on the first to-be-processed data and the second to-be-processed data, respectively call the processing resources in the graphics processor host, and the processing resources respectively process the first to-be-processed data and the second to-be-processed data to obtain the first processing result and the second processing result; wherein any virtual machine includes an application module, a second virtual driver application interface and a virtual graphics processor, and the first to-be-processed data generated by the application module is forwarded to the virtual graphics processor through the second virtual driver application interface, and the virtual graphics processor outputs the first to-be-processed data to the first virtual driver application interface, so as to send the to-be-processed data generated by the virtual machine to the first virtual driver application interface. In this solution, the graphics processor host processes the data generated by the virtual machine and the data generated by the container separately. The same host realizes the sharing of containers and virtual machines, which can fully utilize the host resources and reduce hardware resource consumption. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative work.
[0035] Figure 1 is a structural diagram of a data processing device embodiment 1 provided by the present application;
[0036] Figure 2 is a structural diagram of a data processing device embodiment 2 provided by the present application;
[0037] Figure 3 is a structural diagram of a data processing device embodiment 3 provided by the present application;
[0038] Figure 4is a structural diagram of a data processing device embodiment 4 provided by the present application;
[0039] Figure 5 is a structural diagram of a data processing device embodiment 5 provided by the present application;
[0040] Figure 6 is a structural diagram of a data processing device embodiment 6 provided by the present application;
[0041] Figure 7 is a flow chart of a data processing method embodiment 1 provided by the present application;
[0042] Figure 8 It is a flow chart of Example 2 of a data processing method provided by the present application. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0044] like Figure 1 , which is a schematic diagram of a structure of a data processing device embodiment 1 provided by the present application, the device is applied to a graphics processing unit (GPU) host machine, and the device includes the following structures: at least one virtual machine 101, at least one container 102, a first virtual driver application interface 103 and a driver application interface 104;
[0045] The schematic diagrams in this application all use a virtual machine and a container as examples. In the specific implementation, the number of virtual machines and containers is not limited thereto and can be set according to actual conditions.
[0046] The virtual machine 101 is used to generate first data to be processed;
[0047] Among them, the virtual machine 101 includes an application module 1011, a second virtual driver application program interface (API) 1012 and a virtual graphics processor 1013; the first data to be processed generated by the application module is forwarded to the virtual graphics processor through the second virtual driver application program interface, and the virtual graphics processor loads the first data to be processed into the first virtual driver application program interface.
[0048] Among them, the application module in the virtual machine generates first data to be processed, and the first data to be processed needs to call processing resources in the graphics processor host. Specifically, the first data to be processed is forwarded to the second virtual driver application interface in the virtual machine, and the second virtual application interface forwards the first data to be processed to the virtual graphics processor in the virtual machine. The virtual graphics processor calls the first virtual driver application interface to send the first data to be processed generated by the application module to the graphics processor host.
[0049] The virtual graphics processor mounted in the virtual machine serves as a bridge between the virtual machine and the graphics processor host machine, and outputs the to-be-processed data generated by the application module from the virtual machine.
[0050] Wherein, the container 102 is used to generate second data to be processed;
[0051] The first virtual driver application program interface 103 is connected to the virtual machine 101 and the container 102 respectively, and is used to receive the first data to be processed and the second data to be processed;
[0052] The first virtual driver application program interface is connected to the virtual machine and the container respectively, and receives first data to be processed output by the virtual machine and second data to be processed output by the container.
[0053] The virtual machine and the container call a virtual driver application program interface file so that the graphics processor host receives the first data to be processed and the second data to be processed.
[0054] Among them, the first virtual driver application interface in the graphics processor host machine receives the data to be processed output from the virtual machine and the container respectively, thereby realizing the separate reception and subsequent processing of the data to be processed from the two sources. The virtual machine and the container can be separately set up in the same graphics processor host machine, so as to make full use of the resources in the graphics processor host machine.
[0055] The driver application interface 104 is connected to the first virtual driver application interface 103, and is used to receive the first data to be processed and the second data to be processed transmitted by the first virtual driver application interface, and to call processing resources in the graphics processor host based on the first data to be processed and the second data to be processed, respectively, and the processing resources respectively process the first data to be processed and the second data to be processed to obtain a first processing result and a second processing result;
[0056] The driver application program interface serves as the kernel part of the graphics processor host, provides processing resources for the first processed data and the second processed data, processes the first data to be processed to obtain a first processing result, and processes the second data to be processed to obtain a second processing result.
[0057] In summary, a data processing device provided in this embodiment is applied to a graphics processor host, including at least one virtual machine, at least one container, a first virtual driver application interface and a driver application interface, wherein the first virtual driver application interface is connected to the virtual machine and the container respectively, and is used to receive the first to-be-processed data generated by the virtual machine and the second to-be-processed data generated by the container; the driver application interface is used to receive the first to-be-processed data and the second to-be-processed data transmitted by the first virtual driver application interface, and based on the first to-be-processed data and the second to-be-processed data, respectively call the processing resources in the graphics processor host, and the processing resources respectively process the first to-be-processed data and the second to-be-processed data to obtain the first processing result and the second processing result; wherein any virtual machine includes an application module, a second virtual driver application interface and a virtual graphics processor, and the first to-be-processed data generated by the application module is forwarded to the virtual graphics processor through the second virtual driver application interface, and the virtual graphics processor outputs the first to-be-processed data to the first virtual driver application interface, so as to send the to-be-processed data generated by the virtual machine to the first virtual driver application interface. In this solution, the graphics processor host processes the data generated by the virtual machine and the data generated by the container respectively, and the same host realizes the sharing of the container and the virtual machine, which can make full use of the host resources and reduce the consumption of hardware resources.
[0058] like Figure 2 , which is a schematic diagram of a structure of a data processing device embodiment 2 provided by the present application, the device includes the following structures: at least one virtual machine 201, at least one container 202, a call forwarding module 203, a first virtual driver application interface 204 and a driver application interface 205;
[0059] The structural functions of at least one virtual machine 201, at least one container 202, the first virtual driver application interface 204 and the driver application interface 205 are explained in Example 1 and are not described in detail in this embodiment.
[0060] The forwarding module 203 is called and arranged between the virtual machine 201 and the first virtual driver application program interface 204, receives the first data to be processed sent by the virtual machine, converts the first data to be processed from the first protocol format to the second protocol format, and sends the first data to be processed in the second protocol format to the first virtual driver application program interface;
[0061] The first protocol format is a protocol format used by first data to be processed output by the virtual machine, and the second protocol format is a protocol format used by second data to be processed output by the container.
[0062] Among them, the protocol format of the data to be processed output by the virtual machine is different from that of the data to be processed output by the container. This is because the setting methods of the container and the virtual machine are different. The virtual machine is generally set up by the development manufacturer, and the way its data is generated is unknown to the developer who uses the virtual machine. The container can be developed by the developer who uses the virtual machine. Therefore, the developer who uses the virtual machine adopts the protocol format of unifying the data to be processed output by the virtual machine into the container.
[0063] As an example, the container is loaded into the graphics processor host machine using a .so file, and the call forwarding module also forwards the first to-be-processed data as a .so file to a first virtual driver application program interface of the graphics processor host machine.
[0064] Specifically, the first data to be processed output by the virtual machine is converted from the first protocol format to the second protocol format, so that the protocol format of the data to be processed output by the virtual machine is consistent with the protocol format of the data to be processed output by the container, and the first virtual driver application interface only needs to be able to receive data in the second protocol format, thereby reducing the complexity of the first virtual driver application interface.
[0065] The function of the call forwarding module is to unify the format, specifically to unify the protocol format of the first data to be processed output by the virtual machine with the container, and convert it into the second protocol format.
[0066] Moreover, the call forwarding module is also used to receive the first processing result transmitted by the first virtual driver application program interface, convert the first processing result from the second protocol format to the first protocol format, and output the first processing result in the first protocol format to the virtual graphics processor of the first virtual machine, where the first virtual machine is the virtual machine that generates the first data to be processed.
[0067] The protocol format of the converted data of the function of calling the forwarding module specifically converts the first to-be-processed data output by the virtual machine from the first protocol format into the second protocol format, and converts the first result output by the first virtual driver application interface from the second protocol format into the first protocol format, thereby realizing format conversion between the virtual machine and the first virtual driver application interface and achieving the purpose of data interaction between the two.
[0068] In summary, a data processing device provided in this embodiment also includes: a call forwarding module arranged between the virtual machine and the first virtual driver application interface, the call forwarding module is mainly used to perform data call forwarding between the virtual machine and the first driver application interface to achieve data interaction between the two, and the first to-be-processed data output by the virtual machine is converted from the first protocol format to the second protocol format. The first virtual driver application interface only needs to be able to receive data in the second protocol format, thereby reducing the complexity of the first virtual driver application interface.
[0069] like Figure 3 , which is a schematic diagram of a structure of a data processing device embodiment 3 provided by the present application, the device includes the following structures: at least one virtual machine 301, at least one container 302, a first virtual driver application interface 303, a driver application interface 304 and a graphics processor driver module 305;
[0070] The structural functions of at least one virtual machine 301, at least one container 302, the first virtual driver application interface 303, and the driver application interface 304 are explained in Example 1 and are not described in detail in this embodiment.
[0071] The graphics processor driver module 305 is connected to the driver application program interface and is used to provide processing resources for the driver application program interface.
[0072] The graphics processor host is also provided with a graphics processor driver module to provide processing resources for the driver application program interface.
[0073] Specifically, the processing resources in the graphics processor host are divided into multiple slices, and each slice can provide processing resources for a virtual machine or a container.
[0074] The processing resource in the graphics processor host machine that is called specifically calls a processing resource for the virtual machine or container.
[0075] The processing resources include the computing power and video memory of the graphics processor host.
[0076] For example, if the processing resources in the graphics processor host are evenly divided into 4 slices, each slice occupies 25% of the computing power and video memory of the graphics processor host.
[0077] Among them, computing power represents the ability of the graphics processing host to perform calculations.
[0078] The graphics processor driver module includes a hardware structure (graphics processor hardware) and software (graphics processor driver).
[0079] To process the data to be processed, it is necessary to call the driver application program interface function in the graphics processor host to perform calculations. Specifically, the graphics processor driver and graphics processor hardware in the graphics processor host carry the processing resources.
[0080] In summary, a data processing device provided in this embodiment further includes: a graphics processor driver module, connected to the driver application interface, for providing processing resources for the driver application interface. In this solution, the graphics processor driver module provides processing resources for the virtual machine and the container through the driver application interface, thereby realizing the processing of the to-be-processed data generated for the virtual machine and the container respectively.
[0081] like Figure 4 , which is a structural diagram of a data processing device embodiment 4 provided by the present application, the device includes the following structures: at least one virtual machine 401, at least one container 402, a first virtual driver application interface 403 and a driver application interface 404;
[0082] The first virtual driver application program interface includes: a receiving unit 4041 and an allocating unit 4042;
[0083] The receiving unit 4041 is connected to the virtual machine and the container respectively, and receives the first data to be processed and the second data to be processed;
[0084] The allocating unit 4042 is connected to the receiving unit, and the allocating unit allocates processing resources in a graphics processor host machine to the virtual machine and the container.
[0085] The first virtual application program interface 403 has a receiving unit for receiving the data to be processed of the virtual machine and the container respectively.
[0086] The first virtual application program interface is also provided with an allocation unit, which allocates processing resources in a graphics processor host machine to virtual machines and containers.
[0087] The processing resources include the computing power and video memory of the graphics processor host.
[0088] Specifically, the allocation unit may allocate video memory of the graphics processor host based on parameters such as video memory required by the first data to be processed and the second data to be processed, priority of the source of the data to be processed, and free video memory in the graphics processor host.
[0089] The computing power can also be allocated based on other parameters, such as the source priority of the data to be processed, the amount of idle computing power in the graphics processor host, etc.
[0090] Among them, sources with higher priority will be allocated more computing power to the data to be processed in order to reduce the calculation time and speed up the response.
[0091] For example, the first data to be processed of the virtual machine requires video memory A, the second data to be processed requires video memory B, and the idle video memory in the graphics processor host is C, where C>(A+B), and 2G video memory is allocated to the first data to be processed, 1G video memory is allocated to the second data to be processed, and the idle computing power is allocated to the first data to be processed and the second data to be processed, respectively. If the priority of the virtual machine is higher than that of the container, more computing power can be allocated to the first data to be processed;
[0092] For example, if the priority of the virtual machine is higher than that of the container, the graphics processor host machine prioritizes allocating video memory to the virtual machine. The first data to be processed by the virtual machine requires video memory A, and the second data to be processed requires video memory B. The free video memory in the graphics processor host machine is D, where A<D, D<(A+B). Video memory A is preferentially allocated to the first data to be processed, and the idle computing power is allocated to the first data to be processed.
[0093] Of course, it should be noted that if the processing resources in the graphics processor host are evenly divided into multiple slices, and each slice occupies the same computing power and video memory, more slices of processing resources will be allocated to the source of higher priority data to be processed.
[0094] In summary, in a data processing device provided by this embodiment, the first virtual driver application interface includes: a receiving unit connected to the virtual machine and the container respectively, the receiving unit receiving the first data to be processed and the second data to be processed; an allocation unit connected to the receiving unit, the allocation unit allocating processing resources in the graphics processor host to the virtual machine and the container. In this solution, the first driver application interface allocates processing resources in the graphics processor host to the first data to be processed and the second data to be processed based on the received data to be processed, so as to process the first data to be processed and the second data to be processed, thereby achieving the purpose of processing the data to be processed generated by the virtual machine and the container respectively.
[0095] like Figure 5, which is a structural diagram of a data processing device embodiment 5 provided by the present application, the device includes the following structures: at least one virtual machine 501, at least one container 502, a first virtual driver application interface 503 and a driver application interface 504;
[0096] The virtual machine 501 includes an application program module 5011, a first proxy module 5012, a second virtual driver application program interface 5013 and a virtual graphics processor 5014;
[0097] Among them, the structural functions of the at least one container 502, the first virtual driver application interface 503 and the driver application interface 504, the application module 5011 in the virtual machine, the second virtual driver application interface 5013 and the virtual graphics processor 5014 are consistent with the corresponding structural functions in Example 1. The functional explanation refers to the explanation in Example 1 and is not repeated in this embodiment.
[0098] The first proxy module 5012 is disposed between the application module 5011 and the second virtual driver application interface 5013. The first proxy module intercepts the first data to be processed generated by the application module and sends the first data to be processed to the second virtual driver application interface.
[0099] Wherein, a first proxy module is provided in the virtual machine, and the first proxy module is used to intercept the first data to be processed generated by the application module.
[0100] In a specific implementation, after the application module in the virtual machine generates the first data to be processed, it calls the processing resources in the graphics processor host so that the called processing resources process the first data to be processed. Therefore, the first proxy module intercepts the call of calling the processing resource based on the first data to be processed, which is specifically manifested in intercepting the first data to be processed generated by the application module in the virtual machine.
[0101] The application program in the virtual machine may be set by the developer of the virtual machine, and the developer using the virtual machine can set some parameters in the virtual machine.
[0102] The first proxy module, the second virtual driver application program interface and the virtual graphics processor in the virtual machine in this embodiment are mounted into the virtual machine by the developer who uses the virtual machine.
[0103] Furthermore, a first proxy module is provided in each virtual machine to intercept the first data to be processed generated by the application program module in the virtual machine to which it belongs.
[0104] It should be noted that, since the graphics processor host adopts the virtualization technology corresponding to the container, the first data to be processed generated by the application in the virtual machine cannot be directly transmitted to the graphics processor host. In this embodiment, the first proxy module intercepts the first data to be processed generated by the application so that the first data to be processed can be forwarded to the virtual driver application interface in the graphics processor host through the second virtual driver application interface and the virtual graphics processor, thereby achieving the purpose of transmitting the first data to be processed generated by the application to the graphics processor host for processing.
[0105] In summary, in a data processing device provided in this embodiment, the virtual machine also includes a first proxy module, which is arranged between the application module and the second virtual driver application interface. The first proxy module intercepts the first data to be processed generated by the application module and sends the first data to be processed to the second virtual driver application interface. In this solution, the first data to be processed generated by the application module in the virtual machine is intercepted so that the first data to be processed can be forwarded to the virtual driver application interface in the graphics processor host through the second virtual driver application interface and the virtual graphics processor.
[0106] like Figure 6 , which is a schematic diagram of a structure of a data processing device embodiment 6 provided by the present application, the device includes the following structures: at least one virtual machine 601, at least one container 602, a call forwarding module 603, at least one second proxy module 604, a first virtual driver application interface 605 and a driver application interface 606;
[0107] Among them, the structural functions of at least one virtual machine 601, at least one container 602, call forwarding module 603, first virtual driver application interface 605 and driver application interface 606 are consistent with the corresponding structural functions in Example 2. The functional explanation refers to the explanation in Example 1 and is not repeated in this embodiment.
[0108] The second proxy module 604 is provided between the call forwarding module and the first virtual driver application program interface, and the second proxy module sends the first to-be-processed data to the first virtual driver application program interface based on the first processing resource and the resources required for processing the first to-be-processed data;
[0109] The first processing resource is a resource allocated by a graphics processor host to a first virtual machine, and the first virtual machine is a virtual machine that generates the first data to be processed.
[0110] The second proxy module may be set in a one-to-one correspondence with the virtual machine, with each virtual machine corresponding to one second proxy module; the second proxy module may also correspond to all virtual machines.
[0111] The second proxy module is set in one-to-one correspondence with the virtual machine, and the second proxy module only sends the first to-be-processed data generated by the corresponding virtual machine to the first virtual driver application program interface.
[0112] The first data to be processed carries an identifier, and the identifier can indicate a virtual machine that generates the first data to be processed.
[0113] Specifically, the calling forwarding module determines the corresponding first virtual machine based on the identifier, and can directly send the first to-be-processed data to the second proxy module corresponding to the first virtual machine.
[0114] Specifically, after obtaining the first data to be processed, the second agent module analyzes the first data to be processed to determine the required resources for processing the first data to be processed, obtains the first processing resources allocated to the virtual machine, and determines whether the first processing resources meet the required resources. If so, the first data to be processed is sent to the first virtual driver application interface.
[0115] Specifically, when a virtual machine is created, processing resources are allocated to the virtual machine.
[0116] Among them, when the second proxy module corresponds to all virtual machines, after it receives the first data to be processed, it needs to determine the first virtual machine that generates the first data to be processed and the resources required to process the first data to be processed, and then determine the first processing resource corresponding to the first virtual machine, and then determine whether the first processing resource meets the required resources. If so, the first data to be processed is sent to the first virtual driver application interface.
[0117] The first data to be processed carries an identifier, and the identifier can indicate a virtual machine that generates the first data to be processed. The second proxy module can determine the first virtual machine that generates the first data to be processed based on the identifier.
[0118] In a specific implementation, if the first processing resource cannot meet the required resources, that is, the required resources are greater than the first processing resources, a new virtual machine is created, and more processing resources are allocated to the newly created virtual machine, which may specifically be processing resources that meet the required processing resources. The new virtual machine generates the first data to be processed, and the second agent module analyzes and determines that the processing resources allocated to the new virtual machine meet the required resources, and sends the first data to be processed to the first virtual driver application interface to ensure that the first data to be processed is processed and the processing result is obtained.
[0119] In summary, a data processing device provided in this embodiment further includes: at least one second proxy module, which is arranged between the calling forwarding module and the first virtual driver application interface, and the second proxy module sends the first data to be processed to the first virtual driver application interface based on the first processing resources and the resources required to process the first data to be processed; wherein the first processing resources are resources allocated by the graphics processor host to the first virtual machine, and the first virtual machine is a virtual machine that generates the first data to be processed. In this scheme, the second proxy module receives the first data to be processed output by the calling forwarding module, and determines whether the processing resources of the graphics processor host can process the first data to be processed based on the resources required to process the first data to be processed and the first processing resources allocated by the graphics processor host to the virtual machine that generates the first data to be processed, and if it can be processed, sends the first data to be processed to the first virtual driver application interface, thereby ensuring that the graphics processor can process the first data to be processed to obtain a processing result.
[0120] Corresponding to the above-mentioned data processing device embodiment provided by the present application, the present application also provides a method for applying the data processing device.
[0121] like Figure 7 The flowchart shown is a data processing method embodiment 1 provided by the present application. The method is applied to a graphics processor host machine. The method includes the following steps:
[0122] Step S701: receiving first data to be processed generated by an application in at least one virtual machine and / or second data to be processed generated by at least one container;
[0123] The first data to be processed generated by the application program module in the virtual machine is forwarded to the virtual graphics processor through the second virtual driver application program interface in the virtual machine, and the virtual graphics processor outputs the first data to be processed to the graphics processor host machine.
[0124] Among them, at least one virtual machine and at least one container are set in the graphics processor host.
[0125] The application module in the virtual machine generates first data to be processed, and the first data to be processed is output to the first virtual driver application interface in the graphics processor host machine based on the second virtual driver application interface and the virtual graphics processor mounted in the virtual machine.
[0126] Among them, one or more virtual machines generate first data to be processed, and one or more containers generate second data to be processed. The time when the virtual machines and containers generate the data to be processed can be the same or different.
[0127] Therefore, the graphics processor host receives the first data to be processed and the second data to be processed outputted by the virtual machine and the container at the same time, or receives the first data to be processed outputted by only the virtual machine at a certain moment, and receives the second data to be processed outputted by only the container at a certain moment.
[0128] Step S702: passing the first data to be processed and / or the second data to be processed to the first virtual driver application program interface of the graphics processor host machine respectively;
[0129] Among them, the first data to be processed and the second data to be processed adopt different protocol formats. In the present application, after receiving the first data to be processed, the first data to be processed is also converted from the first protocol format to the second protocol format. The first virtual drive application interface is only set to receive the second protocol format data and can simultaneously receive the first data to be processed and the second data to be processed.
[0130] Step S703: The first virtual driver application interface calls processing resources in the graphics processor host based on the first data to be processed and / or the second data to be processed, and the processing resources process the first data to be processed and / or the second data to be processed to obtain a first processing result and / or a second processing result respectively.
[0131] The first virtual driver application program interface set in the graphics processor host machine receives the first data to be processed and / or the second data to be processed respectively.
[0132] The first virtual driver application program interface is used to allocate processing resources to the first data to be processed and the second data to be processed.
[0133] The processing resources include the computing power and video memory of the graphics processor host.
[0134] Specifically, the graphics memory of the graphics processor host machine may be allocated based on the graphics memory required by the first data to be processed and the second data to be processed, the priority of the container and virtual machine from which the data to be processed comes, and the free graphics memory in the graphics processor host machine.
[0135] In summary, in a data processing method provided by this embodiment, based on the second virtual driver application interface and the virtual graphics processor set in the virtual machine, the first to-be-processed data generated by the application module in the virtual machine is output to the graphics processor host, and the graphics processor host can also receive the second to-be-processed data sent by the container. The graphics processor host processes the data generated by the virtual machine and the data generated by the container respectively. The same host realizes the sharing of containers and virtual machines, which can make full use of the host resources and reduce the consumption of hardware resources.
[0136] like Figure 8 The flowchart shown is a data processing method embodiment 2 provided by the present application, and the method comprises the following steps:
[0137] Step S801: receiving first data to be processed generated by an application in at least one virtual machine and second data to be processed generated by at least one container;
[0138] Among them, step S801 is consistent with step S701 in embodiment 1, and is not described in detail in this embodiment.
[0139] Step S802: passing the second to-be-processed data to the first virtual driver application program interface of the graphics processor host machine;
[0140] Among them, this embodiment is an explanation of the situation where the first data to be processed and the second data to be processed are received at the same time, but the specific implementation is not limited to this. When only the first data to be processed is received, step S802 may not be executed and steps S803-805 may be executed directly.
[0141] Step S803: Determine the resources required by the graphics processor host to process the first data to be processed;
[0142] The first data to be processed is analyzed to determine the resources required by the graphics processor host to process the first data to be processed.
[0143] For example, the first data to be processed is analyzed to determine that 2G video memory is required to process the first data.
[0144] Step S804: obtaining a first processing resource allocated to a first virtual machine in the graphics processor host machine, where the first virtual machine is a virtual machine that generates the first data to be processed;
[0145] The graphics processor host machine allocates processing resources to the configured virtual machine.
[0146] When a virtual machine is created, the graphics processor host allocates processing resources to the virtual machine, and the first to-be-processed data generated by the virtual machine is processed only by using the processing resources allocated to the virtual machine.
[0147] Among them, in addition to allocating processing resources to virtual machines, the graphics processor host also allocates processing resources to containers.
[0148] For example, the processing resources in the graphics processor host are divided into 8 pieces on average, 1 piece of processing resources is allocated to virtual machine a, 2 pieces of processing resources are allocated to virtual machine b, and the remaining 5 pieces of processing resources are allocated as containers.
[0149] Step S805: transmitting the first to-be-processed data to the first virtual driver application program interface of the graphics processor host machine according to the first processing resource and the required resource;
[0150] A corresponding second agent module is provided for each virtual machine, or all virtual machines correspond to a second agent module.
[0151] When the second proxy module is set in one-to-one correspondence with the virtual machine, the computing power and video memory allocated to the virtual machine corresponding to each second proxy module are fixed. Only when the allocated computing power and video memory are greater than the required resources of the virtual machine can the first data to be processed of the virtual machine be processed and the first data to be processed be passed to the first virtual driver application interface.
[0152] Among them, if the processing resources allocated to the first virtual machine in the graphics processor host machine do not meet the required resources, a new virtual machine is created, target resources are allocated to the new virtual machine, and more processing resources are allocated to the newly created virtual machine, which may specifically be processing resources that meet the required processing resources. The new virtual machine generates the first data to be processed, and after analyzing and determining that the processing resources allocated to the new virtual machine meet the required resources, the first data to be processed is sent to the first virtual driver application program interface to ensure that the first data to be processed is processed and a processing result is obtained.
[0153] Step S806: the first virtual driver application program interface calls processing resources in the graphics processor host based on the first data to be processed and the second data to be processed, and the processing resources process the first data to be processed and the second data to be processed to obtain a first processing result and a second processing result respectively.
[0154] Among them, step S806 is consistent with step S703 in Example 1 and is not described in detail in this embodiment.
[0155] In summary, in a data processing method provided in this embodiment, the first data to be processed is passed to the first virtual driver application interface of the graphics processor host, including: determining the resources required by the graphics processor host to process the first data to be processed; obtaining the first processing resources allocated to the first virtual machine in the graphics processor host, the first virtual machine is the virtual machine that generates the first data to be processed; and passing the first data to be processed to the first virtual driver application interface of the graphics processor host according to the first processing resources and the required resources. In this scheme, according to the resources required by the graphics processor host to process the first data to be processed and the first processing resources allocated to the first virtual machine that generates the first data to be processed, it is analyzed and determined whether to pass the first data to be processed generated by the first virtual machine to the first virtual driver application interface, so as to ensure that the processing resources in the graphics processor host can process the data to be processed received by the first virtual driver application interface, and reduce the error rate of the processing of the graphics processor host.
[0156] Based on the data processing device provided in the above embodiments, an embodiment of the present invention further provides an electronic device, which serves as a graphics processor host, and the graphics processor host includes the data processing device described in any one of the above device embodiments.
[0157] Based on the data processing method provided in the above embodiment, an embodiment of the present invention further provides a storage medium, in which computer executable instructions are stored, and the computer executable instructions are used to execute the data processing method.
[0158] The data processing method, device, electronic device and storage medium provided by the present invention are introduced in detail above. The principles and implementation methods of the present invention are explained in this article using specific examples. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
[0159] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device provided in the embodiment, since it corresponds to the method provided in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0160] The above description of the embodiments provided enables professionals and technicians in the field to implement or use the present application. Various modifications to these embodiments will be apparent to professionals and technicians in the field, 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 conform to the widest range consistent with the principles and novel features provided herein.
Claims
1. A data processing device, applied to a graphics processor host, comprising: at least one virtual machine, used to generate first data to be processed; at least one container, used to generate second data to be processed; a first virtual driver application program interface, connected to the virtual machine and the container, respectively, for receiving the first data to be processed and the second data to be processed; a driver application interface, connected to the first virtual driver application interface, and configured to receive the first data to be processed and the second data to be processed transmitted by the first virtual driver application interface, and to call processing resources in a graphics processor host machine based on the first data to be processed and the second data to be processed, respectively, and the processing resources respectively process the first data to be processed and the second data to be processed to obtain a first processing result and a second processing result; Wherein, the virtual machine includes an application program module, a second virtual driver application program interface and a virtual graphics processor; The first data to be processed generated by the application module is forwarded to the virtual graphics processor through the second virtual driver application program interface, and the virtual graphics processor loads the first data to be processed into the first virtual driver application program interface.
2. The apparatus according to claim 1, further comprising: A forwarding module is called, which is arranged between the virtual machine and the first virtual driver application interface, receives the first data to be processed sent by the virtual machine, converts the first data to be processed from a first protocol format to a second protocol format, and sends the first data to be processed in the second protocol format to the first virtual driver application interface, wherein the first protocol format is the protocol format adopted by the first data to be processed output by the virtual machine, and the second protocol format is the protocol format adopted by the second data to be processed output by the container.
3. The apparatus according to claim 1, further comprising: The graphics processor driver module is connected to the driver application program interface and is used to provide processing resources for the driver application program interface.
4. The device according to claim 1, wherein the first virtual driver application program interface comprises: a receiving unit connected to the virtual machine and the container respectively, the receiving unit receiving the first data to be processed and the second data to be processed; An allocating unit connected to the receiving unit, the allocating unit allocating processing resources in a graphics processor host machine to the virtual machine and the container.
5. The apparatus according to claim 1, wherein the virtual machine further comprises: The first proxy module is arranged between the application module and the second virtual driver application interface. The first proxy module intercepts the first data to be processed generated by the application module and sends the first data to be processed to the second virtual driver application interface.
6. The apparatus according to claim 1, further comprising: at least one second proxy module, disposed between the call forwarding module and the first virtual driver application program interface, the second proxy module sending the first to-be-processed data to the first virtual driver application program interface based on the first processing resources and the resources required for processing the first to-be-processed data; The first processing resource is a resource allocated by a graphics processor host to a first virtual machine, and the first virtual machine is a virtual machine that generates the first data to be processed.
7. According to the device of claim 2, the call forwarding module also receives a first processing result transmitted by a first virtual driver application program interface, converts the first processing result from a second protocol format to a first protocol format, and outputs the first processing result in the first protocol format to a virtual graphics processor of a first virtual machine, where the first virtual machine is the virtual machine that generates the first data to be processed.
8. A data processing method, the method being applied to a graphics processor host, comprising: Receive first data to be processed generated by an application in at least one virtual machine and / or second data to be processed generated by at least one container; wherein the first data to be processed generated by an application module in the virtual machine is forwarded to a virtual graphics processor through a second virtual driver application interface in the virtual machine, and the virtual graphics processor outputs the first data to be processed to a graphics processor host machine; Transmitting the first data to be processed and / or the second data to be processed to a first virtual driver application program interface of the graphics processor host machine respectively; The first virtual driver application program interface calls processing resources in a graphics processor host based on the first data to be processed and / or the second data to be processed, and the processing resources process the first data to be processed and / or the second data to be processed to obtain a first processing result and / or a second processing result respectively.
9. The method according to claim 8, wherein the first to-be-processed data is transmitted to the first virtual driver application program interface of the graphics processor host, comprising: Determining resources required by the graphics processor host to process the first data to be processed; Acquire a first processing resource allocated to a first virtual machine in the graphics processor host, where the first virtual machine is a virtual machine that generates the first data to be processed; The first to-be-processed data is transmitted to a first virtual driver application program interface of the graphics processor host machine according to the first processing resource and the required resource.
10. An electronic device, the electronic device serving as a graphics processor host, the graphics processor host comprising the data processing device according to any one of claims 1-7.
Citation Information
Patent Citations
Data processing method, device and system based on hardware acceleration
CN112445568A
Image processing system and method
CN113240571A