WO2021098182A1 - Resource management method and apparatus, electronic device and storage medium - Google Patents

Resource management method and apparatus, electronic device and storage medium Download PDF

Info

Publication number
WO2021098182A1
WO2021098182A1 PCT/CN2020/093491 CN2020093491W WO2021098182A1 WO 2021098182 A1 WO2021098182 A1 WO 2021098182A1 CN 2020093491 W CN2020093491 W CN 2020093491W WO 2021098182 A1 WO2021098182 A1 WO 2021098182A1
Authority
WO
WIPO (PCT)
Prior art keywords
gpu
physical
target virtual
virtual gpu
memory capacity
Prior art date
Application number
PCT/CN2020/093491
Other languages
French (fr)
Chinese (zh)
Inventor
吴保东
陈逊
孙鹏
颜深根
李鼎基
Original Assignee
上海商汤智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 上海商汤智能科技有限公司 filed Critical 上海商汤智能科技有限公司
Priority to JP2021537951A priority Critical patent/JP2022516486A/en
Priority to KR1020217020283A priority patent/KR20210095690A/en
Publication of WO2021098182A1 publication Critical patent/WO2021098182A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5066Algorithms for mapping a plurality of inter-dependent sub-tasks onto a plurality of physical CPUs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing

Definitions

  • This application relates to the field of computer technology, in particular to a resource management method and device, electronic equipment and storage medium.
  • GPUs graphics processing units
  • a large number of small-scale and light-load computing tasks make GPU resources face the challenges of low computing load and high frequency of use.
  • a large number of small tasks increase the power consumption of the GPU cluster and reduce the overall resource utilization.
  • each physical GPU resource is divided into multiple fine-grained virtual GPU computing resources, so that small tasks can be directly processed using the virtual GPU to improve the parallelism of applications and the resource utilization efficiency of GPU clusters.
  • the embodiments of the present application provide a resource management and allocation method and device, electronic equipment, and storage medium.
  • the first aspect of the embodiments of the present application provides a resource management allocation method, including: reading a configuration file, the configuration file including the virtual image processing unit GPU configuration parameters of the guest device; based on the configuration file, generating the guest device At least one available virtual GPU; in response to receiving a task to be processed by a target user, a physical GPU is allocated to a target virtual GPU corresponding to the task to be processed, and the at least one available virtual GPU includes the target virtual GPU.
  • the allocating a physical GPU to the target virtual GPU corresponding to the task to be processed includes: setting the target virtual GPU to the target virtual GPU based on the memory capacity required by the target virtual GPU and a resource state table.
  • the GPU allocates physical GPUs, where the resource state table includes current state information of each of the multiple physical GPUs.
  • the current state information of the physical GPU includes: the video memory capacity of the physical GPU, user information of each virtual GPU corresponding to the video memory already occupied by the physical GPU, and The video memory capacity of each virtual GPU corresponding to the video memory already occupied by the physical GPU.
  • the allocating a physical GPU to the target virtual GPU based on the required video memory capacity and the resource state table of the target virtual GPU includes: based on the required video memory of the target virtual GPU The capacity and the resource state table allocate physical GPUs to the target virtual GPU, so that the video memory of the multiple physical GPUs is used to a minimum.
  • the allocating a physical GPU to the target virtual GPU based on the required video memory capacity and the resource state table of the target virtual GPU includes: based on the resource state table, according to multiple physical The order of GPU arrangement is to determine the remaining video memory capacity of each physical GPU in turn until the determined remaining video memory capacity meets the required video memory capacity of the target virtual GPU; the remaining video memory capacity meets the required video memory capacity of the target virtual GPU
  • the physical GPU determines the physical GPU allocated to the target virtual GPU.
  • the method further includes: when it is determined that the remaining video memory capacity of the physical GPU ranked last among the multiple physical GPUs does not meet the required video memory capacity of the target virtual GPU , It is determined that the virtual GPU has no available physical resources.
  • the allocating a physical GPU to the target virtual GPU based on the display memory capacity and resource state table of the target virtual GPU includes: based on the required display memory capacity of the target virtual GPU and A resource state table, which allocates physical GPUs to the target virtual GPU, so that at least one task of the target user is allocated to the multiple physical GPUs as evenly as possible, wherein the at least one task includes the to-be-processed task.
  • the allocating a physical GPU to the target virtual GPU based on the memory capacity and resource state table of the target virtual GPU includes: determining the target user based on the resource state table The number of tasks currently allocated by each physical GPU in the plurality of physical GPUs, and the remaining video memory capacity of each physical GPU; the number of tasks is minimized and the remaining video memory capacity meets the required video memory capacity of the target virtual GPU
  • the physical GPU determines the physical GPU allocated to the target virtual GPU.
  • the method further includes: when the number of tasks is the smallest and the remaining video memory capacity meets the required video memory capacity of the target virtual GPU, the number of physical GPUs is multiple, The foremost physical GPU among the multiple physical GPUs with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated to the target virtual GPU.
  • the method further includes: updating the resource state table based on the physical GPU allocated to the target virtual GPU; or, in the case that the task processing state changes, based on the The resource status table is updated with the change of the task processing status.
  • an embodiment of the present application provides a resource management allocation method applied to a guest device, including: reading a configuration file of a host, where the configuration file includes virtual GPU configuration parameters of the guest device; based on the A configuration file to generate at least one available virtual GPU of the guest device; in the case of receiving a task to be processed by a target user, send a resource allocation request to the host based on the target virtual GPU corresponding to the task to be processed, wherein the The resource allocation request is used to request the host to allocate a physical GPU to the target virtual GPU, and the at least one available virtual GPU includes the target virtual GPU.
  • the method before the target virtual GPU corresponding to the task to be processed sends a resource allocation request to the host, the method further includes: determining the guest device based on the first resource status table At least one of the available virtual GPUs in the idle state, wherein the first resource state table includes current state information of each of the multiple physical GPUs; determining all the virtual GPUs in the idle state from the virtual GPUs in the idle state.
  • the target virtual GPU before the target virtual GPU corresponding to the task to be processed sends a resource allocation request to the host, the method further includes: determining the guest device based on the first resource status table At least one of the available virtual GPUs in the idle state, wherein the first resource state table includes current state information of each of the multiple physical GPUs; determining all the virtual GPUs in the idle state from the virtual GPUs in the idle state.
  • the method further includes: receiving a first update instruction regarding the first resource status table from the host, where the first update instruction is detected on the host Sent when the task processing state of the physical GPU changes; based on the first update instruction, the first resource state table is updated.
  • the at least one physical GPU includes a first physical GPU with a newly added task
  • the first update instruction carries at least one of the following information: The user information corresponding to the newly added task, the information of the first physical GPU, the video memory capacity of the virtual GPU corresponding to the newly added task; and/or the at least one physical GPU includes the second with the newly completed task
  • the first update instruction carries at least one of the following: user information corresponding to the newly completed task, and information of the second physical GPU.
  • the method further includes: scheduling the virtual GPU to execute the task to be processed; and receiving a processing result of the task to be processed from the host.
  • an embodiment of the present application provides a resource management allocation method, applied to a host, including: receiving a resource allocation request from a guest device, the resource allocation request carrying information of the task to be processed and information of the target virtual GPU; The information of the target virtual GPU allocates a target physical GPU to the target virtual GPU.
  • the allocating a target physical GPU to the target virtual GPU based on the information of the target virtual GPU includes: setting the target physical GPU to the target virtual GPU based on the required video memory capacity of the target virtual GPU.
  • Virtual GPU allocates physical GPU.
  • the allocating a physical GPU to the target virtual GPU based on the video memory capacity of the target virtual GPU includes: based on the required video memory capacity of the target virtual GPU, a resource allocation strategy, and a second The second resource state table allocates physical GPUs to the target virtual GPU, where the second resource state table includes current state information of each of the multiple physical GPUs.
  • the allocating a physical GPU to the target virtual GPU based on the memory capacity of the target virtual GPU, the resource allocation strategy, and the second resource state table includes: based on the second The resource state table, according to the arrangement order of the multiple physical GPUs, sequentially determines the remaining video memory capacity of each physical GPU until the determined remaining video memory capacity meets the required video memory capacity of the target virtual GPU; and the remaining video memory capacity meets all requirements.
  • the physical GPU of the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated to the target virtual GPU.
  • the virtual GPU is determined No physical resources are available.
  • the allocating a physical GPU to the target virtual GPU based on the memory capacity of the target virtual GPU, the resource allocation strategy, and the second resource state table includes: based on the second The resource status table determines the number of tasks currently allocated by each physical GPU of the multiple physical GPUs by the target user, and the remaining video memory capacity of each physical GPU, where the target user is a user corresponding to the target virtual GPU; The physical GPU with the smallest number of tasks and the remaining video memory meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU of the target virtual GPU.
  • the method further includes: when the number of tasks is the smallest and the remaining video memory capacity meets the required video memory capacity of the target virtual GPU, the number of physical GPUs is multiple, The foremost physical GPU among the physical GPUs with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated to the target virtual GPU.
  • the method further includes: updating the second resource state table based on the physical GPU allocated to the target virtual GPU; or, when the task processing state changes, The second resource status table is updated based on the change in the task processing status.
  • the method further includes: performing task scheduling based on the task queue of each physical GPU in the plurality of physical GPUs.
  • an embodiment of the present application provides a resource management system, including: a host and a guest device, wherein a plurality of physical GPUs are provided on the host, the guest device includes a virtual machine or a container; the guest device uses Yu: Read a configuration file, the configuration file including the virtual image processing unit GPU configuration parameters of the guest device; generate at least one available virtual GPU of the guest device based on the configuration file;
  • a resource allocation request is sent to the host based on the target virtual GPU corresponding to the task to be processed, where the resource allocation request is used to request the host to allocate a physical GPU to the target virtual GPU, and
  • the at least one available virtual GPU includes the target virtual GPU; the host is configured to: receive a resource allocation request from the guest device, the resource allocation request carrying information about the task to be processed and the target virtual GPU ⁇ ; Based on the information of the target virtual GPU, assign a target physical GPU to the target virtual GPU.
  • an embodiment of the present application provides a resource management device, including a communication unit and a processing unit, wherein the processing unit is configured to: obtain a configuration file through the communication unit; read the configuration file, the configuration The file includes the virtual image processing unit GPU configuration parameters of the guest device; based on the configuration file, at least one available virtual GPU of the guest device is generated; and in response to receiving the task to be processed by the target user, corresponding to the task to be processed A physical GPU is allocated to the target virtual GPU of the target virtual GPU, and the at least one available virtual GPU includes the target virtual GPU.
  • an embodiment of the present application provides a resource management device, including a communication unit and a processing unit, wherein the processing unit is configured to: obtain a host configuration file through the communication unit; read the host configuration file, wherein The configuration file includes virtual GPU configuration parameters of the guest device; based on the configuration file, at least one available virtual GPU of the guest device is generated; and in the case of receiving a task to be processed by the target user, through the communication
  • the unit sends a resource allocation request to the host based on the target virtual GPU corresponding to the task to be processed, wherein the resource allocation request is used to request the host to allocate a physical GPU to the target virtual GPU, and the at least one available virtual GPU
  • the GPU includes the target virtual GPU.
  • an embodiment of the present application provides a resource management device, including a communication unit and a processing unit, wherein the processing unit is configured to: receive a resource allocation request from a guest device through the communication unit, the resource allocation request Carry the information of the task to be processed and the information of the target virtual GPU; and based on the information of the target virtual GPU, allocate a target physical GPU to the target virtual GPU.
  • an embodiment of the present application provides a resource management system, including a host and a guest device, wherein the host is provided with multiple physical GPUs; the guest device is a device of any one of the sixth aspect of the embodiments of the present application Device; the host is a device according to any one of the seventh aspects of the embodiments of this application.
  • an embodiment of the present application provides an electronic device, including a processor and a memory, where the memory is used to store a computer program, and the computer program is configured to be executed by the above-mentioned processor so that the processor executes the present invention. Any method described in the first aspect, the second aspect, or the third aspect of the application embodiment.
  • an embodiment of the present application provides a computer-readable storage medium, wherein the above-mentioned computer-readable storage medium is used to store a computer program, wherein the above-mentioned computer program enables a computer to execute operations as described in the first aspect and the first aspect of the embodiments of the present application. Any method described in the second or third aspect.
  • an embodiment of the present application provides a computer program product, wherein the above-mentioned computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the above-mentioned computer program is operable to cause a computer to execute operations as described in this application.
  • the above-mentioned computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the above-mentioned computer program is operable to cause a computer to execute operations as described in this application.
  • Embodiments any one of the methods described in the first aspect, the second aspect, or the third aspect.
  • the computer program product may be a software installation package.
  • the embodiment of the application first reads the configuration file, where the configuration file includes the configuration parameters of the virtual GPU of the guest device, and then based on the configuration file, generates at least one available virtual GPU of the guest device, and after receiving the target customer
  • a physical GPU is allocated to a target virtual GPU corresponding to the task to be processed, and the at least one available virtual GPU includes the target virtual GPU.
  • a fixed mapping relationship is not established for the virtual GPU and the physical GPU in advance, but after the virtual GPU receives the task to be processed, the virtual GPU is dynamically assigned the corresponding physical GPU, which can be flexibly based on the current task
  • the characteristics of the physical GPU resources are managed and allocated to improve the resource utilization of the physical GPU and improve the overall performance of the system.
  • Fig. 1 is a schematic diagram of a resource management system provided by an embodiment of the present application.
  • Fig. 2 is a schematic flowchart of a resource management and allocation method disclosed in an embodiment of the present application.
  • FIG. 3 is an architecture diagram of a minimum resource management allocation strategy provided by an embodiment of the present application.
  • Fig. 4 is a structural diagram of a load balancing distribution strategy provided by an embodiment of the present application.
  • Fig. 5 is a schematic flowchart of a method for resource management and allocation disclosed in another embodiment of the present application.
  • Fig. 6 is a schematic flowchart of a method for resource management and allocation disclosed in another embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of an electronic device provided by another embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of an electronic device according to another embodiment of the present application.
  • FIG. 10 is a block diagram of the functional unit composition of a resource management device involved in an embodiment of the present application.
  • Fig. 11 is a block diagram of functional units of a resource management device involved in another embodiment of the present application.
  • Fig. 12 is a block diagram of functional units of a resource management device involved in another embodiment of the present application.
  • the resource management and allocation device involved in the embodiments of the present application is a device that can perform resource management and allocation, and may be an electronic device.
  • the above-mentioned electronic device includes a terminal device.
  • the above-mentioned terminal device includes, but is not limited to, a touch-sensitive surface ( For example, touch screen displays and/or touch pads) mobile phones, laptop computers or other portable devices such as tablet computers.
  • a touch-sensitive surface For example, touch screen displays and/or touch pads
  • the device is not a portable communication device, but a desktop computer, server, etc. having a touch-sensitive surface (eg, touch screen display and/or touch pad).
  • Fig. 1 is a schematic diagram of a resource management system provided by an embodiment of the application.
  • the GPU virtualization solution involves a guest device (Guest) 101 and a host (Host) 102.
  • the host 102 refers to a physical machine node of a device with a physical GPU (pGPU) 140.
  • the user can directly perform GPU tasks on the host.
  • the host also contains a service daemon, which is responsible for starting the physical GPU and parsing and forwarding data with guest devices, etc. Communication operation.
  • the guest device 101 refers to a virtual machine or container that can use a virtualized GPU.
  • the guest device 101 does not have any GPU device and cannot directly perform GPU tasks.
  • the guest device 101 contains a process for GPU virtualization, which is responsible for the dynamic linking of the encapsulated GPU
  • the library and data forwarding enable tasks on the guest device 101 to transparently use the physical GPU of the host to perform operations.
  • the guest's virtual GPU (vGPU) resource management strategy can be selected as follows: the guest's virtual GPU resource management strategy is divided into two stages: virtual display according to configuration options and actual allocation according to task start. Among them, Guest can be a virtual machine. As shown in Figure 1, the main allocation process is as follows: First, start the virtual machine (VM) of the guest device, where there may be multiple virtual machines, such as 110-1, 110-n, and so on.
  • VM virtual machine
  • the virtual GPU related parameters on the current VM including the number of virtual GPUs, the video memory capacity of each virtual GPU, the use time of each virtual GPU, the size of each virtual GPU time slice, etc.;
  • a virtual virtual GPU image 122 is generated on the virtual GPU guest device of the VM.
  • the virtual GPU is not mapped with the physical GPU, and only the virtual GPU information is allocated to the user to observe at the software level; when the user on the VM starts to use
  • the virtual machine sends a request to initialize GPU information.
  • the VM establishes a connection with the Host, and establishes the actual association between the virtual GPU 124 and the physical GPU 140 through the virtual GPU-physical GPU resource allocation strategy 130.
  • one virtual GPU 124 may be associated with one physical GPU, or may be associated with multiple physical GPUs.
  • Host 102 returns the information of the physical GPU 140 to the VM, such as the address ID of the GPU, the device model of the physical GPU, the remaining video memory capacity of the physical GPU, the start time of applying for the use of the physical GPU, and other parameters.
  • the virtual GPU updates the above information and follows the configuration
  • the parameter calls the GPU virtualization process to forward the data of task 123 to the Host.
  • the host's service daemon starts the associated physical GPU and processes task 123 according to the forwarded data, and sends the task processing result back to the VM after the task processing is completed. It should be noted that although the user on the VM looks like the task 123 is completed on the virtual GPU 124 on the VM, in fact, the task 123 is completed on the physical GPU 140 of the host.
  • Guest and Host may be set on the same device; for example, the physical GPU on the host and the guest device installed on the host may also be set on different devices. For example, guest devices installed on user equipment and various physical GPU node devices installed on the network.
  • FIG. 2 is a schematic flowchart of a resource management and allocation method disclosed in an embodiment of the present application. As shown in FIG. 2, the resource management and allocation method includes the following steps.
  • 201 Read a configuration file, where the configuration file includes virtual GPU configuration parameters of the guest device.
  • the configuration file includes virtual GPU-related parameters on the current guest device.
  • the virtual GPU-related parameters may include, but are not limited to, the number of virtual GPUs, the memory capacity of each virtual GPU, the use time of each virtual GPU, and each virtual GPU. One or more of GPU time slice size, etc.
  • the configuration file may be system default, or may be generated according to user requirements.
  • the guest device may generate at least one available virtual GPU of the guest device based on the configuration file.
  • the above virtual GPU is a software level used to present the viewing to the user. For example, after generating at least one of the above-mentioned available virtual GPUs, the user can view the number of virtual GPUs on the guest device through the user device, as well as the video memory capacity of each virtual GPU, the duration of each virtual GPU, and each Parameters such as virtual GPU time slice size. At this time, the virtual GPU is not mapped with the physical GPU.
  • the guest device after the guest device receives the task to be processed, the guest device allocates a target virtual GPU for the task to be processed to process the task to be processed. Then, a physical GPU is allocated to the target virtual GPU according to the specific information of the target virtual GPU, that is, a mapping relationship between the virtual GPU and the physical GPU is established. After the physical GPU is allocated to the target virtual GPU, the task to be processed is processed in the physical GPU allocated by the target virtual GPU, and the processing result is fed back to the guest device. That is, the above-mentioned tasks to be processed are processed in the physical GPU allocated by the host, and the processing result is fed back to the guest device.
  • the embodiment of the application reads a configuration file, where the configuration file includes the parameters of the virtual GPU of the guest device, and the guest device includes at least one virtual GPU;
  • the target virtual GPU corresponding to the task is allocated a physical GPU, and the at least one available virtual GPU includes the target virtual GPU.
  • the virtual GPU and the physical GPU do not establish a mapping relationship before receiving the task. After the task is received, the mapping relationship may be established between the virtual GPU and the physical graphics virtual unit. Furthermore, it is possible to flexibly manage and allocate GPU resources through different resource allocation strategies, so as to improve the use efficiency of physical GPUs.
  • the allocating a physical GPU to the target virtual GPU corresponding to the task to be processed includes: based on the required video memory capacity of the target virtual GPU and a resource state table, assigning a physical GPU to the target virtual GPU The GPU allocates physical GPUs, where the resource state table includes current state information of each of the multiple physical GPUs in the host.
  • the current state information includes: among the above-mentioned multiple physical GPUs, the video memory capacity of each physical GPU, the user information of each virtual GPU in each physical GPU corresponding to the video memory already occupied by the physical GPU, and the user information of each virtual GPU in each physical GPU.
  • the video memory capacity of each physical GPU, the user ID of each virtual GPU in each physical GPU corresponding to the video memory already occupied by the physical GPU Information such as the video memory capacity of each virtual GPU corresponding to the video memory already occupied by the physical GPU.
  • the foregoing current state information may further include a task identifier of each virtual GPU in each physical GPU corresponding to the video memory that the physical GPU has already occupied.
  • Table 1 is a specific implementation manner of a resource status table provided in an embodiment of the application.
  • pGPU stands for physical GPU
  • vGPU stands for virtual GPU
  • ID stands for address or identification.
  • a physical GPU that satisfies the conditions for executing the task to be processed can be determined from the resource state table according to the memory capacity of the target virtual GPU as the target virtual GPU. For example, a physical GPU whose remaining video memory is greater than the video memory of the target virtual GPU may be determined as the physical GPU allocated by the target virtual GPU.
  • the allocating a physical GPU to the target virtual GPU based on the required video memory capacity and resource state table of the target virtual GPU may specifically include: based on the video memory capacity, resource state table, and resource allocation of the target virtual GPU The strategy allocates physical GPUs to the target virtual GPU.
  • the aforementioned resource allocation strategy refers to a mapping rule between the virtual GPU and the physical GPU of the resource formulated to achieve a certain effect.
  • a minimum resource allocation strategy formulated in order to achieve the least use of physical GPUs and another example, a load balancing allocation strategy formulated in order to make multiple tasks of the same user evenly distributed among the physical GPUs.
  • the resource allocation strategy may be located at the host, and a partial mapping relationship of the resource allocation strategy is stored in the guest device.
  • the allocating a physical GPU to the target virtual GPU based on the target virtual GPU's video memory capacity, resource state table, and resource allocation strategy includes: based on the resource state table, according to multiple The sequence of physical GPUs is to determine the remaining video memory capacity of each physical GPU in turn until the determined remaining video memory capacity meets the required video memory capacity of the target virtual GPU; the remaining video memory capacity meets the required video memory capacity of the target virtual GPU The physical GPU of determines the physical GPU allocated to the target virtual GPU.
  • the resource allocation strategy in this allocation method of virtual GPU and physical GPU may be referred to as the least resource allocation strategy.
  • the arrangement order of the multiple physical GPUs can be arranged in the order of the ID numbers of the physical GPUs, or the arrangement order of the multiple physical GPUs in the resource state table, such as pGPU1-pGPUn in Table 1, and in Table 1.
  • the arrangement order of the physical GPUs can be arranged according to the order of the ID numbers of the physical GPUs, or according to the location information of the physical GPUs in the host, or according to the time when the physical GPUs are added to the host.
  • the first physical GPU is determined as the physical GPU allocated by the target virtual GPU; otherwise, the second The remaining video memory capacity of a physical GPU, and then determine whether the remaining video memory capacity of the second physical GPU is greater than or equal to the required video memory capacity of the target virtual GPU, if it is greater than or equal to the required video memory capacity of the target virtual GPU, the second physical GPU
  • the GPU determines the physical GPU allocated to the target virtual GPU; otherwise, it continues to obtain the remaining video memory capacity of the next physical GPU to perform the same judgment operation.
  • FIG. 3 is a structural diagram of a minimum resource management allocation strategy provided by an embodiment of the application.
  • the shaded rectangle with a label indicates the task to be processed
  • the label in the rectangle indicates the order in which the tasks are generated
  • VPT indicates the resource state table
  • pGPU indicates the physical GPU
  • vGPU indicates the virtual GPU. From the architecture diagram, it can be seen that the tasks are generated according to the The order of precedence is assigned to the physical GPUs arranged in front.
  • the physical GPUs arranged in the front are preferentially allocated to the target virtual GPUs, so as to maximize the utilization of each GPU to save GPU resources.
  • the allocating a physical GPU to the target virtual GPU based on the memory capacity of the target virtual GPU, a resource state table, and a resource allocation strategy includes: determining all the physical GPUs based on the resource state table.
  • the number of tasks currently allocated by each physical GPU of the target user among multiple physical GPUs and the remaining video memory of each physical GPU, the user ID is the identification of the target user of the target virtual GPU; the number of tasks is minimized and
  • the physical GPU whose remaining video memory capacity meets the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated to the target virtual GPU.
  • the minimum number of tasks refers to the minimum number of tasks that the target user runs on the physical GPU, rather than the minimum number of all tasks running on the physical GPU.
  • the resource allocation strategy in this allocation method of virtual GPU and physical GPU is referred to as a load balancing allocation strategy.
  • the number of tasks of the target user corresponding to the video memory occupied by each physical GPU in the multiple physical GPUs can be determined, so as to count the tasks of the target user in the above-mentioned multiple physical GPUs.
  • the physical GPU with the least number of tasks and the remaining video memory meeting the required video memory capacity of the target virtual GPU is then determined as the physical GPU allocated by the target virtual GPU.
  • the tasks of the target users mentioned above can be evenly distributed to multiple physical GPUs, so as to reduce the accumulation of multiple tasks of the same user to execute on the same physical GPU, resulting in a single user multi-task queuing phenomenon, thereby increasing the user's tasks Implementation efficiency.
  • the number of physical GPUs with the least number of tasks and remaining video memory meeting the required video memory capacity of the target virtual GPU is multiple, the number of tasks is the least and the remaining video memory capacity meeting the target
  • the physical GPU arranged at the forefront among the physical GPUs with the required video memory capacity of the virtual GPU is determined as the physical GPU of the target virtual GPU.
  • the arrangement order of the multiple physical GPUs may be arranged in the order of the ID numbers of the physical GPUs, or may be the arrangement order of the multiple physical GPUs in the aforementioned resource state table.
  • FIG. 4 is a structural diagram of a load balancing distribution strategy provided by another embodiment of the application.
  • the shaded rectangle with a label indicates the task to be processed
  • the label in the rectangle indicates the order in which the task is generated
  • VPT indicates the resource status table
  • pGPU indicates the physical GPU
  • vGPU indicates the virtual GPU. From the architecture diagram, it can be seen that the same user ID Tasks are evenly distributed to each physical GPU.
  • the method further includes: updating the resource state table based on the physical GPU allocated to the target virtual GPU.
  • the physical GPU of the target virtual GPU After the physical GPU of the target virtual GPU is determined, information such as the physical GPU-ID of the target virtual GPU, the ID of the target virtual GPU, the user ID of the target virtual GPU, and the memory capacity of the target virtual GPU are passed. Update the above resource status table.
  • the resource state table is updated based on the tasks that have been executed and completed.
  • the information of the physical GPU that has executed the task in the resource state table can be updated by using the physical GPU-ID of the executed task and the ID of the virtual GPU corresponding to the executed task.
  • FIG. 5 is a schematic flowchart of a resource management and allocation method disclosed in another embodiment of the present application, which is applied to a guest device. As shown in FIG. 5, the resource management and allocation method includes the following steps.
  • 501 Read a configuration file of the host, where the configuration file includes virtual GPU configuration parameters of the guest device.
  • steps 501 and 502 can refer to steps 201 and 202 in FIG. 2, which will not be repeated here.
  • the aforementioned guest device may correspond to the Guest in FIG. 1, and the aforementioned host may correspond to the Host in FIG. 1.
  • the guest device may be a virtual machine, and the virtual machine includes at least one virtual GPU.
  • the virtual GPU in the virtual machine does not process the task to be processed, the virtual GPU in the virtual machine does not have a physical GPU corresponding to it.
  • the virtual machine After the virtual machine receives the task to be processed, the virtual machine allocates a target virtual GPU corresponding to the task to be processed, and then sends resources to the host according to the information of the allocated target virtual GPU, such as the memory capacity of the target virtual GPU An allocation request to request the host to allocate a physical GPU to the target virtual GPU.
  • the resource allocation request may carry the ID of the target virtual GPU and the video memory capacity, and may also carry the user ID of the target virtual GPU.
  • the guest device may also be a container, and the container includes at least one virtual GPU.
  • the virtual GPU in the container does not process the task to be processed
  • the virtual GPU in the container does not have a physical GPU corresponding to it.
  • the container allocates a target virtual GPU corresponding to the task to be processed, and then sends a resource allocation request to the host according to the information of the allocated target virtual GPU, such as the memory capacity of the target virtual GPU To request the host to allocate a physical GPU to the target virtual GPU.
  • the resource allocation request may carry the ID of the target virtual GPU and the video memory capacity, and may also carry the user ID of the target virtual GPU.
  • the embodiment of the application reads a configuration file, where the configuration file includes the parameters of the virtual GPU of the guest device, and the guest device includes at least one virtual GPU; in the case of receiving a task to be processed, based on the to-be-processed task
  • the target virtual GPU corresponding to the task sends a resource allocation request to the host.
  • the virtual GPU and the physical GPU do not establish a mapping relationship before the task is received. After the task is received, the mapping relationship between the virtual GPU and the physical GPU is dynamically established through a resource allocation strategy. Therefore, the mapping relationship between the virtual GPU and the physical GPU can be flexibly established to improve the use efficiency of the physical GPU.
  • the method further includes: based on the number of virtual GPUs in the guest device and the first The resource status table determines the number of unused virtual GPUs of the guest device, and the first resource status table includes current usage status information of each physical GPU; in the case that the number of unused virtual GPUs is greater than zero , Determining the target virtual GPU from the unused virtual GPUs.
  • the information contained in the above-mentioned first resource state table is consistent with the information contained in the resource state table in FIG. 2, and will not be repeated here.
  • the method further includes: receiving a first update instruction regarding the first resource state table, the first update instruction being sent by the host when a change in the task processing state of the physical GPU is detected ⁇ ; Based on the first update instruction, update the first resource status table.
  • a change in the task processing state may be that a new task is added to the physical GPU or a task is completed.
  • the first update instruction carries at least one of the following information: user information corresponding to the newly added task of the first physical GPU, The information of the first physical GPU, the video memory capacity of the virtual GPU of the newly added task; in the case that the host detects that there is a newly completed task in the video memory of the physical GPU, the first update instruction carries the following information At least one item of: user information corresponding to the newly completed task, and information of the second physical GPU corresponding to the newly completed task.
  • the first physical GPU is a GPU newly added to a task
  • the second physical GPU is a GPU corresponding to a newly completed task.
  • the user information may be the ID of the user
  • the information of the physical GPU may be the ID of the physical GPU.
  • the method further includes: scheduling the virtual GPU to execute the task to be processed; and receiving a processing result of the task to be processed from the host.
  • FIG. 6 is a schematic flowchart of a resource management allocation method disclosed in another embodiment of the present application, which is applied to a host. As shown in FIG. 6, the resource management allocation method includes the following steps.
  • 601 Receive a resource allocation request from a guest device, where the resource allocation request carries information about a task to be processed and information about a target virtual GPU, where the target virtual GPU is a virtual GPU included in the guest device.
  • the aforementioned guest device may correspond to the Guest in FIG. 1, and the aforementioned host may correspond to the Host in FIG. 1.
  • the aforementioned guest device includes at least one virtual GPU.
  • the virtual GPU in the guest device does not process the task to be processed, the virtual GPU in the guest device does not have a physical GPU corresponding to it.
  • the foregoing information of the target virtual GPU may include, but is not limited to, the memory capacity of the target virtual GPU and the user ID of the target virtual GPU.
  • the allocating a target physical GPU to the target virtual GPU based on the information of the target virtual GPU includes: allocating a physical GPU to the target virtual GPU based on the display memory capacity of the target virtual GPU.
  • the target physical GPU is used to process the task to be processed according to the information of the task to be processed.
  • the allocating a physical GPU to the target virtual GPU based on the video memory capacity of the target virtual GPU includes: based on the required video memory capacity of the target virtual GPU, a resource allocation strategy, and a second resource state table as the The target virtual GPU allocates physical GPUs, where the second resource state table includes current state information of each of the multiple physical GPUs.
  • the above-mentioned specific implementation process of allocating a physical GPU to the target virtual GPU based on the memory capacity of the target virtual GPU, the resource allocation strategy, and the second resource state table can refer to the "based on The required video memory capacity of the target virtual GPU and the resource state table allocate operations corresponding to the “physical GPU” for the target virtual GPU.
  • the operation of determining the number of tasks currently allocated by the target user to each physical GPU in the multiple physical GPUs can be understood as determining the number of tasks currently allocated by the target user to each physical GPU in the multiple physical GPUs
  • the target user is the user corresponding to the target virtual GPU.
  • the "second resource state table” in the embodiment of the present application corresponds to the "allocation of physical GPUs to the target virtual GPU based on the required video memory capacity and resource state table of the target virtual GPU” in FIG. 2 above.
  • Resource Status Table In one example, the second resource status table is the same as the first resource status table.
  • the guest device copies the resource status table on the host to the local, and the host maintains the second resource status table, and the second resource status table is displayed in the second resource status table.
  • the guest device is notified to update the first resource status table synchronously. For example, the guest device may be notified to update the first resource status table through the first update instruction.
  • the method further includes: updating the second resource state table based on the physical GPU allocated to the target virtual GPU; or, in the case that the task processing state changes, based on The change in the task processing status updates the second resource status table.
  • the second resource state table is updated, including at least one of the following: user information corresponding to the newly added task of the allocated physical GPU, and information about the allocated physical GPU , The video memory capacity of the virtual GPU corresponding to the newly added task.
  • the second resource state table is updated based on the change in the task processing state, including at least one of the following: user information corresponding to the newly completed task, and information about the physical GPU that completed the task .
  • the information of the physical GPU includes the ID of the physical GPU, and the user information includes the user ID.
  • the method may further include: performing task scheduling based on the task queue of each of the multiple physical GPUs .
  • the task queue refers to tasks included in the video memory occupied by the physical GPU.
  • the embodiment of the present application first receives a resource allocation request from a guest device.
  • the resource allocation request carries information about the task to be processed and a target virtual GPU.
  • the target virtual GPU is a virtual GPU included in the guest device in the guest device, and then based on all the information.
  • the information and resource management strategy of the target virtual GPU allocates a target physical GPU to the target virtual GPU.
  • a fixed mapping relationship is not established for the virtual GPU and the physical GPU in advance, but after the virtual GPU receives the task, the virtual GPU is dynamically allocated the corresponding physical GPU, which can be flexibly allocated through different resources Strategies to manage and allocate GPU resources to improve the resource utilization of the physical GPU and improve the overall performance of the system.
  • FIG. 7 is a schematic structural diagram of an electronic device 700 provided by an embodiment of the present application.
  • the electronic device 700 includes a processor 710, a memory 720, and a communication device. Interface 730 and physical GPU 740.
  • the one or more programs 721 are stored in the aforementioned memory 720 and are configured to be executed by the aforementioned processor 710, and the one or more programs 721 include instructions for executing the following steps.
  • a configuration file including the GPU configuration parameters of the guest device; and based on the configuration file, generate at least one available virtual GPU of the guest device;
  • the target virtual GPU corresponding to the task to be processed is allocated a physical GPU, and the at least one available virtual GPU includes the target virtual GPU.
  • the embodiment of the application reads a configuration file, where the configuration file includes configuration parameters of the virtual GPU of the guest device; and based on the configuration file, generates at least one available virtual GPU of the guest device;
  • a physical GPU is allocated to a target virtual GPU corresponding to the task to be processed, and the at least one available virtual GPU includes the target virtual GPU.
  • a fixed mapping relationship is not established for the virtual GPU and the physical GPU in advance, but after the virtual GPU receives the task to be processed, the virtual GPU is dynamically assigned the corresponding physical GPU, which can be flexibly based on the current task
  • the characteristics of GPU resources are allocated to improve the resource utilization of the physical GPU and improve the overall performance of the GPU system.
  • the target virtual GPU corresponding to the task to be processed is allocated a physical GPU, and the instructions in the program are specifically used to perform the following operations: based on the video memory required by the target virtual GPU
  • the capacity and resource state table allocates physical GPUs to the target virtual GPU, where the resource state table includes current state information of each of the multiple physical GPUs.
  • the current state information of the physical GPU includes: the video memory capacity of the physical GPU, user information of each virtual GPU corresponding to the video memory already occupied by the physical GPU, and The video memory capacity of each virtual GPU corresponding to the video memory already occupied by the physical GPU.
  • the target virtual GPU is allocated a physical GPU based on the required video memory capacity and the resource state table of the target virtual GPU, and the instructions in the program are specifically used to perform the following operations : Based on the required video memory capacity and resource state table of the target virtual GPU, a physical GPU is allocated to the target virtual GPU, so that the video memory of the multiple physical GPUs is used at a minimum.
  • the target virtual GPU is allocated a physical GPU based on the required video memory capacity and resource state table of the target virtual GPU, and the instructions in the program are specifically used to perform the following operations: Based on the resource state table, the remaining video memory capacity of each physical GPU is sequentially determined according to the order of the multiple physical GPUs, until the determined remaining video memory capacity meets the required video memory capacity of the target virtual GPU; and the remaining video memory capacity is satisfied The physical GPU of the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated to the target virtual GPU.
  • the instructions in the program are further used to perform the following operations: after determining that the remaining video memory capacity of the physical GPU ranked last among the multiple physical GPUs does not meet the requirements of the target virtual GPU In the case of the required video memory capacity, it is determined that the virtual GPU has no available physical resources.
  • the target virtual GPU is allocated a physical GPU based on the memory capacity and resource state table of the target virtual GPU, and the instructions in the program are specifically used to perform the following operations:
  • the required video memory capacity and resource state table of the target virtual GPU, and physical GPUs are allocated to the target virtual GPU, so that at least one task of the target user is allocated to the multiple physical GPUs as evenly as possible, wherein ,
  • the at least one task includes the task to be processed.
  • the target virtual GPU is allocated a physical GPU based on the memory capacity and resource state table of the target virtual GPU, and the instructions in the program are specifically used to perform the following operations:
  • the resource status table determines the number of tasks currently allocated by each physical GPU of the multiple physical GPUs by the target user and the remaining video memory capacity of each physical GPU; and minimizes the number of tasks and the remaining video memory capacity satisfies
  • the physical GPU of the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated to the target virtual GPU.
  • the instructions in the program are further used to perform the following operations: when the number of tasks is the smallest and the remaining video memory capacity meets the required video memory capacity of the target virtual GPU, the number of physical GPUs is In the case of multiple, the physical GPU arranged at the forefront among the multiple physical GPUs with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU GPU.
  • the instructions in the program are also used to perform the following operations: update the resource state table based on the physical GPU allocated to the target virtual GPU; or, occur in the task processing state In the case of a change, the resource state table is updated based on the change in the task processing state.
  • FIG. 8 is a schematic structural diagram of an electronic device 800 provided by another embodiment of the present application, and the electronic device 800 may be a visitor device.
  • the electronic device 800 includes a processor 810, a memory 820, and a communication interface 830.
  • the one or more programs 821 are stored in the aforementioned memory 820 and are configured to be executed by the aforementioned processor 810, and the one or more programs 821 include instructions for executing the following steps.
  • the configuration file includes virtual GPU configuration parameters of the guest device; generate at least one available virtual GPU of the guest device based on the configuration file;
  • a resource allocation request is sent to the host based on the target virtual GPU corresponding to the task to be processed, where the resource allocation request is used to request the host to allocate a physical GPU to the target virtual GPU, and the at least One available virtual GPU includes the target virtual GPU.
  • the embodiment of the application reads a configuration file, where the configuration file includes the parameters of the virtual GPU of the guest device; based on the configuration file, generates at least one available virtual GPU of the guest device; In this case, a resource allocation request is sent to the host based on the target virtual GPU corresponding to the task to be processed.
  • a fixed mapping relationship is not established for the virtual GPU and the physical GPU in advance. Instead, after the virtual GPU receives the task, it dynamically sends a resource allocation request to the host to improve the resource utilization of the physical GPU, and Improve the overall performance of the GPU system.
  • the instructions in the program are further used to perform the following operations: based on the first resource state Table, to determine the virtual GPU in the idle state among the at least one available virtual GPU of the guest device, wherein the first resource state table includes current state information of each of the multiple physical GPUs;
  • the target virtual GPU is determined from the virtual GPUs in the idle state.
  • the instructions in the program are further used to perform the following operations: receiving a first update instruction on the first resource state table from the host, the first update instruction It is sent when the host detects that the task processing state of the physical GPU has changed; based on the first update instruction, the first resource state table is updated.
  • the at least one physical GPU includes a first physical GPU with a newly added task
  • the first update instruction carries at least one of the following information: a newly added task of the first physical GPU Corresponding user information, information of the first physical GPU, the video memory capacity of the virtual GPU corresponding to the newly added task; and/or at least one physical GPU includes a second physical GPU with a newly completed task, the first An update instruction carries at least one of the following: user information corresponding to the newly completed task, and information of the second physical GPU.
  • the instructions in the program are further used to perform the following operations: scheduling the virtual GPU to execute the to-be-processed task; and receiving the processing result of the to-be-processed task from the host.
  • FIG. 9 is a schematic structural diagram of an electronic device 900 according to another embodiment of the present application, and the electronic device 900 may be a host.
  • the electronic device 900 includes a processor 910, a memory 920, a communication interface 930, and a physical GPU 940.
  • the one or more programs 921 are stored in the aforementioned memory 920 and are configured to be executed by the aforementioned processor 910, and the one or more programs 921 include instructions for executing the following steps.
  • the resource allocation request carrying information of the task to be processed and information of a target virtual GPU; and based on the information of the target virtual GPU, a target physical GPU is allocated to the target virtual GPU.
  • This embodiment of the application receives a resource allocation request from a guest device, the resource allocation request carries information about the task to be processed and information about a target virtual GPU; and based on the information about the target virtual GPU, allocates a target physical to the target virtual GPU GPU.
  • a fixed mapping relationship is not established for the virtual GPU and the physical GPU in advance. Instead, after receiving the resource allocation request from the guest device, the virtual GPU is dynamically allocated the corresponding physical GPU, which can be flexibly based on the current The characteristics of the task are used to allocate GPU resources to improve the resource utilization of the GPU and improve the overall performance of the GPU system.
  • the target virtual GPU is assigned a target physical GPU based on the information of the target virtual GPU, and the instructions in the program are specifically used to perform the following operations: based on the target virtual GPU
  • the required video memory capacity of the GPU allocates physical GPUs to the target virtual GPU.
  • the physical GPU is allocated to the target virtual GPU based on the memory capacity of the target virtual GPU, and the instructions in the program are specifically used to perform the following operations: based on the target virtual GPU
  • the required video memory capacity, the resource allocation strategy, and the second resource state table allocate physical GPUs to the target virtual GPU, where the second resource state table includes current state information of each of the multiple physical GPUs .
  • the physical GPU is allocated to the target virtual GPU based on the memory capacity of the target virtual GPU, the resource allocation strategy, and the second resource state table, and the instructions in the program are specifically Used to perform the following operations: based on the second resource state table, according to the arrangement order of the multiple physical GPUs, sequentially determine the remaining video memory capacity of each physical GPU until the determined remaining video memory capacity satisfies the target virtual GPU Required video memory capacity; a physical GPU whose remaining video memory capacity meets the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU.
  • the instructions in the program are also used to perform the following operations, when determining that the remaining video memory capacity of the physical GPU ranked last among the multiple physical GPUs does not meet the requirements of the target virtual GPU In the case of the required video memory capacity, it is determined that the virtual GPU has no available physical resources.
  • the program in the program is specifically used to perform the following operations: based on the second resource state table, determine the number of tasks that the target user currently has allocated to each physical GPU among the multiple physical GPUs, and the remaining video memory capacity of each physical GPU, where all The target user is a user corresponding to the target virtual GPU; the physical GPU with the least number of tasks and remaining video memory meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU of the target virtual GPU.
  • the instructions in the program are further used to perform the following operations: when the number of tasks is the smallest and the remaining video memory capacity meets the required video memory capacity of the target virtual GPU, the number of physical GPUs is In the case of multiple, the physical GPU that is arranged at the forefront among the physical GPUs with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU.
  • the instructions in the program are further used to perform the following operations: update the second resource state table based on the physical GPU allocated to the target virtual GPU; or, in task processing When the status changes, the second resource status table is updated based on the change in the task processing status.
  • the instructions in the program are further used to perform the following operations: perform task scheduling based on the task queue of each physical GPU among the multiple physical GPUs.
  • FIG. 10 is a block diagram of the functional unit composition of the resource management device 1000 involved in an embodiment of the present application.
  • the resource management apparatus 1000 is applied to an electronic device, and the electronic device includes a processing unit 1010 and a communication unit 1020.
  • the processing unit 1010 is configured to: obtain a configuration file through the communication unit 1020; read a configuration file, the configuration file including the GPU configuration parameters of the guest device; based on the configuration file, generate at least one available for the guest device A virtual GPU; and in response to receiving a task to be processed by a target user, a physical GPU is allocated to a target virtual GPU corresponding to the task to be processed, and the at least one available virtual GPU includes the target virtual GPU.
  • the embodiment of the application reads a configuration file, where the configuration file includes the parameters of the virtual GPU of the guest device; based on the configuration file, generates at least one available virtual GPU of the guest device; In this case, a physical GPU is allocated to the target virtual GPU corresponding to the task to be processed, and the at least one available virtual GPU includes the target virtual GPU.
  • a fixed mapping relationship is not established for the virtual GPU and the physical GPU in advance, but after the virtual GPU receives the task to be processed, the virtual GPU is dynamically assigned the corresponding physical GPU, which can be flexibly based on the current task
  • the characteristics of the GPU resources are allocated to improve the resource utilization of the GPU and improve the overall performance of the GPU system.
  • the processing unit 1010 is specifically configured to: based on the video memory capacity required by the target virtual GPU And a resource state table that allocates physical GPUs to the target virtual GPU, wherein the resource state table includes current state information of each physical GPU in the multiple physical GPUs.
  • the current state information of each physical GPU includes: the video memory capacity of the physical GPU, the user information of each virtual GPU corresponding to the video memory already occupied by the physical GPU, and the The video memory capacity of each virtual GPU corresponding to the video memory already occupied by the physical GPU.
  • the processing unit 1010 is specifically configured to: Based on the required video memory capacity and resource state table of the target virtual GPU, a physical GPU is allocated to the target virtual GPU, so that the video memory of the multiple physical GPUs is used to a minimum.
  • the processing unit 1010 is specifically configured to:
  • the resource state table determines the remaining video memory capacity of each physical GPU in sequence according to the arrangement order of the multiple physical GPUs, until the determined remaining video memory capacity meets the required video memory capacity of the target virtual GPU; and the remaining video memory capacity meets all requirements.
  • the physical GPU of the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated to the target virtual GPU.
  • the processing unit 1010 is further configured to: determine that the remaining video memory capacity of the physical GPU ranked last among the multiple physical GPUs does not meet the required video memory capacity of the target virtual GPU In the case of, it is determined that the virtual GPU has no available physical resources.
  • the processing unit 1010 is specifically configured to: The required video memory capacity and resource status table of the target virtual GPU, and physical GPUs are allocated to the target virtual GPU, so that at least one task of the target user is allocated to the multiple physical GPUs as evenly as possible, wherein, The at least one task includes the pending task.
  • the processing unit 1010 is specifically configured to:
  • the resource status table determines the number of tasks currently allocated by each physical GPU of the multiple physical GPUs by the target user, and the remaining video memory capacity of each physical GPU; and minimizes the number of tasks and the remaining video memory capacity satisfies all
  • the physical GPU of the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated to the target virtual GPU.
  • the processing unit 1010 is further configured to: when the number of tasks is the smallest and the remaining video memory capacity meets the required video memory capacity of the target virtual GPU, there are multiple physical GPUs. Next, the foremost physical GPU among the multiple physical GPUs with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU.
  • the processing unit 1010 is further configured to: update the resource state table based on the physical GPU allocated to the target virtual GPU; or, when the task processing state changes , Updating the resource status table based on the change of the task processing status.
  • FIG. 11 is a block diagram of the functional unit composition of a resource management device 1100 involved in another embodiment of the present application.
  • the resource management apparatus 1100 is applied to an electronic device, and the electronic device includes a processing unit 1110 and a communication unit 1120.
  • the processing unit 1110 is configured to: obtain a host configuration file through the communication unit 1120; read the host configuration file, where the configuration file includes virtual GPU configuration parameters of the guest device; based on the configuration file, Generate at least one available virtual GPU of the guest device; and in the case of receiving a task to be processed by a target user, send a resource allocation to the host through the communication unit 1120 based on the target virtual GPU corresponding to the task to be processed A request, wherein the resource allocation request is used to request the host to allocate a physical GPU to the target virtual GPU, and the at least one available virtual GPU includes the target virtual GPU.
  • the embodiment of the application reads a configuration file, where the configuration file includes the parameters of the virtual GPU of the guest device; based on the configuration file, generates at least one available virtual GPU of the guest device; In this case, the communication unit sends a resource allocation request to the host based on the target virtual GPU corresponding to the task to be processed.
  • a fixed mapping relationship is not established for the virtual GPU and the physical GPU in advance. Instead, after the virtual GPU receives the task, it sends a resource allocation request to the host to improve the resource utilization of the physical GPU and increase the GPU. The overall performance of the system.
  • the processing unit 1110 is further configured to: determine the resource allocation request based on the first resource state table.
  • the processing unit 1110 is further configured to: receive a first update instruction about the first resource state table from the host, where the first update instruction is in the Sent when the host detects that the task processing state of the physical GPU has changed; based on the first update instruction, the first resource state table is updated.
  • the first update instruction carries at least one of the following information: user information corresponding to the newly added task of the first physical GPU, information of the first physical GPU, and The video memory capacity of the virtual GPU corresponding to the newly added task, the user information corresponding to the completed task, and the information of the second physical GPU corresponding to the completed task, where the first physical GPU is the newly added task GPU, the second physical GPU is a GPU that completes a task.
  • the processing unit 1110 is further configured to: schedule the virtual GPU to execute the task to be processed; and receive a processing result of the task to be processed from the host.
  • FIG. 12 is a block diagram of functional units of a resource management device 1200 involved in another embodiment of the present application.
  • the resource management apparatus 1200 is applied to an electronic device.
  • the electronic device includes a processing unit 1210 and a communication unit 1220.
  • the processing unit 1210 is configured to receive a resource allocation request from a guest device through the communication unit 1220.
  • the resource allocation request carries information of the task to be processed and information of the target virtual GPU; and based on the information of the target virtual GPU, a target physical GPU is allocated to the target virtual GPU.
  • This embodiment of the application receives a resource allocation request from a guest device, the resource allocation request carries information about the task to be processed and information about a target virtual GPU; and based on the information about the target virtual GPU, allocates a target physical to the target virtual GPU GPU.
  • a fixed mapping relationship is not established for the virtual GPU and the physical GPU in advance, but after receiving the resource allocation request from the guest device, the virtual GPU is dynamically allocated the corresponding physical GPU, which can be flexibly based on the current task
  • the characteristics of GPU resources are allocated to improve the resource utilization of the physical GPU and improve the overall performance of the GPU system.
  • the processing unit 1210 is specifically configured to: based on the target virtual GPU The required video memory capacity is allocated to the target virtual GPU with physical GPUs.
  • the processing unit 1210 is specifically configured to: The required video memory capacity, the resource allocation strategy, and the second resource state table allocate physical GPUs to the target virtual GPU, where the second resource state table includes current state information of each of the multiple physical GPUs.
  • the processing unit 1210 is specifically configured to: based on the second resource state table, determine the remaining video memory capacity of each physical GPU in sequence according to the arrangement order of the multiple physical GPUs, until the determined remaining video memory capacity meets the requirements of the target virtual GPU.
  • the processing unit 1210 is further configured to determine that the remaining video memory capacity of the physical GPU ranked last among the multiple physical GPUs does not meet the required video memory capacity of the target virtual GPU In the case of, it is determined that the virtual GPU has no available physical resources.
  • the processing unit 1210 is specifically configured to: based on the second resource state table, determine the number of tasks that the target user currently has allocated to each physical GPU among the multiple physical GPUs, and the remaining video memory capacity of each physical GPU, where the target user Is a user corresponding to the target virtual GPU; the physical GPU with the least number of tasks and remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU of the target virtual GPU.
  • the processing unit 1210 is further configured to: when the number of tasks is the smallest and the remaining video memory capacity meets the required video memory capacity of the target virtual GPU, there are multiple physical GPUs. Next, the physical GPU arranged at the forefront among the physical GPUs with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU.
  • the processing unit 1210 is further configured to: update the second resource state table based on the physical GPU allocated to the target virtual GPU; or, when the task processing state changes In this case, the second resource status table is updated based on the change in the task processing status.
  • the processing unit 1210 is further configured to perform task scheduling based on the task queue of each physical GPU in the multiple physical GPUs.
  • the embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for use in the computer, and the computer program causes a computer to execute part or all of the steps of any method as described in the above method embodiment, and the above computer includes Electronic equipment.
  • the embodiments of the present application also provide a computer program product.
  • the above-mentioned computer program product includes a non-transitory computer-readable storage medium storing a computer program.
  • the above-mentioned computer program is operable to cause a computer to execute any of the methods described in the above-mentioned method embodiments. Part or all of the steps of the method.
  • the computer program product may be a software installation package, and the above-mentioned computer includes electronic equipment.
  • the disclosed device may be implemented in other ways.
  • the device embodiments described above are only illustrative, for example, the division of the above-mentioned units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or integrated. To another system, or some features can be ignored, or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical or other forms.
  • the units described above as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable memory.
  • the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory.
  • a number of instructions are included to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the foregoing methods of the various embodiments of the present application.
  • the aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
  • the program can be stored in a computer-readable memory, and the memory can include: a flash disk , Read-only memory, random access memory, magnetic or optical disk, etc.

Abstract

A resource management allocation method and apparatus, an electronic device, and a storage medium. The method comprises: reading a configuration file, wherein the configuration file comprises a configuration parameter of a virtual GPU of a visitor device (201); generating, on the basis of the configuration file, at least one available virtual GPU of the visitor device (202); and in response to receiving a task to be processed of a target customer, allocating a physical GPU for a target virtual GPU corresponding to the task to be processed, wherein the at least one available virtual GPU comprises the target virtual GPU (203).

Description

资源管理方法和装置、电子设备及存储介质Resource management method and device, electronic equipment and storage medium 技术领域Technical field
本申请涉及计算机技术领域,具体涉及一种资源管理方法和装置、电子设备及存储介质。This application relates to the field of computer technology, in particular to a resource management method and device, electronic equipment and storage medium.
背景技术Background technique
随着图像处理单元(Graphics Processing Unit,GPU)在科学计算、大数据、金融等领域的广泛应用,大量小规模轻负载的计算任务使得GPU资源面临着计算负载低、使用频次高的挑战。一方面单一小规模应用任务难以充分发挥GPU的计算性能优势,另一方面大量小任务增加了GPU集群的功耗,并降低了整体的资源利用率。With the widespread application of graphics processing units (GPUs) in scientific computing, big data, finance and other fields, a large number of small-scale and light-load computing tasks make GPU resources face the challenges of low computing load and high frequency of use. On the one hand, it is difficult for a single small-scale application task to give full play to the computing performance advantages of the GPU. On the other hand, a large number of small tasks increase the power consumption of the GPU cluster and reduce the overall resource utilization.
为了解决上述问题,业界提出了GPU虚拟化技术。即将每个物理GPU资源划分为多个细粒度虚拟GPU计算资源,使得小任务可以直接使用虚拟GPU进行处理,以提高应用的并行度以及GPU集群的资源利用效率。In order to solve the above problems, the industry has proposed GPU virtualization technology. That is, each physical GPU resource is divided into multiple fine-grained virtual GPU computing resources, so that small tasks can be directly processed using the virtual GPU to improve the parallelism of applications and the resource utilization efficiency of GPU clusters.
发明内容Summary of the invention
本申请实施例提供了一种资源管理分配方法和装置、电子设备及存储介质。The embodiments of the present application provide a resource management and allocation method and device, electronic equipment, and storage medium.
本申请实施例第一方面提供一种资源管理分配方法,包括:读取配置文件,所述配置文件包括访客设备的虚拟图像处理单元GPU配置参数;基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU;响应于接收到目标用户的待处理任务,为所述待处理任务对应的目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU。The first aspect of the embodiments of the present application provides a resource management allocation method, including: reading a configuration file, the configuration file including the virtual image processing unit GPU configuration parameters of the guest device; based on the configuration file, generating the guest device At least one available virtual GPU; in response to receiving a task to be processed by a target user, a physical GPU is allocated to a target virtual GPU corresponding to the task to be processed, and the at least one available virtual GPU includes the target virtual GPU.
在一种可选的实施方式中,所述为所述待处理任务对应的目标虚拟GPU分配物理GPU,包括:基于所述目标虚拟GPU所需的显存容量以及资源状态表,为所述目标虚拟GPU分配物理GPU,其中,所述资源状态表包括多个物理GPU中每个物理GPU的当前状态信息。In an optional implementation manner, the allocating a physical GPU to the target virtual GPU corresponding to the task to be processed includes: setting the target virtual GPU to the target virtual GPU based on the memory capacity required by the target virtual GPU and a resource state table. The GPU allocates physical GPUs, where the resource state table includes current state information of each of the multiple physical GPUs.
在一种可选的实施方式中,所述物理GPU的当前状态信息包括:所述物理GPU的显存容量、与所述物理GPU已经被占用的显存对应的每个虚拟GPU的用户信息、与所述物理GPU已经被占用的显存对应的每个虚拟GPU的显存容量。In an optional implementation manner, the current state information of the physical GPU includes: the video memory capacity of the physical GPU, user information of each virtual GPU corresponding to the video memory already occupied by the physical GPU, and The video memory capacity of each virtual GPU corresponding to the video memory already occupied by the physical GPU.
在一种可选的实施方式中,所述基于所述目标虚拟GPU的所需显存容量以及资源状态表,为所述目标虚拟GPU分配物理GPU,包括:基于所述目标虚拟GPU的所需显存容量和所述资源状态表,为所述目标虚拟GPU分配物理GPU,以使得所述多个物理GPU的显存被使用最少。In an optional implementation manner, the allocating a physical GPU to the target virtual GPU based on the required video memory capacity and the resource state table of the target virtual GPU includes: based on the required video memory of the target virtual GPU The capacity and the resource state table allocate physical GPUs to the target virtual GPU, so that the video memory of the multiple physical GPUs is used to a minimum.
在一种可选的实施方式中,所述基于所述目标虚拟GPU所需显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU,包括:基于所述资源状态表,按照多个物理GPU的排列顺序,依次确定每个物理GPU的剩余显存容量,直到确定的剩余显存容量满足所述目标虚拟GPU的所需显存容量;将剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。In an optional implementation manner, the allocating a physical GPU to the target virtual GPU based on the required video memory capacity and the resource state table of the target virtual GPU includes: based on the resource state table, according to multiple physical The order of GPU arrangement is to determine the remaining video memory capacity of each physical GPU in turn until the determined remaining video memory capacity meets the required video memory capacity of the target virtual GPU; the remaining video memory capacity meets the required video memory capacity of the target virtual GPU The physical GPU determines the physical GPU allocated to the target virtual GPU.
在一种可选的实施方式中,所述方法还包括:在确定所述多个物理GPU中排在最后的物理GPU的剩余显存容量不满足所述目标虚拟GPU的所需显存容量的情况下,确定所述虚拟GPU无可用物 理资源。In an optional implementation manner, the method further includes: when it is determined that the remaining video memory capacity of the physical GPU ranked last among the multiple physical GPUs does not meet the required video memory capacity of the target virtual GPU , It is determined that the virtual GPU has no available physical resources.
在一种可选的实施方式中,所述基于所述目标虚拟GPU的显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU,包括:基于所述目标虚拟GPU的所需显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU,以使得所述目标用户的至少一个任务被尽可能均匀地分配给所述多个物理GPU,其中,所述至少一个任务包括所述待处理任务。In an optional implementation manner, the allocating a physical GPU to the target virtual GPU based on the display memory capacity and resource state table of the target virtual GPU includes: based on the required display memory capacity of the target virtual GPU and A resource state table, which allocates physical GPUs to the target virtual GPU, so that at least one task of the target user is allocated to the multiple physical GPUs as evenly as possible, wherein the at least one task includes the to-be-processed task.
在一种可选的实施方式中,所述基于所述目标虚拟GPU的显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU,包括:基于所述资源状态表,确定所述目标用户当前在所述多个物理GPU中每个物理GPU分配的任务数量,以及每个物理GPU的剩余显存容量;将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。In an optional implementation manner, the allocating a physical GPU to the target virtual GPU based on the memory capacity and resource state table of the target virtual GPU includes: determining the target user based on the resource state table The number of tasks currently allocated by each physical GPU in the plurality of physical GPUs, and the remaining video memory capacity of each physical GPU; the number of tasks is minimized and the remaining video memory capacity meets the required video memory capacity of the target virtual GPU The physical GPU determines the physical GPU allocated to the target virtual GPU.
在一种可选的实施方式中,所述方法还包括:在所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU的数量为多个的情况下,将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的多个物理GPU中排列在最前面的物理GPU确定为所述目标虚拟GPU分配的物理GPU。In an optional implementation manner, the method further includes: when the number of tasks is the smallest and the remaining video memory capacity meets the required video memory capacity of the target virtual GPU, the number of physical GPUs is multiple, The foremost physical GPU among the multiple physical GPUs with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated to the target virtual GPU.
在一种可选的实施方式中,所述方法还包括:基于为所述目标虚拟GPU所分配的物理GPU,更新所述资源状态表;或者,在任务处理状态发生变化的情况下,基于所述任务处理状态的变化更新所述资源状态表。In an optional implementation manner, the method further includes: updating the resource state table based on the physical GPU allocated to the target virtual GPU; or, in the case that the task processing state changes, based on the The resource status table is updated with the change of the task processing status.
第二方面,本申请实施例提供一种资源管理分配方法,应用于访客设备,包括:读取主机的配置文件,其中,所述配置文件包括所述访客设备的虚拟GPU配置参数;基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU;在接收到目标用户的待处理任务的情况下,基于所述待处理任务对应的目标虚拟GPU向主机发送资源分配请求,其中,所述资源分配请求用于请求所述主机为所述目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU。In a second aspect, an embodiment of the present application provides a resource management allocation method applied to a guest device, including: reading a configuration file of a host, where the configuration file includes virtual GPU configuration parameters of the guest device; based on the A configuration file to generate at least one available virtual GPU of the guest device; in the case of receiving a task to be processed by a target user, send a resource allocation request to the host based on the target virtual GPU corresponding to the task to be processed, wherein the The resource allocation request is used to request the host to allocate a physical GPU to the target virtual GPU, and the at least one available virtual GPU includes the target virtual GPU.
在一种可选的实施方式中,在所述基于所述待处理任务对应的目标虚拟GPU向主机发送资源分配请求之前,所述方法还包括:基于第一资源状态表,确定所述访客设备的至少一个可用虚拟GPU中处于空闲状态的虚拟GPU,其中,所述第一资源状态表包括多个物理GPU中每个物理GPU的当前状态信息;从所述处于空闲状态的虚拟GPU中确定所述目标虚拟GPU。In an optional implementation manner, before the target virtual GPU corresponding to the task to be processed sends a resource allocation request to the host, the method further includes: determining the guest device based on the first resource status table At least one of the available virtual GPUs in the idle state, wherein the first resource state table includes current state information of each of the multiple physical GPUs; determining all the virtual GPUs in the idle state from the virtual GPUs in the idle state. The target virtual GPU.
在一种可选的实施方式中,所述方法还包括:接收来自于所述主机的关于所述第一资源状态表的第一更新指令,所述第一更新指令是在所述主机检测到物理GPU的任务处理状态发生变化的情况下发送的;基于所述第一更新指令,更新所述第一资源状态表。In an optional implementation manner, the method further includes: receiving a first update instruction regarding the first resource status table from the host, where the first update instruction is detected on the host Sent when the task processing state of the physical GPU changes; based on the first update instruction, the first resource state table is updated.
在一种可选的实施方式中,所述至少一个物理GPU包括具有新加入的任务的第一物理GPU,所述第一更新指令携带下列信息中的至少一项:所述第一物理GPU的新加入的任务对应的用户信息、所述第一物理GPU的信息,所述新加入的任务对应的虚拟GPU的显存容量;和/或所述至少一个物理GPU包括具有新完成的任务的第二物理GPU,所述第一更新指令携带下列中的至少一项:所述新完成任务对应的用户信息,以及所述第二物理GPU的信息。In an optional implementation manner, the at least one physical GPU includes a first physical GPU with a newly added task, and the first update instruction carries at least one of the following information: The user information corresponding to the newly added task, the information of the first physical GPU, the video memory capacity of the virtual GPU corresponding to the newly added task; and/or the at least one physical GPU includes the second with the newly completed task For a physical GPU, the first update instruction carries at least one of the following: user information corresponding to the newly completed task, and information of the second physical GPU.
在一种可选的实施方式中,所述方法还包括:调度所述虚拟GPU执行所述待处理任务;接收来自所述主机的所述待处理任务的处理结果。In an optional implementation manner, the method further includes: scheduling the virtual GPU to execute the task to be processed; and receiving a processing result of the task to be processed from the host.
第三方面,本申请实施例提供一种资源管理分配方法,应用于主机,包括:接收来自访客设备 的资源分配请求,所述资源分配请求携带待处理任务的信息以及目标虚拟GPU的信息;基于所述目标虚拟GPU的信息,为所述目标虚拟GPU分配目标物理GPU。In a third aspect, an embodiment of the present application provides a resource management allocation method, applied to a host, including: receiving a resource allocation request from a guest device, the resource allocation request carrying information of the task to be processed and information of the target virtual GPU; The information of the target virtual GPU allocates a target physical GPU to the target virtual GPU.
在一种可选的实施方式中,所述基于所述目标虚拟GPU的信息,为所述目标虚拟GPU分配目标物理GPU,包括:基于所述目标虚拟GPU的所需显存容量,为所述目标虚拟GPU分配物理GPU。In an optional implementation manner, the allocating a target physical GPU to the target virtual GPU based on the information of the target virtual GPU includes: setting the target physical GPU to the target virtual GPU based on the required video memory capacity of the target virtual GPU. Virtual GPU allocates physical GPU.
在一种可选的实施方式中,所述基于所述目标虚拟GPU的显存容量为所述目标虚拟GPU分配物理GPU,包括:基于所述目标虚拟GPU的所需显存容量、资源分配策略以及第二资源状态表为所述目标虚拟GPU分配物理GPU,其中,所述第二资源状态表包括多个物理GPU中每个物理GPU的当前状态信息。In an optional implementation manner, the allocating a physical GPU to the target virtual GPU based on the video memory capacity of the target virtual GPU includes: based on the required video memory capacity of the target virtual GPU, a resource allocation strategy, and a second The second resource state table allocates physical GPUs to the target virtual GPU, where the second resource state table includes current state information of each of the multiple physical GPUs.
在一种可选的实施方式中,所述基于所述目标虚拟GPU的显存容量、所述资源分配策略以及第二资源状态表为所述目标虚拟GPU分配物理GPU,包括:基于所述第二资源状态表,按照所述多个物理GPU的排列顺序,依次确定每个物理GPU的剩余显存容量,直到确定的剩余显存容量满足所述目标虚拟GPU的所需显存容量;将剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。In an optional implementation manner, the allocating a physical GPU to the target virtual GPU based on the memory capacity of the target virtual GPU, the resource allocation strategy, and the second resource state table includes: based on the second The resource state table, according to the arrangement order of the multiple physical GPUs, sequentially determines the remaining video memory capacity of each physical GPU until the determined remaining video memory capacity meets the required video memory capacity of the target virtual GPU; and the remaining video memory capacity meets all requirements. The physical GPU of the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated to the target virtual GPU.
在一种可选的实施方式中,在确定所述多个物理GPU中排在最后的物理GPU的剩余显存容量不满足所述目标虚拟GPU的所需显存容量的情况下,确定所述虚拟GPU无可用物理资源。In an optional implementation manner, in a case where it is determined that the remaining video memory capacity of the last physical GPU among the multiple physical GPUs does not meet the required video memory capacity of the target virtual GPU, the virtual GPU is determined No physical resources are available.
在一种可选的实施方式中,所述基于所述目标虚拟GPU的显存容量、所述资源分配策略以及第二资源状态表为所述目标虚拟GPU分配物理GPU,包括:基于所述第二资源状态表,确定目标用户当前在多个物理GPU中每个物理GPU已经分配的任务数量,以及每个物理GPU的剩余显存容量,其中,所述目标用户为所述目标虚拟GPU对应的用户;将所述任务数量最少且剩余显存满足容量所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU的物理GPU。In an optional implementation manner, the allocating a physical GPU to the target virtual GPU based on the memory capacity of the target virtual GPU, the resource allocation strategy, and the second resource state table includes: based on the second The resource status table determines the number of tasks currently allocated by each physical GPU of the multiple physical GPUs by the target user, and the remaining video memory capacity of each physical GPU, where the target user is a user corresponding to the target virtual GPU; The physical GPU with the smallest number of tasks and the remaining video memory meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU of the target virtual GPU.
在一种可选的实施方式中,所述方法还包括:在所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU的数量为多个的情况下,将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU中排列在最前面的物理GPU确定为所述目标虚拟GPU分配的物理GPU。In an optional implementation manner, the method further includes: when the number of tasks is the smallest and the remaining video memory capacity meets the required video memory capacity of the target virtual GPU, the number of physical GPUs is multiple, The foremost physical GPU among the physical GPUs with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated to the target virtual GPU.
在一种可选的实施方式中,所述方法还包括:基于为所述目标虚拟GPU所分配的物理GPU,更新所述第二资源状态表;或者,在任务处理状态发生变化的情况下,基于所述任务处理状态的变化更新所述第二资源状态表。In an optional implementation manner, the method further includes: updating the second resource state table based on the physical GPU allocated to the target virtual GPU; or, when the task processing state changes, The second resource status table is updated based on the change in the task processing status.
在一种可选的实施方式中,所述方法还包括:基于多个物理GPU中每个物理GPU的任务队列,进行任务调度。In an optional implementation manner, the method further includes: performing task scheduling based on the task queue of each physical GPU in the plurality of physical GPUs.
第四方面,本申请实施例提供一种资源管理系统,包括:主机和访客设备,其中,所述主机上设置有多个物理GPU,所述访客设备包括虚拟机或容器;所述访客设备用于:读取配置文件,所述配置文件包括所述访客设备的虚拟图像处理单元GPU配置参数;基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU;在接收到目标用户的待处理任务的情况下,基于所述待处理任务对应的目标虚拟GPU向所述主机发送资源分配请求,其中,所述资源分配请求用于请求所述主机为所述目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU;所述主机用于:接收来所述自访客设备的资源分配请求,所述资源分配请求携带所述待处理任务的信息以及所述目标虚拟GPU的信息;基于所述目标虚拟GPU的信息,为所述目标虚拟GPU分配目标物理GPU。In a fourth aspect, an embodiment of the present application provides a resource management system, including: a host and a guest device, wherein a plurality of physical GPUs are provided on the host, the guest device includes a virtual machine or a container; the guest device uses Yu: Read a configuration file, the configuration file including the virtual image processing unit GPU configuration parameters of the guest device; generate at least one available virtual GPU of the guest device based on the configuration file; In the case of processing tasks, a resource allocation request is sent to the host based on the target virtual GPU corresponding to the task to be processed, where the resource allocation request is used to request the host to allocate a physical GPU to the target virtual GPU, and The at least one available virtual GPU includes the target virtual GPU; the host is configured to: receive a resource allocation request from the guest device, the resource allocation request carrying information about the task to be processed and the target virtual GPU的信息; Based on the information of the target virtual GPU, assign a target physical GPU to the target virtual GPU.
第五方面,本申请实施例提供一种资源管理装置,包括通信单元和处理单元,其中,所述处理单元用于:通过所述通信单元获取配置文件;读取所述配置文件,所述配置文件包括访客设备的虚拟图像处理单元GPU配置参数;基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU;以及响应于接收到目标用户的待处理任务,为所述待处理任务对应的目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU。In a fifth aspect, an embodiment of the present application provides a resource management device, including a communication unit and a processing unit, wherein the processing unit is configured to: obtain a configuration file through the communication unit; read the configuration file, the configuration The file includes the virtual image processing unit GPU configuration parameters of the guest device; based on the configuration file, at least one available virtual GPU of the guest device is generated; and in response to receiving the task to be processed by the target user, corresponding to the task to be processed A physical GPU is allocated to the target virtual GPU of the target virtual GPU, and the at least one available virtual GPU includes the target virtual GPU.
第六方面,本申请实施例提供一种资源管理装置,包括通信单元和处理单元,其中,所述处理单元用于:通过所述通信单元获取主机配置文件;读取所述主机配置文件,其中,所述配置文件包括访客设备的虚拟GPU配置参数;基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU;以及在接收到目标用户的待处理任务的情况下,通过所述通信单元基于所述待处理任务对应的目标虚拟GPU向所述主机发送资源分配请求,其中,所述资源分配请求用于请求所述主机为所述目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU。In a sixth aspect, an embodiment of the present application provides a resource management device, including a communication unit and a processing unit, wherein the processing unit is configured to: obtain a host configuration file through the communication unit; read the host configuration file, wherein The configuration file includes virtual GPU configuration parameters of the guest device; based on the configuration file, at least one available virtual GPU of the guest device is generated; and in the case of receiving a task to be processed by the target user, through the communication The unit sends a resource allocation request to the host based on the target virtual GPU corresponding to the task to be processed, wherein the resource allocation request is used to request the host to allocate a physical GPU to the target virtual GPU, and the at least one available virtual GPU The GPU includes the target virtual GPU.
第七方面,本申请实施例提供一种资源管理装置,包括通信单元和处理单元,其中,所述处理单元用于:通过所述通信单元接收来自访客设备的资源分配请求,所述资源分配请求携带待处理任务的信息以及目标虚拟GPU的信息;以及基于所述目标虚拟GPU的信息,为所述目标虚拟GPU分配目标物理GPU。In a seventh aspect, an embodiment of the present application provides a resource management device, including a communication unit and a processing unit, wherein the processing unit is configured to: receive a resource allocation request from a guest device through the communication unit, the resource allocation request Carry the information of the task to be processed and the information of the target virtual GPU; and based on the information of the target virtual GPU, allocate a target physical GPU to the target virtual GPU.
第八方面,本申请实施例提供一种资源管理系统,包括主机和访客设备,其中,所述主机上设置有多个物理GPU;所述访客设备为本申请实施例第六方面任一项的装置;所述主机为本申请实施例第七方面任一项的装置。In an eighth aspect, an embodiment of the present application provides a resource management system, including a host and a guest device, wherein the host is provided with multiple physical GPUs; the guest device is a device of any one of the sixth aspect of the embodiments of the present application Device; the host is a device according to any one of the seventh aspects of the embodiments of this application.
在第九方面,本申请实施例提供一种电子设备,包括处理器以及存储器,所述存储器用于存储计算机程序,所述计算机程序被配置由上述处理器执行,以使所述处理器执行本申请实施例第一方面、第二方面或第三方面中所述的任一方法。In a ninth aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, where the memory is used to store a computer program, and the computer program is configured to be executed by the above-mentioned processor so that the processor executes the present invention. Any method described in the first aspect, the second aspect, or the third aspect of the application embodiment.
第十方面,本申请实施例提供了一种计算机可读存储介质,其中,上述计算机可读存储介质用于存储计算机程序,其中,上述计算机程序使得计算机执行如本申请实施例第一方面、第二方面或第三方面中所述的任一方法。In a tenth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the above-mentioned computer-readable storage medium is used to store a computer program, wherein the above-mentioned computer program enables a computer to execute operations as described in the first aspect and the first aspect of the embodiments of the present application. Any method described in the second or third aspect.
第十一方面,本申请实施例提供了一种计算机程序产品,其中,上述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,上述计算机程序可操作来使计算机执行如本申请实施例第一方面、第二方面或第三方面中所述的任一方法。该计算机程序产品可以为一个软件安装包。In an eleventh aspect, an embodiment of the present application provides a computer program product, wherein the above-mentioned computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the above-mentioned computer program is operable to cause a computer to execute operations as described in this application. Embodiments any one of the methods described in the first aspect, the second aspect, or the third aspect. The computer program product may be a software installation package.
本申请实施例首先读取配置文件,其中,所述配置文件包括访客设备的虚拟GPU的配置参数,然后基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU,在接收到目标客户的待处理任务的情况下,为所述待处理任务对应的目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU。在本申请实施例中,不为虚拟GPU和物理GPU预先建立固定的映射关系,而是在虚拟GPU接收到待处理任务后,动态的为虚拟GPU分配对应的物理GPU,可以灵活的基于当前任务的特点来对物理GPU资源进行管理分配,以提升物理GPU的资源利用率,并提高系统的整体性能。The embodiment of the application first reads the configuration file, where the configuration file includes the configuration parameters of the virtual GPU of the guest device, and then based on the configuration file, generates at least one available virtual GPU of the guest device, and after receiving the target customer In the case of a task to be processed, a physical GPU is allocated to a target virtual GPU corresponding to the task to be processed, and the at least one available virtual GPU includes the target virtual GPU. In the embodiment of the present application, a fixed mapping relationship is not established for the virtual GPU and the physical GPU in advance, but after the virtual GPU receives the task to be processed, the virtual GPU is dynamically assigned the corresponding physical GPU, which can be flexibly based on the current task The characteristics of the physical GPU resources are managed and allocated to improve the resource utilization of the physical GPU and improve the overall performance of the system.
附图说明Description of the drawings
此处的附图被并入说明书中并构成本说明书的一部分,这些附图示出了符合本公开的实施例, 并与说明书一起用于说明本公开的技术方案。The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments that conform to the present disclosure, and are used together with the specification to explain the technical solutions of the present disclosure.
图1是本申请实施例提供的一种资源管理系统示意图。Fig. 1 is a schematic diagram of a resource management system provided by an embodiment of the present application.
图2是本申请实施例公开的一种资源管理分配方法的流程示意图。Fig. 2 is a schematic flowchart of a resource management and allocation method disclosed in an embodiment of the present application.
图3是本申请实施例提供的一种资源最少管理分配策略的架构图。FIG. 3 is an architecture diagram of a minimum resource management allocation strategy provided by an embodiment of the present application.
图4是本申请实施例提供的一种负载均衡分配策略的架构图。Fig. 4 is a structural diagram of a load balancing distribution strategy provided by an embodiment of the present application.
图5是本申请另一实施例公开的一种资源管理分配方法的流程示意图。Fig. 5 is a schematic flowchart of a method for resource management and allocation disclosed in another embodiment of the present application.
图6是本申请又一实施例公开的一种资源管理分配方法的流程示意图。Fig. 6 is a schematic flowchart of a method for resource management and allocation disclosed in another embodiment of the present application.
图7是本申请实施例提供的一种电子设备的结构示意图。FIG. 7 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
图8是本申请另一实施例提供的一种电子设备的结构示意图。FIG. 8 is a schematic structural diagram of an electronic device provided by another embodiment of the present application.
图9是本申请又一实施例提供的一种电子设备的结构示意图。FIG. 9 is a schematic structural diagram of an electronic device according to another embodiment of the present application.
图10是本申请实施例中所涉及的一种资源管理装置的功能单元组成框图。FIG. 10 is a block diagram of the functional unit composition of a resource management device involved in an embodiment of the present application.
图11是本申请另一实施例中所涉及的一种资源管理装置的功能单元组成框图。Fig. 11 is a block diagram of functional units of a resource management device involved in another embodiment of the present application.
图12是本申请又一实施例中所涉及的一种资源管理装置的功能单元组成框图。Fig. 12 is a block diagram of functional units of a resource management device involved in another embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
本申请中的术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中术语“至少一种”表示多种中的任意一种或多种中的至少两种的任意组合,例如,包括A、B、C中的至少一种,可以表示包括从A、B和C构成的集合中选择的任意一个或多个元素。本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其他步骤或单元。The term "and/or" in this application is only an association relationship describing the associated objects, indicating that there can be three types of relationships, for example, A and/or B, which can mean that A alone exists, and A and B exist at the same time. There are three cases of B alone. In addition, the term "at least one" in this document means any one or any combination of at least two of the multiple, for example, including at least one of A, B, and C, may mean including A, Any one or more elements selected in the set formed by B and C. The terms "first" and "second" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific sequence. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes unlisted steps or units, or optionally also includes Other steps or units inherent to these processes, methods, products or equipment.
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。Reference to "embodiments" herein means that a specific feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art clearly and implicitly understand that the embodiments described herein can be combined with other embodiments.
本申请实施例所涉及到的资源管理分配装置是可以进行资源管理分配的装置,可以为电子设备,上述电子设备包括终端设备,具体实现中,上述终端设备包括但不限于诸如具有触摸敏感表面(例如,触摸屏显示器和/或触摸板)的移动电话、膝上型计算机或平板计算机之类的其它便携式设备。还应当理解的是,在某些实施例中,所述设备并非便携式通信设备,而是具有触摸敏感表面(例如,触摸屏显示器和/或触摸板)的台式计算机、服务器等。The resource management and allocation device involved in the embodiments of the present application is a device that can perform resource management and allocation, and may be an electronic device. The above-mentioned electronic device includes a terminal device. In a specific implementation, the above-mentioned terminal device includes, but is not limited to, a touch-sensitive surface ( For example, touch screen displays and/or touch pads) mobile phones, laptop computers or other portable devices such as tablet computers. It should also be understood that, in some embodiments, the device is not a portable communication device, but a desktop computer, server, etc. having a touch-sensitive surface (eg, touch screen display and/or touch pad).
图1为本申请实施例提供的一种资源管理系统示意图。其中,GPU虚拟化方案涉及访客设备 (Guest)101和主机(Host)102。主机102指拥有物理GPU(pGPU)140的设备的物理机节点,用户可以直接在主机执行GPU任务,此外主机还包含一个服务守护进程,该进程负责启动物理GPU以及与访客设备进行数据解析转发等通信操作。访客设备101是指可以使用虚拟化GPU的虚拟机或容器,访客设备101没有任何GPU设备,不能直接执行GPU任务,访客设备101包含用于GPU虚拟化的进程,该进程负责封装的GPU动态链接库和数据转发,使得访客设备101上的任务可以透明地使用主机的物理GPU进行操作。Fig. 1 is a schematic diagram of a resource management system provided by an embodiment of the application. Among them, the GPU virtualization solution involves a guest device (Guest) 101 and a host (Host) 102. The host 102 refers to a physical machine node of a device with a physical GPU (pGPU) 140. The user can directly perform GPU tasks on the host. In addition, the host also contains a service daemon, which is responsible for starting the physical GPU and parsing and forwarding data with guest devices, etc. Communication operation. The guest device 101 refers to a virtual machine or container that can use a virtualized GPU. The guest device 101 does not have any GPU device and cannot directly perform GPU tasks. The guest device 101 contains a process for GPU virtualization, which is responsible for the dynamic linking of the encapsulated GPU The library and data forwarding enable tasks on the guest device 101 to transparently use the physical GPU of the host to perform operations.
在本申请实施例提供的资源管理系统中,Guest的虚拟GPU(vGPU)资源管理策略可选如下:Guest的虚拟GPU资源管理策略分为按配置选项虚拟展示与按任务启动实际分配两个阶段,其中,Guest可以为虚拟机。如图1所示,其主要的分配过程为:首先,启动访客设备的虚拟机(Virtual Machine,VM),其中,可以有多个虚拟机,如110-1,110-n等。通过读取配置文件Config 121,获取当前VM上的虚拟GPU相关参数,包括虚拟GPU个数、每个虚拟GPU的显存容量、每个虚拟GPU的使用时长、每个虚拟GPU时间片大小等;然后在VM的虚拟GPU访客设备上生成虚拟的虚拟GPU镜像122,此时的虚拟GPU并未与物理GPU进行映射,只有软件层面虚拟分配给用户观察的虚拟GPU信息;当VM上的用户开始执行使用GPU资源的任务123时,虚拟机会发出初始化GPU信息的请求,此时VM会与Host建立连接,并通过虚拟GPU-物理GPU资源分配策略130建立虚拟GPU 124与物理GPU 140的实际关联。其中,一个虚拟GPU 124可以与一个物理GPU进行关联,也可以与多个物理GPU进行关联。Host 102向VM返回物理GPU 140的信息,例如GPU的地址ID、物理GPU的设备型号、物理GPU的剩余显存容量、申请使用物理GPU的起始时间等参数,虚拟GPU更新上述信息并按照配置的参数调用GPU虚拟化的进程向Host转发任务123的数据。Host的服务守护进程根据转发的数据,启动关联的物理GPU并处理任务123,在任务处理结束后,将任务处理结果发回VM。需要注意的是,虽然VM上的用户看起来,任务123是在VM上的虚拟GPU 124完成的,但是实际上,任务123是在主机的物理GPU 140上完成的。In the resource management system provided by the embodiment of the present application, the guest's virtual GPU (vGPU) resource management strategy can be selected as follows: the guest's virtual GPU resource management strategy is divided into two stages: virtual display according to configuration options and actual allocation according to task start. Among them, Guest can be a virtual machine. As shown in Figure 1, the main allocation process is as follows: First, start the virtual machine (VM) of the guest device, where there may be multiple virtual machines, such as 110-1, 110-n, and so on. By reading the configuration file Config 121, obtain the virtual GPU related parameters on the current VM, including the number of virtual GPUs, the video memory capacity of each virtual GPU, the use time of each virtual GPU, the size of each virtual GPU time slice, etc.; A virtual virtual GPU image 122 is generated on the virtual GPU guest device of the VM. At this time, the virtual GPU is not mapped with the physical GPU, and only the virtual GPU information is allocated to the user to observe at the software level; when the user on the VM starts to use When task 123 of the GPU resource occurs, the virtual machine sends a request to initialize GPU information. At this time, the VM establishes a connection with the Host, and establishes the actual association between the virtual GPU 124 and the physical GPU 140 through the virtual GPU-physical GPU resource allocation strategy 130. Among them, one virtual GPU 124 may be associated with one physical GPU, or may be associated with multiple physical GPUs. Host 102 returns the information of the physical GPU 140 to the VM, such as the address ID of the GPU, the device model of the physical GPU, the remaining video memory capacity of the physical GPU, the start time of applying for the use of the physical GPU, and other parameters. The virtual GPU updates the above information and follows the configuration The parameter calls the GPU virtualization process to forward the data of task 123 to the Host. The host's service daemon starts the associated physical GPU and processes task 123 according to the forwarded data, and sends the task processing result back to the VM after the task processing is completed. It should be noted that although the user on the VM looks like the task 123 is completed on the virtual GPU 124 on the VM, in fact, the task 123 is completed on the physical GPU 140 of the host.
可以理解的是,上述Guest和Host可以是设置在同一设备上的;例如,在主机上的物理GPU和安装在该主机上的访客设备,也可以是设置在不同设备上的。例如安装在用户设备上的访客设备和设置在网络中的各个物理GPU节点设备。It is understandable that the aforementioned Guest and Host may be set on the same device; for example, the physical GPU on the host and the guest device installed on the host may also be set on different devices. For example, guest devices installed on user equipment and various physical GPU node devices installed on the network.
图2是本申请实施例公开的一种资源管理分配方法的流程示意图,如图2所示,该资源管理分配方法包括如下步骤。FIG. 2 is a schematic flowchart of a resource management and allocation method disclosed in an embodiment of the present application. As shown in FIG. 2, the resource management and allocation method includes the following steps.
201:读取配置文件,所述配置文件包括访客设备的虚拟GPU配置参数。201: Read a configuration file, where the configuration file includes virtual GPU configuration parameters of the guest device.
其中,所述配置文件包括当前访客设备上的虚拟GPU相关参数,虚拟GPU相关参数可以包括但不限于虚拟GPU个数、每个虚拟GPU的显存容量、每个虚拟GPU的使用时长、每个虚拟GPU时间片大小等中的一个或多个。Wherein, the configuration file includes virtual GPU-related parameters on the current guest device. The virtual GPU-related parameters may include, but are not limited to, the number of virtual GPUs, the memory capacity of each virtual GPU, the use time of each virtual GPU, and each virtual GPU. One or more of GPU time slice size, etc.
可选的,所述配置文件可以是系统默认的,也可以是根据用户的需求生成的。Optionally, the configuration file may be system default, or may be generated according to user requirements.
202:基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU。202: Based on the configuration file, generate at least one available virtual GPU of the guest device.
在本申请实施例中,当读取到上述配置文件后,访客设备可以根据基于所述配置文件生成所述访客设备的至少一个可用虚拟GPU,上述虚拟GPU是软件层面用于呈现给用户的观看的虚拟的GPU,例如,在生成上述至少一个可用虚拟GPU之后,用户可以通过用户设备观看访客设备上虚拟GPU的数量,以及每个虚拟GPU的显存容量、每个虚拟GPU的使用时长、每个虚拟GPU时间片大小等 参数。此时的虚拟GPU并未与物理GPU进行映射。In the embodiment of the present application, after reading the above configuration file, the guest device may generate at least one available virtual GPU of the guest device based on the configuration file. The above virtual GPU is a software level used to present the viewing to the user. For example, after generating at least one of the above-mentioned available virtual GPUs, the user can view the number of virtual GPUs on the guest device through the user device, as well as the video memory capacity of each virtual GPU, the duration of each virtual GPU, and each Parameters such as virtual GPU time slice size. At this time, the virtual GPU is not mapped with the physical GPU.
203:响应于接收到目标用户的待处理任务,为所述待处理任务对应的目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU。203: In response to receiving the to-be-processed task of the target user, allocate a physical GPU to the target virtual GPU corresponding to the to-be-processed task, where the at least one available virtual GPU includes the target virtual GPU.
在本申请实施例中,当访客设备接收到待处理任务后,访客设备为上述待处理任务分配目标虚拟GPU以对所述待处理任务进行处理。然后根据上述目标虚拟GPU的具体信息为上述目标虚拟GPU分配物理GPU,即建立虚拟GPU与物理GPU映射关系。在为上述目标虚拟GPU分配物理GPU之后,则在上述目标虚拟GPU分配的物理GPU中处理上述待处理任务,并向访客设备反馈处理结果。也就是在主机被分配的物理GPU中处理上述待处理任务,并向访客设备反馈处理结果。In the embodiment of the present application, after the guest device receives the task to be processed, the guest device allocates a target virtual GPU for the task to be processed to process the task to be processed. Then, a physical GPU is allocated to the target virtual GPU according to the specific information of the target virtual GPU, that is, a mapping relationship between the virtual GPU and the physical GPU is established. After the physical GPU is allocated to the target virtual GPU, the task to be processed is processed in the physical GPU allocated by the target virtual GPU, and the processing result is fed back to the guest device. That is, the above-mentioned tasks to be processed are processed in the physical GPU allocated by the host, and the processing result is fed back to the guest device.
本申请实施例通过读取配置文件,其中,所述配置文件包括访客设备的虚拟GPU的参数,所述访客设备包括至少一个虚拟GPU;在接收到待处理任务的情况下,为所述待处理任务对应的目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU。在本申请实施例中,虚拟GPU和物理GPU在接收到任务之前没有建立映射关系,在接收到任务后,可以对虚拟GPU和物理图形虚拟单元建立映射关系。更进一步的,可以灵活的通过不同的资源分配策略来对GPU资源进行管理分配,以提升物理GPU的使用效率。The embodiment of the application reads a configuration file, where the configuration file includes the parameters of the virtual GPU of the guest device, and the guest device includes at least one virtual GPU; The target virtual GPU corresponding to the task is allocated a physical GPU, and the at least one available virtual GPU includes the target virtual GPU. In the embodiment of the present application, the virtual GPU and the physical GPU do not establish a mapping relationship before receiving the task. After the task is received, the mapping relationship may be established between the virtual GPU and the physical graphics virtual unit. Furthermore, it is possible to flexibly manage and allocate GPU resources through different resource allocation strategies, so as to improve the use efficiency of physical GPUs.
作为一种可选的实施方式,所述为所述待处理任务对应的目标虚拟GPU分配物理GPU,包括:基于所述目标虚拟GPU的所需的显存容量以及资源状态表,为所述目标虚拟GPU分配物理GPU,其中,所述资源状态表包括主机中的多个物理GPU中每个物理GPU的当前状态信息。As an optional implementation manner, the allocating a physical GPU to the target virtual GPU corresponding to the task to be processed includes: based on the required video memory capacity of the target virtual GPU and a resource state table, assigning a physical GPU to the target virtual GPU The GPU allocates physical GPUs, where the resource state table includes current state information of each of the multiple physical GPUs in the host.
其中,所述当前状态信息包括:上述多个物理GPU中,每个物理GPU的显存容量、每个物理GPU中与该物理GPU已经被占用的显存对应的每个虚拟GPU的用户信息、与每个物理GPU已经被占用的显存对应的每个虚拟GPU的显存容量。或者,可以根据所述当前状态信息推导出上述多个物理GPU中,每个物理GPU的显存容量、每个物理GPU中与该物理GPU已经被占用的显存对应的每个虚拟GPU的用户ID、与物理GPU已经被占用的显存对应的每个虚拟GPU的显存容量等信息。可选的,上述当前状态信息还可以包括每个物理GPU中与该物理GPU已经被占用的显存对应的每个虚拟GPU的任务标识。Wherein, the current state information includes: among the above-mentioned multiple physical GPUs, the video memory capacity of each physical GPU, the user information of each virtual GPU in each physical GPU corresponding to the video memory already occupied by the physical GPU, and the user information of each virtual GPU in each physical GPU. The video memory capacity of each virtual GPU corresponding to the video memory that has been occupied by a physical GPU. Or, according to the current state information, among the above-mentioned multiple physical GPUs, the video memory capacity of each physical GPU, the user ID of each virtual GPU in each physical GPU corresponding to the video memory already occupied by the physical GPU, Information such as the video memory capacity of each virtual GPU corresponding to the video memory already occupied by the physical GPU. Optionally, the foregoing current state information may further include a task identifier of each virtual GPU in each physical GPU corresponding to the video memory that the physical GPU has already occupied.
表1为本申请实施例提供的一种资源状态表的具体实施方式。其中,pGPU表示物理GPU,vGPU表示虚拟GPU,ID表示地址或标识。Table 1 is a specific implementation manner of a resource status table provided in an embodiment of the application. Among them, pGPU stands for physical GPU, vGPU stands for virtual GPU, and ID stands for address or identification.
表1资源状态表Table 1 Resource Status Table
Figure PCTCN2020093491-appb-000001
Figure PCTCN2020093491-appb-000001
在具体实现中,在接收到上述待处理任务并确定目标虚拟GPU之后,可以根据目标虚拟GPU的显存容量从上述资源状态表中确定满足执行所述待处理任务条件的物理GPU为目标虚拟GPU分配的物理GPU,例如可以将剩余显存大于上述目标虚拟GPU的显存的物理GPU确定为目标虚拟GPU分配的物理GPU。In a specific implementation, after receiving the above-mentioned task to be processed and determining the target virtual GPU, a physical GPU that satisfies the conditions for executing the task to be processed can be determined from the resource state table according to the memory capacity of the target virtual GPU as the target virtual GPU. For example, a physical GPU whose remaining video memory is greater than the video memory of the target virtual GPU may be determined as the physical GPU allocated by the target virtual GPU.
进一步的,所述基于所述目标虚拟GPU的所需显存容量以及资源状态表为所述目标虚拟GPU分配物理GPU,具体可以包括:基于所述目标虚拟GPU的显存容量、资源状态表以及资源分配策略为所述目标虚拟GPU分配物理GPU。Further, the allocating a physical GPU to the target virtual GPU based on the required video memory capacity and resource state table of the target virtual GPU may specifically include: based on the video memory capacity, resource state table, and resource allocation of the target virtual GPU The strategy allocates physical GPUs to the target virtual GPU.
其中,上述资源分配策略是指以达到某种效果制定的资源虚拟GPU与物理GPU之间的映射规则。例如,为了达到物理GPU使用最少而制定的最少资源分配策略,又例如,为了使得同一个用户的多个任务在各个物理GPU中分配均匀制定的负载均衡分配策略。作为示例,资源分配策略可以位于主机处,并且在访客设备存储了资源分配策略的部分映射关系。Among them, the aforementioned resource allocation strategy refers to a mapping rule between the virtual GPU and the physical GPU of the resource formulated to achieve a certain effect. For example, a minimum resource allocation strategy formulated in order to achieve the least use of physical GPUs, and another example, a load balancing allocation strategy formulated in order to make multiple tasks of the same user evenly distributed among the physical GPUs. As an example, the resource allocation strategy may be located at the host, and a partial mapping relationship of the resource allocation strategy is stored in the guest device.
作为一种可选的实施方式,所述基于所述目标虚拟GPU的显存容量、资源状态表以及资源分配策略为所述目标虚拟GPU分配物理GPU,包括:基于所述资源状态表,按照多个物理GPU的排列顺序,依次确定每个物理GPU的剩余显存容量,直到确定的剩余显存容量满足所述目标虚拟GPU的所需显存容量;将剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。若在确定所述多个物理GPU中排在最后的物理GPU的剩余显存容量不满足所述目标虚拟GPU的所需显存容量的情况下,也即,每个物理GPU的剩余显存都小于所述目标虚拟GPU的所需显存,确定所述虚拟GPU无可用物理资源。在本申请实施例中,可以将这种虚拟GPU与物理GPU的分配方式中的资源分配策略称为资源最少分配策略。As an optional implementation manner, the allocating a physical GPU to the target virtual GPU based on the target virtual GPU's video memory capacity, resource state table, and resource allocation strategy includes: based on the resource state table, according to multiple The sequence of physical GPUs is to determine the remaining video memory capacity of each physical GPU in turn until the determined remaining video memory capacity meets the required video memory capacity of the target virtual GPU; the remaining video memory capacity meets the required video memory capacity of the target virtual GPU The physical GPU of determines the physical GPU allocated to the target virtual GPU. If it is determined that the remaining video memory capacity of the last physical GPU among the multiple physical GPUs does not meet the required video memory capacity of the target virtual GPU, that is, the remaining video memory of each physical GPU is less than the The required video memory of the target virtual GPU, and it is determined that the virtual GPU has no available physical resources. In the embodiments of the present application, the resource allocation strategy in this allocation method of virtual GPU and physical GPU may be referred to as the least resource allocation strategy.
其中,上述多个物理GPU的排列顺序可以是按照物理GPU的ID编号顺序排列,也可以是多个物理GPU在上述资源状态表中的排列顺序,如表1中的pGPU1-pGPUn,表1中的物理GPU的排列顺序可以根据物理GPU的ID编号顺序进行排列,也可以根据物理GPU在主机中的位置信息进行排列,还可以根据物理GPU添加到主机中的时间先后进行排列,本申请对此不做限制。Among them, the arrangement order of the multiple physical GPUs can be arranged in the order of the ID numbers of the physical GPUs, or the arrangement order of the multiple physical GPUs in the resource state table, such as pGPU1-pGPUn in Table 1, and in Table 1. The arrangement order of the physical GPUs can be arranged according to the order of the ID numbers of the physical GPUs, or according to the location information of the physical GPUs in the host, or according to the time when the physical GPUs are added to the host. This application No restrictions.
在具体实现中,当确定上述待处理任务的目标虚拟GPU的显存容量后,按照资源状态表中物理GPU的排列顺序,首先获取第一个物理GPU的剩余显存容量,然后判断第一个物理GPU的剩余显存容量是否大于或等于目标虚拟GPU所需显存容量,若大于或等于目标虚拟GPU所需显存容量,则将第一个物理GPU确定为目标虚拟GPU分配的物理GPU;否则,获取第二个物理GPU的剩余显存容量,然后判断第二个物理GPU的剩余显存容量是否大于或等于目标虚拟GPU的所需显存容量,若大于或等于目标虚拟GPU所需显存容量,则将第二个物理GPU确定为目标虚拟GPU分配的物理GPU;否则,继续获取下一个物理GPU的剩余显存容量进行相同的判断操作。以此类推,若所有的物理GPU的剩余显存容量均小于上述目标虚拟GPU的显存容量,则确定虚拟GPU无可用物理资源。In specific implementation, after determining the video memory capacity of the target virtual GPU for the task to be processed, according to the order of the physical GPUs in the resource state table, first obtain the remaining video memory capacity of the first physical GPU, and then determine the first physical GPU Whether the remaining video memory capacity of is greater than or equal to the required video memory capacity of the target virtual GPU, if it is greater than or equal to the required video memory capacity of the target virtual GPU, the first physical GPU is determined as the physical GPU allocated by the target virtual GPU; otherwise, the second The remaining video memory capacity of a physical GPU, and then determine whether the remaining video memory capacity of the second physical GPU is greater than or equal to the required video memory capacity of the target virtual GPU, if it is greater than or equal to the required video memory capacity of the target virtual GPU, the second physical GPU The GPU determines the physical GPU allocated to the target virtual GPU; otherwise, it continues to obtain the remaining video memory capacity of the next physical GPU to perform the same judgment operation. By analogy, if the remaining video memory capacity of all physical GPUs is less than the video memory capacity of the target virtual GPU, it is determined that the virtual GPU has no available physical resources.
图3为本申请实施例提供的一种资源最少管理分配策略的架构图。其中,带标号的阴影矩形表示待处理任务,矩形中的标号表示任务产生的先后顺序,VPT表示资源状态表,pGPU表示物理GPU,vGPU表示虚拟GPU,从架构图中可看出任务按照产生的先后顺序被分配到排列在前面的物理GPU中。FIG. 3 is a structural diagram of a minimum resource management allocation strategy provided by an embodiment of the application. Among them, the shaded rectangle with a label indicates the task to be processed, the label in the rectangle indicates the order in which the tasks are generated, VPT indicates the resource state table, pGPU indicates the physical GPU, and vGPU indicates the virtual GPU. From the architecture diagram, it can be seen that the tasks are generated according to the The order of precedence is assigned to the physical GPUs arranged in front.
在本申请实施例中,在确定目标虚拟GPU分配物理GPU时,通过优先分配排列在前面的物理GPU给目标虚拟GPU,从而使得每个GPU的利用率达到最大,以节省GPU的资源。In the embodiment of the present application, when it is determined that the target virtual GPU allocates physical GPUs, the physical GPUs arranged in the front are preferentially allocated to the target virtual GPUs, so as to maximize the utilization of each GPU to save GPU resources.
作为另一种可选的实施方式,所述基于所述目标虚拟GPU的显存容量、资源状态表以及资源分配策略为所述目标虚拟GPU分配物理GPU,包括:基于所述资源状态表,确定所述目标用户当前在多个物理GPU中每个物理GPU分配的任务数量以及每个物理GPU的剩余显存,所述用户ID为所述目标虚拟GPU的目标用户的标识;将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。所述任务数量最少,指的是目标用户在该物理GPU上运行的任务数量最少,而不是该物理GPU上所有运行的任务的数量最少。在本申请实施例中,将这种虚拟GPU与物理GPU的分配方式中的资源分配策略称为负载均衡分配策略。As another optional implementation manner, the allocating a physical GPU to the target virtual GPU based on the memory capacity of the target virtual GPU, a resource state table, and a resource allocation strategy includes: determining all the physical GPUs based on the resource state table. The number of tasks currently allocated by each physical GPU of the target user among multiple physical GPUs and the remaining video memory of each physical GPU, the user ID is the identification of the target user of the target virtual GPU; the number of tasks is minimized and The physical GPU whose remaining video memory capacity meets the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated to the target virtual GPU. The minimum number of tasks refers to the minimum number of tasks that the target user runs on the physical GPU, rather than the minimum number of all tasks running on the physical GPU. In the embodiments of the present application, the resource allocation strategy in this allocation method of virtual GPU and physical GPU is referred to as a load balancing allocation strategy.
在具体实现中,可以基于所述资源状态表中信息,确定多个物理GPU中每个物理GPU已经被占用的显存对应的目标用户的任务的数量,从而统计上述目标用户的任务在上述多个物理GPU中的分布情况,然后将所述任务数量最少且剩余显存满足容量所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。这样可以尽量使得上述目标用户的任务均匀分配给多个物理GPU,以减轻同一用户的多个任务堆积在同一个物理GPU上执行,所导致的单个用户多任务排队现象,从而增加了用户的任务的执行效率。In a specific implementation, based on the information in the resource state table, the number of tasks of the target user corresponding to the video memory occupied by each physical GPU in the multiple physical GPUs can be determined, so as to count the tasks of the target user in the above-mentioned multiple physical GPUs. According to the distribution of physical GPUs, the physical GPU with the least number of tasks and the remaining video memory meeting the required video memory capacity of the target virtual GPU is then determined as the physical GPU allocated by the target virtual GPU. In this way, the tasks of the target users mentioned above can be evenly distributed to multiple physical GPUs, so as to reduce the accumulation of multiple tasks of the same user to execute on the same physical GPU, resulting in a single user multi-task queuing phenomenon, thereby increasing the user's tasks Implementation efficiency.
进一步的,在所述任务数量最少且剩余显存满足容量所述目标虚拟GPU的所需显存容量的物理GPU的数量为多个的情况下,将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU中排列在最前面的物理GPU确定为所述目标虚拟GPU的物理GPU。该多个物理GPU的排列顺序可以是按照物理GPU的ID编号顺序排列,也可以是该多个物理GPU在上述资源状态表中的排列顺序。Further, in the case that the number of physical GPUs with the least number of tasks and remaining video memory meeting the required video memory capacity of the target virtual GPU is multiple, the number of tasks is the least and the remaining video memory capacity meeting the target The physical GPU arranged at the forefront among the physical GPUs with the required video memory capacity of the virtual GPU is determined as the physical GPU of the target virtual GPU. The arrangement order of the multiple physical GPUs may be arranged in the order of the ID numbers of the physical GPUs, or may be the arrangement order of the multiple physical GPUs in the aforementioned resource state table.
图4为本申请另一实施例提供的一种负载均衡分配策略的架构图。其中,带标号的阴影矩形表示待处理任务,矩形中的标号表示任务产生的先后顺序,VPT表示资源状态表,pGPU表示物理GPU,vGPU表示虚拟GPU,从架构图中可看出同一用户ID的任务被均匀的分配到各个物理GPU中。FIG. 4 is a structural diagram of a load balancing distribution strategy provided by another embodiment of the application. Among them, the shaded rectangle with a label indicates the task to be processed, the label in the rectangle indicates the order in which the task is generated, VPT indicates the resource status table, pGPU indicates the physical GPU, and vGPU indicates the virtual GPU. From the architecture diagram, it can be seen that the same user ID Tasks are evenly distributed to each physical GPU.
作为一种可选的实施方式,在确定上述目标虚拟GPU的物理GPU之后,上述方法还包括:基于为所述目标虚拟GPU所分配的物理GPU,更新所述资源状态表。As an optional implementation manner, after determining the physical GPU of the target virtual GPU, the method further includes: updating the resource state table based on the physical GPU allocated to the target virtual GPU.
在具体实现方式中,在确定上述目标虚拟GPU的物理GPU之后,通过上述目标虚拟GPU的物理GPU-ID、上述目标虚拟GPU的ID、目标虚拟GPU的用户ID、目标虚拟GPU的显存容量等信息更新上述资源状态表。In a specific implementation manner, after the physical GPU of the target virtual GPU is determined, information such as the physical GPU-ID of the target virtual GPU, the ID of the target virtual GPU, the user ID of the target virtual GPU, and the memory capacity of the target virtual GPU are passed. Update the above resource status table.
作为一种可选的实施方式,在上述多个物理GPU中存在任务被执行完成的情况下,基于被执行完成的任务更新所述资源状态表。As an optional implementation manner, in the case where there are tasks that have been executed and completed in the multiple physical GPUs, the resource state table is updated based on the tasks that have been executed and completed.
具体的,可以通过执行完任务的物理GPU-ID、被执行完的任务对应的虚拟GPU的ID对上述资源状态表中上述执行完任务的物理GPU的信息进行更新。Specifically, the information of the physical GPU that has executed the task in the resource state table can be updated by using the physical GPU-ID of the executed task and the ID of the virtual GPU corresponding to the executed task.
图5是本申请另一实施例公开的一种资源管理分配方法的流程示意图,应用于访客设备,如图5所示,该资源管理分配方法包括如下步骤。FIG. 5 is a schematic flowchart of a resource management and allocation method disclosed in another embodiment of the present application, which is applied to a guest device. As shown in FIG. 5, the resource management and allocation method includes the following steps.
501:读取主机的配置文件,其中,所述配置文件包括访客设备的虚拟GPU配置参数。501: Read a configuration file of the host, where the configuration file includes virtual GPU configuration parameters of the guest device.
502:基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU。502: Generate at least one available virtual GPU of the guest device based on the configuration file.
在本申请实施例中,501和502的步骤可以参考图2中的步骤201和202,此处不再赘述。In the embodiment of the present application, steps 501 and 502 can refer to steps 201 and 202 in FIG. 2, which will not be repeated here.
503:在接收到目标用户的待处理任务的情况下,基于所述待处理任务对应的目标虚拟GPU向主机发送资源分配请求,其中,所述资源分配请求用于请求所述主机为所述目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU。503: In the case of receiving the task to be processed by the target user, send a resource allocation request to the host based on the target virtual GPU corresponding to the task to be processed, where the resource allocation request is used to request the host to be the target The virtual GPU allocates a physical GPU, and the at least one available virtual GPU includes the target virtual GPU.
在本申请实施例中,上述访客设备可以对应于图1中的Guest,上述主机可以对应于图1中的Host。In the embodiment of the present application, the aforementioned guest device may correspond to the Guest in FIG. 1, and the aforementioned host may correspond to the Host in FIG. 1.
在一个例子中,访客设备可以为虚拟机,虚拟机包括至少一个虚拟GPU。在上述虚拟机中的虚拟GPU没有处理待处理任务时,上述虚拟机中的虚拟GPU没有与之对应的物理GPU。In an example, the guest device may be a virtual machine, and the virtual machine includes at least one virtual GPU. When the virtual GPU in the virtual machine does not process the task to be processed, the virtual GPU in the virtual machine does not have a physical GPU corresponding to it.
在上述虚拟机接收到待处理任务后,上述虚拟机为上述待处理任务分配与之对应的目标虚拟GPU,然后根据分配的目标虚拟GPU的信息,例如目标虚拟GPU的显存容量向上述主机发送资源分配请求,以请求所述主机为所述目标虚拟GPU分配物理GPU。After the virtual machine receives the task to be processed, the virtual machine allocates a target virtual GPU corresponding to the task to be processed, and then sends resources to the host according to the information of the allocated target virtual GPU, such as the memory capacity of the target virtual GPU An allocation request to request the host to allocate a physical GPU to the target virtual GPU.
其中,上述资源分配请求中,可以携带上述目标虚拟GPU的ID以及显存容量,还可以携带目标虚拟GPU的用户ID。Wherein, the resource allocation request may carry the ID of the target virtual GPU and the video memory capacity, and may also carry the user ID of the target virtual GPU.
在另一个例子中,访客设备也可以为容器,容器包括至少一个虚拟GPU。在容器中的虚拟GPU没有处理待处理任务时,该容器中的虚拟GPU没有与之对应的物理GPU。在该容器接收到待处理任务后,该容器为上述待处理任务分配与之对应的目标虚拟GPU,然后根据分配的目标虚拟GPU的信息,例如目标虚拟GPU的显存容量向上述主机发送资源分配请求,以请求所述主机为所述目标虚拟GPU分配物理GPU。其中,上述资源分配请求中,可以携带上述目标虚拟GPU的ID以及显存容量,还可以携带目标虚拟GPU的用户ID。In another example, the guest device may also be a container, and the container includes at least one virtual GPU. When the virtual GPU in the container does not process the task to be processed, the virtual GPU in the container does not have a physical GPU corresponding to it. After the container receives the task to be processed, the container allocates a target virtual GPU corresponding to the task to be processed, and then sends a resource allocation request to the host according to the information of the allocated target virtual GPU, such as the memory capacity of the target virtual GPU To request the host to allocate a physical GPU to the target virtual GPU. Wherein, the resource allocation request may carry the ID of the target virtual GPU and the video memory capacity, and may also carry the user ID of the target virtual GPU.
本申请实施例通过读取配置文件,其中,所述配置文件包括访客设备的虚拟GPU的参数,所述访客设备包括至少一个虚拟GPU;在接收到待处理任务的情况下,基于所述待处理任务对应的目标虚拟GPU向主机发送资源分配请求。在本申请实施例中,虚拟GPU和物理GPU在接收到任务之前没有建立映射关系,在接收到任务后,则通过资源分配策略动态的对虚拟GPU和物理GPU建立映射关系。因此,可以灵活地建立虚拟GPU和物理GPU之间的映射关系,以提升物理GPU的使用效率。The embodiment of the application reads a configuration file, where the configuration file includes the parameters of the virtual GPU of the guest device, and the guest device includes at least one virtual GPU; in the case of receiving a task to be processed, based on the to-be-processed task The target virtual GPU corresponding to the task sends a resource allocation request to the host. In the embodiment of the present application, the virtual GPU and the physical GPU do not establish a mapping relationship before the task is received. After the task is received, the mapping relationship between the virtual GPU and the physical GPU is dynamically established through a resource allocation strategy. Therefore, the mapping relationship between the virtual GPU and the physical GPU can be flexibly established to improve the use efficiency of the physical GPU.
作为一种可选的实施方式,在所述基于所述待处理任务对应的目标虚拟GPU向主机发送资源分配请求之前,所述方法还包括:基于所述访客设备中虚拟GPU的数量和第一资源状态表确定所述访客设备的未使用的虚拟GPU的数量,所述第一资源状态表包括每个物理GPU当前的使用状态信息;在所述未使用的虚拟GPU的数量大于零的情况下,从所述未使用的虚拟GPU中确定所述目标虚拟GPU。As an optional implementation manner, before the target virtual GPU corresponding to the task to be processed sends a resource allocation request to the host, the method further includes: based on the number of virtual GPUs in the guest device and the first The resource status table determines the number of unused virtual GPUs of the guest device, and the first resource status table includes current usage status information of each physical GPU; in the case that the number of unused virtual GPUs is greater than zero , Determining the target virtual GPU from the unused virtual GPUs.
其中,上述第一资源状态表中包含的信息与图2中的资源状态表包含的信息一致,此处不再赘述。Wherein, the information contained in the above-mentioned first resource state table is consistent with the information contained in the resource state table in FIG. 2, and will not be repeated here.
可选的,所述方法还包括:接收关于所述第一资源状态表的第一更新指令,所述第一更新指令是所述主机在检测到物理GPU的任务处理状态发生变化的情况下发送的;基于所述第一更新指令,更新所述第一资源状态表。其中,任务处理状态发生变化可以是物理GPU加入了新的任务或有任务被完成。Optionally, the method further includes: receiving a first update instruction regarding the first resource state table, the first update instruction being sent by the host when a change in the task processing state of the physical GPU is detected的; Based on the first update instruction, update the first resource status table. Among them, a change in the task processing state may be that a new task is added to the physical GPU or a task is completed.
具体的,在所述主机检测到物理GPU中存在新的任务加入的情况下,所述第一更新指令携带下列信息中的至少一项:第一物理GPU的新加入的任务对应的用户信息、第一物理GPU的信息, 所述新加入的任务的虚拟GPU的显存容量;在所述主机检测到物理GPU的显存中有新完成的任务的情况下,所述第一更新指令携带下列信息中的至少一项:新完成的任务对应的用户信息,以及新完成的任务对应的第二物理GPU的信息。其中,所述第一物理GPU为新加入任务的GPU,所述第二物理GPU为新完成任务对应的GPU。所述用户信息可以是用户的ID,所述物理GPU的信息,可以是物理GPU的ID.Specifically, when the host detects that a new task is added to the physical GPU, the first update instruction carries at least one of the following information: user information corresponding to the newly added task of the first physical GPU, The information of the first physical GPU, the video memory capacity of the virtual GPU of the newly added task; in the case that the host detects that there is a newly completed task in the video memory of the physical GPU, the first update instruction carries the following information At least one item of: user information corresponding to the newly completed task, and information of the second physical GPU corresponding to the newly completed task. Wherein, the first physical GPU is a GPU newly added to a task, and the second physical GPU is a GPU corresponding to a newly completed task. The user information may be the ID of the user, and the information of the physical GPU may be the ID of the physical GPU.
可选的,所述方法还包括:调度所述虚拟GPU执行所述待处理任务;接收来自所述主机的所述待处理任务的处理结果。Optionally, the method further includes: scheduling the virtual GPU to execute the task to be processed; and receiving a processing result of the task to be processed from the host.
图6是本申请又一实施例公开的一种资源管理分配方法的流程示意图,应用于主机,如图6所示,该资源管理分配方法包括如下步骤。FIG. 6 is a schematic flowchart of a resource management allocation method disclosed in another embodiment of the present application, which is applied to a host. As shown in FIG. 6, the resource management allocation method includes the following steps.
601:接收来自访客设备的资源分配请求,所述资源分配请求携带待处理任务的信息以及目标虚拟GPU的信息,所述目标虚拟GPU是访客设备中包括的虚拟GPU。601: Receive a resource allocation request from a guest device, where the resource allocation request carries information about a task to be processed and information about a target virtual GPU, where the target virtual GPU is a virtual GPU included in the guest device.
在本申请实施例中,上述访客设备可以对应于图1中的Guest,上述主机可以对应于图1中的Host。In the embodiment of the present application, the aforementioned guest device may correspond to the Guest in FIG. 1, and the aforementioned host may correspond to the Host in FIG. 1.
在上述访客设备包括至少一个虚拟GPU。在上述访客设备中的虚拟GPU没有处理待处理任务时,上述访客设备中的虚拟GPU没有与之对应的物理GPU。The aforementioned guest device includes at least one virtual GPU. When the virtual GPU in the guest device does not process the task to be processed, the virtual GPU in the guest device does not have a physical GPU corresponding to it.
上述目标虚拟GPU的信息可以包括但不限于目标虚拟GPU的显存容量、目标虚拟GPU的用户ID。The foregoing information of the target virtual GPU may include, but is not limited to, the memory capacity of the target virtual GPU and the user ID of the target virtual GPU.
602:基于所述目标虚拟GPU的信息为所述目标虚拟GPU分配目标物理GPU。602: Assign a target physical GPU to the target virtual GPU based on the information of the target virtual GPU.
在本申请实施例中,所述基于所述目标虚拟GPU的信息为所述目标虚拟GPU分配目标物理GPU,包括:基于所述目标虚拟GPU的显存容量,为所述目标虚拟GPU分配物理GPU。其中,所述目标物理GPU用于根据待处理任务的信息处理待处理任务。In the embodiment of the present application, the allocating a target physical GPU to the target virtual GPU based on the information of the target virtual GPU includes: allocating a physical GPU to the target virtual GPU based on the display memory capacity of the target virtual GPU. Wherein, the target physical GPU is used to process the task to be processed according to the information of the task to be processed.
进一步的,所述基于所述目标虚拟GPU的显存容量为所述目标虚拟GPU分配物理GPU,包括:基于所述目标虚拟GPU的所需显存容量、资源分配策略以及第二资源状态表为所述目标虚拟GPU分配物理GPU,其中,所述第二资源状态表包括多个物理GPU中每个物理GPU的当前状态信息。Further, the allocating a physical GPU to the target virtual GPU based on the video memory capacity of the target virtual GPU includes: based on the required video memory capacity of the target virtual GPU, a resource allocation strategy, and a second resource state table as the The target virtual GPU allocates physical GPUs, where the second resource state table includes current state information of each of the multiple physical GPUs.
在本申请实施例中,上述基于所述目标虚拟GPU的显存容量、所述资源分配策略以及第二资源状态表为所述目标虚拟GPU分配物理GPU的具体实现过程可以参考图2中“基于所述目标虚拟GPU的所需显存容量以及资源状态表为所述目标虚拟GPU分配物理GPU”对应的操作。需要注意的是,其中,确定所述目标用户当前在多个物理GPU中每个物理GPU分配的任务数量的操作可以理解为确定目标用户当前在多个物理GPU中每个物理GPU分配的任务数量,该目标用户为目标虚拟GPU对应的用户。其中,本申请实施例中的“第二资源状态表”对应于上述图2中“基于所述目标虚拟GPU的所需显存容量以及资源状态表为所述目标虚拟GPU分配物理GPU”中的“资源状态表”。在一个例子中,第二资源状态表与第一资源状态表相同,例如,访客设备将主机上的资源状态表拷贝到本地,主机对第二资源状态表进行维护,并在第二资源状态表有更新时,通知访客设备对第一资源状态表做同步的更新。例如,可以通过第一更新指令通知访客设备更新第一资源状态表。In the embodiment of the present application, the above-mentioned specific implementation process of allocating a physical GPU to the target virtual GPU based on the memory capacity of the target virtual GPU, the resource allocation strategy, and the second resource state table can refer to the "based on The required video memory capacity of the target virtual GPU and the resource state table allocate operations corresponding to the “physical GPU” for the target virtual GPU. It should be noted that the operation of determining the number of tasks currently allocated by the target user to each physical GPU in the multiple physical GPUs can be understood as determining the number of tasks currently allocated by the target user to each physical GPU in the multiple physical GPUs , The target user is the user corresponding to the target virtual GPU. Among them, the "second resource state table" in the embodiment of the present application corresponds to the "allocation of physical GPUs to the target virtual GPU based on the required video memory capacity and resource state table of the target virtual GPU" in FIG. 2 above. Resource Status Table". In one example, the second resource status table is the same as the first resource status table. For example, the guest device copies the resource status table on the host to the local, and the host maintains the second resource status table, and the second resource status table is displayed in the second resource status table. When there is an update, the guest device is notified to update the first resource status table synchronously. For example, the guest device may be notified to update the first resource status table through the first update instruction.
作为一种可选的实施方式,所述方法还包括:基于为所述目标虚拟GPU所分配的物理GPU,更新所述第二资源状态表;或者,在任务处理状态发生变化的情况下,基于所述任务处理状态的变化更新所述第二资源状态表。基于为所述目标虚拟GPU所分配的物理GPU,更新所述第二资源状态表,包括以下至少一项:所分配的物理GPU的新加入的任务对应的用户信息、所分配的物理GPU的信息,所述新加入的任务对应的虚拟GPU的显存容量。在任务处理状态发生变化的情况下,基于所述任务处理状态的变化更新所述第二资源状态表,包括以下至少一项:新完成的任务对应的用户信息,以及完成任务的物理GPU的信息。物理GPU的信息包括物理GPU的ID,用户信息包括用户ID。As an optional implementation manner, the method further includes: updating the second resource state table based on the physical GPU allocated to the target virtual GPU; or, in the case that the task processing state changes, based on The change in the task processing status updates the second resource status table. Based on the physical GPU allocated for the target virtual GPU, the second resource state table is updated, including at least one of the following: user information corresponding to the newly added task of the allocated physical GPU, and information about the allocated physical GPU , The video memory capacity of the virtual GPU corresponding to the newly added task. In the case of a change in the task processing state, the second resource state table is updated based on the change in the task processing state, including at least one of the following: user information corresponding to the newly completed task, and information about the physical GPU that completed the task . The information of the physical GPU includes the ID of the physical GPU, and the user information includes the user ID.
作为一种可选的实施方式,在为所述待处理任务对应的目标虚拟GPU分配物理GPU之后,所述方法还可以包括:基于多个物理GPU中每个物理GPU的任务队列,进行任务调度。As an optional implementation manner, after allocating physical GPUs to the target virtual GPU corresponding to the task to be processed, the method may further include: performing task scheduling based on the task queue of each of the multiple physical GPUs .
其中,所述任务队列是指物理GPU已被占用的显存中包括的任务。Wherein, the task queue refers to tasks included in the video memory occupied by the physical GPU.
本申请实施例首先接收来自访客设备的资源分配请求,所述资源分配请求携带待处理任务以及目标虚拟GPU的信息,所述目标虚拟GPU是访客设备中的访客设备包括的虚拟GPU,然后基于所述目标虚拟GPU的信息和资源管理策略为所述目标虚拟GPU分配目标物理GPU。在本申请实施例中,不为虚拟GPU和物理GPU预先建立固定的映射关系,而是在虚拟GPU接收到任务后,动态的为虚拟GPU分配对应的物理GPU,可以灵活的通过不同的资源分配策略来对GPU资源进行管理分配,以提升物理GPU的资源利用率,并提高系统的整体性能。The embodiment of the present application first receives a resource allocation request from a guest device. The resource allocation request carries information about the task to be processed and a target virtual GPU. The target virtual GPU is a virtual GPU included in the guest device in the guest device, and then based on all the information. The information and resource management strategy of the target virtual GPU allocates a target physical GPU to the target virtual GPU. In the embodiment of this application, a fixed mapping relationship is not established for the virtual GPU and the physical GPU in advance, but after the virtual GPU receives the task, the virtual GPU is dynamically allocated the corresponding physical GPU, which can be flexibly allocated through different resources Strategies to manage and allocate GPU resources to improve the resource utilization of the physical GPU and improve the overall performance of the system.
与上述图2所示的实施例类似的,图7是本申请实施例提供的一种电子设备700的结构示意图,如图7所示,所述电子设备700包括处理器710、存储器720、通信接口730以及物理GPU 740。其中,所述一个或多个程序721被存储在上述存储器720中,并且被配置由上述处理器710执行,所述一个或多个程序721包括用于执行以下步骤的指令。Similar to the embodiment shown in FIG. 2 above, FIG. 7 is a schematic structural diagram of an electronic device 700 provided by an embodiment of the present application. As shown in FIG. 7, the electronic device 700 includes a processor 710, a memory 720, and a communication device. Interface 730 and physical GPU 740. The one or more programs 721 are stored in the aforementioned memory 720 and are configured to be executed by the aforementioned processor 710, and the one or more programs 721 include instructions for executing the following steps.
读取配置文件,所述配置文件包括访客设备的GPU配置参数;以及基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU;以及响应于接收到目标用户的待处理任务,为所述待处理任务对应的目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU。Read a configuration file, the configuration file including the GPU configuration parameters of the guest device; and based on the configuration file, generate at least one available virtual GPU of the guest device; The target virtual GPU corresponding to the task to be processed is allocated a physical GPU, and the at least one available virtual GPU includes the target virtual GPU.
本申请实施例通过读取配置文件,其中,所述配置文件包括访客设备的虚拟GPU的配置参数;以及基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU;在接收到待处理任务的情况下,为所述待处理任务对应的目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU。在本申请实施例中,不为虚拟GPU和物理GPU预先建立固定的映射关系,而是在虚拟GPU接收到待处理任务后,动态的为虚拟GPU分配对应的物理GPU,可以灵活的基于当前任务的特点来对GPU资源进行分配,以提升物理GPU的资源利用率,并提高GPU系统的整体性能。The embodiment of the application reads a configuration file, where the configuration file includes configuration parameters of the virtual GPU of the guest device; and based on the configuration file, generates at least one available virtual GPU of the guest device; In the case of a task, a physical GPU is allocated to a target virtual GPU corresponding to the task to be processed, and the at least one available virtual GPU includes the target virtual GPU. In the embodiment of the present application, a fixed mapping relationship is not established for the virtual GPU and the physical GPU in advance, but after the virtual GPU receives the task to be processed, the virtual GPU is dynamically assigned the corresponding physical GPU, which can be flexibly based on the current task The characteristics of GPU resources are allocated to improve the resource utilization of the physical GPU and improve the overall performance of the GPU system.
在一种可选的实施方式中,所述为所述待处理任务对应的目标虚拟GPU分配物理GPU,所述程序中的指令具体用于执行以下操作:基于所述目标虚拟GPU所需的显存容量以及资源状态表,为所述目标虚拟GPU分配物理GPU,其中,所述资源状态表包括多个物理GPU中每个物理GPU的当前状态信息。In an optional implementation manner, the target virtual GPU corresponding to the task to be processed is allocated a physical GPU, and the instructions in the program are specifically used to perform the following operations: based on the video memory required by the target virtual GPU The capacity and resource state table allocates physical GPUs to the target virtual GPU, where the resource state table includes current state information of each of the multiple physical GPUs.
在一种可选的实施方式中,所述物理GPU的当前状态信息包括:所述物理GPU的显存容量、与所述物理GPU已经被占用的显存对应的每个虚拟GPU的用户信息、与所述物理GPU已经被 占用的显存对应的每个虚拟GPU的显存容量。In an optional implementation manner, the current state information of the physical GPU includes: the video memory capacity of the physical GPU, user information of each virtual GPU corresponding to the video memory already occupied by the physical GPU, and The video memory capacity of each virtual GPU corresponding to the video memory already occupied by the physical GPU.
在一种可选的实施方式中,所述基于所述目标虚拟GPU的所需显存容量以及资源状态表,为所述目标虚拟GPU分配物理GPU,所述程序中的指令具体用于执行以下操作:基于所述目标虚拟GPU的所需显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU,以使得所述多个物理GPU的显存被使用最少。In an optional implementation manner, the target virtual GPU is allocated a physical GPU based on the required video memory capacity and the resource state table of the target virtual GPU, and the instructions in the program are specifically used to perform the following operations : Based on the required video memory capacity and resource state table of the target virtual GPU, a physical GPU is allocated to the target virtual GPU, so that the video memory of the multiple physical GPUs is used at a minimum.
在一种可选的实施方式中,所述基于所述目标虚拟GPU所需显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU,所述程序中的指令具体用于执行以下操作:基于所述资源状态表,按照多个物理GPU的排列顺序,依次确定每个物理GPU的剩余显存容量,直到确定的剩余显存容量满足所述目标虚拟GPU的所需显存容量;将剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。In an optional implementation manner, the target virtual GPU is allocated a physical GPU based on the required video memory capacity and resource state table of the target virtual GPU, and the instructions in the program are specifically used to perform the following operations: Based on the resource state table, the remaining video memory capacity of each physical GPU is sequentially determined according to the order of the multiple physical GPUs, until the determined remaining video memory capacity meets the required video memory capacity of the target virtual GPU; and the remaining video memory capacity is satisfied The physical GPU of the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated to the target virtual GPU.
在一种可选的实施方式中,所述程序中的指令还用于执行以下操作:在确定所述多个物理GPU中排在最后的物理GPU的剩余显存容量不满足所述目标虚拟GPU的所需显存容量的情况下,确定所述虚拟GPU无可用物理资源。In an optional implementation manner, the instructions in the program are further used to perform the following operations: after determining that the remaining video memory capacity of the physical GPU ranked last among the multiple physical GPUs does not meet the requirements of the target virtual GPU In the case of the required video memory capacity, it is determined that the virtual GPU has no available physical resources.
在一种可选的实施方式中,所述基于所述目标虚拟GPU的显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU,所述程序中的指令具体用于执行以下操作:基于所述目标虚拟GPU的所需显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU,以使得所述目标用户的至少一个任务被尽可能均匀地分配给所述多个物理GPU,其中,所述至少一个任务包括所述待处理任务。In an optional implementation manner, the target virtual GPU is allocated a physical GPU based on the memory capacity and resource state table of the target virtual GPU, and the instructions in the program are specifically used to perform the following operations: The required video memory capacity and resource state table of the target virtual GPU, and physical GPUs are allocated to the target virtual GPU, so that at least one task of the target user is allocated to the multiple physical GPUs as evenly as possible, wherein , The at least one task includes the task to be processed.
在一种可选的实施方式中,所述基于所述目标虚拟GPU的显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU,所述程序中的指令具体用于执行以下操作:基于所述资源状态表,确定所述目标用户当前在所述多个物理GPU中每个物理GPU分配的任务数量,以及每个物理GPU的剩余显存容量;将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。In an optional implementation manner, the target virtual GPU is allocated a physical GPU based on the memory capacity and resource state table of the target virtual GPU, and the instructions in the program are specifically used to perform the following operations: The resource status table determines the number of tasks currently allocated by each physical GPU of the multiple physical GPUs by the target user and the remaining video memory capacity of each physical GPU; and minimizes the number of tasks and the remaining video memory capacity satisfies The physical GPU of the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated to the target virtual GPU.
在一种可选的实施方式中,所述程序中的指令还用于执行以下操作:在所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU的数量为多个的情况下,将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的多个物理GPU中排列在最前面的物理GPU确定为所述目标虚拟GPU分配的物理GPU。In an optional implementation manner, the instructions in the program are further used to perform the following operations: when the number of tasks is the smallest and the remaining video memory capacity meets the required video memory capacity of the target virtual GPU, the number of physical GPUs is In the case of multiple, the physical GPU arranged at the forefront among the multiple physical GPUs with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU GPU.
在一种可选的实施方式中,所述程序中的指令还用于执行以下操作:基于为所述目标虚拟GPU所分配的物理GPU,更新所述资源状态表;或者,在任务处理状态发生变化的情况下,基于所述任务处理状态的变化更新所述资源状态表。In an optional implementation manner, the instructions in the program are also used to perform the following operations: update the resource state table based on the physical GPU allocated to the target virtual GPU; or, occur in the task processing state In the case of a change, the resource state table is updated based on the change in the task processing state.
与上述图5所示的实施例类似的,图8是本申请另一实施例提供的一种电子设备800的结构示意图,所述电子设备800可以是访客设备。如图8所示,所述电子设备800包括处理器810、存储器820以及通信接口830。其中,所述一个或多个程序821被存储在上述存储器820中,并且被配置由上述处理器810执行,所述一个或多个程序821包括用于执行以下步骤的指令。Similar to the embodiment shown in FIG. 5, FIG. 8 is a schematic structural diagram of an electronic device 800 provided by another embodiment of the present application, and the electronic device 800 may be a visitor device. As shown in FIG. 8, the electronic device 800 includes a processor 810, a memory 820, and a communication interface 830. The one or more programs 821 are stored in the aforementioned memory 820 and are configured to be executed by the aforementioned processor 810, and the one or more programs 821 include instructions for executing the following steps.
读取主的配置文件,其中,所述配置文件包括所述访客设备的虚拟GPU配置参数;基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU;以及在接收到目标用户的待处理任务的情况下,基于所述待处理任务对应的目标虚拟GPU向主机发送资源分配请求,其中,所述资源分配请求用于请求所述主机为所述目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述 目标虚拟GPU。Read the main configuration file, where the configuration file includes virtual GPU configuration parameters of the guest device; generate at least one available virtual GPU of the guest device based on the configuration file; In the case of processing tasks, a resource allocation request is sent to the host based on the target virtual GPU corresponding to the task to be processed, where the resource allocation request is used to request the host to allocate a physical GPU to the target virtual GPU, and the at least One available virtual GPU includes the target virtual GPU.
本申请实施例通过读取配置文件,其中,所述配置文件包括访客设备的虚拟GPU的参数;基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU;在接收到待处理任务的情况下,基于所述待处理任务对应的目标虚拟GPU向主机发送资源分配请求。在本申请实施例中,不为虚拟GPU和物理GPU预先建立固定的映射关系,而是在虚拟GPU接收到任务后,动态的向主机发送资源分配请求,以提升物理GPU的资源利用率,并提高GPU系统的整体性能。The embodiment of the application reads a configuration file, where the configuration file includes the parameters of the virtual GPU of the guest device; based on the configuration file, generates at least one available virtual GPU of the guest device; In this case, a resource allocation request is sent to the host based on the target virtual GPU corresponding to the task to be processed. In the embodiment of this application, a fixed mapping relationship is not established for the virtual GPU and the physical GPU in advance. Instead, after the virtual GPU receives the task, it dynamically sends a resource allocation request to the host to improve the resource utilization of the physical GPU, and Improve the overall performance of the GPU system.
在一种可选的实施方式中,在所述基于所述待处理任务对应的目标虚拟GPU向主机发送资源分配请求之前,所述程序中的指令还用于执行以下操作:基于第一资源状态表,,确定所述访客设备的至少一个可用虚拟GPU中处于空闲状态的虚拟GPU,其中,所述第一资源状态表包括多个物理GPU中每个物理GPU的当前状态信息;从所述处于空闲状态的虚拟GPU中确定所述目标虚拟GPU。In an optional implementation manner, before the target virtual GPU corresponding to the task to be processed sends a resource allocation request to the host, the instructions in the program are further used to perform the following operations: based on the first resource state Table, to determine the virtual GPU in the idle state among the at least one available virtual GPU of the guest device, wherein the first resource state table includes current state information of each of the multiple physical GPUs; The target virtual GPU is determined from the virtual GPUs in the idle state.
在一种可选的实施方式中,所述程序中的指令还用于执行以下操作:接收来自于所述主机的关于所述第一资源状态表的第一更新指令,所述第一更新指令是在所述主机检测到物理GPU的任务处理状态发生变化的情况下发送的;基于所述第一更新指令,更新所述第一资源状态表。In an optional implementation manner, the instructions in the program are further used to perform the following operations: receiving a first update instruction on the first resource state table from the host, the first update instruction It is sent when the host detects that the task processing state of the physical GPU has changed; based on the first update instruction, the first resource state table is updated.
在一种可选的实施方式中,至少一个物理GPU包括具有新加入的任务的第一物理GPU,所述第一更新指令携带下列信息中的至少一项:第一物理GPU的新加入的任务对应的用户信息、所述第一物理GPU的信息,所述新加入的任务对应的虚拟GPU的显存容量;和/或至少一个物理GPU包括具有新完成的任务的第二物理GPU,所述第一更新指令携带下列中的至少一项:新完成的任务对应的用户信息,以及第二物理GPU的信息。In an optional implementation manner, the at least one physical GPU includes a first physical GPU with a newly added task, and the first update instruction carries at least one of the following information: a newly added task of the first physical GPU Corresponding user information, information of the first physical GPU, the video memory capacity of the virtual GPU corresponding to the newly added task; and/or at least one physical GPU includes a second physical GPU with a newly completed task, the first An update instruction carries at least one of the following: user information corresponding to the newly completed task, and information of the second physical GPU.
在一种可选的实施方式中,所述程序中的指令还用于执行以下操作:调度所述虚拟GPU执行所述待处理任务;接收来自所述主机的所述待处理任务的处理结果。In an optional implementation manner, the instructions in the program are further used to perform the following operations: scheduling the virtual GPU to execute the to-be-processed task; and receiving the processing result of the to-be-processed task from the host.
与上述图6所示的实施例类似的,图9是本申请又一实施例提供的一种电子设备900的结构示意图,所述电子设备900可以是主机。如图9所示,所述电子设备900包括处理器910、存储器920、通信接口930以及物理GPU 940。其中,所述一个或多个程序921被存储在上述存储器920中,并且被配置由上述处理器910执行,所述一个或多个程序921包括用于执行以下步骤的指令。Similar to the embodiment shown in FIG. 6 above, FIG. 9 is a schematic structural diagram of an electronic device 900 according to another embodiment of the present application, and the electronic device 900 may be a host. As shown in FIG. 9, the electronic device 900 includes a processor 910, a memory 920, a communication interface 930, and a physical GPU 940. The one or more programs 921 are stored in the aforementioned memory 920 and are configured to be executed by the aforementioned processor 910, and the one or more programs 921 include instructions for executing the following steps.
接收来自访客设备的资源分配请求,所述资源分配请求携带待处理任务的信息以及目标虚拟GPU的信息;以及基于所述目标虚拟GPU的信息,为所述目标虚拟GPU分配目标物理GPU。Receiving a resource allocation request from a guest device, the resource allocation request carrying information of the task to be processed and information of a target virtual GPU; and based on the information of the target virtual GPU, a target physical GPU is allocated to the target virtual GPU.
本申请实施例接收来自访客设备的资源分配请求,所述资源分配请求携带待处理任务的信息以及目标虚拟GPU的信息;以及基于所述目标虚拟GPU的信息,为所述目标虚拟GPU分配目标物理GPU。在本申请实施例中,不为虚拟GPU和物理GPU预先建立固定的映射关系,而是在接收来自访客设备的资源分配请求后,动态的为虚拟GPU分配对应的物理GPU,可以灵活的基于当前任务的特点来对GPU资源进行分配,以提升GPU的资源利用率,并提高GPU系统的整体性能。This embodiment of the application receives a resource allocation request from a guest device, the resource allocation request carries information about the task to be processed and information about a target virtual GPU; and based on the information about the target virtual GPU, allocates a target physical to the target virtual GPU GPU. In the embodiment of this application, a fixed mapping relationship is not established for the virtual GPU and the physical GPU in advance. Instead, after receiving the resource allocation request from the guest device, the virtual GPU is dynamically allocated the corresponding physical GPU, which can be flexibly based on the current The characteristics of the task are used to allocate GPU resources to improve the resource utilization of the GPU and improve the overall performance of the GPU system.
在一种可选的实施方式中,所述基于所述目标虚拟GPU的信息,为所述目标虚拟GPU分配目标物理GPU,所述程序中的指令具体用于执行以下操作:基于所述目标虚拟GPU的所需显存容量,为所述目标虚拟GPU分配物理GPU。In an optional implementation manner, the target virtual GPU is assigned a target physical GPU based on the information of the target virtual GPU, and the instructions in the program are specifically used to perform the following operations: based on the target virtual GPU The required video memory capacity of the GPU allocates physical GPUs to the target virtual GPU.
在一种可选的实施方式中,所述基于所述目标虚拟GPU的显存容量为所述目标虚拟GPU分配物理GPU,所述程序中的指令具体用于执行以下操作:基于所述目标虚拟GPU的所需显存容 量、所述资源分配策略以及第二资源状态表为所述目标虚拟GPU分配物理GPU,其中,所述第二资源状态表包括多个物理GPU中每个物理GPU的当前状态信息。In an optional implementation manner, the physical GPU is allocated to the target virtual GPU based on the memory capacity of the target virtual GPU, and the instructions in the program are specifically used to perform the following operations: based on the target virtual GPU The required video memory capacity, the resource allocation strategy, and the second resource state table allocate physical GPUs to the target virtual GPU, where the second resource state table includes current state information of each of the multiple physical GPUs .
在一种可选的实施方式中,所述基于所述目标虚拟GPU的显存容量、所述资源分配策略以及第二资源状态表为所述目标虚拟GPU分配物理GPU,所述程序中的指令具体用于执行以下操作:基于所述第二资源状态表,按照所述多个物理GPU的排列顺序,依次确定每个物理GPU的剩余显存容量,直到确定的剩余显存容量满足所述目标虚拟GPU的所需显存容量;将剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。In an optional implementation manner, the physical GPU is allocated to the target virtual GPU based on the memory capacity of the target virtual GPU, the resource allocation strategy, and the second resource state table, and the instructions in the program are specifically Used to perform the following operations: based on the second resource state table, according to the arrangement order of the multiple physical GPUs, sequentially determine the remaining video memory capacity of each physical GPU until the determined remaining video memory capacity satisfies the target virtual GPU Required video memory capacity; a physical GPU whose remaining video memory capacity meets the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU.
在一种可选的实施方式中,所述程序中的指令还用于执行以下操作,在确定所述多个物理GPU中排在最后的物理GPU的剩余显存容量不满足所述目标虚拟GPU的所需显存容量的情况下,确定所述虚拟GPU无可用物理资源。In an optional implementation manner, the instructions in the program are also used to perform the following operations, when determining that the remaining video memory capacity of the physical GPU ranked last among the multiple physical GPUs does not meet the requirements of the target virtual GPU In the case of the required video memory capacity, it is determined that the virtual GPU has no available physical resources.
在一种可选的实施方式中,在所述基于所述目标虚拟GPU的显存容量、所述资源分配策略以及第二资源状态表为所述目标虚拟GPU分配物理GPU方面,所述程序中的指令具体用于执行以下操作:基于所述第二资源状态表,确定目标用户当前在多个物理GPU中每个物理GPU已经分配的任务数量,以及每个物理GPU的剩余显存容量,其中,所述目标用户为所述目标虚拟GPU对应的用户;将所述任务数量最少且剩余显存满足容量所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU的物理GPU。In an optional implementation manner, in the aspect of allocating physical GPUs for the target virtual GPU based on the memory capacity of the target virtual GPU, the resource allocation strategy, and the second resource state table, the program in the program The instructions are specifically used to perform the following operations: based on the second resource state table, determine the number of tasks that the target user currently has allocated to each physical GPU among the multiple physical GPUs, and the remaining video memory capacity of each physical GPU, where all The target user is a user corresponding to the target virtual GPU; the physical GPU with the least number of tasks and remaining video memory meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU of the target virtual GPU.
在一种可选的实施方式中,所述程序中的指令还用于执行以下操作:在所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU的数量为多个的情况下,将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU中排列在最前面的物理GPU确定为所述目标虚拟GPU分配的物理GPU。In an optional implementation manner, the instructions in the program are further used to perform the following operations: when the number of tasks is the smallest and the remaining video memory capacity meets the required video memory capacity of the target virtual GPU, the number of physical GPUs is In the case of multiple, the physical GPU that is arranged at the forefront among the physical GPUs with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU.
在一种可选的实施方式中,所述程序中的指令还用于执行以下操作:基于为所述目标虚拟GPU所分配的物理GPU,更新所述第二资源状态表;或者,在任务处理状态发生变化的情况下,基于所述任务处理状态的变化更新所述第二资源状态表。In an optional implementation manner, the instructions in the program are further used to perform the following operations: update the second resource state table based on the physical GPU allocated to the target virtual GPU; or, in task processing When the status changes, the second resource status table is updated based on the change in the task processing status.
在一种可选的实施方式中,所述程序中的指令还用于执行以下操作:基于多个物理GPU中每个物理GPU的任务队列,进行任务调度。In an optional implementation manner, the instructions in the program are further used to perform the following operations: perform task scheduling based on the task queue of each physical GPU among the multiple physical GPUs.
图10是本申请实施例中所涉及的资源管理装置1000的功能单元组成框图。该资源管理装置1000应用于电子设备,所述电子设备包括处理单元1010和通信单元1020。FIG. 10 is a block diagram of the functional unit composition of the resource management device 1000 involved in an embodiment of the present application. The resource management apparatus 1000 is applied to an electronic device, and the electronic device includes a processing unit 1010 and a communication unit 1020.
所述处理单元1010用于:通过所述通信单元1020获取配置文件;读取配置文件,所述配置文件包括访客设备的GPU配置参数;基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU;以及响应于接收到目标用户的待处理任务,为所述待处理任务对应的目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU。The processing unit 1010 is configured to: obtain a configuration file through the communication unit 1020; read a configuration file, the configuration file including the GPU configuration parameters of the guest device; based on the configuration file, generate at least one available for the guest device A virtual GPU; and in response to receiving a task to be processed by a target user, a physical GPU is allocated to a target virtual GPU corresponding to the task to be processed, and the at least one available virtual GPU includes the target virtual GPU.
本申请实施例通过读取配置文件,其中,所述配置文件包括访客设备的虚拟GPU的参数;基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU;在接收到待处理任务的情况下,为所述待处理任务对应的目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU。在本申请实施例中,不为虚拟GPU和物理GPU预先建立固定的映射关系,而是在虚拟GPU接收到待处理任务后,动态的为虚拟GPU分配对应的物理GPU,可以灵活的基于当前任务的特点来对GPU资源进行分配,以提升GPU的资源利用率,并提高GPU系统的整体性能。The embodiment of the application reads a configuration file, where the configuration file includes the parameters of the virtual GPU of the guest device; based on the configuration file, generates at least one available virtual GPU of the guest device; In this case, a physical GPU is allocated to the target virtual GPU corresponding to the task to be processed, and the at least one available virtual GPU includes the target virtual GPU. In the embodiment of the present application, a fixed mapping relationship is not established for the virtual GPU and the physical GPU in advance, but after the virtual GPU receives the task to be processed, the virtual GPU is dynamically assigned the corresponding physical GPU, which can be flexibly based on the current task The characteristics of the GPU resources are allocated to improve the resource utilization of the GPU and improve the overall performance of the GPU system.
在一种可选的实施方式中,在所述为所述待处理任务对应的目标虚拟GPU分配物理GPU情况下,所述处理单元1010具体用于:基于所述目标虚拟GPU所需的显存容量以及资源状态表,为所述目标虚拟GPU分配物理GPU,其中,所述资源状态表包括多个物理GPU中每个物理GPU的当前状态信息。In an optional implementation manner, in the case where a physical GPU is allocated to the target virtual GPU corresponding to the task to be processed, the processing unit 1010 is specifically configured to: based on the video memory capacity required by the target virtual GPU And a resource state table that allocates physical GPUs to the target virtual GPU, wherein the resource state table includes current state information of each physical GPU in the multiple physical GPUs.
在一种可选的实施方式中,所述每个物理GPU的当前状态信息包括:该物理GPU的显存容量、与该物理GPU已经被占用的显存对应的每个虚拟GPU的用户信息、与该物理GPU已经被占用的显存对应的每个虚拟GPU的显存容量。In an optional implementation manner, the current state information of each physical GPU includes: the video memory capacity of the physical GPU, the user information of each virtual GPU corresponding to the video memory already occupied by the physical GPU, and the The video memory capacity of each virtual GPU corresponding to the video memory already occupied by the physical GPU.
在一种可选的实施方式中,在所述基于所述目标虚拟GPU的所需显存容量以及资源状态表,为所述目标虚拟GPU分配物理GPU情况下,所述处理单元1010具体用于:基于所述目标虚拟GPU的所需显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU,以使得所述多个物理GPU的显存被使用最少。In an optional implementation manner, in the case where a physical GPU is allocated to the target virtual GPU based on the required video memory capacity and the resource state table of the target virtual GPU, the processing unit 1010 is specifically configured to: Based on the required video memory capacity and resource state table of the target virtual GPU, a physical GPU is allocated to the target virtual GPU, so that the video memory of the multiple physical GPUs is used to a minimum.
在一种可选的实施方式中,在所述基于所述目标虚拟GPU所需显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU情况下,所述处理单元1010具体用于:基于所述资源状态表,按照多个物理GPU的排列顺序,依次确定每个物理GPU的剩余显存容量,直到确定的剩余显存容量满足所述目标虚拟GPU的所需显存容量;将剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。In an optional implementation manner, in the case where a physical GPU is allocated to the target virtual GPU based on the required video memory capacity and resource state table of the target virtual GPU, the processing unit 1010 is specifically configured to: The resource state table determines the remaining video memory capacity of each physical GPU in sequence according to the arrangement order of the multiple physical GPUs, until the determined remaining video memory capacity meets the required video memory capacity of the target virtual GPU; and the remaining video memory capacity meets all requirements. The physical GPU of the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated to the target virtual GPU.
在一种可选的实施方式中,所述处理单元1010还用于:在确定所述多个物理GPU中排在最后的物理GPU的剩余显存容量不满足所述目标虚拟GPU的所需显存容量的情况下,确定所述虚拟GPU无可用物理资源。In an optional implementation manner, the processing unit 1010 is further configured to: determine that the remaining video memory capacity of the physical GPU ranked last among the multiple physical GPUs does not meet the required video memory capacity of the target virtual GPU In the case of, it is determined that the virtual GPU has no available physical resources.
在一种可选的实施方式中,在所述基于所述目标虚拟GPU的显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU情况下,所述处理单元1010具体用于:基于所述目标虚拟GPU的所需显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU,以使得所述目标用户的至少一个任务被尽可能均匀地分配给所述多个物理GPU,其中,所述至少一个任务包括所述待处理任务。In an optional implementation manner, in the case where a physical GPU is allocated to the target virtual GPU based on the display memory capacity and resource state table of the target virtual GPU, the processing unit 1010 is specifically configured to: The required video memory capacity and resource status table of the target virtual GPU, and physical GPUs are allocated to the target virtual GPU, so that at least one task of the target user is allocated to the multiple physical GPUs as evenly as possible, wherein, The at least one task includes the pending task.
在一种可选的实施方式中,在所述基于所述目标虚拟GPU的显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU情况下,所述处理单元1010具体用于:基于所述资源状态表,确定所述目标用户当前在所述多个物理GPU中每个物理GPU分配的任务数量,以及每个物理GPU的剩余显存容量;将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。In an optional implementation manner, in the case where a physical GPU is allocated to the target virtual GPU based on the display memory capacity and resource state table of the target virtual GPU, the processing unit 1010 is specifically configured to: The resource status table determines the number of tasks currently allocated by each physical GPU of the multiple physical GPUs by the target user, and the remaining video memory capacity of each physical GPU; and minimizes the number of tasks and the remaining video memory capacity satisfies all The physical GPU of the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated to the target virtual GPU.
在一种可选的实施方式中,所述处理单元1010还用于:在所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU的数量为多个的情况下,将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的多个物理GPU中排列在最前面的物理GPU确定为所述目标虚拟GPU分配的物理GPU。In an optional implementation manner, the processing unit 1010 is further configured to: when the number of tasks is the smallest and the remaining video memory capacity meets the required video memory capacity of the target virtual GPU, there are multiple physical GPUs. Next, the foremost physical GPU among the multiple physical GPUs with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU.
在一种可选的实施方式中,所述处理单元1010还用于:基于为所述目标虚拟GPU所分配的物理GPU,更新所述资源状态表;或者,在任务处理状态发生变化的情况下,基于所述任务处理状态的变化更新所述资源状态表。In an optional implementation manner, the processing unit 1010 is further configured to: update the resource state table based on the physical GPU allocated to the target virtual GPU; or, when the task processing state changes , Updating the resource status table based on the change of the task processing status.
图11是本申请另一实施例中所涉及的资源管理装置1100的功能单元组成框图。该资源管理装置1100应用于电子设备,所述电子设备包括处理单元1110和通信单元1120。FIG. 11 is a block diagram of the functional unit composition of a resource management device 1100 involved in another embodiment of the present application. The resource management apparatus 1100 is applied to an electronic device, and the electronic device includes a processing unit 1110 and a communication unit 1120.
所述处理单元1110用于:通过所述通信单元1120获取主机配置文件;读取所述主机配置文件,其中,所述配置文件包括所述访客设备的虚拟GPU配置参数;基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU;以及在接收到目标用户的待处理任务的情况下,通过所述通信单元1120基于所述待处理任务对应的目标虚拟GPU向所述主机发送资源分配请求,其中,所述资源分配请求用于请求所述主机为所述目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU。The processing unit 1110 is configured to: obtain a host configuration file through the communication unit 1120; read the host configuration file, where the configuration file includes virtual GPU configuration parameters of the guest device; based on the configuration file, Generate at least one available virtual GPU of the guest device; and in the case of receiving a task to be processed by a target user, send a resource allocation to the host through the communication unit 1120 based on the target virtual GPU corresponding to the task to be processed A request, wherein the resource allocation request is used to request the host to allocate a physical GPU to the target virtual GPU, and the at least one available virtual GPU includes the target virtual GPU.
本申请实施例通过读取配置文件,其中,所述配置文件包括访客设备的虚拟GPU的参数;基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU;在接收到待处理任务的情况下,通过所述通信单元基于所述待处理任务对应的目标虚拟GPU向所述主机发送资源分配请求。在本申请实施例中,不为虚拟GPU和物理GPU预先建立固定的映射关系,而是在虚拟GPU接收到任务后,向主机发送资源分配请求,以提升物理GPU的资源利用率,并提高GPU系统的整体性能。The embodiment of the application reads a configuration file, where the configuration file includes the parameters of the virtual GPU of the guest device; based on the configuration file, generates at least one available virtual GPU of the guest device; In this case, the communication unit sends a resource allocation request to the host based on the target virtual GPU corresponding to the task to be processed. In the embodiment of this application, a fixed mapping relationship is not established for the virtual GPU and the physical GPU in advance. Instead, after the virtual GPU receives the task, it sends a resource allocation request to the host to improve the resource utilization of the physical GPU and increase the GPU. The overall performance of the system.
在一种可选的实施方式中,在所述基于所述待处理任务对应的目标虚拟GPU向主机发送资源分配请求之前,所述处理单元1110还用于:基于第一资源状态表,确定所述访客设备的至少一个可用虚拟GPU中处于空闲状态的虚拟GPU,其中,所述第一资源状态表包括多个物理GPU中每个物理GPU的当前状态信息;从所述处于空闲状态的虚拟GPU中确定所述目标虚拟GPU。In an optional implementation manner, before the target virtual GPU corresponding to the task to be processed sends a resource allocation request to the host, the processing unit 1110 is further configured to: determine the resource allocation request based on the first resource state table. The virtual GPU in the idle state among the at least one available virtual GPU of the guest device, wherein the first resource state table includes current state information of each of the multiple physical GPUs; from the virtual GPU in the idle state Determine the target virtual GPU in.
在一种可选的实施方式中,所述处理单元1110还用于:接收来自于所述主机的关于所述第一资源状态表的第一更新指令,所述第一更新指令是在所述主机检测到物理GPU的任务处理状态发生变化的情况下发送的;基于所述第一更新指令,更新所述第一资源状态表。In an optional implementation manner, the processing unit 1110 is further configured to: receive a first update instruction about the first resource state table from the host, where the first update instruction is in the Sent when the host detects that the task processing state of the physical GPU has changed; based on the first update instruction, the first resource state table is updated.
在一种可选的实施方式中,所述第一更新指令携带下列信息中的至少一项:第一物理GPU的新加入的任务对应的用户信息、所述第一物理GPU的信息,所述新加入的任务对应的虚拟GPU的显存容量,被完成的任务对应的用户信息,以及所述被完成的任务对应的第二物理GPU的信息,其中,所述第一物理GPU为新加入任务的GPU,所述第二物理GPU为完成任务的GPU。In an optional implementation manner, the first update instruction carries at least one of the following information: user information corresponding to the newly added task of the first physical GPU, information of the first physical GPU, and The video memory capacity of the virtual GPU corresponding to the newly added task, the user information corresponding to the completed task, and the information of the second physical GPU corresponding to the completed task, where the first physical GPU is the newly added task GPU, the second physical GPU is a GPU that completes a task.
在一种可选的实施方式中,所述处理单元1110还用于:调度所述虚拟GPU执行所述待处理任务;接收来自所述主机的所述待处理任务的处理结果。In an optional implementation manner, the processing unit 1110 is further configured to: schedule the virtual GPU to execute the task to be processed; and receive a processing result of the task to be processed from the host.
图12是本申请又一实施例中所涉及的资源管理装置1200的功能单元组成框图。该资源管理装置1200应用于电子设备,所述电子设备包括处理单元1210和通信单元1220,其中,所述处理单元1210用于:通过所述通信单元1220接收来自访客设备的资源分配请求,所述资源分配请求携带待处理任务的信息以及目标虚拟GPU的信息;以及基于所述目标虚拟GPU的信息,为所述目标虚拟GPU分配目标物理GPU。FIG. 12 is a block diagram of functional units of a resource management device 1200 involved in another embodiment of the present application. The resource management apparatus 1200 is applied to an electronic device. The electronic device includes a processing unit 1210 and a communication unit 1220. The processing unit 1210 is configured to receive a resource allocation request from a guest device through the communication unit 1220. The resource allocation request carries information of the task to be processed and information of the target virtual GPU; and based on the information of the target virtual GPU, a target physical GPU is allocated to the target virtual GPU.
本申请实施例接收来自访客设备的资源分配请求,所述资源分配请求携带待处理任务的信息以及目标虚拟GPU的信息;以及基于所述目标虚拟GPU的信息,为所述目标虚拟GPU分配目标物理GPU。在本申请实施例中,不为虚拟GPU和物理GPU预先建立固定的映射关系,而是接收来自访客设备的资源分配请求后,动态的为虚拟GPU分配对应的物理GPU,可以灵活的基于当前任务的特点来对GPU资源进行分配,以提升物理GPU的资源利用率,并提高GPU系统的整体性能。This embodiment of the application receives a resource allocation request from a guest device, the resource allocation request carries information about the task to be processed and information about a target virtual GPU; and based on the information about the target virtual GPU, allocates a target physical to the target virtual GPU GPU. In the embodiment of this application, a fixed mapping relationship is not established for the virtual GPU and the physical GPU in advance, but after receiving the resource allocation request from the guest device, the virtual GPU is dynamically allocated the corresponding physical GPU, which can be flexibly based on the current task The characteristics of GPU resources are allocated to improve the resource utilization of the physical GPU and improve the overall performance of the GPU system.
在一种可选的实施方式中,在所述基于所述目标虚拟GPU的信息,为所述目标虚拟GPU分配目标物理GPU情况下,所述处理单元1210具体用于:基于所述目标虚拟GPU的所需显存容量,为所述目标虚拟GPU分配物理GPU。In an optional implementation manner, in the case where a target physical GPU is allocated to the target virtual GPU based on the information of the target virtual GPU, the processing unit 1210 is specifically configured to: based on the target virtual GPU The required video memory capacity is allocated to the target virtual GPU with physical GPUs.
在一种可选的实施方式中,在所述基于所述目标虚拟GPU的显存容量为所述待处理任务分配物理GPU情况下,所述处理单元1210具体用于:基于所述目标虚拟GPU的所需显存容量、资源分配策略以及第二资源状态表为所述目标虚拟GPU分配物理GPU,其中,所述第二资源状态表包括多个物理GPU中每个物理GPU的当前状态信息。In an optional implementation manner, in the case where a physical GPU is allocated to the task to be processed based on the memory capacity of the target virtual GPU, the processing unit 1210 is specifically configured to: The required video memory capacity, the resource allocation strategy, and the second resource state table allocate physical GPUs to the target virtual GPU, where the second resource state table includes current state information of each of the multiple physical GPUs.
在一种可选的实施方式中,在所述基于所述目标虚拟GPU的显存容量、所述资源分配策略以及第二资源状态表为所述目标虚拟GPU分配物理GPU情况下,所述处理单元1210具体用于:基于所述第二资源状态表,按照所述多个物理GPU的排列顺序,依次确定每个物理GPU的剩余显存容量,直到确定的剩余显存容量满足所述目标虚拟GPU的所需显存容量;将剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。In an optional implementation manner, in the case where a physical GPU is allocated to the target virtual GPU based on the video memory capacity of the target virtual GPU, the resource allocation strategy, and the second resource state table, the processing unit 1210 is specifically configured to: based on the second resource state table, determine the remaining video memory capacity of each physical GPU in sequence according to the arrangement order of the multiple physical GPUs, until the determined remaining video memory capacity meets the requirements of the target virtual GPU. Required video memory capacity; a physical GPU whose remaining video memory capacity meets the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU.
在一种可选的实施方式中,所述处理单元1210还用于,在确定所述多个物理GPU中排在最后的物理GPU的剩余显存容量不满足所述目标虚拟GPU的所需显存容量的情况下,确定所述虚拟GPU无可用物理资源。In an optional implementation manner, the processing unit 1210 is further configured to determine that the remaining video memory capacity of the physical GPU ranked last among the multiple physical GPUs does not meet the required video memory capacity of the target virtual GPU In the case of, it is determined that the virtual GPU has no available physical resources.
在一种可选的实施方式中,在所述基于所述目标虚拟GPU的显存容量、所述资源分配策略以及第二资源状态表为所述目标虚拟GPU分配物理GPU情况下,所述处理单元1210具体用于:基于所述第二资源状态表,确定目标用户当前在多个物理GPU中每个物理GPU已经分配的任务数量,以及每个物理GPU的剩余显存容量,其中,所述目标用户为所述目标虚拟GPU对应的用户;将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU的物理GPU。In an optional implementation manner, in the case where a physical GPU is allocated to the target virtual GPU based on the video memory capacity of the target virtual GPU, the resource allocation strategy, and the second resource state table, the processing unit 1210 is specifically configured to: based on the second resource state table, determine the number of tasks that the target user currently has allocated to each physical GPU among the multiple physical GPUs, and the remaining video memory capacity of each physical GPU, where the target user Is a user corresponding to the target virtual GPU; the physical GPU with the least number of tasks and remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU of the target virtual GPU.
在一种可选的实施方式中,所述处理单元1210还用于:在所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU的数量为多个的情况下,将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU中排列在最前面的物理GPU确定为所述目标虚拟GPU分配的物理GPU。In an optional implementation manner, the processing unit 1210 is further configured to: when the number of tasks is the smallest and the remaining video memory capacity meets the required video memory capacity of the target virtual GPU, there are multiple physical GPUs. Next, the physical GPU arranged at the forefront among the physical GPUs with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU.
在一种可选的实施方式中,所述处理单元1210还用于:基于为所述目标虚拟GPU所分配的物理GPU,更新所述第二资源状态表;或者,在任务处理状态发生改变的情况下,基于所述任务处理状态的变化更新所述第二资源状态表。In an optional implementation manner, the processing unit 1210 is further configured to: update the second resource state table based on the physical GPU allocated to the target virtual GPU; or, when the task processing state changes In this case, the second resource status table is updated based on the change in the task processing status.
在一种可选的实施方式中,所述处理单元1210还用于:基于多个物理GPU中每个物理GPU的任务队列,进行任务调度。In an optional implementation manner, the processing unit 1210 is further configured to perform task scheduling based on the task queue of each physical GPU in the multiple physical GPUs.
本申请实施例还提供一种计算机存储介质,其中,该计算机存储介质存储用于计算机程序,该计算机程序使得计算机执行如上述方法实施例中记载的任一方法的部分或全部步骤,上述计算机包括电子设备。The embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for use in the computer, and the computer program causes a computer to execute part or all of the steps of any method as described in the above method embodiment, and the above computer includes Electronic equipment.
本申请实施例还提供一种计算机程序产品,上述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,上述计算机程序可操作来使计算机执行如上述方法实施例中记载的任一方法的部分或全部步骤。该计算机程序产品可以为一个软件安装包,上述计算机包括电子设备。The embodiments of the present application also provide a computer program product. The above-mentioned computer program product includes a non-transitory computer-readable storage medium storing a computer program. The above-mentioned computer program is operable to cause a computer to execute any of the methods described in the above-mentioned method embodiments. Part or all of the steps of the method. The computer program product may be a software installation package, and the above-mentioned computer includes electronic equipment.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that this application is not limited by the described sequence of actions. Because according to this application, some steps can be performed in other order or at the same time. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in an embodiment, reference may be made to related descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如上述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed device may be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the above-mentioned units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or integrated. To another system, or some features can be ignored, or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical or other forms.
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described above as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
上述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储器中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例上述方法的全部或部分步骤。而前述的存储器包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。If the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable memory. Based on this understanding, the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory. A number of instructions are included to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the foregoing methods of the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储器中,存储器可以包括:闪存盘、只读存储器、随机存取存储器、磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above-mentioned embodiments can be completed by a program instructing relevant hardware. The program can be stored in a computer-readable memory, and the memory can include: a flash disk , Read-only memory, random access memory, magnetic or optical disk, etc.
以上对本申请实施例进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The embodiments of the application are described in detail above, and specific examples are used in this article to illustrate the principles and implementation of the application. The descriptions of the above embodiments are only used to help understand the methods and core ideas of the application; at the same time, for Those of ordinary skill in the art, based on the ideas of the application, will have changes in the specific implementation and the scope of application. In summary, the content of this specification should not be construed as limiting the application.

Claims (51)

  1. 一种资源管理方法,其特征在于,所述方法包括:A resource management method, characterized in that the method includes:
    读取配置文件,所述配置文件包括访客设备的虚拟图像处理单元GPU配置参数;Reading a configuration file, the configuration file including virtual image processing unit GPU configuration parameters of the guest device;
    基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU;Generating at least one available virtual GPU of the guest device based on the configuration file;
    响应于接收到目标用户的待处理任务,为所述待处理任务对应的目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU。In response to receiving the task to be processed by the target user, a physical GPU is allocated to the target virtual GPU corresponding to the task to be processed, and the at least one available virtual GPU includes the target virtual GPU.
  2. 根据权利要求1所述的方法,其特征在于,所述为所述待处理任务对应的目标虚拟GPU分配物理GPU,包括:The method according to claim 1, wherein the allocating a physical GPU to the target virtual GPU corresponding to the task to be processed comprises:
    基于所述目标虚拟GPU所需的显存容量以及资源状态表,为所述目标虚拟GPU分配物理GPU,其中,所述资源状态表包括多个物理GPU中每个物理GPU的当前状态信息。Based on the video memory capacity required by the target virtual GPU and a resource state table, physical GPUs are allocated to the target virtual GPU, where the resource state table includes current state information of each of the multiple physical GPUs.
  3. 根据权利要求2所述的方法,其特征在于,所述物理GPU的当前状态信息包括:The method according to claim 2, wherein the current state information of the physical GPU comprises:
    所述物理GPU的显存容量、与所述物理GPU已经被占用的显存对应的每个虚拟GPU的用户信息、与所述物理GPU已经被占用的显存对应的每个虚拟GPU的显存容量。The video memory capacity of the physical GPU, the user information of each virtual GPU corresponding to the video memory already occupied by the physical GPU, and the video memory capacity of each virtual GPU corresponding to the video memory already occupied by the physical GPU.
  4. 根据权利要求2或3所述的方法,其特征在于,所述基于所述目标虚拟GPU的所需显存容量以及资源状态表,为所述目标虚拟GPU分配物理GPU,包括:The method according to claim 2 or 3, wherein the allocating a physical GPU to the target virtual GPU based on the required video memory capacity and a resource state table of the target virtual GPU comprises:
    基于所述目标虚拟GPU的所需显存容量和所述资源状态表,为所述目标虚拟GPU分配物理GPU,以使得所述多个物理GPU的显存被使用最少。Based on the required video memory capacity of the target virtual GPU and the resource state table, a physical GPU is allocated to the target virtual GPU, so that the video memory of the multiple physical GPUs is used to a minimum.
  5. 根据权利要求2至4中任一项所述的方法,其特征在于,所述基于所述目标虚拟GPU所需显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU,包括:The method according to any one of claims 2 to 4, wherein the allocating a physical GPU to the target virtual GPU based on a required video memory capacity and a resource state table of the target virtual GPU comprises:
    基于所述资源状态表,按照多个物理GPU的排列顺序,依次确定每个物理GPU的剩余显存容量,直到确定的剩余显存容量满足所述目标虚拟GPU的所需显存容量;Based on the resource state table, sequentially determining the remaining video memory capacity of each physical GPU according to the arrangement order of the multiple physical GPUs, until the determined remaining video memory capacity meets the required video memory capacity of the target virtual GPU;
    将剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。A physical GPU whose remaining video memory capacity meets the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU.
  6. 根据权利要求5所述的方法,其特征在于,所述方法还包括:The method according to claim 5, wherein the method further comprises:
    在确定所述多个物理GPU中排在最后的物理GPU的剩余显存容量不满足所述目标虚拟GPU的所需显存容量的情况下,确定所述虚拟GPU无可用物理资源。In a case where it is determined that the remaining video memory capacity of the last physical GPU among the multiple physical GPUs does not meet the required video memory capacity of the target virtual GPU, it is determined that the virtual GPU has no available physical resources.
  7. 根据权利要求2或3所述的方法,其特征在于,所述基于所述目标虚拟GPU的显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU,包括:The method according to claim 2 or 3, wherein the allocating a physical GPU to the target virtual GPU based on the memory capacity and resource state table of the target virtual GPU comprises:
    基于所述目标虚拟GPU的所需显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU,以使得所述目标用户的至少一个任务被尽可能均匀地分配给所述多个物理GPU,其中,所述至少一个任务包括所述待处理任务。Allocating a physical GPU to the target virtual GPU based on the required video memory capacity and the resource state table of the target virtual GPU, so that at least one task of the target user is allocated to the multiple physical GPUs as evenly as possible, Wherein, the at least one task includes the task to be processed.
  8. 根据权利要求2、3或7所述的方法,其特征在于,所述基于所述目标虚拟GPU的显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU,包括:The method according to claim 2, 3, or 7, wherein the allocating a physical GPU to the target virtual GPU based on the memory capacity and resource state table of the target virtual GPU comprises:
    基于所述资源状态表,确定所述目标用户当前在所述多个物理GPU中每个物理GPU分配的任务数量,以及每个物理GPU的剩余显存容量;Based on the resource state table, determine the number of tasks currently allocated by each physical GPU of the multiple physical GPUs by the target user, and the remaining video memory capacity of each physical GPU;
    将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。The physical GPU with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU.
  9. 根据权利要求8所述的方法,其特征在于,所述方法还包括:The method according to claim 8, wherein the method further comprises:
    在所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU的数 量为多个的情况下,将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的多个物理GPU中排列在最前面的物理GPU确定为所述目标虚拟GPU分配的物理GPU。When the number of tasks is the smallest and the remaining video memory capacity meets the required video memory capacity of the target virtual GPU, the number of physical GPUs is multiple, the number of tasks is the least and the remaining video memory capacity meets the target virtual GPU. The physical GPU arranged at the forefront among the multiple physical GPUs with the required video memory capacity determines the physical GPU allocated to the target virtual GPU.
  10. 根据权利要求2-9任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 2-9, wherein the method further comprises:
    基于为所述目标虚拟GPU所分配的物理GPU,更新所述资源状态表;或者,Update the resource state table based on the physical GPU allocated to the target virtual GPU; or,
    在任务处理状态发生变化的情况下,基于所述任务处理状态的变化更新所述资源状态表。In the case of a change in the task processing state, the resource state table is updated based on the change in the task processing state.
  11. 一种资源管理方法,应用于访客设备,其特征在于,所述方法包括:A resource management method applied to a guest device, characterized in that the method includes:
    读取主机的配置文件,其中,所述配置文件包括所述访客设备的虚拟GPU配置参数;Reading a configuration file of the host, where the configuration file includes virtual GPU configuration parameters of the guest device;
    基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU;Generating at least one available virtual GPU of the guest device based on the configuration file;
    在接收到目标用户的待处理任务的情况下,基于所述待处理任务对应的目标虚拟GPU向主机发送资源分配请求,其中,所述资源分配请求用于请求所述主机为所述目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU。In the case of receiving the task to be processed by the target user, send a resource allocation request to the host based on the target virtual GPU corresponding to the task to be processed, wherein the resource allocation request is used to request the host to be the target virtual GPU Allocate physical GPUs, and the at least one available virtual GPU includes the target virtual GPU.
  12. 根据权利要求11所述的方法,其特征在于,在所述基于所述待处理任务对应的目标虚拟GPU向主机发送资源分配请求之前,所述方法还包括:The method according to claim 11, characterized in that, before the sending a resource allocation request to the host based on the target virtual GPU corresponding to the task to be processed, the method further comprises:
    基于资源状态表,确定所述访客设备的至少一个可用虚拟GPU中处于空闲状态的虚拟GPU,其中,所述资源状态表包括多个物理GPU中每个物理GPU的当前状态信息;Determine a virtual GPU in an idle state among at least one available virtual GPU of the guest device based on a resource state table, wherein the resource state table includes current state information of each of the multiple physical GPUs;
    从所述处于空闲状态的虚拟GPU中确定所述目标虚拟GPU。The target virtual GPU is determined from the virtual GPUs in the idle state.
  13. 根据权利要求12所述的方法,其特征在于,所述方法还包括:The method according to claim 12, wherein the method further comprises:
    接收来自于所述主机的对所述第一资源状态表的第一更新指令,所述第一更新指令是在所述主机检测到至少一个物理GPU的任务处理状态发生变化的情况下发送的;Receiving a first update instruction for the first resource state table from the host, the first update instruction being sent when the host detects that the task processing state of at least one physical GPU has changed;
    基于所述第一更新指令,更新所述第一资源状态表。Based on the first update instruction, the first resource status table is updated.
  14. 根据权利要求13所述的方法,其特征在于,The method of claim 13, wherein:
    所述至少一个物理GPU包括具有新加入的任务的第一物理GPU,所述第一更新指令携带下列信息中的至少一项:所述第一物理GPU的新加入的任务对应的用户信息、所述第一物理GPU的信息,所述新加入的任务对应的虚拟GPU的显存容量;和/或The at least one physical GPU includes a first physical GPU with a newly added task, and the first update instruction carries at least one of the following information: user information corresponding to the newly added task of the first physical GPU, and The information of the first physical GPU, the video memory capacity of the virtual GPU corresponding to the newly added task; and/or
    所述至少一个物理GPU包括具有新完成的任务的第二物理GPU,所述第一更新指令携带下列中的至少一项:所述新完成的任务对应的用户信息,以及所述第二物理GPU的信息。The at least one physical GPU includes a second physical GPU with a newly completed task, and the first update instruction carries at least one of the following: user information corresponding to the newly completed task, and the second physical GPU Information.
  15. 根据权利要求11-14任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 11-14, wherein the method further comprises:
    调度所述虚拟GPU执行所述待处理任务;Scheduling the virtual GPU to execute the task to be processed;
    接收来自所述主机的所述待处理任务的处理结果。Receiving the processing result of the to-be-processed task from the host.
  16. 一种资源管理方法,应用于主机,其特征在于,所述方法包括:A resource management method applied to a host, characterized in that the method includes:
    接收来自访客设备的资源分配请求,所述资源分配请求携带待处理任务的信息以及目标虚拟GPU的信息;Receiving a resource allocation request from the guest device, the resource allocation request carrying information of the task to be processed and information of the target virtual GPU;
    基于所述目标虚拟GPU的信息,为所述目标虚拟GPU分配目标物理GPU。Based on the information of the target virtual GPU, a target physical GPU is allocated to the target virtual GPU.
  17. 根据权利要求16所述的方法,其特征在于,所述基于所述目标虚拟GPU的信息,为所述目标虚拟GPU分配目标物理GPU,包括:The method according to claim 16, wherein the allocating a target physical GPU to the target virtual GPU based on the information of the target virtual GPU comprises:
    基于所述目标虚拟GPU的所需显存容量,为所述目标虚拟GPU分配物理GPU。Based on the required video memory capacity of the target virtual GPU, a physical GPU is allocated to the target virtual GPU.
  18. 根据权利要求17所述的方法,其特征在于,所述基于所述目标虚拟GPU的显存容量为所述目标虚拟GPU分配物理GPU,包括:The method according to claim 17, wherein the allocating a physical GPU to the target virtual GPU based on the memory capacity of the target virtual GPU comprises:
    基于所述目标虚拟GPU的所需显存容量、资源分配策略以及资源状态表为所述目标虚拟GPU分配物理GPU,其中,所述资源状态表包括多个物理GPU中每个物理GPU的当前状态信息。Allocate physical GPUs to the target virtual GPU based on the required video memory capacity, resource allocation strategy, and resource state table of the target virtual GPU, where the resource state table includes current state information of each of the multiple physical GPUs .
  19. 根据权利要求18所述的方法,其特征在于,所述基于所述目标虚拟GPU的显存容量、所述资源分配策略以及资源状态表为所述目标虚拟GPU分配物理GPU,包括:The method according to claim 18, wherein the allocating a physical GPU to the target virtual GPU based on the memory capacity of the target virtual GPU, the resource allocation strategy, and the resource state table comprises:
    基于所述第二资源状态表,按照所述多个物理GPU的排列顺序,依次确定每个物理GPU的剩余显存容量,直到确定的剩余显存容量满足所述目标虚拟GPU的所需显存容量;Based on the second resource state table, sequentially determining the remaining video memory capacity of each physical GPU according to the arrangement order of the multiple physical GPUs until the determined remaining video memory capacity meets the required video memory capacity of the target virtual GPU;
    将剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。A physical GPU whose remaining video memory capacity meets the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU.
  20. 根据权利要19所述的方法,其特征在于,在确定所述多个物理GPU中排在最后的物理GPU的剩余显存容量不满足所述目标虚拟GPU的所需显存容量的情况下,确定所述虚拟GPU无可用物理资源。The method according to claim 19, wherein when it is determined that the remaining video memory capacity of the last physical GPU among the plurality of physical GPUs does not meet the required video memory capacity of the target virtual GPU, determining all The virtual GPU has no available physical resources.
  21. 根据权利要求18所述的方法,其特征在于,所述基于所述目标虚拟GPU的显存容量、所述资源分配策略以及第二资源状态表为所述目标虚拟GPU分配物理GPU,包括:The method of claim 18, wherein the allocating a physical GPU to the target virtual GPU based on the memory capacity of the target virtual GPU, the resource allocation strategy, and a second resource state table comprises:
    基于所述第二资源状态表,确定目标用户当前在多个物理GPU中每个物理GPU已经分配的任务数量,以及每个物理GPU的剩余显存容量,其中,所述目标用户为所述目标虚拟GPU对应的用户;Based on the second resource state table, determine the number of tasks that the target user currently has allocated to each physical GPU among the multiple physical GPUs, and the remaining video memory capacity of each physical GPU, where the target user is the target virtual The user corresponding to the GPU;
    将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU的物理GPU。The physical GPU with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU of the target virtual GPU.
  22. 根据权利要求21所述的方法,其特征在于,所述方法还包括:The method according to claim 21, wherein the method further comprises:
    在所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU的数量为多个的情况下,将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU中排列在最前面的物理GPU确定为所述目标虚拟GPU分配的物理GPU。When the number of tasks is the smallest and the remaining video memory capacity meets the required video memory capacity of the target virtual GPU, the number of physical GPUs is multiple, the number of tasks is the least and the remaining video memory capacity meets the target virtual GPU. The physical GPU arranged at the forefront among the physical GPUs with the required video memory capacity determines the physical GPU allocated to the target virtual GPU.
  23. 根据权利要求16-22任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 16-22, wherein the method further comprises:
    基于为所述目标虚拟GPU所分配的物理GPU,更新所述第二资源状态表;或者,Update the second resource state table based on the physical GPU allocated to the target virtual GPU; or,
    在任务处理状态发生变化的情况下,基于所述任务处理状态的变化更新所述第二资源状态表。In the case of a change in the task processing state, the second resource state table is updated based on the change in the task processing state.
  24. 根据权利要求16-23任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 16-23, wherein the method further comprises:
    基于多个物理GPU中每个物理GPU的任务队列,进行任务调度。Task scheduling is performed based on the task queue of each physical GPU among multiple physical GPUs.
  25. 一种资源管理装置,其特征在于,包括通信单元和处理单元,其中,A resource management device, which is characterized by comprising a communication unit and a processing unit, wherein:
    所述处理单元用于:The processing unit is used for:
    通过所述通信单元获取配置文件;Obtaining a configuration file through the communication unit;
    读取所述配置文件,所述配置文件包括访客设备的虚拟图像处理单元GPU配置参数;Reading the configuration file, where the configuration file includes GPU configuration parameters of the virtual image processing unit of the guest device;
    基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU;Generating at least one available virtual GPU of the guest device based on the configuration file;
    以及响应于接收到目标用户的待处理任务,为所述待处理任务对应的目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU。And in response to receiving the to-be-processed task of the target user, a physical GPU is allocated to the target virtual GPU corresponding to the to-be-processed task, and the at least one available virtual GPU includes the target virtual GPU.
  26. 根据权利要求25所述的装置,其特征在于,在所述为所述待处理任务对应的目标虚拟GPU分配物理GPU情况下,所述处理单元具体用于:The apparatus according to claim 25, wherein, in the case where a physical GPU is allocated to the target virtual GPU corresponding to the task to be processed, the processing unit is specifically configured to:
    基于所述目标虚拟GPU所需的显存容量以及资源状态表,为所述目标虚拟GPU分配物理GPU,其中,所述资源状态表包括多个物理GPU中每个物理GPU的当前状态信息。Based on the video memory capacity required by the target virtual GPU and a resource state table, physical GPUs are allocated to the target virtual GPU, where the resource state table includes current state information of each of the multiple physical GPUs.
  27. 根据权利要求26所述的装置,其特征在于,所述物理GPU的当前状态信息包括:The device of claim 26, wherein the current state information of the physical GPU comprises:
    所述物理GPU的显存容量、与所述物理GPU已经被占用的显存对应的每个虚拟GPU的用户信息、与所述物理GPU已经被占用的显存对应的每个虚拟GPU的显存容量。The video memory capacity of the physical GPU, the user information of each virtual GPU corresponding to the video memory already occupied by the physical GPU, and the video memory capacity of each virtual GPU corresponding to the video memory already occupied by the physical GPU.
  28. 根据权利要求26或27所述的装置,其特征在于,在所述基于所述目标虚拟GPU的所需显存容量以及资源状态表,为所述目标虚拟GPU分配物理GPU情况下,所述处理单元具体用于:The device according to claim 26 or 27, wherein, in the case where a physical GPU is allocated to the target virtual GPU based on the required video memory capacity and the resource state table of the target virtual GPU, the processing unit Specifically used for:
    基于所述目标虚拟GPU的所需显存容量和所述资源状态表,为所述目标虚拟GPU分配物理GPU,以使得所述多个物理GPU的显存被使用最少。Based on the required video memory capacity of the target virtual GPU and the resource state table, a physical GPU is allocated to the target virtual GPU, so that the video memory of the multiple physical GPUs is used to a minimum.
  29. 根据权利要求26至28中任一项所述的装置,其特征在于,在所述基于所述目标虚拟GPU所需显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU情况下,所述处理单元具体用于:The device according to any one of claims 26 to 28, wherein, in the case of assigning a physical GPU to the target virtual GPU based on the required video memory capacity and resource state table of the target virtual GPU, The processing unit is specifically used for:
    基于所述资源状态表,按照多个物理GPU的排列顺序,依次确定每个物理GPU的剩余显存容量,直到确定的剩余显存容量满足所述目标虚拟GPU的所需显存容量;Based on the resource state table, sequentially determining the remaining video memory capacity of each physical GPU according to the arrangement order of the multiple physical GPUs, until the determined remaining video memory capacity meets the required video memory capacity of the target virtual GPU;
    将剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。A physical GPU whose remaining video memory capacity meets the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU.
  30. 根据权利要求29所述的装置,其特征在于,所述处理单元还用于:The device according to claim 29, wherein the processing unit is further configured to:
    在确定所述多个物理GPU中排在最后的物理GPU的剩余显存容量不满足所述目标虚拟GPU的所需显存容量的情况下,确定所述虚拟GPU无可用物理资源。In a case where it is determined that the remaining video memory capacity of the last physical GPU among the multiple physical GPUs does not meet the required video memory capacity of the target virtual GPU, it is determined that the virtual GPU has no available physical resources.
  31. 根据权利要求26或27所述的装置,其特征在于,在所述基于所述目标虚拟GPU的显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU情况下,所述处理单元具体用于:The device according to claim 26 or 27, wherein, in the case where a physical GPU is allocated to the target virtual GPU based on the display memory capacity and resource state table of the target virtual GPU, the processing unit specifically uses in:
    基于所述目标虚拟GPU的所需显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU,以使得所述目标用户的至少一个任务被尽可能均匀地分配给所述多个物理GPU,其中,所述至少一个任务包括所述待处理任务。Allocating a physical GPU to the target virtual GPU based on the required video memory capacity and the resource state table of the target virtual GPU, so that at least one task of the target user is allocated to the multiple physical GPUs as evenly as possible, Wherein, the at least one task includes the task to be processed.
  32. 根据权利要求26、27或31所述的装置,其特征在于,在所述基于所述目标虚拟GPU的显存容量和资源状态表,为所述目标虚拟GPU分配物理GPU情况下,所述处理单元具体用于:The device according to claim 26, 27, or 31, wherein, in the case where a physical GPU is allocated to the target virtual GPU based on the display memory capacity and resource state table of the target virtual GPU, the processing unit Specifically used for:
    基于所述资源状态表,确定所述目标用户当前在所述多个物理GPU中每个物理GPU分配的任务数量,以及每个物理GPU的剩余显存容量;Based on the resource state table, determine the number of tasks currently allocated by each physical GPU of the multiple physical GPUs by the target user, and the remaining video memory capacity of each physical GPU;
    将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。The physical GPU with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU.
  33. 根据权利要求32所述的装置,其特征在于,所述处理单元还用于:The device according to claim 32, wherein the processing unit is further configured to:
    在所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU的数量为多个的情况下,将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的多个物理GPU中排列在最前面的物理GPU确定为所述目标虚拟GPU分配的物理GPU。In the case that there are multiple physical GPUs with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU, the number of tasks is the least and the remaining video memory capacity meeting the target virtual GPU's The physical GPU arranged at the forefront among the multiple physical GPUs with the required video memory capacity determines the physical GPU allocated to the target virtual GPU.
  34. 根据权利要求26-33任一项所述的装置,其特征在于,所述处理单元还用于:The device according to any one of claims 26-33, wherein the processing unit is further configured to:
    基于为所述目标虚拟GPU所分配的物理GPU,更新所述资源状态表;或者,Update the resource state table based on the physical GPU allocated to the target virtual GPU; or,
    在任务处理状态发生变化的情况下,基于所述任务处理状态的变化更新所述资源状态表。In the case of a change in the task processing state, the resource state table is updated based on the change in the task processing state.
  35. 一种资源管理装置,其特征在于,包括通信单元和处理单元,其中,A resource management device, which is characterized by comprising a communication unit and a processing unit, wherein:
    所述处理单元用于:The processing unit is used for:
    通过所述通信单元获取主机配置文件;Obtaining a host configuration file through the communication unit;
    读取所述主机配置文件,其中,所述配置文件包括访客设备的虚拟GPU配置参数;Reading the host configuration file, where the configuration file includes virtual GPU configuration parameters of the guest device;
    基于所述配置文件,生成所述访客设备的至少一个可用虚拟GPU;Generating at least one available virtual GPU of the guest device based on the configuration file;
    以及在接收到目标用户的待处理任务的情况下,通过所述通信单元基于所述待处理任务对应的目标虚拟GPU向所述主机发送资源分配请求,其中,所述资源分配请求用于请求所述主机为所述目标虚拟GPU分配物理GPU,所述至少一个可用虚拟GPU包括所述目标虚拟GPU。And in the case of receiving the task to be processed by the target user, the communication unit sends a resource allocation request to the host based on the target virtual GPU corresponding to the task to be processed, wherein the resource allocation request is used to request all The host allocates a physical GPU to the target virtual GPU, and the at least one available virtual GPU includes the target virtual GPU.
  36. 根据权利要求35所述的装置,其特征在于,在所述基于所述待处理任务对应的目标虚拟 GPU向主机发送资源分配请求之前,所述处理单元还用于:The apparatus according to claim 35, wherein before the target virtual GPU corresponding to the task to be processed sends a resource allocation request to the host, the processing unit is further configured to:
    基于第一资源状态表,确定所述访客设备的至少一个可用虚拟GPU中处于空闲状态的虚拟GPU,其中,所述第一资源状态表包括多个物理GPU中每个物理GPU的当前状态信息;Determine a virtual GPU in an idle state among at least one available virtual GPU of the guest device based on a first resource state table, where the first resource state table includes current state information of each of the multiple physical GPUs;
    从所述处于空闲状态的虚拟GPU中确定所述目标虚拟GPU。The target virtual GPU is determined from the virtual GPUs in the idle state.
  37. 根据权利要求36所述的装置,其特征在于,所述处理单元还用于:The device according to claim 36, wherein the processing unit is further configured to:
    接收来自于所述主机的关于所述第一资源状态表的第一更新指令,所述第一更新指令是在所述主机检测到物理GPU的任务处理状态发生变化的情况下发送的;Receiving a first update instruction regarding the first resource state table from the host, the first update instruction being sent when the host detects a change in the task processing state of a physical GPU;
    基于所述第一更新指令,更新所述第一资源状态表。Based on the first update instruction, the first resource status table is updated.
  38. 根据权利要求37所述的装置,其特征在于,所述至少一个物理GPU包括具有新加入的任务的第一物理GPU,所述第一更新指令携带下列信息中的至少一项:所述第一物理GPU的新加入的任务对应的用户信息、所述第一物理GPU的信息,所述新加入的任务对应的虚拟GPU的显存容量;和/或The device according to claim 37, wherein the at least one physical GPU comprises a first physical GPU with a newly added task, and the first update instruction carries at least one of the following information: the first The user information corresponding to the newly added task of the physical GPU, the information of the first physical GPU, the video memory capacity of the virtual GPU corresponding to the newly added task; and/or
    所述至少一个物理GPU包括具有新完成的任务的第二物理GPU,所述第一更新指令携带下列中的至少一项:所述新完成的任务对应的用户信息,以及所述第二物理GPU的信息。The at least one physical GPU includes a second physical GPU with a newly completed task, and the first update instruction carries at least one of the following: user information corresponding to the newly completed task, and the second physical GPU Information.
  39. 根据权利要求35-38任一项所述的装置,其特征在于,所述处理单元还用于:The device according to any one of claims 35-38, wherein the processing unit is further configured to:
    调度所述虚拟GPU执行所述待处理任务;Scheduling the virtual GPU to execute the task to be processed;
    接收来自所述主机的所述待处理任务的处理结果。Receiving the processing result of the to-be-processed task from the host.
  40. 一种资源管理装置,其特征在于,包括通信单元和处理单元,其中,A resource management device, which is characterized by comprising a communication unit and a processing unit, wherein:
    所述处理单元用于:The processing unit is used for:
    通过所述通信单元接收来自访客设备的资源分配请求,所述资源分配请求携带待处理任务的信息以及目标虚拟GPU的信息;Receiving, through the communication unit, a resource allocation request from the guest device, the resource allocation request carrying information of the task to be processed and information of the target virtual GPU;
    以及基于所述目标虚拟GPU的信息,为所述目标虚拟GPU分配目标物理GPU。And based on the information of the target virtual GPU, a target physical GPU is allocated to the target virtual GPU.
  41. 根据权利要求40所述的装置,其特征在于,在所述基于所述目标虚拟GPU的信息,为所述目标虚拟GPU分配目标物理GPU情况下,所述处理单元具体用于:The apparatus according to claim 40, wherein, in the case where a target physical GPU is allocated to the target virtual GPU based on the information of the target virtual GPU, the processing unit is specifically configured to:
    基于所述目标虚拟GPU的所需显存容量,为所述目标虚拟GPU分配物理GPU。Based on the required video memory capacity of the target virtual GPU, a physical GPU is allocated to the target virtual GPU.
  42. 根据权利要求41所述的装置,其特征在于,在所述基于所述目标虚拟GPU的显存容量为所述目标虚拟GPU分配物理GPU情况下,所述处理单元具体用于:The device according to claim 41, wherein, in the case of allocating a physical GPU to the target virtual GPU based on the memory capacity of the target virtual GPU, the processing unit is specifically configured to:
    基于所述目标虚拟GPU的所需显存容量、资源分配策略以及第二资源状态表为所述目标虚拟GPU分配物理GPU,其中,所述第二资源状态表包括多个物理GPU中每个物理GPU的当前状态信息。Allocate physical GPUs to the target virtual GPU based on the required video memory capacity, resource allocation strategy, and a second resource state table of the target virtual GPU, where the second resource state table includes each of the multiple physical GPUs The current status information of.
  43. 根据权利要求42所述的装置,其特征在于,在所述基于所述目标虚拟GPU的显存容量、所述资源分配策略以及第二资源状态表为所述目标虚拟GPU分配物理GPU情况下,所述处理单元具体用于:The device according to claim 42, wherein in the case where the target virtual GPU is allocated a physical GPU based on the memory capacity of the target virtual GPU, the resource allocation strategy, and the second resource state table, The processing unit is specifically used for:
    基于所述第二资源状态表,按照所述多个物理GPU的排列顺序,依次确定每个物理GPU的剩余显存容量,直到确定的剩余显存容量满足所述目标虚拟GPU的所需显存容量;Based on the second resource state table, sequentially determining the remaining video memory capacity of each physical GPU according to the arrangement order of the multiple physical GPUs until the determined remaining video memory capacity meets the required video memory capacity of the target virtual GPU;
    将剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU分配的物理GPU。A physical GPU whose remaining video memory capacity meets the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU.
  44. 根据权利要43所述的装置,其特征在于,所述处理单元还用于,在确定所述多个物理GPU中排在最后的物理GPU的剩余显存容量不满足所述目标虚拟GPU的所需显存容量的情况下,确定所述虚拟GPU无可用物理资源。The device according to claim 43, wherein the processing unit is further configured to determine that the remaining video memory capacity of the physical GPU ranked last among the multiple physical GPUs does not meet the requirements of the target virtual GPU In the case of video memory capacity, it is determined that the virtual GPU has no available physical resources.
  45. 根据权利要求42所述的装置,其特征在于,在所述基于所述目标虚拟GPU的显存容量、所述资源分配策略以及第二资源状态表为所述目标虚拟GPU分配物理GPU情况下,所述处理单元具体用于:The device according to claim 42, wherein in the case where the target virtual GPU is allocated a physical GPU based on the memory capacity of the target virtual GPU, the resource allocation strategy, and the second resource state table, The processing unit is specifically used for:
    基于所述第二资源状态表,确定目标用户当前在多个物理GPU中每个物理GPU已经分配的任务数量,以及每个物理GPU的剩余显存容量,其中,所述目标用户为所述目标虚拟GPU对应的用户;Based on the second resource state table, determine the number of tasks that the target user currently has allocated to each physical GPU among the multiple physical GPUs, and the remaining video memory capacity of each physical GPU, where the target user is the target virtual The user corresponding to the GPU;
    将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU确定为所述目标虚拟GPU的物理GPU。The physical GPU with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU of the target virtual GPU.
  46. 根据权利要求45所述的装置,其特征在于,所述处理单元还用于:在所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU的数量为多个的情况下,将所述任务数量最少且剩余显存容量满足所述目标虚拟GPU的所需显存容量的物理GPU中排列在最前面的物理GPU确定为所述目标虚拟GPU分配的物理GPU。The device according to claim 45, wherein the processing unit is further configured to: when the number of tasks is the smallest and the remaining video memory capacity meets the required video memory capacity of the target virtual GPU, the number of physical GPUs is multiple In the case of, the physical GPU arranged at the forefront among the physical GPUs with the least number of tasks and the remaining video memory capacity meeting the required video memory capacity of the target virtual GPU is determined as the physical GPU allocated by the target virtual GPU.
  47. 根据权利要求40-46任一项所述的装置,其特征在于,所述处理单元还用于:The device according to any one of claims 40-46, wherein the processing unit is further configured to:
    基于为所述目标虚拟GPU所分配的物理GPU,更新所述第二资源状态表;或者,Update the second resource state table based on the physical GPU allocated to the target virtual GPU; or,
    在任务处理状态发生改变的情况下,基于所述任务处理状态的变化更新所述第二资源状态表。In the case of a change in the task processing state, the second resource state table is updated based on the change in the task processing state.
  48. 根据权利要求40-47任一项所述的装置,其特征在于,所述处理单元还用于:The device according to any one of claims 40-47, wherein the processing unit is further configured to:
    基于多个物理GPU中每个物理GPU的任务队列,进行任务调度。Task scheduling is performed based on the task queue of each physical GPU among multiple physical GPUs.
  49. 一种资源管理系统,包括:A resource management system, including:
    主机和访客设备,其中,所述主机上设置有多个物理GPU;Host and guest devices, where multiple physical GPUs are provided on the host;
    所述访客设备为如权利要求35-39任一项所述装置;The visitor equipment is the device according to any one of claims 35-39;
    所述主机为如权利要求40-48任一项所述装置。The host is the device according to any one of claims 40-48.
  50. 一种电子设备,其特征在于,包括处理器以及存储器,所述存储器用于存储计算机程序,所述计算机程序被配置成由所述处理器执行,以使所述处理器执行如权利要求1-10任一项或11-15任一项或16-24任一项所述的方法。An electronic device, characterized by comprising a processor and a memory, the memory is used to store a computer program, the computer program is configured to be executed by the processor, so that the processor executes according to claim 1- The method according to any one of 10 or any one of 11-15 or any one of 16-24.
  51. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质用于存储计算机程序,其中,所述计算机程序使得计算机执行如权利要求1-10任一项或11-15任一项或16-24任一项所述的方法。A computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, wherein the computer program causes a computer to execute any one of claims 1-10 or any one of claims 11-15 Or the method described in any one of 16-24.
PCT/CN2020/093491 2019-11-20 2020-05-29 Resource management method and apparatus, electronic device and storage medium WO2021098182A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2021537951A JP2022516486A (en) 2019-11-20 2020-05-29 Resource management methods and equipment, electronic devices, and recording media
KR1020217020283A KR20210095690A (en) 2019-11-20 2020-05-29 Resource management method and apparatus, electronic device and recording medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911153197.1A CN112825042A (en) 2019-11-20 2019-11-20 Resource management method and device, electronic equipment and storage medium
CN201911153197.1 2019-11-20

Publications (1)

Publication Number Publication Date
WO2021098182A1 true WO2021098182A1 (en) 2021-05-27

Family

ID=75906499

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/093491 WO2021098182A1 (en) 2019-11-20 2020-05-29 Resource management method and apparatus, electronic device and storage medium

Country Status (5)

Country Link
JP (1) JP2022516486A (en)
KR (1) KR20210095690A (en)
CN (1) CN112825042A (en)
TW (1) TWI748530B (en)
WO (1) WO2021098182A1 (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114579319A (en) * 2022-05-07 2022-06-03 北京象帝先计算技术有限公司 Video memory management method, video memory management module, SOC and electronic equipment
CN115437781A (en) * 2022-06-30 2022-12-06 北京九章云极科技有限公司 GPU resource management method and system
CN115499388A (en) * 2022-08-30 2022-12-20 阿里巴巴(中国)有限公司 Virtual host resource allocation method, device, equipment and storage medium
CN116188240A (en) * 2022-12-28 2023-05-30 摩尔线程智能科技(北京)有限责任公司 GPU virtualization method and device for container and electronic equipment
CN116755843A (en) * 2023-08-17 2023-09-15 摩尔线程智能科技(北京)有限责任公司 Virtual resource creation method and device, electronic equipment, chip and storage medium
WO2023173954A1 (en) * 2022-03-15 2023-09-21 北京有竹居网络技术有限公司 Data acquisition method and apparatus, storage medium, and electronic device

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115220911A (en) * 2022-06-17 2022-10-21 中科驭数(北京)科技有限公司 Resource management method, device, equipment and medium
CN115373860B (en) * 2022-10-26 2023-01-10 小米汽车科技有限公司 Scheduling method, device and equipment of GPU (graphics processing Unit) tasks and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102819460A (en) * 2012-08-07 2012-12-12 清华大学 Budget power guidance-based high-energy-efficiency GPU (Graphics Processing Unit) cluster system scheduling algorithm
CN107533463A (en) * 2015-03-18 2018-01-02 英特尔公司 Apparatus and method for the unknowable more GPU processing of software
US20180293776A1 (en) * 2017-04-07 2018-10-11 Intel Corporation Apparatus and method for efficient graphics virtualization
CN109766179A (en) * 2017-11-09 2019-05-17 阿里巴巴集团控股有限公司 A kind of video memory distribution method and device
CN110389825A (en) * 2018-04-20 2019-10-29 伊姆西Ip控股有限责任公司 Manage method, equipment and the computer program product of dedicated processes resource

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9727385B2 (en) * 2011-07-18 2017-08-08 Apple Inc. Graphical processing unit (GPU) implementing a plurality of virtual GPUs
CN102725736B (en) * 2011-12-31 2014-03-12 华为技术有限公司 Picture display method and system based on virtualization technology
JP5839119B2 (en) * 2012-05-11 2016-01-06 富士通株式会社 Information processing apparatus, battery remaining amount notification method, and battery remaining amount notification program
US20150009222A1 (en) * 2012-11-28 2015-01-08 Nvidia Corporation Method and system for cloud based virtualized graphics processing for remote displays
US9142004B2 (en) * 2012-12-20 2015-09-22 Vmware, Inc. Dynamic allocation of physical graphics processing units to virtual machines
CN107807840B (en) * 2016-09-09 2022-01-25 阿里巴巴集团控股有限公司 Equipment direct connection method and device applied to virtual machine network
US10176550B1 (en) * 2017-03-20 2019-01-08 Nutanix, Inc. GPU resource usage display and dynamic GPU resource allocation in a networked virtualization system
US10304421B2 (en) * 2017-04-07 2019-05-28 Intel Corporation Apparatus and method for remote display and content protection in a virtualized graphics processing environment
CN108984264B (en) * 2017-06-02 2022-11-15 阿里巴巴集团控股有限公司 Virtual GPU (graphics processing Unit) implementation method, device and system
US11720408B2 (en) * 2018-05-08 2023-08-08 Vmware, Inc. Method and system for assigning a virtual machine in virtual GPU enabled systems
CN109766183A (en) * 2018-12-28 2019-05-17 郑州云海信息技术有限公司 A kind of method and system of cluster GPU multiplexing and intelligent load
CN110196753A (en) * 2019-01-21 2019-09-03 腾讯科技(北京)有限公司 Graphics processor GPU vitualization method, apparatus and readable medium based on container

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102819460A (en) * 2012-08-07 2012-12-12 清华大学 Budget power guidance-based high-energy-efficiency GPU (Graphics Processing Unit) cluster system scheduling algorithm
CN107533463A (en) * 2015-03-18 2018-01-02 英特尔公司 Apparatus and method for the unknowable more GPU processing of software
US20180293776A1 (en) * 2017-04-07 2018-10-11 Intel Corporation Apparatus and method for efficient graphics virtualization
CN109766179A (en) * 2017-11-09 2019-05-17 阿里巴巴集团控股有限公司 A kind of video memory distribution method and device
CN110389825A (en) * 2018-04-20 2019-10-29 伊姆西Ip控股有限责任公司 Manage method, equipment and the computer program product of dedicated processes resource

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023173954A1 (en) * 2022-03-15 2023-09-21 北京有竹居网络技术有限公司 Data acquisition method and apparatus, storage medium, and electronic device
CN114579319A (en) * 2022-05-07 2022-06-03 北京象帝先计算技术有限公司 Video memory management method, video memory management module, SOC and electronic equipment
CN114579319B (en) * 2022-05-07 2022-07-19 北京象帝先计算技术有限公司 Video memory management method, video memory management module, SOC and electronic equipment
CN115437781A (en) * 2022-06-30 2022-12-06 北京九章云极科技有限公司 GPU resource management method and system
CN115437781B (en) * 2022-06-30 2023-10-31 北京九章云极科技有限公司 GPU resource management method and system
CN115499388A (en) * 2022-08-30 2022-12-20 阿里巴巴(中国)有限公司 Virtual host resource allocation method, device, equipment and storage medium
CN115499388B (en) * 2022-08-30 2024-04-12 阿里巴巴(中国)有限公司 Virtual host resource allocation method, device, equipment and storage medium
CN116188240A (en) * 2022-12-28 2023-05-30 摩尔线程智能科技(北京)有限责任公司 GPU virtualization method and device for container and electronic equipment
CN116188240B (en) * 2022-12-28 2024-04-05 摩尔线程智能科技(北京)有限责任公司 GPU virtualization method and device for container and electronic equipment
CN116755843A (en) * 2023-08-17 2023-09-15 摩尔线程智能科技(北京)有限责任公司 Virtual resource creation method and device, electronic equipment, chip and storage medium
CN116755843B (en) * 2023-08-17 2023-12-19 摩尔线程智能科技(北京)有限责任公司 Virtual resource creation method and device, electronic equipment, chip and storage medium

Also Published As

Publication number Publication date
CN112825042A (en) 2021-05-21
JP2022516486A (en) 2022-02-28
KR20210095690A (en) 2021-08-02
TW202121407A (en) 2021-06-01
TWI748530B (en) 2021-12-01

Similar Documents

Publication Publication Date Title
WO2021098182A1 (en) Resource management method and apparatus, electronic device and storage medium
US10901802B2 (en) Method and apparatus for implementing virtual GPU and system
TWI479422B (en) Computer system and graphics processing method therefore
US11093297B2 (en) Workload optimization system
JP5510556B2 (en) Method and system for managing virtual machine storage space and physical hosts
TWI696952B (en) Resource processing method and device
US9063783B2 (en) Coordinating parallel execution of processes using agents
US20150371355A1 (en) Host-Based Heterogeneous Multi-GPU Assignment
US20100115510A1 (en) Virtual graphics device and methods thereof
KR20120017411A (en) Priority-based management of system load level
JP2015530660A (en) Dynamic partitioning technology for physical memory
CN112148422A (en) IO processing method and device
EP3748508A1 (en) Memory management in virtualized computing
CN113419846B (en) Resource allocation method and device, electronic equipment and computer readable storage medium
CN109712060B (en) Cloud desktop display card sharing method and system based on GPU container technology
JP2008107966A (en) Computer system
CN114816777A (en) Command processing device, method, electronic device and computer readable storage medium
JP2009181249A (en) Virtual machine server, virtual machine system, virtual machine distribution method and program for use in the same
JP2018190355A (en) Resource management method
WO2023020177A1 (en) Task scheduling method, game engine, device and storage medium
CN113268356B (en) LINUX system-based multi-GPU board card bounding system, method and medium
WO2013021441A1 (en) Data processing system and data processing method
EP4260185A1 (en) System and method for performing workloads using composed systems
WO2023231768A1 (en) Multi-core processor and related inter-core communication method
US11954534B2 (en) Scheduling in a container orchestration system utilizing hardware topology hints

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2021537951

Country of ref document: JP

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 20217020283

Country of ref document: KR

Kind code of ref document: A

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20889691

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20889691

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 20889691

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 09.11.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20889691

Country of ref document: EP

Kind code of ref document: A1