TW202121407A - 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
TW202121407A
TW202121407A TW109121468A TW109121468A TW202121407A TW 202121407 A TW202121407 A TW 202121407A TW 109121468 A TW109121468 A TW 109121468A TW 109121468 A TW109121468 A TW 109121468A TW 202121407 A TW202121407 A TW 202121407A
Authority
TW
Taiwan
Prior art keywords
gpu
virtual gpu
physical
target virtual
memory capacity
Prior art date
Application number
TW109121468A
Other languages
Chinese (zh)
Other versions
TWI748530B (en
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 大陸商上海商湯智能科技有限公司
Publication of TW202121407A publication Critical patent/TW202121407A/en
Application granted granted Critical
Publication of TWI748530B publication Critical patent/TWI748530B/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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

Examples of the present application disclose a resource management method and apparatus, an electronic device, and a storage medium. The method includes: reading a configuration file, where the configuration file includes a configuration parameter of a virtual GPU in a guest device; generating at least one available virtual GPU in the guest device based on the configuration file; in response to receiving a to-be-processed task from a target client, allocating a physical GPU to a target virtual GPU corresponding to the to-be-processed task, where the at least one available virtual GPU includes the target virtual GPU.

Description

資源管理方法和裝置、電子設備及記錄媒體Resource management method and device, electronic equipment and recording medium

本申請涉及電腦技術領域,具體涉及一種資源管理方法和裝置、電子設備及記錄媒體。This application relates to the field of computer technology, in particular to a resource management method and device, electronic equipment and recording media.

隨著圖像處理單元(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 virtual GPUs to improve the parallelism of applications and the resource utilization efficiency of GPU clusters.

本申請實施例提供了一種資源管理分配方法和裝置、電子設備及記錄媒體。The embodiments of the present application provide a method and device for resource management and allocation, electronic equipment, and recording media.

本申請實施例第一方面提供一種資源管理分配方法,包括:讀取配置文件,所述配置文件包括訪客設備的虛擬圖像處理單元(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 virtual image processing unit (GPU) configuration parameters of the guest device; generating the visitor based on the configuration file At least one available virtual GPU of the device; 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. Allocating physical GPUs, wherein the resource state table includes current state information of each physical GPU in the plurality of 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 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 of the target virtual GPU and the resource state table includes: based on the required video memory capacity of the target virtual GPU With the resource state table, physical GPUs are allocated 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 resource state table of the target virtual GPU includes: based on the resource state table, according to multiple physical GPUs The order of arrangement, the remaining video memory capacity of each physical GPU is determined 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 physical memory capacity of the target virtual GPU The GPU determines the physical GPU allocated to the target virtual GPU.

在一種可選的實施方式中,所述方法還包括:在確定所述多個物理GPU中排在最後的物理GPU的剩餘顯存容量不滿足所述目標虛擬GPU的所需顯存容量的情況下,確定所述虛擬GPU無可用物理資源。In an optional implementation manner, the method further includes: in a case where 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 and resources of the target virtual GPU The state table 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 task to be processed .

在一種可選的實施方式中,所述基於所述目標虛擬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 status table of the target virtual GPU includes: determining the current target user based on the resource status table The number of tasks allocated by each physical GPU in the plurality of physical GPUs, and the remaining video memory capacity of each physical GPU; the minimum number of tasks and the remaining video memory capacity meet the required video memory capacity of the target virtual GPU The 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 more than one. 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.

在一種可選的實施方式中,所述方法還包括:基於為所述目標虛擬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 change of task processing status updates the resource status table.

第二方面,本申請實施例提供一種資源管理分配方法,應用於訪客設備,包括:讀取主機的配置文件,其中,所述配置文件包括所述訪客設備的虛擬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 configuration File, 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 resource The 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 at least one of the guest devices based on the resource status table A virtual GPU in an idle state among the available virtual GPUs, wherein the resource state table includes current state information of each of the multiple physical GPUs; the target virtual GPU is determined from the virtual GPU in the idle state.

在一種可選的實施方式中,所述方法還包括:接收來自於所述主機的關於所述資源狀態表的第一更新指令,所述第一更新指令是在所述主機檢測到物理GPU的任務處理狀態發生變化的情況下發送的;基於所述第一更新指令,更新所述資源狀態表。In an optional implementation manner, the method further includes: receiving a first update instruction on the resource state table from the host, where the first update instruction is when a physical GPU is detected on the host Sent when the task processing status changes; based on the first update instruction, the resource status 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: User information corresponding to the added task, 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 a second physical with a newly completed task GPU, the first update command 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 target 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 about the task to be processed and information about 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 virtual GPU to the target virtual GPU based on the required video memory capacity of the target virtual GPU. The GPU allocates physical GPUs.

在一種可選的實施方式中,所述基於所述目標虛擬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, resource allocation strategy, and resource status of the target virtual GPU The table allocates physical GPUs to the target virtual GPU, wherein the resource state table includes current state information of each physical GPU among 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 video memory capacity of the target virtual GPU, the resource allocation strategy, and the resource state table includes: based on the resource state table, according to The sequence of the multiple 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; and the remaining video memory capacity meets the target virtual GPU’s The physical GPU with the required video memory capacity 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 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 memory capacity. Available physical resources.

在一種可選的實施方式中,所述基於所述目標虛擬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 video memory capacity of the target virtual GPU, the resource allocation strategy, and the resource state table includes: determining based on the resource state table The target user’s current number of tasks allocated by each physical GPU among multiple physical GPUs, and the remaining video memory capacity of each physical GPU, where the target user is the user corresponding to the target virtual GPU; and the number of tasks The physical GPU with the least 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 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 more than one. 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 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 change of task processing status updates the resource status table.

在一種可選的實施方式中,所述方法還包括:基於多個物理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 multiple physical GPUs are provided on the host, the guest device includes a virtual machine or a container; the guest device is used for : 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 file Including virtual image processing unit (GPU) configuration parameters of the guest device; generating at least one available virtual GPU of the guest device based on the configuration file; 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.

第六方面,本申請實施例提供一種資源管理裝置,包括通訊單元和處理單元,其中,所述處理單元用於:通過所述通訊單元獲取主機配置文件;讀取所述主機配置文件,其中,所述配置文件包括訪客設備的虛擬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 when the task to be processed by the target user is received, the communication unit 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 allocate a physical GPU to the target virtual GPU, and the at least one available virtual GPU Including 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, and 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;所述訪客設備為本申請實施例第六方面任一項的裝置;所述主機為本申請實施例第七方面任一項的裝置。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 according to any one of the sixth aspects of the embodiments of the present application ; 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 storage device, the storage device is used to store a computer program, the computer program is configured to be executed by the processor, so that the processor executes Any method described in the first aspect, the second aspect, or the third aspect of the embodiments of the present application.

第十方面,本申請實施例提供了一種電腦可讀取記錄媒體,其中,上述電腦可讀取記錄媒體用於儲存電腦程式,其中,上述電腦程式使得電腦執行如本申請實施例第一方面、第二方面或第三方面中所述的任一方法。In a tenth aspect, an embodiment of the present application provides a computer-readable recording medium, wherein the computer-readable recording medium is used to store a computer program, wherein the computer program enables the computer to execute the first aspect, Any of the methods described in the second or third aspect.

第十一方面,本申請實施例提供了一種電腦程式產品,其中,上述電腦程式產品包括儲存了電腦程式的非暫態電腦可讀取記錄媒體,上述電腦程式可操作來使電腦執行如本申請實施例第一方面、第二方面或第三方面中所述的任一方法。該電腦程式產品可以為一個軟體安裝包。In an eleventh aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable recording medium storing a computer program, and the computer program is operable to make the computer execute the application Embodiments any one of the methods described in the first aspect, the second aspect, or the third aspect. The computer program product can 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.

為讓本發明的上述特徵和優點能更明顯易懂,下文特舉實施例,並配合所附圖式作詳細說明如下。In order to make the above-mentioned features and advantages of the present invention more comprehensible, the following specific embodiments are described in detail in conjunction with the accompanying drawings.

下面將結合本申請實施例中的附圖,對本申請實施例中的技術方案進行清楚、完整地描述。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 that describes associated objects, indicating that there can be three types of relationships, for example, A and/or B, which can mean: A alone exists, A and B exist at the same time, exist alone B these three situations. 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, and may mean including those formed from A, B, and C. Any one or more elements selected in the set. The terms "first", "second", etc. in the description of the application, the scope of the patent application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "include" and "have" and any variations of them are intended to cover non-exclusive inclusion. 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.

在本文中提及「實施例」意味著,結合實施例描述的特定特徵、結構或特性可以包含在本申請的至少一個實施例中。在說明書中的各個位置出現該短語並不一定均是指相同的實施例,也不是與其它實施例互斥的獨立的或備選的實施例。本領域技術人員顯式地和隱式地理解的是,本文所描述的實施例可以與其它實施例相結合。The 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 distribution device involved in the embodiments of the present application is a device that can perform resource management and distribution, 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 display and/or touch pad) other portable devices such as mobile phones, laptops or tablets. It should also be understood that, in some embodiments, the device is not a portable communication device, but a desktop computer with a touch-sensitive surface (for example, a touch screen display and/or a touch pad), a servo器等。

圖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 are forwarded so that tasks on the guest device 101 can be transparently operated using the physical GPU of the host.

在本申請實施例提供的資源管理系統中,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(vGPUs)124與物理GPU(pGPU)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 this 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 a virtual machine (Virtual Machine, VM) of the guest device, where there may be multiple virtual machines, such as virtual machines 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 memory capacity of each virtual GPU, the use time of each virtual GPU, and the size of each virtual GPU time slice Then, 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 software level is virtually allocated to the virtual GPU information observed by the user; when the user on the VM When the task 123 that uses GPU resources is started, the virtual machine sends out a request to initialize GPU information. At this time, the VM will establish a connection with the Host, and establish virtual GPUs (vGPUs) 124 and physical GPUs (vGPUs) through the virtual GPU-physical GPU resource allocation strategy 130. pGPU) 140 actual association. 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 One or more of the virtual GPU time slice size, etc.

可選的,所述配置文件可以是系統預設的,也可以是根據用戶的需求生成的。Optionally, the configuration file may be preset by the system or generated according to the needs of the user.

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 can 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 to the user for viewing. For example, after generating at least one available virtual GPU, the user can view the number of virtual GPUs on the guest device through the user device, as well as the memory capacity of each virtual GPU, the usage time of each virtual GPU, and the Parameters such as the size of a virtual GPU time slice. 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 to-be-processed tasks are processed in the physical GPU allocated by the host, and the processing results are 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: setting the target virtual GPU to the target virtual GPU based on the required video memory capacity and the resource state table of the target virtual GPU Allocate 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 corresponding to the video memory occupied by the physical GPU in each physical GPU, and each The video memory capacity of each virtual GPU corresponding to the video memory that has been occupied by a physical GPU. Alternatively, 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, and the video memory capacity of each physical GPU may be derived based on the current state information. Information such as the video memory capacity of each virtual GPU corresponding to the video memory already occupied by the physical GPU. Optionally, the aforementioned current state information may also include a task identifier of each virtual GPU in each physical GPU corresponding to the video memory that the physical GPU has 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 資源狀態表 pGPU1-ID pGPU1顯存容量 pGPU1剩餘顯存容量 vGPU1-ID vGPU1顯存容量 User-ID1 任務標識1 …… vGPU2-ID vGPU2顯存容量 User-ID2 任務標識2 …… vGPU3-ID vGPU3顯存容量 User-ID1 任務標識1 …… vGPU4-ID vGPU4顯存容量 User-ID3 任務標識3 …… …. …… …. …… …… pGPU2-ID pGPU2顯存容量 pGPU2剩餘顯存容量 vGPUn-ID vGPUn-ID顯存容量 User-ID5 任務標識5 …… vGPUn+1-ID vGPUn+1-ID 顯存容量 User-ID8 任務標識8 …… …… …… …… …… …… …… …… …… …… …… …… Table 1 Resource status table pGPU1-ID pGPU1 memory capacity pGPU1 remaining video memory capacity vGPU1-ID vGPU1 memory capacity User-ID1 Task ID 1 ... vGPU2-ID vGPU2 memory capacity User-ID2 Task ID 2 ... vGPU3-ID vGPU3 memory capacity User-ID1 Task ID 1 ... vGPU4-ID vGPU4 memory capacity User-ID3 Task ID 3 ... .... ... .... ... ... pGPU2-ID pGPU2 memory capacity pGPU2 remaining video memory capacity vGPUn-ID vGPUn-ID video memory capacity User-ID5 Task ID 5 ... vGPUn+1-ID vGPUn+1-ID video memory capacity User-ID8 Task ID 8 ... ... ... ... ... ... ... ... ... ... ... ...

在具體實現中,在接收到上述待處理任務並確定目標虛擬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 above 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, a resource state table, and a resource allocation strategy includes: based on the resource state table, according to multiple physical GPUs 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. 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 ID number order of the physical GPUs, or according to the location information of the physical GPUs in the host, and can also be arranged 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 aforementioned target virtual GPU, it is determined that the virtual GPU has no available physical resources.

圖3為本申請實施例提供的一種資源最少管理分配策略的架構圖。其中,帶標號的陰影矩形表示待處理任務,矩形中的標號表示任務產生的先後順序,VPT表示資源狀態表,pGPU、pGPU1表示物理GPU,vGPU、vGPU2表示虛擬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 task is generated, VPT indicates the resource state table, pGPU, pGPU1 indicate physical GPU, vGPU, vGPU2 indicate virtual GPU, as can be seen from the architecture diagram Tasks are assigned to the physical GPUs arranged in front in the order of their generation.

在本申請實施例中,在確定目標虛擬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 the target virtual GPU based on the resource state table The target user's current number of tasks allocated by each physical GPU 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 the smallest and the remaining The physical GPU whose 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 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、pGPU1表示物理GPU,vGPU、vGPU2表示虛擬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 state table, pGPU, pGPU1 indicate physical GPU, vGPU, vGPU2 indicate virtual GPU, as can be seen from the architecture diagram Tasks with the same user ID 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 executed and completed in the multiple physical GPUs, the resource state table is updated based on the executed tasks.

具體的,可以通過執行完任務的物理GPU-ID、被執行完的任務對應的虛擬GPU的ID對上述資源狀態表中上述執行完任務的物理GPU的資訊進行更新。Specifically, the information of the physical GPU that has completed the task in the resource state table can be updated through the physical GPU-ID of the completed task and the ID of the virtual GPU corresponding to the completed task.

圖5是本申請另一實施例公開的一種資源管理分配方法的流程示意圖,應用於訪客設備,如圖5所示,該資源管理分配方法包括如下步驟。FIG. 5 is a schematic flowchart of a resource management 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 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 the 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 sending a resource allocation request to the host based on the target virtual GPU corresponding to the task to be processed, the method further includes: based on the number of virtual GPUs in the guest device and the resource status table Determine the number of unused virtual GPUs of the guest device, and the resource state table includes information about the current usage status of each physical GPU; The target virtual GPU is determined from the used virtual GPUs.

其中,該資源狀態表中包含的資訊可以可選地與圖2中的資源狀態表包含的資訊一致,此處不再贅述。Wherein, the information contained in the resource status table may optionally be consistent with the information contained in the resource status table in FIG. 2, and will not be repeated here.

可選的,所述方法還包括:接收關於所述資源狀態表的第一更新指令,所述第一更新指令是所述主機在檢測到物理GPU的任務處理狀態發生變化的情況下發送的;基於所述第一更新指令,更新所述資源狀態表。其中,任務處理狀態發生變化可以是物理GPU加入了新的任務或有任務被完成。Optionally, the method further includes: receiving a first update instruction regarding the 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, the resource status table is updated. 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, 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 command 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 target 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 and allocation method disclosed in another embodiment of the present application, which is applied to a host. As shown in FIG. 6, the resource management and 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 aforementioned 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 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: assigning a physical GPU to the target virtual GPU based on the required video memory capacity of the target virtual GPU, a resource allocation strategy, and a resource state table. The GPU allocates physical GPUs, wherein the resource state table includes current state information of each physical GPU in the plurality of 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 resource state table can refer to the "based on the target virtual GPU" in Figure 2. The required video memory capacity of the 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 "resource status table" in the embodiment of the present application corresponds to the "resource status" in the "resource status for the target virtual GPU based on the required video memory capacity and resource status table of the target virtual GPU" in Figure 2 above. table". In an example, the resource state table of the host may be called the second resource state table, and the resource state table of the guest device may be called the first resource state table, and the second resource state table is the same as the first resource state 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 when the second resource status table is updated, 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 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 task The resource status table is updated with the change of processing status. Based on the physical GPU allocated to the target virtual GPU, the 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, information of the allocated physical GPU, and The video memory capacity of the virtual GPU corresponding to the newly added task is described. When the task processing state changes, the 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的資源利用率,並提高系統的整體性能。This embodiment of the application first receives a resource allocation request from a guest device, the resource allocation request carries information about the task to be processed and the 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 the 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 storage device 720, and a communication device. Interface 730 and physical GPU 740. The one or more programs 721 are stored in the storage device 720 and are configured to be executed by the 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 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 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 capacity required by the target virtual GPU And a resource state table for assigning physical GPUs to the target virtual GPU, wherein 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 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, physical GPUs are allocated 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 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: 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.

在一種可選的實施方式中,所述程式中的指令還用於執行以下操作:在確定所述多個物理GPU中排在最後的物理GPU的剩餘顯存容量不滿足所述目標虛擬GPU的所需顯存容量的情況下,確定所述虛擬GPU無可用物理資源。In an optional implementation manner, the instructions in the program are also 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 where the video memory capacity is required, 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 pending task.

在一種可選的實施方式中,所述基於所述目標虛擬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 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.

在一種可選的實施方式中,所述程式中的指令還用於執行以下操作:在所述任務數量最少且剩餘顯存容量滿足所述目標虛擬GPU的所需顯存容量的物理GPU的數量為多個的情況下,將所述任務數量最少且剩餘顯存容量滿足所述目標虛擬GPU的所需顯存容量的多個物理GPU中排列在最前面的物理GPU確定為所述目標虛擬GPU分配的物理GPU。In an optional implementation manner, the instructions in the program are also 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 greater. In the case of one, 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,更新所述資源狀態表;或者,在任務處理狀態發生變化的情況下,基於所述任務處理狀態的變化更新所述資源狀態表。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, when the task processing state changes In the case of updating the resource status table based on the change of the task processing status.

與上述圖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 storage device 820 and a communication interface 830. The one or more programs 821 are stored in the storage device 820 and are configured to be executed by the 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, at least one available virtual GPU of the guest device is generated; 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: determine based on the resource status table The virtual GPU in the idle state among the at least one available virtual GPU of the guest device, wherein the 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.

在一種可選的實施方式中,所述程式中的指令還用於執行以下操作:接收來自於所述主機的關於所述資源狀態表的第一更新指令,所述第一更新指令是在所述主機檢測到物理GPU的任務處理狀態發生變化的情況下發送的;基於所述第一更新指令,更新所述資源狀態表。In an optional implementation manner, the instructions in the program are also used to perform the following operations: receiving a first update instruction on the resource status table from the host, where the first update instruction is Sent when the host detects that the task processing state of the physical GPU has changed; based on the first update instruction, the 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 newly added task of the first physical GPU corresponds to User 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 The update command 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 target virtual GPU to execute the task to be processed; and receiving the processing result of the task to be processed 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 storage device 920, a communication interface 930, and a physical GPU 940. The one or more programs 921 are stored in the storage device 920 and are configured to be executed by the 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 the 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系統的整體性能。The 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 the 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 is allocated to the target virtual GPU with physical GPUs.

在一種可選的實施方式中,所述基於所述目標虛擬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 video memory capacity of the target virtual GPU, and the instructions in the program are specifically used to perform the following operations: The required video memory capacity, the resource allocation strategy, and the resource state table allocate physical GPUs to the target virtual GPU, wherein the 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 target virtual GPU is allocated a physical GPU based on the memory capacity of the target virtual GPU, the resource allocation strategy, and the resource state table, and the instructions in the program are specifically used to execute The following operations: based on the 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 meets the required video memory capacity of the target virtual 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.

在一種可選的實施方式中,所述程式中的指令還用於執行以下操作,在確定所述多個物理GPU中排在最後的物理GPU的剩餘顯存容量不滿足所述目標虛擬GPU的所需顯存容量的情況下,確定所述虛擬GPU無可用物理資源。In an optional implementation manner, the instructions in the program are also used to perform the following operations, in determining that the remaining 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 where the video memory capacity is required, 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 a physical GPU to the target virtual GPU based on the video memory capacity of the target virtual GPU, the resource allocation strategy, and the resource state table, the instructions in the program are specifically used To perform the following operations: based on the 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 all The user corresponding to the target virtual GPU; 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 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 also 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 greater. In the case of one, 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.

在一種可選的實施方式中,所述程式中的指令還用於執行以下操作:基於為所述目標虛擬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, when the task processing state changes In the case of updating the resource status table based on the change of the task processing status.

在一種可選的實施方式中,所述程式中的指令還用於執行以下操作:基於多個物理GPU中每個物理GPU的任務佇列,進行任務調度。In an optional implementation manner, the instructions in the program are also used to perform the following operations: perform task scheduling based on the task queue of each physical GPU in 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 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 of assigning a physical GPU 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 The resource state table allocates physical GPUs to the target virtual GPU, wherein 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 each physical GPU includes: the video memory capacity of the physical GPU, the user information of each virtual GPU corresponding to the video memory occupied by the physical GPU, and the physical GPU The video memory capacity of each virtual GPU corresponding to the video memory that the GPU has already occupied.

在一種可選的實施方式中,在所述基於所述目標虛擬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: The required video memory capacity and resource state table of the target virtual GPU allocates physical GPUs to the target virtual GPU, so that the video memory of the multiple physical GPUs is used at 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: According to the resource state table, the remaining video memory capacity of each physical GPU is determined in turn 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; The physical GPU with 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 this case, 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 state table of the target virtual GPU, and the physical GPU is 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情況下,所述處理單元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 the The physical GPU with 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. , Determining the foremost physical GPU among the plurality of 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 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, The resource status table is updated based on the change in 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 electronic equipment, and the electronic equipment 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 guest device based on the resource status table A virtual GPU in an idle state among at least one of the available virtual GPUs, wherein the resource state table includes current state information of each physical GPU in a plurality of physical GPUs; the target is determined from the virtual GPU in the idle state Virtual GPU.

在一種可選的實施方式中,所述處理單元1110還用於:接收來自於所述主機的關於所述資源狀態表的第一更新指令,所述第一更新指令是在所述主機檢測到物理GPU的任務處理狀態發生變化的情況下發送的;基於所述第一更新指令,更新所述資源狀態表。In an optional implementation manner, the processing unit 1110 is further configured to: receive a first update instruction regarding the 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 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 new The video memory capacity of the virtual GPU corresponding to the 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 GPU newly added to the task , The second physical GPU is a GPU that completes the task.

在一種可選的實施方式中,所述處理單元1110還用於:調度所述目標虛擬GPU執行所述待處理任務;接收來自所述主機的所述待處理任務的處理結果。In an optional implementation manner, the processing unit 1110 is further configured to: schedule the target 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 the functional unit composition 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, and 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 visitor 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系統的整體性能。The 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 the 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 the 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: For the required video memory capacity, physical GPUs are allocated to the target virtual GPU.

在一種可選的實施方式中,在所述基於所述目標虛擬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, resource allocation strategy, and resource state table allocate 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情況下,所述處理單元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 resource state table, the processing unit 1210 specifically uses Yu: Based on the 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 required video memory capacity of the target virtual GPU; 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.

在一種可選的實施方式中,所述處理單元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 this case, 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 resource state table, the processing unit 1210 specifically uses Yu: Based on the resource status table, determine the number of tasks that the target user currently has allocated to each physical GPU among 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; 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.

在一種可選的實施方式中,所述處理單元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. , Determining 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 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 resource state table based on the physical GPU allocated to the target virtual GPU; or, when the task processing state changes, The 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.

本申請實施例還提供一種電腦可讀取記錄媒體,其中,該電腦可讀取記錄媒體儲存用於電腦程式,該電腦程式使得電腦執行如上述方法實施例中記載的任一方法的部分或全部步驟,上述電腦包括電子設備。An embodiment of the present application also provides a computer-readable recording medium, wherein the computer-readable recording medium stores a computer program for use, and the computer program enables the computer to execute part or all of any of the methods described in the above-mentioned method embodiments Step, the above-mentioned computer includes electronic equipment.

本申請實施例還提供一種電腦程式產品,上述電腦程式產品包括儲存了電腦程式的非暫態電腦可讀取記錄媒體,上述電腦程式可操作來使電腦執行如上述方法實施例中記載的任一方法的部分或全部步驟。該電腦程式產品可以為一個軟體安裝包,上述電腦包括電子設備。An embodiment of the application also provides a computer program product. The computer program product includes a non-transitory computer-readable recording medium storing a computer program, and the computer program is operable to cause the computer to execute any of the methods described in the foregoing method embodiments. Part or all of the steps of the method. The computer program product may be a software installation package, and the 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 emphasis. 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 merely 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 into 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 separated, 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 realized either in the form of hardware or in the form of software functional unit.

上述整合的單元如果以軟體功能單元的形式實現並作為獨立的產品銷售或使用時,可以儲存在一個電腦可讀取儲存裝置中。基於這樣的理解,本申請的技術方案本質上或者說對現有技術做出貢獻的部分或者該技術方案的全部或部分可以以軟體產品的形式體現出來,該電腦軟體產品儲存在一個儲存裝置中,包括若干指令用以使得一台電腦設備(可為個人電腦、伺服器或者網路設備等)執行本申請各個實施例上述方法的全部或部分步驟。而前述的儲存裝置包括:隨身碟、唯讀記憶體(ROM,Read-Only Memory)、隨機存取記憶體(RAM,Random Access Memory)、隨身硬碟、磁碟或者光碟等各種可以儲存程式碼的介質。If the above-mentioned integrated unit is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage device. 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 storage device. 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 above-mentioned methods in each embodiment of the present application. The aforementioned storage devices include: flash drives, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), flash drives, magnetic disks, or optical disks, etc., which can store program codes Medium.

本領域普通技術人員可以理解上述實施例的各種方法中的全部或部分步驟是可以通過程式來指令相關的硬體來完成,該程式可以儲存於一電腦可讀儲存裝置中,儲存裝置可以包括:快閃記憶體、唯讀記憶體、隨機存取記憶體、磁碟或光碟等。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 instructing relevant hardware through a program. The program can be stored in a computer-readable storage device. The storage device can include: Flash memory, read-only memory, random access memory, floppy disk or CD-ROM, 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 idea 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 a limitation to the application.

110-1, 110-n:虛擬機 101:訪客設備 102:主機 121:配置文件 122:虛擬GPU鏡像 123:任務 124, vGPU, vGPU2:虛擬GPU 130:虛擬GPU-物理GPU資源分配策略 140, pGPU, pGPU1:物理GPU 201~203, 501~503, 601~602:步驟 VPT:資源狀態表 700, 800, 900:電子設備 710, 810, 910:處理器 720, 820, 920:儲存裝置 721, 821, 921:一個或多個程式 730, 830, 930:通訊介面 740, 940:物理GPU 1000, 1100, 1200:資源管理裝置 1010, 1110, 1210:處理單元 1020, 1120, 1220:通訊單元110-1, 110-n: virtual machine 101: Guest device 102: host 121: configuration file 122: virtual GPU mirroring 123: Task 124, vGPU, vGPU2: virtual GPU 130: Virtual GPU-Physical GPU resource allocation strategy 140, pGPU, pGPU1: physical GPU 201~203, 501~503, 601~602: steps VPT: Resource Status Table 700, 800, 900: electronic equipment 710, 810, 910: Processor 720, 820, 920: storage device 721, 821, 921: One or more programs 730, 830, 930: communication interface 740, 940: Physical GPU 1000, 1100, 1200: resource management device 1010, 1110, 1210: processing unit 1020, 1120, 1220: communication unit

圖1是本申請實施例提供的一種資源管理系統示意圖。 圖2是本申請實施例公開的一種資源管理分配方法的流程示意圖。 圖3是本申請實施例提供的一種資源最少管理分配策略的架構圖。 圖4是本申請實施例提供的一種負載均衡分配策略的架構圖。 圖5是本申請另一實施例公開的一種資源管理分配方法的流程示意圖。 圖6是本申請又一實施例公開的一種資源管理分配方法的流程示意圖。 圖7是本申請實施例提供的一種電子設備的結構示意圖。 圖8是本申請另一實施例提供的一種電子設備的結構示意圖。 圖9是本申請又一實施例提供的一種電子設備的結構示意圖。 圖10是本申請實施例中所涉及的一種資源管理裝置的功能單元組成方塊圖。 圖11是本申請另一實施例中所涉及的一種資源管理裝置的功能單元組成方塊圖。 圖12是本申請又一實施例中所涉及的一種資源管理裝置的功能單元組成方塊圖。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 a structural 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 resource management and allocation method disclosed in another embodiment of the present application. Fig. 6 is a schematic flowchart of a resource management and allocation method 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 the functional unit composition of a resource management device involved in another embodiment of the present application. FIG. 12 is a block diagram of the functional unit composition of a resource management device involved in another embodiment of the present application.

201~203:步驟201~203: Steps

Claims (18)

一種資源管理方法,所述方法包括: 讀取配置文件,所述配置文件包括訪客設備的虛擬圖像處理單元(GPU)配置參數; 基於所述配置文件,生成所述訪客設備的至少一個可用虛擬GPU;以及 響應於接收到目標用戶的待處理任務,為所述待處理任務對應的目標虛擬GPU分配物理GPU,所述至少一個可用虛擬GPU包括所述目標虛擬GPU。A resource management method, the method includes: Reading a configuration file, the configuration file including virtual image processing unit (GPU) configuration parameters of the guest device; Generating at least one available virtual GPU of the guest device based on the configuration file; and 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. 如請求項1所述的方法,其中為所述待處理任務對應的所述目標虛擬GPU分配所述物理GPU的步驟包括: 基於所述目標虛擬GPU的所需顯存容量以及資源狀態表,為所述目標虛擬GPU分配所述物理GPU,其中,所述資源狀態表包括多個物理GPU中每個所述多個物理GPU的當前狀態資訊。The method according to claim 1, wherein the step of allocating the 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, the physical GPU is allocated to the target virtual GPU, wherein the resource state table includes the information of each of the multiple physical GPUs. Current status information. 如請求項2所述的方法,其中基於所述目標虛擬GPU的所需顯存容量以及所述資源狀態表,為所述目標虛擬GPU分配所述物理GPU的步驟包括: 基於所述目標虛擬GPU的所需顯存容量和所述資源狀態表,為所述目標虛擬GPU分配所述物理GPU,以使得所述多個物理GPU的顯存被使用最少。The method according to claim 2, wherein the step of allocating the physical GPU to the target virtual GPU based on the required video memory capacity of the target virtual GPU and the resource state table includes: Based on the required video memory capacity of the target virtual GPU and the resource state table, the physical GPU is allocated to the target virtual GPU, so that the video memory of the multiple physical GPUs is used at a minimum. 如請求項2至3中任一項所述的方法,其中基於所述目標虛擬GPU所需顯存容量和所述資源狀態表,為所述目標虛擬GPU分配所述物理GPU的步驟包括: 基於所述資源狀態表,按照所述多個物理GPU的排列順序,依次確定每個所述多個物理GPU的剩餘顯存容量,直到確定的剩餘顯存容量滿足所述目標虛擬GPU的所需顯存容量;以及 將剩餘顯存容量滿足所述目標虛擬GPU的所需顯存容量的物理GPU確定為所述目標虛擬GPU分配的所述物理GPU。The method according to any one of claims 2 to 3, wherein the step of allocating the physical GPU to the target virtual GPU based on the required video memory capacity of the target virtual GPU and the resource state table includes: Based on the resource state table, according to the arrangement order of the multiple physical GPUs, determine the remaining video memory capacity of each of the multiple physical GPUs in turn until the determined remaining video memory capacity meets the required video memory capacity of the target virtual GPU ;as well as 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. 如請求項2所述的方法,其中基於所述目標虛擬GPU的所需顯存容量和所述資源狀態表,為所述目標虛擬GPU分配所述物理GPU的步驟包括: 基於所述目標虛擬GPU的所需顯存容量和所述資源狀態表,為所述目標虛擬GPU分配所述物理GPU,以使得所述目標用戶的至少一個任務被盡可能均勻地分配給所述多個物理GPU,其中,所述至少一個任務包括所述待處理任務。The method according to claim 2, wherein the step of allocating the physical GPU to the target virtual GPU based on the required video memory capacity of the target virtual GPU and the resource state table includes: Based on the required video memory capacity of the target virtual GPU and the resource state table, the physical GPU is allocated to the target virtual GPU, so that at least one task of the target user is allocated to the multiple tasks as evenly as possible. A physical GPU, wherein the at least one task includes the task to be processed. 如請求項2或5所述的方法,其中基於所述目標虛擬GPU的所需顯存容量和所述資源狀態表,為所述目標虛擬GPU分配所述物理GPU步驟包括: 基於所述資源狀態表,確定所述目標用戶當前在所述多個物理GPU中每個所述多個物理GPU分配的任務數量,以及每個所述多個物理GPU的剩餘顯存容量;以及 將所述任務數量最少且剩餘顯存容量滿足所述目標虛擬GPU的所需顯存容量的物理GPU確定為所述目標虛擬GPU分配的所述物理GPU。The method according to claim 2 or 5, wherein the step of allocating the physical GPU to the target virtual GPU based on the required video memory capacity of the target virtual GPU and the resource state table includes: Based on the resource status table, determine the number of tasks currently allocated by the target user to each of the multiple physical GPUs in the multiple physical GPUs, and the remaining video memory capacity of each of the multiple physical GPUs; and 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. 一種資源管理方法,應用於訪客設備,所述方法包括: 讀取主機的配置文件,其中,所述配置文件包括所述訪客設備的虛擬GPU配置參數; 基於所述配置文件,生成所述訪客設備的至少一個可用虛擬GPU;以及 在接收到目標用戶的待處理任務的情況下,基於所述待處理任務對應的目標虛擬GPU向所述主機發送資源分配請求,其中,所述資源分配請求用於請求所述主機為所述目標虛擬GPU分配物理GPU,所述至少一個可用虛擬GPU包括所述目標虛擬GPU。A resource management method applied to a visitor device, the method includes: Reading a configuration file of the host, where the configuration file includes virtual GPU configuration parameters of the guest device; Generating at least one available virtual GPU of the guest device based on the configuration file; and In the case of receiving the task to be processed by the target user, based on the target virtual GPU corresponding to the task to be processed, a resource allocation request is sent to the host, 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. 如請求項7所述的方法,其中在所述基於所述待處理任務對應的所述目標虛擬GPU向所述主機發送所述資源分配請求的步驟之前,所述方法還包括: 基於資源狀態表,確定所述訪客設備的至少一個可用虛擬GPU中處於空閒狀態的虛擬GPU,其中,所述資源狀態表包括多個物理GPU中每個所述多個物理GPU的當前狀態資訊;以及 從所述處於空閒狀態的虛擬GPU中確定所述目標虛擬GPU。The method according to claim 7, wherein before the step of sending the resource allocation request to the host based on the target virtual GPU corresponding to the task to be processed, the method further includes: Determine the virtual GPU in the idle state among the at least one available virtual GPU of the guest device based on the resource state table, wherein the resource state table includes current state information of each of the multiple physical GPUs; as well as The target virtual GPU is determined from the virtual GPUs in the idle state. 如請求項7或8所述的方法,其中所述方法還包括: 調度所述目標虛擬GPU執行所述待處理任務;以及 接收來自所述主機的所述待處理任務的處理結果。The method according to claim 7 or 8, wherein the method further includes: Scheduling the target virtual GPU to execute the task to be processed; and Receiving the processing result of the to-be-processed task from the host. 一種資源管理方法,應用於主機,所述方法包括: 接收來自訪客設備的資源分配請求,所述資源分配請求攜帶待處理任務的資訊以及目標虛擬GPU的資訊;以及 基於所述目標虛擬GPU的資訊,為所述目標虛擬GPU分配目標物理GPU。A resource management method, applied to a host, and the method includes: Receiving a resource allocation request from the guest device, the resource allocation request carrying information about the task to be processed and information about 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. 如請求項10所述的方法,其中基於所述目標虛擬GPU的資訊,為所述目標虛擬GPU分配所述目標物理GPU的步驟包括: 基於所述目標虛擬GPU的所需顯存容量、資源分配策略以及資源狀態表為所述目標虛擬GPU分配所述物理GPU,其中,所述資源狀態表包括多個物理GPU中每個所述多個物理GPU的當前狀態資訊。The method according to claim 10, wherein the step of allocating the target physical GPU to the target virtual GPU based on the information of the target virtual GPU includes: The physical GPU is allocated to the target virtual GPU based on the required video memory capacity, resource allocation strategy, and resource state table of the target virtual GPU, wherein the resource state table includes each of the plurality of physical GPUs. The current status information of the physical GPU. 如請求項11所述的方法,其中基於所述目標虛擬GPU的所需顯存容量、所述資源分配策略以及所述資源狀態表為所述目標虛擬GPU分配所述物理GPU的步驟包括: 基於所述資源狀態表,按照所述多個物理GPU的排列順序,依次確定每個所述多個物理GPU的剩餘顯存容量,直到確定的剩餘顯存容量滿足所述目標虛擬GPU的所需顯存容量;以及 將剩餘顯存容量滿足所述目標虛擬GPU的所需顯存容量的物理GPU確定為所述目標虛擬GPU分配的所述物理GPU。The method according to claim 11, wherein the step of allocating the physical GPU to the target virtual GPU based on the required video memory capacity of the target virtual GPU, the resource allocation strategy, and the resource state table includes: Based on the resource state table, according to the arrangement order of the multiple physical GPUs, determine the remaining video memory capacity of each of the multiple physical GPUs in turn until the determined remaining video memory capacity meets the required video memory capacity of the target virtual GPU ;as well as 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. 如請求項11所述的方法,其中基於所述目標虛擬GPU的所需顯存容量、所述資源分配策略以及所述資源狀態表為所述目標虛擬GPU分配所述物理GPU的步驟包括: 基於所述資源狀態表,確定目標用戶當前在所述多個物理GPU中每個所述多個物理GPU已經分配的任務數量,以及每個所述多個物理GPU的剩餘顯存容量,其中,所述目標用戶為所述目標虛擬GPU對應的用戶;以及 將所述任務數量最少且剩餘顯存容量滿足所述目標虛擬GPU的所需顯存容量的物理GPU確定為所述目標虛擬GPU的所述物理GPU。The method according to claim 11, wherein the step of allocating the physical GPU to the target virtual GPU based on the required video memory capacity of the target virtual GPU, the resource allocation strategy, and the resource state table includes: Based on the resource state table, determine the number of tasks that the target user currently has allocated to each of the multiple physical GPUs in the multiple physical GPUs, and the remaining video memory capacity of each of the multiple physical GPUs, where all The target user is a user corresponding to the target virtual GPU; and The physical GPU with the smallest 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. 一種資源管理裝置,包括通訊單元和處理單元,其中,所述處理單元用於: 通過所述通訊單元獲取配置文件; 讀取所述配置文件,所述配置文件包括訪客設備的虛擬圖像處理單元(GPU)配置參數; 基於所述配置文件,生成所述訪客設備的至少一個可用虛擬GPU;以及 響應於接收到目標用戶的待處理任務,為所述待處理任務對應的目標虛擬GPU分配物理GPU,所述至少一個可用虛擬GPU包括所述目標虛擬GPU。A resource management device includes a communication unit and a processing unit, wherein the processing unit is used for: Obtaining a configuration file through the communication unit; Reading the configuration file, the configuration file including virtual image processing unit (GPU) configuration parameters of the guest device; Generating at least one available virtual GPU of the guest device based on the configuration file; and 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. 一種資源管理裝置,包括通訊單元和處理單元,其中,所述處理單元用於: 通過所述通訊單元獲取主機的配置文件; 讀取所述配置文件,其中,所述配置文件包括訪客設備的虛擬GPU配置參數; 基於所述配置文件,生成所述訪客設備的至少一個可用虛擬GPU;以及 在接收到目標用戶的待處理任務的情況下,通過所述通訊單元基於所述待處理任務對應的目標虛擬GPU向所述主機發送資源分配請求,其中,所述資源分配請求用於請求所述主機為所述目標虛擬GPU分配物理GPU,所述至少一個可用虛擬GPU包括所述目標虛擬GPU。A resource management device includes a communication unit and a processing unit, wherein the processing unit is used for: Obtaining the configuration file of the host through the communication unit; Reading the configuration file, where the configuration file includes virtual GPU configuration parameters of the guest device; Generating at least one available virtual GPU of the guest device based on the configuration file; 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 the The host allocates 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。A resource management device includes a communication unit and a processing unit, wherein the processing unit is used for: Receiving a resource allocation request from the guest device through the communication unit, the resource allocation request carrying information about the task to be processed and information about 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. 一種電子設備,包括處理器以及儲存裝置,所述儲存裝置用於儲存電腦程式,所述電腦程式被配置成由所述處理器執行,以使所述處理器執行如請求項1-6任一項或7-9任一項或10-13任一項所述的方法。An electronic device, comprising a processor and a storage device, the storage device is used to store a computer program, the computer program is configured to be executed by the processor, so that the processor executes any of claims 1-6 Item or any one of 7-9 or any one of 10-13. 一種電腦可讀取記錄媒體,所述電腦可讀取記錄媒體用於儲存電腦程式,其中,所述電腦程式使得電腦執行如請求項1-6任一項或7-9任一項或10-13任一項所述的方法。A computer-readable recording medium, the computer-readable recording medium is used to store a computer program, wherein the computer program enables the computer to execute any one of claims 1-6 or any one of 7-9 or 10- 13. The method of any one of them.
TW109121468A 2019-11-20 2020-06-24 Resource management method and apparatus, electronic device, and storage medium TWI748530B (en)

Applications Claiming Priority (2)

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

Publications (2)

Publication Number Publication Date
TW202121407A true TW202121407A (en) 2021-06-01
TWI748530B TWI748530B (en) 2021-12-01

Family

ID=75906499

Family Applications (1)

Application Number Title Priority Date Filing Date
TW109121468A TWI748530B (en) 2019-11-20 2020-06-24 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)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114595065A (en) * 2022-03-15 2022-06-07 北京有竹居网络技术有限公司 Data acquisition method and device, storage medium and electronic equipment
CN114579319B (en) * 2022-05-07 2022-07-19 北京象帝先计算技术有限公司 Video memory management method, video memory management module, SOC and electronic equipment
CN115220911A (en) * 2022-06-17 2022-10-21 中科驭数(北京)科技有限公司 Resource management method, device, equipment and medium
CN115437781B (en) * 2022-06-30 2023-10-31 北京九章云极科技有限公司 GPU resource management method and system
CN115499388B (en) * 2022-08-30 2024-04-12 阿里巴巴(中国)有限公司 Virtual host resource allocation method, device, equipment and storage medium
CN115373860B (en) * 2022-10-26 2023-01-10 小米汽车科技有限公司 Scheduling method, device and equipment of GPU (graphics processing Unit) tasks and storage medium
CN116188240B (en) * 2022-12-28 2024-04-05 摩尔线程智能科技(北京)有限责任公司 GPU virtualization method and device for container and electronic equipment
CN116755843B (en) * 2023-08-17 2023-12-19 摩尔线程智能科技(北京)有限责任公司 Virtual resource creation method and device, electronic equipment, chip and storage medium

Family Cites Families (17)

* 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
WO2013168293A1 (en) * 2012-05-11 2013-11-14 富士通株式会社 Information processing device, remaining battery capacity notification method, and remaining battery capacity notification program
CN102819460B (en) * 2012-08-07 2015-05-20 清华大学 Budget power guidance-based high-energy-efficiency GPU (Graphics Processing Unit) cluster system scheduling algorithm
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
CN107533463A (en) * 2015-03-18 2018-01-02 英特尔公司 Apparatus and method for the unknowable more GPU processing of software
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
US10891773B2 (en) * 2017-04-07 2021-01-12 Intel Corporation Apparatus and method for efficient graphics virtualization
CN108984264B (en) * 2017-06-02 2022-11-15 阿里巴巴集团控股有限公司 Virtual GPU (graphics processing Unit) implementation method, device and system
CN109766179B (en) * 2017-11-09 2023-03-14 阿里巴巴集团控股有限公司 Video memory allocation method and device
CN110389825B (en) * 2018-04-20 2023-08-04 伊姆西Ip控股有限责任公司 Method, apparatus and computer program product for managing dedicated processing resources
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

Also Published As

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

Similar Documents

Publication Publication Date Title
TWI748530B (en) Resource management method and apparatus, electronic device, and storage medium
US11094031B2 (en) GPU resource usage display and dynamic GPU resource allocation in a networked virtualization 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
US11243707B2 (en) Method and system for implementing virtual machine images
EP3073374B1 (en) Thread creation method, service request processing method and related device
US8762999B2 (en) Guest-initiated resource allocation request based on comparison of host hardware information and projected workload requirement
US20180349204A1 (en) Method and apparatus for implementing virtual gpu and system
JP2020024722A (en) Session idle optimization for streaming server
US20150371355A1 (en) Host-Based Heterogeneous Multi-GPU Assignment
TWI696952B (en) Resource processing method and device
US20200356402A1 (en) Method and apparatus for deploying virtualized network element device
WO2011124077A1 (en) Method and system for virtual machine management, virtual machine management server
TW201336264A (en) Method for increasing virtual machines
CN102801636B (en) The method of cloud computing platform cloud mainframe network bandwidth restriction
WO2022041507A1 (en) 3d rendering method and system
JP5178778B2 (en) Virtual machine and CPU allocation method
JP2020194522A (en) Method, apparatus, device, and medium for processing data
WO2023020177A1 (en) Task scheduling method, game engine, device and storage medium
TW201201102A (en) Resource adjustment methods and systems for virtual machines, and computer program products thereof
JP2010026828A (en) Method for controlling virtual computer
JP6870390B2 (en) Resource allocation method, connection management server and connection management program in a system based on a virtual infrastructure
Yang et al. The implementation of a virtual desktop infrastructure with GPU accelerated on OpenStack
US20190278714A1 (en) System and method for memory access latency values in a virtual machine