A virtual machine desktop rendering method, apparatus and system
By rationally allocating virtual machine desktop rendering tasks to different GPUs, the problem of increased costs caused by the increase in the number of virtual machines was solved, and efficient GPU resource utilization was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- XIAN WANXIANG ELECTRONICS TECH CO LTD
- Filing Date
- 2020-12-24
- Publication Date
- 2026-05-26
AI Technical Summary
In existing technologies, as the number of virtual machines running on servers increases, more and more GPUs are needed to render the desktops of the virtual machines, leading to increased costs.
By receiving desktop rendering instructions from the virtual machine, it determines whether it is necessary to exclusively use the GPU, and rationally allocates desktop rendering tasks to different GPUs for rendering based on factors such as the number of pending instructions, utilization rate, and video memory.
It effectively reduces the cost of virtual machine desktop rendering, improves rendering efficiency, and avoids allocating a separate GPU for rendering to each virtual machine.
Smart Images

Figure CN112650586B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and in particular to a virtual machine desktop rendering method, apparatus and system. Background Technology
[0002] With the development of computer technology, servers are becoming increasingly powerful, and more and more terminal devices are connecting to them. Consequently, the number of virtual machines allocated to these connected devices by servers is also increasing. Currently, when rendering the desktops of virtual machines running on a server, each virtual machine's desktop is rendered by its corresponding Graphics Processing Unit (GPU). However, as the number of virtual machines running on servers increases, more and more GPUs are needed to render their desktops, increasing costs. Summary of the Invention
[0003] This disclosure provides a virtual machine desktop rendering method, apparatus, and system, which can solve the problem of high cost in existing technologies. The technical solution is as follows:
[0004] According to a first aspect of the present disclosure, a virtual machine desktop rendering method is provided, the method comprising:
[0005] Receive desktop rendering instructions sent by each virtual machine in at least one virtual machine, wherein the desktop rendering instructions include first identification information of the virtual machine, desktop texture data of the virtual machine, and second identification information, wherein the second identification information is used to indicate whether the desktop rendering instructions require exclusive GPU access;
[0006] If the second identification information of the target desktop rendering instruction indicates that the target desktop rendering instruction needs to exclusively use the GPU, then obtain the number of desktop rendering instructions to be processed for each GPU in at least one GPU, wherein the target desktop rendering instruction is the desktop rendering instruction sent by the target virtual machine, and the target virtual machine is any one of the at least one virtual machines;
[0007] A first GPU is determined from the at least one GPU, wherein the first GPU is the GPU with the fewest pending desktop rendering instructions among the at least one GPU;
[0008] Obtain the desktop rendering instructions to be processed from the first GPU and send the desktop rendering instructions to be processed to other GPUs, wherein the other GPUs are GPUs other than the first GPU among the at least one GPU;
[0009] The target desktop rendering instruction is sent to the first GPU so that the first GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0010] The virtual machine desktop rendering method provided in this disclosure is capable of receiving desktop rendering instructions sent by each virtual machine in at least one virtual machine. Each desktop rendering instruction includes first identification information of the virtual machine, desktop texture data of the virtual machine, and second identification information. The second identification information indicates whether the desktop rendering instruction requires exclusive GPU access. If the second identification information of the target desktop rendering instruction indicates that the target desktop rendering instruction requires exclusive GPU access, the number of pending desktop rendering instructions for each of the at least one GPUs is obtained. The target desktop rendering instruction is the desktop rendering instruction sent by the target virtual machine, and the target virtual machine is any one of the at least one virtual machines. A first GPU is determined from the at least one GPU. The first GPU has the fewest pending desktop rendering instructions. It acquires the pending desktop rendering instructions from this first GPU and sends them to other GPUs, which are the GPUs other than the first GPU among the at least one GPUs. It then sends the target desktop rendering instruction to the first GPU so that the first GPU renders the desktop of the target virtual machine based on the desktop texture data. When the desktop rendering of the target virtual machine requires dedicated GPU access, the first GPU can render only the desktop of the target virtual machine, while other GPUs execute the pending desktop rendering instructions from the first GPU and render the desktops of other virtual machines. This eliminates the need to allocate a separate GPU for each virtual machine to render its desktop, effectively reducing costs.
[0011] In one embodiment, the desktop rendering instruction further includes a priority, and the method further includes: if the second identification information of the target desktop rendering instruction indicates that it does not need to exclusively occupy the GPU and the priority of the target desktop rendering instruction is high, then obtain the utilization rate of each GPU in at least one GPU.
[0012] A second GPU is determined from the at least one GPU, wherein the second GPU is a GPU whose utilization rate is less than or equal to a first preset utilization threshold among the at least one GPUs;
[0013] The target desktop rendering instruction is sent to the second GPU so that the second GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0014] In one embodiment, the method further includes:
[0015] If the second identification information of the target desktop rendering instruction indicates that it does not need to exclusively occupy the GPU and the priority of the target desktop rendering instruction is low, then a third GPU is determined from the at least one GPU. The third GPU is the GPU among the at least one GPU whose utilization rate is greater than or equal to a second preset utilization rate threshold, and the second preset utilization rate threshold is greater than the first preset utilization rate threshold.
[0016] The target desktop rendering instruction is sent to the third GPU so that the third GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0017] In one embodiment, the method further includes:
[0018] If the second identification information of the target desktop rendering instruction indicates that it does not require exclusive GPU use and the priority of the target desktop rendering instruction is medium, then a fourth GPU is determined from the at least one GPU. The fourth GPU is the GPU among the at least one GPU whose utilization rate is greater than the first preset utilization rate threshold and less than the second preset utilization rate threshold.
[0019] The target desktop rendering instruction is sent to the fourth GPU so that the fourth GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0020] By obtaining the utilization rate of each GPU in at least one GPU, desktop rendering instructions that do not require exclusive GPU use and have priorities of high / medium / low can be sent to GPUs with low / medium / high utilization respectively. This enables the desktop rendering instructions to be executed by the GPU whose utilization rate matches the priority of the desktop rendering instruction, effectively improving the desktop rendering efficiency of the virtual machine.
[0021] In one embodiment, the method further includes:
[0022] If the second identification information of the target desktop rendering instruction indicates that it does not require exclusive GPU access and the size of the desktop texture data of the target desktop rendering instruction is greater than or equal to the first preset threshold, then the video memory of each GPU in the at least one GPU is obtained.
[0023] A fifth GPU is determined from the at least one GPU, wherein the fifth GPU is a GPU among the at least one GPU whose video memory is greater than or equal to a first preset video memory threshold;
[0024] The target desktop rendering instruction is sent to the fifth GPU so that the fifth GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0025] In one embodiment, the method further includes:
[0026] If the second identification information of the target desktop rendering instruction indicates that it does not need to exclusively occupy the GPU and the size of the desktop texture data of the target desktop rendering instruction is less than the first preset threshold and greater than the second preset threshold, then a sixth GPU is determined from the at least one GPU. The sixth GPU is the GPU among the at least one GPU whose video memory is less than the first preset video memory threshold and greater than the second preset video memory threshold. The second preset video memory threshold is less than the first preset video memory threshold.
[0027] The target desktop rendering instruction is sent to the sixth GPU so that the sixth GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0028] In one embodiment, the desktop rendering instructions further include the desktop texture data of the virtual machine, and the method further includes:
[0029] If the second identification information of the target desktop rendering instruction indicates that it does not need to exclusively occupy the GPU and the size of the desktop texture data of the target desktop rendering instruction is less than or equal to the second preset threshold, a seventh GPU is determined from the at least one GPU, and the seventh GPU is the GPU among the at least one GPU whose video memory is less than or equal to the second preset video memory threshold;
[0030] The target desktop rendering instructions are sent to the seventh GPU so that the seventh GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0031] By acquiring the video memory of each GPU in at least one GPU, desktop rendering instructions that do not require exclusive GPU access and whose desktop texture data sizes are large / medium / small can be sent to the GPUs with large / medium / small video memory respectively. This enables the GPU whose video memory size matches the size of the desktop texture data of the desktop rendering instruction to execute the desktop rendering instruction, effectively improving the desktop rendering efficiency of the virtual machine.
[0032] According to a second aspect of the present disclosure, a virtual machine desktop rendering apparatus is provided, comprising:
[0033] A desktop rendering instruction receiving module is used to receive desktop rendering instructions sent by each virtual machine in at least one virtual machine. The desktop rendering instruction includes first identification information of the virtual machine, desktop texture data of the virtual machine, and second identification information. The second identification information is used to indicate whether the desktop rendering instruction needs to exclusively use the GPU.
[0034] The pending desktop rendering instruction quantity acquisition module is used to acquire the number of pending desktop rendering instructions for each GPU in at least one GPU if the second identification information of the target desktop rendering instruction indicates that the target desktop rendering instruction needs to exclusively occupy the GPU. The target desktop rendering instruction is the desktop rendering instruction sent by the target virtual machine, and the target virtual machine is any one of the at least one virtual machines.
[0035] A first GPU determination module is configured to determine a first GPU from the at least one GPU, wherein the first GPU is the GPU with the fewest number of desktop rendering instructions to be processed among the at least one GPU;
[0036] A pending desktop rendering instruction sending module is used to obtain the pending desktop rendering instruction of the first GPU and send the pending desktop rendering instruction to other GPUs, wherein the other GPUs are GPUs other than the first GPU among the at least one GPU;
[0037] The target desktop rendering instruction sending module is used to send the target desktop rendering instruction to the first GPU, so that the first GPU renders the desktop of the target virtual machine according to the desktop texture data.
[0038] In one embodiment, the desktop rendering instruction further includes a priority, and the apparatus further includes:
[0039] The GPU utilization acquisition module is used for:
[0040] If the second identification information of the target desktop rendering instruction indicates that it does not require exclusive GPU access and the priority of the target desktop rendering instruction is high, then obtain the utilization rate of each GPU in at least one GPU.
[0041] A second GPU is determined from the at least one GPU, wherein the second GPU is a GPU whose utilization rate is less than or equal to a first preset utilization threshold among the at least one GPUs;
[0042] The target desktop rendering instruction is sent to the second GPU so that the second GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0043] In one embodiment, the GPU utilization acquisition module is further configured to:
[0044] If the second identification information of the target desktop rendering instruction indicates that it does not need to exclusively occupy the GPU and the priority of the target desktop rendering instruction is low, then a third GPU is determined from the at least one GPU. The third GPU is the GPU among the at least one GPU whose utilization rate is greater than or equal to a second preset utilization rate threshold, and the second preset utilization rate threshold is greater than the first preset utilization rate threshold.
[0045] The target desktop rendering instruction is sent to the third GPU so that the third GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0046] In one embodiment, the GPU utilization acquisition module is further configured to:
[0047] If the second identification information of the target desktop rendering instruction indicates that it does not require exclusive GPU use and the priority of the target desktop rendering instruction is medium, then a fourth GPU is determined from the at least one GPU. The fourth GPU is the GPU among the at least one GPU whose utilization rate is greater than the first preset utilization rate threshold and less than the second preset utilization rate threshold.
[0048] The target desktop rendering instruction is sent to the fourth GPU so that the fourth GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0049] In one embodiment, the apparatus further includes:
[0050] The GPU memory acquisition module is used for:
[0051] If the second identification information of the target desktop rendering instruction indicates that it does not require exclusive GPU access and the size of the desktop texture data of the target desktop rendering instruction is greater than or equal to the first preset threshold, then the video memory of each GPU in the at least one GPU is obtained.
[0052] A fifth GPU is determined from the at least one GPU, wherein the fifth GPU is a GPU among the at least one GPU whose video memory is greater than or equal to a first preset video memory threshold;
[0053] The target desktop rendering instruction is sent to the fifth GPU so that the fifth GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0054] In one embodiment, the GPU memory acquisition module is further configured to:
[0055] If the second identification information of the target desktop rendering instruction indicates that it does not need to exclusively occupy the GPU and the size of the desktop texture data of the target desktop rendering instruction is less than the first preset threshold and greater than the second preset threshold, then a sixth GPU is determined from the at least one GPU. The sixth GPU is the GPU among the at least one GPU whose video memory is less than the first preset video memory threshold and greater than the second preset video memory threshold. The second preset video memory threshold is less than the first preset video memory threshold.
[0056] The target desktop rendering instruction is sent to the sixth GPU so that the sixth GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0057] In one embodiment, the GPU memory acquisition module is further configured to:
[0058] If the second identification information of the target desktop rendering instruction indicates that it does not need to exclusively occupy the GPU and the size of the desktop texture data of the target desktop rendering instruction is less than or equal to the second preset threshold, a seventh GPU is determined from the at least one GPU, and the seventh GPU is the GPU among the at least one GPU whose video memory is less than or equal to the second preset video memory threshold;
[0059] The target desktop rendering instructions are sent to the seventh GPU so that the seventh GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0060] According to a third aspect of the present disclosure, a virtual machine desktop rendering system is provided, comprising:
[0061] At least one virtual machine running on the server, a CPU, and at least one GPU;
[0062] The central processing unit (CPU) is connected to any one of the at least one virtual machines, and the CPU is also connected to any one of the at least one GPUs.
[0063] The CPU is used to execute the virtual machine desktop rendering method described in any one of the first aspects.
[0064] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0065] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0066] Figure 1 This is a schematic diagram of the structure of a virtual machine desktop rendering system provided in an embodiment of this disclosure;
[0067] Figure 2 This is a flowchart of a virtual machine desktop rendering method provided in an embodiment of this disclosure;
[0068] Figure 3 This is a schematic diagram of the structure of a virtual machine desktop rendering device provided in an embodiment of this disclosure. Figure 1 ;
[0069] Figure 4 This is a schematic diagram of the structure of a virtual machine desktop rendering device provided in an embodiment of this disclosure. Figure 2 . Detailed Implementation
[0070] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0071] Figure 1 This is a schematic diagram of the structure of a virtual machine desktop rendering system provided according to an embodiment of this disclosure. Figure 1 As shown, the system includes:
[0072] At least one virtual machine 101, a central processing unit (CPU) 102, and at least one GPU 103 running in the server;
[0073] The CPU is the CPU of the server, and the at least one GPU is the GPU of the server. The CPU 102 is connected to any one of the at least one virtual machines 101, and the CPU 102 is also connected to any one of the at least one GPUs 103.
[0074] Each of the at least one virtual machine 101 can send a desktop rendering instruction to the CPU 102. The desktop rendering instruction includes first identification information of the virtual machine, desktop texture data of the virtual machine, and second identification information. The second identification information is used to indicate whether the desktop rendering instruction requires exclusive GPU access. For example, a target virtual machine can send a target desktop rendering instruction to the CPU 102. The target virtual machine can be any one of the at least one virtual machine 101.
[0075] After the CPU 102 receives desktop rendering instructions sent by each of the at least one virtual machine, for example, in this embodiment, the CPU 102 can receive target desktop rendering instructions sent by a target virtual machine, which is any one of the at least one virtual machines. If the second identification information of the target desktop rendering instruction indicates that the target desktop rendering instruction requires exclusive GPU access, the CPU 102 obtains the number of pending desktop rendering instructions for each of the at least one GPU 102; then determines a first GPU from the at least one GPU 103, which is the GPU with the fewest pending desktop rendering instructions; obtains the pending desktop rendering instructions of the first GPU and sends the pending desktop rendering instructions to other GPUs, which are GPUs other than the first GPU among the at least one GPUs; finally, sends the target desktop rendering instruction to the first GPU so that the first GPU renders the desktop of the target virtual machine according to the desktop texture data.
[0076] This combination Figure 1 Please provide an explanation. For example... Figure 1 As shown, the server runs m virtual machines, where virtual machine 1 is the target virtual machine. The server has n GPUs rendering the desktops of the m virtual machines. m is less than or equal to n. For example, m can be 10 and n can be 3.
[0077] After the CPU receives the desktop rendering instruction from virtual machine 1, if the second identification information of the desktop rendering instruction from virtual machine 1 indicates that the desktop rendering instruction from virtual machine 1 requires exclusive GPU access, then the CPU 102 obtains the number of pending desktop rendering instructions for each of the at least one GPU 102; then it determines a first GPU from the at least one GPU 103, which is the GPU with the fewest pending desktop rendering instructions among the at least one GPUs; for example, the first GPU is... Figure 1The CPU then retrieves the desktop rendering instructions from GPU2 and sends them to other GPUs. These other GPUs are any of the at least one GPU other than GPU2. For example, when m is 3, these other GPUs are GPU1 and GPU3. Finally, the target desktop rendering instructions are sent to GPU2 so that GPU2 can render the desktop of virtual machine 1 based on the desktop texture data. At this time, GPU2 has no other desktop rendering instructions to process and only executes the desktop rendering instructions for virtual machine 1, that is, it only renders the desktop of virtual machine 1. GPUs 1 and 3 execute the desktop rendering instructions to be processed by GPU2 and the desktop rendering instructions for other virtual machines. Therefore, when the desktop rendering of virtual machine 1 requires exclusive GPU access, GPU2 can render only the desktop of virtual machine 1, while GPUs 1 and 3 render the desktops of other virtual machines. It is not necessary to allocate a separate GPU for each virtual machine to render its desktop, effectively reducing costs.
[0078] The following is combined Figure 2 The embodiments herein provide a detailed explanation of how the virtual machine desktop rendering system provided in this disclosure renders the desktop of a virtual machine. Figure 2 This is a flowchart of a virtual machine desktop rendering method provided in an embodiment of this disclosure, which is applied to a CPU. Figure 2 As shown, the method includes:
[0079] S201. Receive desktop rendering instructions sent by each virtual machine in at least one virtual machine. The desktop rendering instructions include first identification information of the virtual machine, desktop texture data of the virtual machine, and second identification information. The second identification information is used to indicate whether the desktop rendering instructions need to exclusively use the GPU.
[0080] S202. If the second identification information of the target desktop rendering instruction indicates that the target desktop rendering instruction needs to exclusively occupy the GPU, then obtain the number of desktop rendering instructions to be processed for each GPU in at least one GPU, wherein the target desktop rendering instruction is the desktop rendering instruction sent by the target virtual machine, and the target virtual machine is any one of the at least one virtual machines.
[0081] This combination Figure 1The CPU can receive desktop rendering instructions from each of the n virtual machines. For example, in this embodiment, the CPU can receive a target desktop rendering instruction from a target virtual machine (e.g., virtual machine 1). If the second identification information of the target desktop rendering instruction indicates that the target desktop rendering instruction requires exclusive GPU access, the CPU obtains the number of pending desktop rendering instructions for each GPU in at least one GPU 102. After receiving the desktop rendering instruction from virtual machine 1, if the second identification information of the desktop rendering instruction from virtual machine 1 indicates that the desktop rendering instruction from virtual machine 1 requires exclusive GPU access, the CPU 102 obtains the number of pending desktop rendering instructions for each GPU in at least one GPU 102.
[0082] S203. Determine a first GPU from the at least one GPU, the first GPU being the GPU with the fewest pending desktop rendering instructions among the at least one GPUs.
[0083] Furthermore, the CPU determines a first GPU from the at least one GPU, which is the GPU with the fewest pending desktop rendering instructions among the at least one GPUs. For example, Figure 1 In this example, GPU2 is the GPU with the fewest pending desktop rendering instructions among the m GPUs. In this embodiment, m can be 10 and n can be 3. The values of m and n are only given as examples here, and the values of m and n can also be other values. This embodiment does not impose specific restrictions on them.
[0084] S204. Obtain the desktop rendering instruction to be processed from the first GPU and send the desktop rendering instruction to be processed to other GPUs, wherein the other GPUs are GPUs other than the first GPU among the at least one GPU;
[0085] S205. Send the target desktop rendering instruction to the first GPU so that the first GPU can render the desktop of the target virtual machine according to the desktop texture data.
[0086] The CPU acquires the desktop rendering instructions to be processed from GPU2 and sends them to other GPUs. These other GPUs are any of the at least one GPU other than GPU2. For example, when m is 3, the other GPUs are GPU1 and GPU3. The CPU then sends the target desktop rendering instructions to GPU2 so that GPU2 can render the desktop of virtual machine 1 based on the desktop texture data. At this time, GPU2 has no other desktop rendering instructions to be processed and only executes the desktop rendering instructions for virtual machine 1, i.e., it only renders the desktop of virtual machine 1. GPUs 1 and 3 execute the desktop rendering instructions to be processed from GPU2 and the desktop rendering instructions for other virtual machines. Therefore, when the desktop rendering of virtual machine 1 requires dedicated GPU resources, GPU2 can render only the desktop of virtual machine 1, while GPUs 1 and 3 render the desktops of other virtual machines. It is not necessary to allocate a separate GPU for each virtual machine to render its desktop, effectively reducing costs.
[0087] In one embodiment, the desktop rendering instruction further includes a priority, and the method further includes: if the second identification information of the target desktop rendering instruction indicates that it does not need to exclusively occupy the GPU and the priority of the target desktop rendering instruction is high, then obtain the utilization of each GPU in at least one GPU.
[0088] A second GPU is determined from the at least one GPU, wherein the second GPU is a GPU whose utilization is less than or equal to a first preset utilization threshold among the at least one GPUs;
[0089] The target desktop rendering command is sent to the second GPU so that the second GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0090] In another embodiment, the method further includes:
[0091] If the second identification information of the target desktop rendering instruction indicates that it does not require exclusive GPU and the priority of the target desktop rendering instruction is low, then a third GPU is determined from the at least one GPU. The third GPU is the GPU among the at least one GPU whose utilization rate is greater than or equal to a second preset utilization rate threshold, and the second preset utilization rate threshold is greater than the first preset utilization rate threshold.
[0092] The target desktop rendering instruction is sent to the third GPU so that the third GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0093] In another embodiment, the method further includes:
[0094] If the second identification information of the target desktop rendering instruction indicates that it does not require exclusive GPU and the priority of the target desktop rendering instruction is medium, then a fourth GPU is determined from the at least one GPU. The fourth GPU is the GPU among the at least one GPU whose utilization rate is greater than the first preset utilization rate threshold and less than the second preset utilization rate threshold.
[0095] The target desktop rendering instruction is sent to the fourth GPU so that the fourth GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0096] In one embodiment, the method further includes:
[0097] If the second identification information of the target desktop rendering instruction indicates that it does not require exclusive GPU access and the size of the desktop texture data of the target desktop rendering instruction is greater than or equal to the first preset threshold, then the video memory of each GPU in the at least one GPU is obtained.
[0098] A fifth GPU is determined from the at least one GPU, wherein the fifth GPU is a GPU whose video memory is greater than or equal to a first preset video memory threshold among the at least one GPUs;
[0099] The target desktop rendering instruction is sent to the fifth GPU so that the fifth GPU can render the desktop of the target virtual machine based on the desktop texture data.
[0100] In another embodiment, the method further includes:
[0101] If the second identification information of the target desktop rendering instruction indicates that it does not require exclusive GPU and the size of the desktop texture data of the target desktop rendering instruction is less than the first preset threshold and greater than the second preset threshold, then a sixth GPU is determined from the at least one GPU. The sixth GPU is the GPU among the at least one GPU whose video memory is less than the first preset video memory threshold and greater than the second preset video memory threshold. The second preset video memory threshold is less than the first preset video memory threshold.
[0102] The target desktop rendering instruction is sent to the sixth GPU so that the sixth GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0103] In another embodiment, the method further includes:
[0104] If the second identification information of the target desktop rendering instruction indicates that it does not require exclusive GPU and the size of the desktop texture data of the target desktop rendering instruction is less than or equal to the second preset threshold, a seventh GPU is determined from the at least one GPU, and the seventh GPU is the GPU among the at least one GPU whose video memory is less than or equal to the second preset video memory threshold;
[0105] The target desktop rendering instruction is sent to the seventh GPU so that the seventh GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0106] The virtual machine desktop rendering method provided in this disclosure is capable of receiving desktop rendering instructions sent by each virtual machine in at least one virtual machine. Each desktop rendering instruction includes first identification information of the virtual machine, desktop texture data of the virtual machine, and second identification information. The second identification information indicates whether the desktop rendering instruction requires exclusive GPU access. If the second identification information of the target desktop rendering instruction indicates that the target desktop rendering instruction requires exclusive GPU access, the number of pending desktop rendering instructions for each of the at least one GPUs is obtained. The target desktop rendering instruction is the desktop rendering instruction sent by the target virtual machine, and the target virtual machine is any one of the at least one virtual machines. A first GPU is determined from the at least one GPU. The first GPU has the fewest pending desktop rendering instructions. It acquires the pending desktop rendering instructions from this first GPU and sends them to other GPUs, which are the GPUs other than the first GPU among the at least one GPUs. It then sends the target desktop rendering instruction to the first GPU so that the first GPU renders the desktop of the target virtual machine based on the desktop texture data. When the desktop rendering of the target virtual machine requires dedicated GPU access, the first GPU can render only the desktop of the target virtual machine, while other GPUs execute the pending desktop rendering instructions from the first GPU and render the desktops of other virtual machines. This eliminates the need to allocate a separate GPU for each virtual machine to render its desktop, effectively reducing costs.
[0107] Regarding the virtual machine desktop rendering method described in the above corresponding embodiments, the following are device embodiments of this disclosure, which can be used to execute the method embodiments of this disclosure.
[0108] Figure 3 A schematic diagram of the structure of a virtual machine desktop rendering device provided in this embodiment of the disclosure. Figure 1 This image processing device is applied to the CPU. For example... Figure 3 As shown, the device 30 includes:
[0109] The desktop rendering instruction receiving module 301 is used to receive desktop rendering instructions sent by each virtual machine in at least one virtual machine. The desktop rendering instruction includes first identification information of the virtual machine, desktop texture data of the virtual machine, and second identification information. The second identification information is used to indicate whether the desktop rendering instruction needs to exclusively use the GPU.
[0110] The pending desktop rendering instruction quantity acquisition module 302 is used to acquire the number of pending desktop rendering instructions for each GPU in at least one GPU if the second identification information of the target desktop rendering instruction indicates that the target desktop rendering instruction needs to exclusively occupy the GPU. The target desktop rendering instruction is the desktop rendering instruction sent by the target virtual machine, and the target virtual machine is any one of the at least one virtual machines.
[0111] First GPU determination module 303 is used to determine a first GPU from the at least one GPU, wherein the first GPU is the GPU with the fewest number of desktop rendering instructions to be processed among the at least one GPU;
[0112] The pending desktop rendering instruction sending module 304 is used to obtain the pending desktop rendering instruction of the first GPU and send the pending desktop rendering instruction to other GPUs, wherein the other GPUs are GPUs other than the first GPU among the at least one GPU;
[0113] The target desktop rendering instruction sending module 305 is used to send the target desktop rendering instruction to the first GPU so that the first GPU renders the desktop of the target virtual machine according to the desktop texture data.
[0114] In one embodiment, the desktop rendering instructions also include a priority, such as Figure 4 As shown, the device 30 also includes:
[0115] GPU utilization acquisition module 306, used for:
[0116] If the second identification information of the target desktop rendering instruction indicates that it does not require exclusive GPU access and the priority of the target desktop rendering instruction is high, then obtain the utilization rate of each GPU in at least one GPU.
[0117] A second GPU is determined from the at least one GPU, wherein the second GPU is a GPU whose utilization rate is less than or equal to a first preset utilization threshold among the at least one GPUs;
[0118] The target desktop rendering instruction is sent to the second GPU so that the second GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0119] In one embodiment, the GPU utilization acquisition module 306 is further configured to:
[0120] If the second identification information of the target desktop rendering instruction indicates that it does not need to exclusively occupy the GPU and the priority of the target desktop rendering instruction is low, then a third GPU is determined from the at least one GPU. The third GPU is the GPU among the at least one GPU whose utilization rate is greater than or equal to a second preset utilization rate threshold, and the second preset utilization rate threshold is greater than the first preset utilization rate threshold.
[0121] The target desktop rendering instruction is sent to the third GPU so that the third GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0122] In one embodiment, the GPU utilization acquisition module 306 is further configured to:
[0123] If the second identification information of the target desktop rendering instruction indicates that it does not require exclusive GPU use and the priority of the target desktop rendering instruction is medium, then a fourth GPU is determined from the at least one GPU. The fourth GPU is the GPU among the at least one GPU whose utilization rate is greater than the first preset utilization rate threshold and less than the second preset utilization rate threshold.
[0124] The target desktop rendering instruction is sent to the fourth GPU so that the fourth GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0125] In one embodiment, the device 30 further includes:
[0126] GPU memory acquisition module 307 is used for:
[0127] If the second identification information of the target desktop rendering instruction indicates that it does not require exclusive GPU access and the size of the desktop texture data of the target desktop rendering instruction is greater than or equal to the first preset threshold, then the video memory of each GPU in the at least one GPU is obtained.
[0128] A fifth GPU is determined from the at least one GPU, wherein the fifth GPU is a GPU among the at least one GPU whose video memory is greater than or equal to a first preset video memory threshold;
[0129] The target desktop rendering instruction is sent to the fifth GPU so that the fifth GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0130] In one embodiment, the GPU memory acquisition module 307 is further configured to:
[0131] If the second identification information of the target desktop rendering instruction indicates that it does not need to exclusively occupy the GPU and the size of the desktop texture data of the target desktop rendering instruction is less than the first preset threshold and greater than the second preset threshold, then a sixth GPU is determined from the at least one GPU. The sixth GPU is the GPU among the at least one GPU whose video memory is less than the first preset video memory threshold and greater than the second preset video memory threshold. The second preset video memory threshold is less than the first preset video memory threshold.
[0132] The target desktop rendering instruction is sent to the sixth GPU so that the sixth GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0133] In one embodiment, the GPU memory acquisition module 307 is further configured to:
[0134] If the second identification information of the target desktop rendering instruction indicates that it does not need to exclusively occupy the GPU and the size of the desktop texture data of the target desktop rendering instruction is less than or equal to the second preset threshold, a seventh GPU is determined from the at least one GPU, and the seventh GPU is the GPU among the at least one GPU whose video memory is less than or equal to the second preset video memory threshold;
[0135] The target desktop rendering instructions are sent to the seventh GPU so that the seventh GPU renders the desktop of the target virtual machine based on the desktop texture data.
[0136] The virtual machine desktop rendering device provided in this disclosure can be implemented and its technical effects can be found in the above-described embodiments. Figure 2 Examples are not described in detail here.
[0137] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0138] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
Claims
1. A virtual machine desktop rendering method, characterized in that, include: Receive desktop rendering instructions sent by each virtual machine in at least one virtual machine, wherein the desktop rendering instructions include first identification information of the virtual machine, desktop texture data of the virtual machine, and second identification information, wherein the second identification information is used to indicate whether the desktop rendering instructions require exclusive GPU access; If the second identification information of the target desktop rendering instruction indicates that the target desktop rendering instruction needs to exclusively occupy the GPU, then obtain the number of desktop rendering instructions to be processed for each GPU in at least one graphics processing unit (GPU), wherein the target desktop rendering instruction is a desktop rendering instruction sent by the target virtual machine, and the target virtual machine is any one of the at least one virtual machines; A first GPU is determined from the at least one GPU, wherein the first GPU is the GPU with the fewest pending desktop rendering instructions among the at least one GPU; Obtain the desktop rendering instructions to be processed from the first GPU and send the desktop rendering instructions to be processed to other GPUs, wherein the other GPUs are GPUs other than the first GPU among the at least one GPU; The target desktop rendering instruction is sent to the first GPU so that the first GPU renders the desktop of the target virtual machine based on the desktop texture data.
2. The method according to claim 1, characterized in that, The desktop rendering instruction also includes a priority, and the method further includes: if the second identification information of the target desktop rendering instruction indicates that it does not need to exclusively occupy the GPU and the priority of the target desktop rendering instruction is high, then obtain the utilization rate of each GPU in at least one GPU; A second GPU is determined from the at least one GPU, wherein the second GPU is a GPU whose utilization rate is less than or equal to a first preset utilization threshold among the at least one GPUs; The target desktop rendering instruction is sent to the second GPU so that the second GPU renders the desktop of the target virtual machine based on the desktop texture data.
3. The method according to claim 2, characterized in that, The method further includes: If the second identification information of the target desktop rendering instruction indicates that it does not need to exclusively occupy the GPU and the priority of the target desktop rendering instruction is low, then a third GPU is determined from the at least one GPU. The third GPU is the GPU among the at least one GPU whose utilization rate is greater than or equal to a second preset utilization rate threshold, and the second preset utilization rate threshold is greater than the first preset utilization rate threshold. The target desktop rendering instruction is sent to the third GPU so that the third GPU renders the desktop of the target virtual machine based on the desktop texture data.
4. The method according to claim 3, characterized in that, The method further includes: If the second identification information of the target desktop rendering instruction indicates that it does not require exclusive GPU use and the priority of the target desktop rendering instruction is medium, then a fourth GPU is determined from the at least one GPU. The fourth GPU is the GPU among the at least one GPU whose utilization rate is greater than the first preset utilization rate threshold and less than the second preset utilization rate threshold. The target desktop rendering instruction is sent to the fourth GPU so that the fourth GPU renders the desktop of the target virtual machine based on the desktop texture data.
5. The method according to claim 1, characterized in that, The method further includes: If the second identification information of the target desktop rendering instruction indicates that it does not require exclusive GPU access and the size of the desktop texture data of the target desktop rendering instruction is greater than or equal to the first preset threshold, then the video memory of each GPU in the at least one GPU is obtained. A fifth GPU is determined from the at least one GPU, wherein the fifth GPU is a GPU among the at least one GPU whose video memory is greater than or equal to a first preset video memory threshold; The target desktop rendering instruction is sent to the fifth GPU so that the fifth GPU renders the desktop of the target virtual machine based on the desktop texture data.
6. The method according to claim 5, characterized in that, The method further includes: If the second identification information of the target desktop rendering instruction indicates that it does not need to exclusively occupy the GPU and the size of the desktop texture data of the target desktop rendering instruction is less than the first preset threshold and greater than the second preset threshold, then a sixth GPU is determined from the at least one GPU. The sixth GPU is the GPU among the at least one GPU whose video memory is less than the first preset video memory threshold and greater than the second preset video memory threshold. The second preset video memory threshold is less than the first preset video memory threshold. The target desktop rendering instruction is sent to the sixth GPU so that the sixth GPU renders the desktop of the target virtual machine based on the desktop texture data.
7. The method according to claim 6, characterized in that, The method further includes: If the second identification information of the target desktop rendering instruction indicates that it does not need to exclusively occupy the GPU and the size of the desktop texture data of the target desktop rendering instruction is less than or equal to the second preset threshold, a seventh GPU is determined from the at least one GPU, and the seventh GPU is the GPU among the at least one GPU whose video memory is less than or equal to the second preset video memory threshold; The target desktop rendering instructions are sent to the seventh GPU so that the seventh GPU renders the desktop of the target virtual machine based on the desktop texture data.
8. A virtual machine desktop rendering device, characterized in that, include: A desktop rendering instruction receiving module is used to receive desktop rendering instructions sent by each virtual machine in at least one virtual machine. The desktop rendering instruction includes first identification information of the virtual machine, desktop texture data of the virtual machine, and second identification information. The second identification information is used to indicate whether the desktop rendering instruction needs to exclusively use the GPU. The pending desktop rendering instruction quantity acquisition module is used to acquire the number of pending desktop rendering instructions for each GPU in at least one GPU if the second identification information of the target desktop rendering instruction indicates that the target desktop rendering instruction needs to exclusively occupy the GPU. The target desktop rendering instruction is a desktop rendering instruction sent by a target virtual machine, and the target virtual machine is any one of the at least one virtual machines. A first GPU determination module is configured to determine a first GPU from the at least one GPU, wherein the first GPU is the GPU with the fewest number of desktop rendering instructions to be processed among the at least one GPU; A pending desktop rendering instruction sending module is used to obtain the pending desktop rendering instruction of the first GPU and send the pending desktop rendering instruction to other GPUs, wherein the other GPUs are GPUs other than the first GPU among the at least one GPU; The target desktop rendering instruction sending module is used to send the target desktop rendering instruction to the first GPU, so that the first GPU renders the desktop of the target virtual machine according to the desktop texture data.
9. The apparatus according to claim 8, characterized in that, The desktop rendering instructions also include priority, and the device further includes: The GPU utilization acquisition module is used for: If the second identification information of the target desktop rendering instruction indicates that it does not require exclusive GPU access and the priority of the target desktop rendering instruction is high, then obtain the utilization rate of each GPU in at least one GPU. A second GPU is determined from the at least one GPU, wherein the second GPU is a GPU whose utilization rate is less than or equal to a first preset utilization threshold among the at least one GPUs; The target desktop rendering instruction is sent to the second GPU so that the second GPU renders the desktop of the target virtual machine based on the desktop texture data.
10. A virtual machine desktop rendering system, characterized in that, include: At least one virtual machine, a central processing unit (CPU), and at least one GPU running on the server; The central processing unit (CPU) is connected to any one of the at least one virtual machines, and the CPU is also connected to any one of the at least one GPUs. The CPU is used to execute the virtual machine desktop rendering method according to any one of claims 1 to 7.