Gpu resource calling method and device, electronic equipment and storage medium
By receiving AI business requests in the Kubernetes cloud platform and calling local or remote GPU resources based on identifiers, the problem of efficient GPU resource calling for AI business containers is solved. This enables efficient utilization of local GPU resources and remote calling of remote GPU resources, thereby improving the overall utilization and efficiency of GPU resources.
Patent Information
- Application Number
- CN202310739140.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-20
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-06-20
AI Technical Summary
In the Kubernetes cloud platform, how to efficiently manage and utilize GPU resources, especially for the high computing power requirements of AI-related business containers, is a challenge that existing technologies struggle to achieve.
By receiving AI business requests in the Kubernetes cloud platform and determining whether to call local or remote GPU resources based on the identifier, the hijacked interface is obtained using the Kubernetes device plugin component, and local or remote GPU resources are called in a time-division multiplexing manner, thereby achieving efficient utilization of local GPU resources and remote calling of remote GPU resources.
It improves the utilization and efficiency of GPU resources in the Kubernetes cloud platform, ensuring that special AI services can prioritize local GPU resources, while ordinary AI services can remotely call GPU resources in different locations, thereby improving the overall efficiency of GPU resource utilization.
Smart Images

Figure CN116800808B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Kubernetes cloud platform technology, and in particular to a method, apparatus, electronic device, and storage medium for GPU resource access. Background Technology
[0002] As a distributed operating system, the Kubernetes (K8S) cloud platform can reduce IT operation and maintenance costs and shorten business delivery cycles. Furthermore, as a PaaS platform integrating agile development cloud, application management, elastic scaling, resource monitoring, and microservice governance, it has gradually become an important platform for business cloud migration. Therefore, the Kubernetes cloud platform is widely used in various fields, especially in the field of Artificial Intelligence (AI) technology.
[0003] In the Kubernetes cloud platform, ordinary business containers can meet their needs based on the computing power of the Central Processing Unit (CPU), while AI-related business containers may require high-performance computing power such as Graphics Processing Units (GPUs). Due to the higher complexity of AI-related business scenarios, there are stringent requirements for the efficiency of GPU resource utilization. Therefore, how to efficiently manage and utilize GPU resources for AI-related business containers is a pressing issue that needs to be addressed. Summary of the Invention
[0004] This application provides a GPU resource mobilization method, apparatus, electronic device, and storage medium, which can efficiently mobilize GPU resources for different AI business scenarios.
[0005] In a first aspect, embodiments of this application provide a GPU resource invocation method, applied to a first electronic device, the first electronic device being a device in a Kubernetes cloud platform, the first electronic device including local graphics processing unit (GPU) resources, the GPU resource invocation method comprising:
[0006] At the first moment, a request for a first artificial intelligence (AI) service is received. The request for the first AI service includes a first identifier, which is used to indicate that the first AI service is a service that needs to call the local GPU resources.
[0007] Based on the first identifier, the local GPU resources are invoked through the first AI business container, which is a container running an application for processing the first AI business.
[0008] At the second moment, a request from the second AI service is received. The request from the second AI service includes a second identifier, which is used to indicate that the second AI service is a service that requires remote access to GPU resources.
[0009] Based on the second identifier, the target off-site GPU resource is determined among multiple off-site GPU resources;
[0010] The target off-site GPU resources are remotely invoked through a second AI service container, which is a container that runs an application for processing the second AI service.
[0011] In one possible implementation, the step of calling local GPU resources through the first AI service container based on the first identifier includes:
[0012] Based on the first identifier, the hijacked first interface is obtained in the Kubernetes device plugin component through the first AI service container. The Kubernetes device plugin component includes the correspondence between the identifiers of multiple AI services and the hijacked interfaces.
[0013] The first AI business container calls the hijacked first interface to access the local GPU resources.
[0014] One possible implementation involves calling local GPU resources through the first AI business container, including:
[0015] The local GPU resources are invoked through the first AI business container using time-division multiplexing.
[0016] In one possible implementation, the step of remotely invoking the target off-site GPU resource through a second AI service container based on the second identifier includes:
[0017] Based on the second identifier, the hijacked second interface is obtained in the Kubernetes device plugin component through the second AI service container;
[0018] The second AI service container utilizes the network to call the hijacked second interface in the target Kubernetes server to remotely call the target off-site GPU resource. The target Kubernetes server is the server where the target off-site GPU resource is located.
[0019] In one possible implementation, the step of remotely invoking the target off-site GPU resources via the second AI service container further includes:
[0020] The second AI service container uses time-division multiplexing to remotely call the target off-site GPU resources.
[0021] In one possible implementation, the method further includes:
[0022] Receive the first operation on the first AI service;
[0023] In response to the first operation, a first identifier is set for the first AI service;
[0024] Receive the second operation for the second AI service;
[0025] In response to the second operation, a second identifier is set for the second AI service.
[0026] In one possible implementation, the method further includes:
[0027] At the third moment, the third AI service container of the second electronic device remotely calls the local GPU resources to the third AI service container, so as to remotely call the local GPU resources to the third AI service container. The second electronic device is a device in the Kubernetes cloud platform. The third AI service container runs an application for processing the third AI service. The second electronic device does not include GPU resources.
[0028] Secondly, embodiments of this application provide a GPU resource allocation device, the GPU resource allocation device comprising:
[0029] The receiving module is used to receive a request from a first AI service at a first moment. The request from the first AI service includes a first identifier, which is used to indicate that the first AI service is a service that needs to call local GPU resources.
[0030] The calling module is used to call local GPU resources through the first AI business container based on the first identifier. The first AI business container is a container that runs an application for processing the first AI business.
[0031] The receiving module is further configured to receive a request for a second AI service at a second time, wherein the request for the second AI service includes a second identifier, which indicates that the second AI service is a service that requires remote access to GPU resources.
[0032] The processing module is used to determine the target off-site GPU resource among multiple off-site GPU resources based on the second identifier.
[0033] The invocation module is also used to remotely invoke the target off-site GPU resources through a second AI business container, which is a container running an application for processing the second AI business.
[0034] In one possible implementation, the calling module is specifically used to obtain the hijacked first interface in the Kubernetes device plugin component through the first AI service container based on the first identifier. The Kubernetes device plugin component includes the correspondence between the identifiers of multiple AI services and the hijacked interfaces. The hijacked first interface is then called through the first AI service container to invoke the local GPU resources.
[0035] In one possible implementation, the calling module is specifically used to call the local GPU resources through the first AI business container using time-division multiplexing.
[0036] In one possible implementation, the calling module is specifically used to obtain the hijacked second interface in the Kubernetes device plugin component through the second AI service container based on the second identifier; and to call the hijacked second interface in the target Kubernetes server through the second AI service container using the network, so as to remotely call the target off-site GPU resource, wherein the target Kubernetes server is the server where the target off-site GPU resource is located.
[0037] In one possible implementation, the calling module is specifically used to remotely call the target off-site GPU resources through the second AI business container using time-division multiplexing.
[0038] In one possible implementation, the receiving module is further configured to receive a first operation on the first AI service.
[0039] The processing module is further configured to, in response to the first operation, set a first identifier for the first AI service.
[0040] The receiving module is also used to receive a second operation on the second AI service.
[0041] The processing module is also configured to, in response to the second operation, set a second identifier for the second AI service.
[0042] In one possible implementation, the receiving module is further configured to receive, at a third moment, a remote call from the third AI service container of the second electronic device to the local GPU resources, so as to remotely call the local GPU resources to the third AI service container. The second electronic device is a device in the Kubernetes cloud platform, and the third AI service container runs an application for processing third AI services. The second electronic device does not include GPU resources.
[0043] Thirdly, embodiments of this application also provide an electronic device, which includes: a processor and a memory communicatively connected to the processor;
[0044] The memory stores computer-executed instructions;
[0045] The processor executes computer execution instructions stored in the memory to implement the method described in any possible implementation of the first aspect above.
[0046] Fourthly, embodiments of this application also provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method described in any possible implementation of the first aspect.
[0047] Fifthly, embodiments of this application also provide a computer program product, including a computer program that, when executed by a processor, implements the method described in any possible implementation of the first aspect.
[0048] Therefore, this application provides a GPU resource mobilization method, apparatus, electronic device, and storage medium, applied to a first electronic device, which is a device in a Kubernetes cloud platform. The first electronic device includes local graphics processing unit (GPU) resources. The method includes: at a first moment, receiving a request from a first artificial intelligence (AI) service, the request from the first AI service including a first identifier, the first identifier indicating that the first AI service requires mobilizing local GPU resources; mobilizing local GPU resources through a first AI service container based on the first identifier, the first AI service container being a container running an application for processing the first AI service; at a second moment, receiving a request from a second AI service, the request from the second AI service including a second identifier, the second identifier indicating that the second AI service requires remote mobilization of GPU resources; determining a target remote GPU resource among multiple remote GPU resources based on the second identifier; and remotely mobilizing the target remote GPU resource through a second AI service container, the second AI service container being a container running an application for processing the second AI service. This allows AI services that need to access local GPU resources to do so, and AI services that need to access GPU resources remotely to access GPU resources in other locations. This improves the utilization of GPU resources on the Kubernetes cloud platform and increases the efficiency of GPU resource access. Attached Figure Description
[0049] Figure 1 A flowchart illustrating a GPU resource retrieval method provided in an embodiment of this application;
[0050] Figure 2 A flowchart illustrating a method for a user to set an identifier for an AI service request, provided in an embodiment of this application;
[0051] Figure 3 A schematic diagram illustrating the allocation of GPU resources for AI services, provided as an embodiment of this application;
[0052] Figure 4 This is a schematic diagram illustrating a method for accessing local GPU resources provided in an embodiment of this application;
[0053] Figure 5 This is a schematic diagram illustrating a method for accessing local GPU resources in a different location, as provided in an embodiment of this application.
[0054] Figure 6 This is a schematic diagram of the structure of a GPU resource retrieval device provided in an embodiment of this application;
[0055] Figure 7 This is a schematic diagram of an electronic device structure provided in this application.
[0056] The accompanying drawings have illustrated specific embodiments of this disclosure, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concepts of this disclosure to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0057] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0058] In the embodiments of this application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone, where A and B can be singular or plural. In the textual description of this application, the character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0059] With the rapid development of cloud-native technologies, various container orchestration systems have emerged. Among them, the Kubernetes cloud platform is widely used by the industry for building private container clouds. The Kubernetes cloud platform supports the operation of business containers by managing various computing, network, and storage resources. Ordinary business containers can meet the needs based on CPU computing power, but the increasingly demanding AI-related business containers require high computing power support such as GPUs.
[0060] A Kubernetes cloud platform contains multiple electronic devices, each of which can be considered a node within the Kubernetes cloud platform. Some nodes in the Kubernetes cloud platform have local GPU resources, while others do not. Therefore, how to efficiently utilize GPU resources in the Kubernetes cloud platform, ensuring that both nodes with and without GPU resources can access them, has become a pressing issue.
[0061] Based on this, this application provides a GPU resource invocation method. It can pre-determine whether an AI service requires access to local GPU resources based on the specific AI service, and mark different AI services accordingly. Thus, when an electronic device determines that a received AI service requires access to local GPU resources, the device can invoke local resources; when it receives an AI service that does not require access to local GPU resources, it can invoke GPU resources from a different location. This allows the electronic device to flexibly invoke GPU resources based on the AI service. Since remote invocation of GPU resources may be limited by network conditions and the specific characteristics of the GPU resources themselves, special AI services can prioritize the invocation of local GPU resources, while ordinary AI services can remotely invoke GPU resources from different locations, thereby improving GPU resource utilization and invocation efficiency.
[0062] The GPU resource access method provided in this application will be described in detail below through specific embodiments. It is understood that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0063] In this embodiment of the application, the Kubernetes cloud platform may include multiple electronic devices, which may include a first electronic device, a second electronic device, and possibly a third electronic device, etc. This embodiment of the application does not limit the number of electronic devices included in the Kubernetes cloud platform.
[0064] For example, among the multiple electronic devices in the Kubernetes cloud platform are electronic devices with GPU resources and electronic devices without GPU resources.
[0065] In this embodiment of the application, the first electronic device in the Kubernetes cloud platform is an electronic device that includes local GPU resources.
[0066] Figure 1 This is a flowchart illustrating a GPU resource retrieval method provided in an embodiment of this application. This GPU resource retrieval method can be executed by software and / or hardware devices. For example, the hardware device can be a GPU resource retrieval apparatus, which can be a first electronic device or a processing chip within the first electronic device. For an example, please refer to [link to example]. Figure 1 As shown, this GPU resource access method may include:
[0067] S101. At the first moment, a request from the first artificial intelligence (AI) service is received. The request from the first AI service includes a first identifier, which is used to indicate that the first AI service is a service that needs to call local GPU resources.
[0068] For example, the request for the first AI service may be submitted by the user through an application on their terminal device, or it may be submitted in other ways. This application embodiment does not limit this.
[0069] The first identifier may be composed of at least one of letters, numbers, or special symbols, and the embodiments of this application do not limit the form of the first identifier.
[0070] S102. Based on the first identifier, call local GPU resources through the first AI business container, where the first AI business container is a container that runs an application for processing the first AI business.
[0071] For example, when the first electronic device calls local GPU resources through the first AI service container based on the first identifier, the first electronic device can obtain the hijacked first interface in the Kubernetes device plugin component through the first AI service container based on the first identifier, and call the hijacked first interface through the first AI service container to call local GPU resources.
[0072] The Kubernetes device plugin component includes multiple identifiers for AI services and their corresponding hijacked interfaces. For example, the Kubernetes device plugin component may include a first identifier for a first AI service and its corresponding first hijacked interface. This embodiment of the application does not specifically limit the correspondence included in the Kubernetes device plugin component.
[0073] It should be noted that the content in the Kubernetes device plugin component is reported by various electronic devices in the Kubernetes cloud platform.
[0074] For example, for an electronic device with GPU resources, there is a GPU resource management module in the electronic device. This GPU resource management module can obtain information about the GPU resources in the electronic device and report the obtained GPU resource information to the Kubernetes device plugin component so that the business container can obtain the calling interface of the GPU resource in the Kubernetes device plugin component, i.e. the hijacked interface.
[0075] It is understood that the first electronic device includes a first GPU resource management module, which can obtain information about the local GPU resources of the first electronic device and report the information about the local GPU resources to the Kubernetes device plugin component.
[0076] For example, the first interface to be hijacked can be the hijacked CUDA driver API, or it can be other interfaces; this application embodiment does not limit this.
[0077] In this way, the Kubernetes device plugin component enables unified pooling of GPU resources within the Kubernetes cloud platform. This pooled Kubernetes device plugin component is then provided to nodes that require local GPU resource access. This improves the efficiency of local GPU resource access when the primary AI application is a specialized AI application.
[0078] For example, when the first electronic device calls local GPU resources through the first AI service container, it can call local GPU resources in a time-division multiplexing manner through the first AI service container.
[0079] In this way, by using time-division multiplexing to call local GPU resources, other AI services that call local GPU resources can be called normally, which can improve the utilization rate of local GPU resources.
[0080] S103. At the second moment, a request from the second AI service is received. The request from the second AI service includes a second identifier, which is used to indicate that the second AI service is a service that requires remote access to GPU resources.
[0081] For example, the request for the second AI service may be submitted by the user through an application on their terminal device, or it may be submitted in other ways. This application embodiment does not limit this.
[0082] The second identifier may be composed of at least one of letters, numbers, or special symbols, and the embodiments of this application do not limit the form of the second identifier.
[0083] It should be noted that the first identifier and the second identifier are different identifiers, in order to distinguish whether the AI business corresponding to the identifier is a special business that requires local GPU resource access.
[0084] S104. Based on the second identifier, determine the target off-site GPU resource among multiple off-site GPU resources.
[0085] In this embodiment, the Kubernetes device plugin component in the Kubernetes cloud platform includes a mapping between identifiers of multiple AI services and hijacked interfaces. For example, the Kubernetes device plugin component may include a mapping between a second identifier of a second AI service and a second hijacked interface. This embodiment does not specifically limit the mapping included in the Kubernetes device plugin component.
[0086] In this embodiment, the target off-site GPU resource can be the GPU resource of a third electronic device in a Kubernetes cloud platform. The third electronic device includes a second GPU resource management module, which can obtain information about the GPU resources of the third electronic device and report this information to the Kubernetes device plugin component. This allows the Kubernetes device plugin component to generate a correspondence between a second identifier of the second AI service and the hijacked second interface.
[0087] This application embodiment is only used as an example to illustrate the correspondence between the second identifier of the generated second AI service and the hijacked second interface, but it does not constitute any limitation.
[0088] Therefore, when the first electronic device determines that the request for the second AI service includes the second identifier, it can determine the target off-site GPU resource corresponding to the second identifier in the Kubernetes device plugin component based on the second identifier.
[0089] S105. Remotely call the target off-site GPU resources through the second AI business container. The second AI business container is a container that runs an application used to process the second AI business.
[0090] For example, when the first electronic device remotely calls the target off-site GPU resource through the second AI service container based on the second identifier, it can obtain the hijacked second interface in the Kubernetes device plugin component through the second AI service container based on the second identifier; and use the network through the second AI service container to call the hijacked second interface in the target Kubernetes server to remotely call the target off-site GPU resource, where the target Kubernetes server is the server where the target off-site GPU resource is located.
[0091] For example, the network can be a network for communication between electronic devices in a Kubernetes cloud platform. The hijacked second interface can be a hijacked CUDA runtime API, or other interfaces; this embodiment does not limit the scope of the application.
[0092] In this way, for general AI applications that require remote access to GPU resources, remote access to geographically located GPU resources can be used, while local GPU resources can be prioritized for specific AI applications. This allows general AI applications to access GPU resources while enabling specific AI applications to access GPU resources more quickly, improving the efficiency of both remotely located and local GPU resource utilization.
[0093] For example, when the first electronic device remotely calls the target remote GPU resource through the second AI service container, it can use the second AI service container to remotely call the target remote GPU resource in a time-division multiplexing manner.
[0094] In this way, by using time-division multiplexing to call the target off-site GPU resources, other AI services that call the target off-site GPU resources can be called normally, which can improve the utilization rate of the target off-site GPU resources.
[0095] Therefore, the GPU resource invocation method provided in this application embodiment allows the first electronic device to invoke local GPU resources for a first AI service that requires access to local GPU resources, while for a second AI service that requires remote invocation, the first electronic device remotely invokes target GPU resources in a different location. This allows different GPU resources to be invoked based on the actual situation of the AI service, enabling special AI services to prioritize accessing local GPU resources and quickly utilize them. Ordinary AI services can also access remote GPU resources, improving the efficiency of GPU resource invocation and increasing the utilization rate of various GPU resources in the Kubernetes cloud platform.
[0096] In this embodiment of the application, the first identifier in the request for the first AI service and the second identifier in the request for the second AI service can be preset. Figure 2 This is a flowchart illustrating a method for a user to set an identifier for an AI service request, as provided in an embodiment of this application.
[0097] like Figure 2 As shown, the methods for users to set the identifier for AI service requests may include:
[0098] S201, Receive the first operation for the first AI service.
[0099] For example, the first operation could be an operation input by a user through a device in the Kubernetes cloud platform, and this application embodiment does not limit this. For instance, the first operation could be marking a first AI service as requiring the use of local GPU resources.
[0100] In one possible implementation, the first operation could also be the user marking the first AI service as a node that includes GPU resources.
[0101] S202, In response to the first operation, set the first identifier for the first AI business.
[0102] For example, the first electronic device can set a first identifier for the first AI service, so that when the first AI service is received, the first identifier can be recognized.
[0103] S203, Receive the second operation for the second AI service.
[0104] For example, the second operation could be an operation input by a user through a device in the Kubernetes cloud platform, and this application embodiment does not limit this. For instance, the second operation could be an operation that marks a second AI service as requiring remote access to off-site GPU resources.
[0105] In one possible implementation, when the electronic device processing the second AI service does not include GPU resources, the second operation can also be the user marking the second AI service as a node that does not include GPU resources.
[0106] S204. In response to the second operation, set a second identifier for the second AI service.
[0107] For example, the first electronic device can set a second identifier for the second AI service, so that when the second AI service is received, the second identifier can be identified and the remote GPU resources can be called for the second AU service.
[0108] In this way, by having users pre-set identifiers for AI services, electronic devices can access GPU resources based on these identifiers, which can further improve the efficiency of GPU resource access.
[0109] In this embodiment, since not all nodes in the Kubernetes cloud platform include GPU resources, users can allocate the GPU resources called by AI services in the Kubernetes cloud platform based on whether a node includes GPU resources and whether the AI services that the node can handle are special AI services.
[0110] Figure 3 This is a schematic diagram illustrating the allocation of GPU resources for AI services, as provided in an embodiment of this application.
[0111] like Figure 3 As shown, AI services include ordinary AI services and special AI services. Ordinary AI services may include a first ordinary AI service, a second ordinary AI service, a third ordinary AI service, ..., an Nth ordinary AI service. Special AI services may include a first special AI service, a second special AI service, ..., an Mth special AI service. Wherein, M and N are natural numbers, and the size of M and N is not limited in this embodiment.
[0112] The first ordinary AI service, the second ordinary AI service, the third ordinary AI service, and the Nth ordinary AI service are all AI services processed by electronic devices excluding GPU resources. The first special AI service, the second special AI service, and the Mth special AI service are all AI services processed by electronic devices including GPU resources.
[0113] like Figure 3 As shown, when an electronic device receives a first special AI service, it can access its GPU resources through the first special AI service container. When the electronic device receives a second special AI service, it can access its GPU resources through the second special AI service container. When the electronic device receives the Mth special AI service, it can access its GPU resources through the Mth special AI service container. When the electronic device receives a first ordinary AI service, it can access the GPU resources of the electronic device corresponding to the second special AI service through the first ordinary AI service container. When the electronic device receives a second ordinary AI service, it can access the GPU resources of the electronic device corresponding to the first special AI service through the second ordinary AI service container. When the electronic device receives a third ordinary AI service, it can access the GPU resources of the electronic device corresponding to the second special AI service through the third ordinary AI service container. When the electronic device receives the Nth ordinary AI service, it can access the GPU resources of the electronic device corresponding to the Mth special AI service through the Nth ordinary AI service container.
[0114] Therefore, in the Kubernetes cloud platform, by dividing the network into ordinary nodes without GPUs (denoted as nogpunodes) and special nodes with GPUs (denoted as gpu nodes), most ordinary AI application containers can be algorithmically routed to nogpu nodes, while a small number of special high-level AI application containers can be algorithmically routed to gpu nodes. This allows special high-level AI application containers to use GPUs without going through the network. AI application containers on nogpu nodes use the rcuda (remote CUDA runtime) method to select a suitable GPU node for remote GPU use, while AI application containers on gpu nodes only need to use the GPU locally through the vcuda (virtual CUDA driver) method. The rcuda and vcuda methods are described in the following examples.
[0115] Based on the above embodiments, when the second electronic device in the Kubernetes cloud platform does not include GPU resources, the first electronic device in this application embodiment can also receive remote calls to the local GPU resources from the third AI business container of the second electronic device at a third time, so as to remotely call the local GPU resources to the third AI business container, and the third AI business container runs an application for processing the third AI business.
[0116] It is understandable that the method by which the local GPU resources of the first electronic device are invoked by the third AI service container of the second electronic device is similar to the method by which the second AI service container invokes the target remote GPU resources in the above embodiment, and will not be described again here.
[0117] In this way, the local GPU resources of the first electronic device can also be called by the AI business containers of other devices, which can improve the utilization rate of GPU resources and improve the efficiency of GPU resource calling.
[0118] To facilitate understanding of the GPU resource calling method provided in this application embodiment, the following will explain two cases: calling local GPU resources and calling remote GPU resources.
[0119] Figure 4 This is a schematic diagram illustrating a method for calling local GPU resources, provided in an embodiment of this application.
[0120] It should be noted that, Figure 4 The electronic device shown is an electronic device in the Kubernetes cloud platform. It can be the first electronic device described in the above embodiments, or it can be other electronic devices that include GPU resources. This application does not limit this.
[0121] For example, Figure 4 The AI business container shown can call local GPU resources through the vcuda method.
[0122] exist Figure 4 In this context, when the electronic device is the first electronic device, the AI service container can be the first AI service container described in the above embodiments. The interface can be a hijacked CUDA driver API. The GPU resource management module can be a module used to obtain local GPU resources. The driver can be an NVIDIA driver.
[0123] like Figure 4 As shown, the AI application container can access local GPU resources through the following steps:
[0124] Step 1: The GPU resource management module manages all GPU hardware information on the local machine, mainly by calling the cudadriver API.
[0125] For example, the GPU resource management module could be an implemented Kubernetes cloud platform device plugin.
[0126] Step 2: After obtaining the GPU information, the GPU resource management module reports it to the entire cloud environment of the Kubernetes cloud platform.
[0127] For example, the GPU resource management module reports to the Kubernetes cloud platform device plugin.
[0128] In this embodiment, vCUDA may further include a GPU resource control module. Besides overseeing all GPU resource information to provide algorithms for invocation, the GPU resource control module can also provide the target host address to the rcuda module. For details on providing the target host address to the rcuda module, please refer to the description in the following embodiments.
[0129] Step 3: The Kubernetes device plugin component requires the AI business container to mount the necessary file system directory.
[0130] The Kubernetes device plugin component, through the Kubernetes device plugin mechanism, requires the AI application container to mount the necessary file system directory. This file system directory can be the mapping between the interfaces and identifiers described in the above embodiments. This directory may contain the hijacked CUDA driver API and related underlying drivers.
[0131] The underlying related drivers can be Figure 4 The NVIDIA driver in the code is used to access GPU resources.
[0132] Step 4: The AI business container calls the hijacked CUDA driver API at runtime to achieve time-division multiplexing of the GPU.
[0133] The specific process by which the AI business container calls the hijacked CUDA driver API at runtime to achieve GPU time-division multiplexing can be found in the above embodiments, and will not be repeated here.
[0134] Step 5: The hijacked CUDA driver API reports the usage of the GPU by the AI business container to the GPU resource management module.
[0135] For example, when an electronic device includes multiple GPUs, the AI business container can call one or more GPU resources. In this way, the hijacked CUDA driver API reports to the GPU resource management module the usage of a particular GPU or any GPU by the AI business container.
[0136] Figure 5 This is a schematic diagram illustrating a method for accessing local GPU resources in a different location, as provided in an embodiment of this application.
[0137] It should be noted that, Figure 5 Electronic device 1 and electronic device 2 shown are both electronic devices in the Kubernetes cloud platform. Electronic device 1 can be the second electronic device described in the above embodiments, or it can be other electronic devices that do not include GPU resources. Electronic device 2 can be the first electronic device described in the above embodiments, or it can be other electronic devices that include GPU resources. This application does not limit this aspect.
[0138] For example, Figure 5 The AI business container of the electronic device 1 shown can call the GPU resources of the electronic device 2 through the rcuda method, that is, the AI business container calls the GPU resources in a different location.
[0139] RCUDA provides remote GPU access. Electronic device 1 is an RCUDA client and does not have GPU resources, while electronic device 2 is an RCUDA server and does have GPU resources. In this embodiment, access to GPU resources is executed on the server's GPU through the hijacked CUDA runtime API. The server is implemented using a vCUDA solution.
[0140] exist Figure 5In this embodiment, when electronic device 1 is the second electronic device, the AI service container can be the third AI service container described above. The interface can be a hijacked CUDA driver API. The GPU resource management module can be a module used to obtain local GPU resources. The driver can be an NVIDIA driver.
[0141] like Figure 5 As shown, the AI application container can access local GPU resources through the following steps:
[0142] Step 1: The GPU resource management module of electronic device 2 (server side) manages all GPU hardware information on the local machine, mainly by calling the CUDA driver API.
[0143] This step can be referred to in the above embodiments, and will not be repeated here.
[0144] Step 2: After obtaining the GPU information, the GPU resource management module reports it to the entire cloud environment of the Kubernetes cloud platform.
[0145] This step can be referred to in the above embodiments, and will not be repeated here.
[0146] Step 3: Mount the relevant file system directory or set environment variables on the AI business container of electronic device 1 (client side) as required.
[0147] For example, environment variables can contain configuration files related to the target host address. File system directories can contain the hijacked CUDA driver API and the underlying NVIDIA driver.
[0148] Step 4: After the AI business container of electronic device 1 (client side) calls the hijacked CUDA runtime API, it initiates a call to the target rcuda-server service through the network.
[0149] This step can be referred to in the above embodiments, and will not be repeated here.
[0150] Step 5: The rcuda-server program calls the hijacked CUDA driver API at runtime to implement time-division multiplexing of the GPU.
[0151] The rcuda-server program is used in electronic device 2 to access GPU resources.
[0152] Step 6: The hijacked CUDA driver API reports the usage of a certain GPU by the rcuda-server program to the GPU resource management module of electronic device 2.
[0153] In this way, the GPU resource management module of electronic device 2 can understand the GPU resource usage in a timely manner, so as to make reasonable use of GPU resources.
[0154] In summary, the method provided in this application enables the unified management of GPU resources on different nodes to form a resource pool, which is then provided to local or remote business containers for use. GPU virtualization is achieved by hijacking the CUDA Driver API, allowing different programs (i.e., business containers) to time-division multiplex a specific GPU. It can pool GPU resources and remotely provide them to nodes without GPU resources, while also supporting local use of the pooled GPU resources; that is, it allows special-level business containers to directly call upon nodes with GPU resources for efficient local GPU utilization.
[0155] Figure 6 This is a schematic diagram of a GPU resource allocation device 60 provided in an embodiment of this application. For an example, please refer to [link to example diagram]. Figure 6 As shown, the GPU resource allocation device 60 may include:
[0156] The receiving module 601 is used to receive a request from the first AI service at a first moment. The request from the first AI service includes a first identifier, which is used to indicate that the first AI service is a service that needs to call local GPU resources.
[0157] Module 602 is invoked to invoke local GPU resources through the first AI business container based on the first identifier. The first AI business container is a container that runs an application for processing the first AI business.
[0158] The receiving module 601 is also configured to receive a request for a second AI service at a second moment. The request for the second AI service includes a second identifier, which indicates that the second AI service is a service that requires remote access to GPU resources.
[0159] Processing module 603 is used to determine the target off-site GPU resource among multiple off-site GPU resources based on the second identifier.
[0160] The calling module 602 is also used to remotely call the target off-site GPU resources through the second AI business container, which is a container that runs an application for processing the second AI business.
[0161] In one possible implementation, module 602 is specifically used to obtain the hijacked first interface in the Kubernetes device plugin component through the first AI service container based on the first identifier. The Kubernetes device plugin component includes the correspondence between the identifiers of multiple AI services and the hijacked interfaces. The hijacked first interface is called through the first AI service container to access local GPU resources.
[0162] In one possible implementation, module 602 is invoked, specifically to invoke local GPU resources through time-division multiplexing via the first AI business container.
[0163] In one possible implementation, module 602 is specifically used to obtain the hijacked second interface in the Kubernetes device plugin component through the second AI service container based on the second identifier; and to call the hijacked second interface in the target Kubernetes server through the network via the second AI service container, so as to remotely call the target off-site GPU resource, where the target Kubernetes server is the server where the target off-site GPU resource is located.
[0164] In one possible implementation, module 602 is used to remotely invoke target off-site GPU resources via a time-division multiplexing method through a second AI business container.
[0165] In one possible implementation, the receiving module 601 is also used to receive a first operation on the first AI service.
[0166] The processing module 603 is also used to respond to the first operation by setting a first identifier for the first AI service.
[0167] The receiving module 601 is also used to receive a second operation on the second AI service.
[0168] The processing module 603 is also used to set a second identifier for the second AI service in response to the second operation.
[0169] In one possible implementation, the receiving module 601 is further configured to receive, at a third moment, a remote call to the local GPU resources by the third AI business container of the second electronic device, so as to remotely call the local GPU resources to the third AI business container. The second electronic device is a device in the Kubernetes cloud platform, and the third AI business container runs an application for processing the third AI business. The second electronic device does not include GPU resources.
[0170] The GPU resource retrieval device provided in this application embodiment can execute the technical solution of the GPU resource retrieval method in any of the above embodiments. Its implementation principle and beneficial effects are similar to those of the GPU resource retrieval method. Please refer to the implementation principle and beneficial effects of the GPU resource retrieval method. It will not be repeated here.
[0171] Figure 7 This is a schematic diagram of an electronic device structure provided in this application. Figure 7 As shown, the electronic device 700 may include at least one processor 701 and a memory 702.
[0172] The memory 702 is used to store programs. Specifically, the program may include program code, which includes computer operation instructions.
[0173] The memory 702 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.
[0174] The processor 701 executes computer execution instructions stored in the memory 702 to implement the GPU resource retrieval method described in the foregoing method embodiments. The processor 701 may be a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application. Specifically, when implementing the GPU resource retrieval method described in the foregoing method embodiments, the electronic device may be, for example, a terminal, a server, or other electronic device with processing capabilities.
[0175] Optionally, the electronic device 700 may also include a communication interface 703. In specific implementations, if the communication interface 703, memory 702, and processor 701 are implemented independently, they can be interconnected via a bus to complete communication. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc., but this does not imply that there is only one bus or one type of bus.
[0176] Optionally, in a specific implementation, if the communication interface 703, memory 702, and processor 701 are integrated on a single chip, then the communication interface 703, memory 702, and processor 701 can communicate through an internal interface.
[0177] This application also provides a computer-readable storage medium, which may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk. Specifically, the computer-readable storage medium stores program instructions, which are used in the methods described in the above embodiments.
[0178] This application also provides a program product including executable instructions stored in a readable storage medium. At least one processor of an electronic device can read the executable instructions from the readable storage medium, and the at least one processor executes the executable instructions to cause the electronic device to implement the GPU resource mobilization methods provided in the various embodiments described above.
[0179] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A method for accessing GPU resources, applied to a first electronic device, the first electronic device being a device in a Kubernetes cloud platform, the first electronic device including local graphics processing unit (GPU) resources, characterized in that... include: At the first moment, a request for the first artificial intelligence (AI) service is received. The request for the first AI service includes a first identifier, which is used to indicate that the first AI service is a service that needs to call local GPU resources. Based on the first identifier, the hijacked first interface is obtained in the Kubernetes device plugin component through the first AI service container. The Kubernetes device plugin component includes the correspondence between the identifiers of multiple AI services and the hijacked interfaces. The hijacked first interface is called through the first AI service container to call the local GPU resources. The first AI service container is a container that runs an application for processing the first AI service. The first AI service container calls the local GPU resources in a time-division multiplexing manner. At the second moment, a request from the second AI service is received. The request from the second AI service includes a second identifier, which is used to indicate that the second AI service is a service that requires remote access to GPU resources. Based on the second identifier, the hijacked second interface is obtained in the Kubernetes device plugin component through the second AI service container; The second AI service container utilizes the network to call the hijacked second interface in the target Kubernetes server to remotely call the target off-site GPU resource. The target Kubernetes server is the server where the target off-site GPU resource is located. The second AI service container is a container that runs an application for processing the second AI service, wherein the second AI service container remotely invokes the target off-site GPU resources using time-division multiplexing. The AI services include ordinary AI services and special AI services. The first AI service is a special AI service, and the second AI service is an ordinary AI service. The special AI service prioritizes the use of the local GPU resources, while the ordinary AI service can call upon the off-site GPU resources. The method further includes: At the third moment, the third AI service container of the second electronic device remotely calls the local GPU resources to the third AI service container, so as to remotely call the local GPU resources to the third AI service container. The second electronic device is a device in the Kubernetes cloud platform. The third AI service container runs an application for processing the third AI service. The second electronic device does not include GPU resources.
2. The method according to claim 1, characterized in that, The method further includes: Receive the first operation on the first AI service; In response to the first operation, a first identifier is set for the first AI service; Receive the second operation for the second AI service; In response to the second operation, a second identifier is set for the second AI service.
3. A GPU resource allocation device, characterized in that, include: The receiving module is used to receive a request from a first AI service at a first moment. The request from the first AI service includes a first identifier, which is used to indicate that the first AI service is a service that needs to call local GPU resources. The calling module is used to obtain the hijacked first interface in the Kubernetes device plugin component through the first AI service container based on the first identifier. The Kubernetes device plugin component includes the correspondence between the identifiers of multiple AI services and the hijacked interfaces. The hijacked first interface is called through the first AI service container to call local GPU resources. The first AI service container is a container that runs an application for processing the first AI service. The first AI service container calls the local GPU resources in a time-division multiplexing manner. The receiving module is further configured to receive a request for a second AI service at a second moment, wherein the request for the second AI service includes a second identifier, which is used to indicate that the second AI service is a service that requires remote access to GPU resources. The processing module is configured to obtain the hijacked second interface in the Kubernetes deviceplugin component through the second AI service container based on the second identifier. The calling module is further configured to utilize the network through the second AI service container to call the hijacked second interface in the target Kubernetes server to remotely call the target off-site GPU resource, wherein the target Kubernetes server is the server where the target off-site GPU resource is located; the second AI service container is a container running an application for processing the second AI service, wherein the second AI service container remotely calls the target off-site GPU resource using time-division multiplexing. The AI services include ordinary AI services and special AI services. The first AI service is a special AI service, and the second AI service is an ordinary AI service. The special AI service prioritizes the use of the local GPU resources, while the ordinary AI service can call upon the off-site GPU resources. The calling module is also used for: At the third moment, the system receives a remote call from the third AI service container of the second electronic device to the local GPU resources, so as to remotely call the local GPU resources to the third AI service container. The second electronic device is a device in the Kubernetes cloud platform, and the third AI service container runs an application for processing third AI services. The second electronic device does not contain GPU resources.
4. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement a GPU resource retrieval method as described in claim 1 or 2.
5. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by the processor, implement the GPU resource retrieval method as described in claim 1 or 2.
Citation Information
Patent Citations
Service calling method and device based on multistage service platform
CN114285852A
Resource scheduling method and device, equipment and medium
CN115658311A
