Heterogeneous equipment adaptation method, device and equipment
By using a unified protocol and toolset plugins for identification and adaptation, the problem of limited adaptation methods for heterogeneous devices has been solved, thereby improving the flexibility and stability of container systems.
Patent Information
- Application Number
- CN202411180911.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2026-03-03
AI Technical Summary
Existing technologies offer relatively simple and inflexible methods for adapting to heterogeneous devices, resulting in low stability and availability of container systems. In particular, device plugins need to be adjusted when updating or upgrading heterogeneous resources.
The system obtains the startup instructions of the target container through the front-end interface, interacts with the device plugins in the container system based on the target unified protocol, identifies heterogeneous device types and determines the target toolset plugins, and performs adaptation operations to enable the container to execute commands based on heterogeneous devices.
It improves the flexibility of adapting to heterogeneous devices, reduces the need for adjusting device plug-ins, and enhances the stability and availability of container systems.
Smart Images

Figure CN121597339A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of container technology, and in particular to a method, apparatus and device for adapting heterogeneous devices. Background Technology
[0002] With the continuous development of the Internet and artificial intelligence (AI) technologies, the types of heterogeneous chips are increasing, and the application of various types of heterogeneous resources is becoming more and more widespread.
[0003] In related technologies, due to the different underlying implementation methods of various heterogeneous resources, container management open source platforms (Kubernetes, k8s) require different container runtimes to adapt and use. Furthermore, each container runtime corresponds to a different protocol. k8s usually needs different device plugins to adapt to different heterogeneous resources, that is, one heterogeneous resource corresponds to one device plugin, so that k8s can schedule and use different heterogeneous resources.
[0004] The adaptation method for heterogeneous devices in this technology is relatively simple and lacks flexibility. When there are updates or upgrades to heterogeneous resources, the corresponding device plugins need to be adjusted accordingly, which can easily lead to low stability and availability of the container system. Summary of the Invention
[0005] This application provides a heterogeneous device adaptation method, apparatus, and device in several aspects, which enables more flexible adaptation of heterogeneous devices and can improve the stability and availability of container systems.
[0006] In a first aspect, embodiments of this application provide a heterogeneous device adaptation method, including:
[0007] The startup command of the target container is obtained through a front-end interface, which interacts with the device plugins in the container system corresponding to the target container based on the target unified protocol.
[0008] Based on the startup command, identify the target device types corresponding to the multiple heterogeneous devices in the container system, and determine the target toolkit plugins corresponding to the target device types;
[0009] Based on the target toolset plugin, an adaptation operation is performed on the heterogeneous device corresponding to the target device type, so that the target container executes the target command based on the heterogeneous device.
[0010] In one possible implementation, the target unified protocol includes target environment variables corresponding to multiple heterogeneous devices; the environment variables corresponding to each of the heterogeneous devices are all the target environment variables; and the environment variables corresponding to the device plug-ins in the container system are the target environment variables.
[0011] In one possible implementation, identifying the target device type corresponding to each of the multiple heterogeneous devices in the container system includes:
[0012] The analyzer collects the identification information corresponding to each of the heterogeneous devices.
[0013] The target device type corresponding to the heterogeneous device is determined based on the identification information.
[0014] In one possible implementation, determining the target toolset plugin corresponding to the target device type includes:
[0015] The target mapping relationship between the device type and the toolkit plugin is determined by the plugin manager based on the toolkit plugins registered in the plugin manager and the device type corresponding to the toolkit plugins.
[0016] The plugin manager determines the target toolset plugin corresponding to the target device type based on the target device type and the target mapping relationship.
[0017] In one possible implementation, the step of performing an adaptation operation for heterogeneous devices corresponding to the target device type based on the target toolset plugin includes:
[0018] Based on the target toolset plugin, mount the heterogeneous device corresponding to the target device type;
[0019] For the heterogeneous device, perform the environment configuration operation corresponding to the target device type.
[0020] In one possible implementation, the front-end interface is a hook interface under the container runtime standard OCI; the front-end interface is registered in the pre-startup phase of the target container.
[0021] Secondly, embodiments of this application provide a heterogeneous device adapter, comprising:
[0022] The acquisition module is used to acquire the startup command of the target container through a front-end interface, wherein the front-end interface interacts with the device plugins in the container system corresponding to the target container based on the target unified protocol.
[0023] The identification module is used to identify the target device types corresponding to multiple heterogeneous devices in the container system according to the startup command, and to determine the target toolkit plugins corresponding to the target device types.
[0024] An adaptation module is used to perform an adaptation operation on heterogeneous devices corresponding to the target device type based on the target toolset plugin, so that the target container can execute target commands based on the heterogeneous device.
[0025] In one possible implementation, the target unified protocol includes target environment variables corresponding to multiple heterogeneous devices; the environment variables corresponding to each of the heterogeneous devices are all the target environment variables; and the environment variables corresponding to the device plug-ins in the container system are the target environment variables.
[0026] In one possible implementation, the identification module is specifically used for:
[0027] The analyzer collects the identification information corresponding to each of the heterogeneous devices.
[0028] The target device type corresponding to the heterogeneous device is determined based on the identification information.
[0029] In one possible implementation, the identification module is specifically used for:
[0030] The target mapping relationship between the device type and the toolkit plugin is determined by the plugin manager based on the toolkit plugins registered in the plugin manager and the device type corresponding to the toolkit plugins.
[0031] The plugin manager determines the target toolset plugin corresponding to the target device type based on the target device type and the target mapping relationship.
[0032] In one possible implementation, the adapter module is specifically used for:
[0033] Based on the target toolset plugin, mount the heterogeneous device corresponding to the target device type;
[0034] For the heterogeneous device, perform the environment configuration operation corresponding to the target device type.
[0035] In one possible implementation, the front-end interface is a hook interface under the container runtime standard OCI; the front-end interface is registered in the pre-startup phase of the target container.
[0036] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;
[0037] The memory stores computer-executed instructions;
[0038] The processor executes computer execution instructions stored in the memory, causing the processor to perform the heterogeneous device adaptation method according to any one of the first aspects.
[0039] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the heterogeneous device adaptation method described in any one of the first aspects.
[0040] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the heterogeneous device adaptation method shown in any of the first aspects.
[0041] In this embodiment, the startup command of the target container is obtained through a front-end interface. The front-end interface interacts with the device plugins in the container system corresponding to the target container based on the target unified protocol. According to the startup command, the target device types corresponding to multiple heterogeneous devices in the container system are identified, and the target toolset plugins corresponding to the target device types are determined. Based on the target toolset plugins, adaptation operations are performed on the heterogeneous devices corresponding to the target device types, so that the target container can execute target commands based on the heterogeneous devices. In this application, for different heterogeneous devices, the front-end interface interacts with the device plugins in the container system through the target unified protocol. After obtaining the startup command of the target container, the front-end interface identifies the target device types of each heterogeneous device and selects the target toolset plugin corresponding to that target device type. Then, it performs the corresponding adaptation operation based on the target toolset plugin. In this way, the device plugins in the container system do not need to be directly adapted to the underlying heterogeneous devices. One device plugin can adapt to multiple different heterogeneous devices, which can improve the flexibility of heterogeneous device adaptation. At the same time, updates and upgrades of heterogeneous devices do not require adjustments to the device plugins, which can improve the stability and availability of the container system. Attached Figure Description
[0042] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0043] Figure 1 A schematic diagram illustrating an application scenario provided for an exemplary embodiment of this application;
[0044] Figure 2 A flowchart illustrating a heterogeneous device adaptation method provided for an exemplary embodiment of this application;
[0045] Figure 3A flowchart illustrating another heterogeneous device adaptation method provided for an exemplary embodiment of this application;
[0046] Figure 4 A schematic diagram of an architecture for heterogeneous device adaptation provided for an exemplary embodiment of this application;
[0047] Figure 5 A schematic diagram of the structure of a heterogeneous device adapter provided for an exemplary embodiment of this application;
[0048] Figure 6 This is a schematic diagram of the structure of an electronic device provided as an exemplary embodiment of this application. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with relevant laws, regulations, and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0050] With the continuous development of artificial intelligence technology, the types of heterogeneous chips are increasing, such as AI computing chips like Graphics Processing Units (GPUs) and Deep Computing Units (DCUs). In addition, more heterogeneous hardware may emerge in the future.
[0051] In related technologies, due to the different underlying implementation methods of various heterogeneous resources, different container runtimes are required in the container scheduling and management platform Kubernetes to adapt and use them. Furthermore, each container runtime corresponds to a different protocol. Based on this, different device plugins are needed at the upper layer of Kubernetes for adaptation. These device plugins can abstract the hardware resources of heterogeneous devices and report them to the Kubernetes system, so that Kubernetes can schedule and use different heterogeneous resources.
[0052] In traditional approaches, Kubernetes systems typically require different heterogeneous resources to provide corresponding device plugins for each resource. This results in multiple sets of device plugins if the container system (or container cluster) has various heterogeneous devices (or resources, cards). Furthermore, if new heterogeneous devices are added later, the container system needs to deploy new plugins. Therefore, related technologies for heterogeneous device adaptation are relatively simplistic and inflexible. Moreover, when heterogeneous devices are updated or upgraded, the device plugins need to be redeployed, leading to low stability and availability of the container system.
[0053] To address the aforementioned issues, this application provides a heterogeneous device adaptation method, apparatus, and device, which can be implemented using a containerization suite (or container runtime). This containerization suite obtains the startup command of the target container through a front-end interface. The front-end interface interacts with the device plugins in the container system corresponding to the target container based on the target unified protocol. Based on the startup command, it identifies the target device types corresponding to multiple heterogeneous devices in the container system and determines the target toolset plugins corresponding to each target device type. Based on the target toolset plugins, it performs adaptation operations on the heterogeneous devices corresponding to the target device types, enabling the target container to execute target commands based on the heterogeneous devices. Thus, this application allows the same device plugin to be used for different heterogeneous devices, eliminating the need for a separate device plugin for each heterogeneous device, improving the flexibility, stability, and usability of heterogeneous device adaptation.
[0054] Figure 1 This is a schematic diagram illustrating an application scenario provided for an exemplary embodiment of this application. For example... Figure 1 As shown, in heterogeneous container scenarios, related technologies require setting up a corresponding container runtime for each type of heterogeneous device. Furthermore, since different container runtimes use different protocols, a matching device plugin is also needed. For example, heterogeneous device A requires container runtime A and device plugin A, heterogeneous device B requires container runtime B and device plugin B, and heterogeneous device C requires container runtime C and device plugin C. This form of heterogeneous device adaptation is relatively simple and lacks flexibility. Moreover, when new heterogeneous devices are added or upgraded, the device plugin needs to be redeployed, resulting in low stability and availability of the container system.
[0055] This application provides a heterogeneous container runtime (or containerization suite) whose front-end interface interacts with device plugins through a target unified protocol. It can identify the target device types corresponding to multiple underlying heterogeneous devices and determine the corresponding target toolkit plugins based on these device types. Then, based on these toolkit plugins, adaptation operations can be performed on the heterogeneous devices corresponding to the target device types, allowing the target container to directly execute subsequent target commands on the heterogeneous devices. This eliminates the need to report specific resources of the underlying heterogeneous devices to the device plugins; the containerization suite can report general resources based on the target unified protocol. The adaptation method for heterogeneous devices is more flexible, and there is no need to redeploy device plugins when heterogeneous devices are updated or upgraded, thus improving the stability and availability of the container system.
[0056] The technical solutions shown in this application will be described in detail below through specific embodiments. It should be noted that the following embodiments may exist independently or in combination with each other, and the same or similar content will not be described again in different embodiments.
[0057] Figure 2 This is a flowchart illustrating a heterogeneous device adaptation method provided for an exemplary embodiment of this application. Please refer to... Figure 4 The heterogeneous device adaptation method may include:
[0058] S201. Obtain the startup command of the target container through the front-end interface. The front-end interface interacts with the device plugins in the container system corresponding to the target container based on the target unified protocol.
[0059] The execution subject in this application embodiment can be an electronic device, specifically a containerized suite or container runtime installed in the electronic device, or a heterogeneous device adapter installed in the electronic device. The heterogeneous device adapter can be implemented through software or a combination of software and hardware. For ease of understanding, the following description uses a containerized suite as the execution subject.
[0060] In this embodiment, the frontend interface can refer to the interface module of the containerization suite, which can be used to interact with device plugins and target containers in a container system or container cluster. The target container can refer to a container in a container cluster, specifically a Docker container (an open-source application container engine). The launch command can refer to the startup command of the target container. The target unified protocol can refer to the unified protocol used when the frontend interface interacts with device plugins in the container system. Exemplarily, the target unified protocol can be implemented through a unified interface (Application Programming Interface, API), which is not limited in this embodiment. The container system can refer to a container cluster based on a Kubernetes system. In this embodiment, the number of device plugins in the container system can be one, and adaptation to multiple types of heterogeneous devices can be achieved based on this single device plugin.
[0061] Specifically, the containerization suite in this embodiment may include modules such as a front-end interface, an analyzer, and a plugin manager. In a container system, the Kubernetes proxy node (kubelet) can send a resource allocation request (allocreq) to the device plugin, and the device plugin can return a resource allocation response (allocrsp) to the proxy node. The proxy node can then start the target container. At this point, the front-end interface of the containerization suite can receive the startup command of the target container and, through the analyzer and plugin manager, execute the subsequent adaptation process for heterogeneous devices.
[0062] S202. Based on the startup command, identify the target device types corresponding to multiple heterogeneous devices in the container system, and determine the target toolkit plugins corresponding to the target device types.
[0063] In this embodiment, a heterogeneous device can refer to the underlying hardware system corresponding to the container system. The number of heterogeneous devices can be two, three, or more, and this embodiment does not limit this. The target device type can refer to the device type corresponding to the heterogeneous device. The target toolset plugin can refer to a specific toolset plugin corresponding to the target device type.
[0064] When adapting to different heterogeneous devices, container systems may employ different adaptation methods. Specifically, different heterogeneous resources may use different environment configurations, have different numbers of mounted resource cards, and different mounted dynamic link libraries. Container systems need to perform specific configurations for different heterogeneous devices. Based on this, related technologies typically set up a corresponding device plugin in the container system for each type of heterogeneous device to achieve adaptation. However, this method of heterogeneous device adaptation is not very flexible. When adding new heterogeneous devices or upgrading existing ones, the container system usually needs to redeploy the device plugin, resulting in low availability and stability of the container system.
[0065] In this embodiment, the containerization suite interacts with the container system's device plugins via a front-end interface based on a target unified protocol. After receiving the target container's startup command, the containerization suite's front-end interface can identify the target device type corresponding to each heterogeneous device in the container system using an analyzer. Then, it uses a plugin manager to determine the target toolset plugins corresponding to each target device type. Subsequently, it can perform adaptation operations based on these target toolset plugins to achieve adaptation between the target container and the heterogeneous devices. In this way, different types of heterogeneous devices can use a unified device plugin based on the containerization suite, eliminating the need to deploy separate device plugins for each heterogeneous device. This provides greater flexibility in heterogeneous device adaptation. Furthermore, when adding or upgrading heterogeneous devices, there is no need to redeploy the device plugins, improving the availability and stability of the container system.
[0066] S203. Based on the target toolset plugin, perform adaptation operations for heterogeneous devices corresponding to the target device type, so that the target container can execute target commands based on heterogeneous devices.
[0067] In this embodiment, adaptation operations refer to various adaptation operations required by the target container when executing target commands on heterogeneous devices, specifically including mounting operations, environment configuration operations, etc. Target commands refer to specific user commands that the container needs to execute, such as container-defined commands (entry points). Specifically, after determining the target toolkit plugin corresponding to the target device type, the containerization suite can select that target toolkit plugin to perform adaptation operations between the target container and the heterogeneous device corresponding to that target device type. This can specifically refer to mounting resource cards, performing environment configuration operations, etc., thus achieving adaptation between the target container and the heterogeneous device, allowing the target container to execute target commands based on the heterogeneous device.
[0068] In this embodiment, the startup command of the target container is obtained through a front-end interface. The front-end interface interacts with the device plugins in the container system corresponding to the target container based on the target unified protocol. According to the startup command, the target device types corresponding to multiple heterogeneous devices in the container system are identified, and the target toolset plugins corresponding to the target device types are determined. Based on the target toolset plugins, adaptation operations are performed on the heterogeneous devices corresponding to the target device types, so that the target container can execute target commands based on the heterogeneous devices. In this application, for different heterogeneous devices, the front-end interface interacts with the device plugins in the container system through the target unified protocol. After obtaining the startup command of the target container, the front-end interface identifies the target device types of each heterogeneous device and selects the target toolset plugin corresponding to that target device type. Then, it performs the corresponding adaptation operation based on the target toolset plugin. In this way, the device plugins in the container system do not need to be directly adapted to the underlying heterogeneous devices. One device plugin can adapt to multiple different heterogeneous devices, which can improve the flexibility of heterogeneous device adaptation. At the same time, updates and upgrades of heterogeneous devices do not require adjustments to the device plugins, which can improve the stability and availability of the container system.
[0069] Based on the above embodiments, Figure 3 A flowchart illustrating another heterogeneous device adaptation method provided for an exemplary embodiment of this application. Please refer to... Figure 3 The heterogeneous device adaptation method may include:
[0070] S301. Obtain the startup command of the target container through the front-end interface. The front-end interface interacts with the device plugins in the container system corresponding to the target container based on the target unified protocol.
[0071] In one possible implementation, the target unification protocol includes target environment variables corresponding to multiple heterogeneous devices; the environment variables corresponding to each heterogeneous device are all target environment variables; and the environment variables corresponding to device plug-ins in the container system are target environment variables.
[0072] In this embodiment, the environment variable can refer to the environment variable field corresponding to the heterogeneous device. The target environment variable can refer to the unified environment variable corresponding to different heterogeneous devices.
[0073] In related technologies, the environmental variables of different heterogeneous devices are usually different. Based on the environmental variables, the device plugins corresponding to heterogeneous devices can identify the specific type of heterogeneous devices and perform corresponding adaptation operations.
[0074] In this embodiment, different types of heterogeneous devices all use the same target environment variable, and this target environment variable is also set in the device plugin of the container system. This way, the device plugin does not need to be aware of the specific type of the underlying heterogeneous device and can adapt to different types of heterogeneous devices. For example, in this embodiment, different types of heterogeneous devices can all use the target environment variable "XPU_VISIBLE_DEVICES", and the device plugin only needs to fill in the same target environment variable "XPU_VISIBLE_DEVICES". Thus, a device plugin can match and be applicable to various types of underlying heterogeneous devices, improving the flexibility of heterogeneous device adaptation. It should be noted that this target environment variable can also be represented in other forms, and this embodiment does not limit this.
[0075] In one possible implementation, the front-end interface is a hook interface under the Open Container Initiative (OCI) standard; the front-end interface is registered in the pre-startup phase of the target container.
[0076] In this embodiment, the container runtime standard defines how a container builds its runtime based on its configuration. The hook mechanism, defined in the OCI standard, can be used to execute specific user-defined operations during the container lifecycle. Hooks can be triggered at different stages of the container lifecycle, such as the pre-start phase, post-start phase, and pre-stop phase.
[0077] The containerization suite in this embodiment conforms to the OCI HOOK standard. Essentially, it maintains a patch on top of the container runtime tool (runc). Specifically, it injects a prestart HOOK interface into the container's property configuration file (Spec) before the container starts. This prestart HOOK interface is registered in the pre-start phase, meaning it executes after the container starts (after the namespace has been created) and before the container's target command is executed. Thus, by performing adaptation operations between the target container and heterogeneous devices in the pre-start phase, the containerization suite ensures accurate adaptation to heterogeneous devices and correct execution of the container's target command.
[0078] S302. Collect the identification information corresponding to each heterogeneous device through the analyzer; determine the target device type corresponding to the heterogeneous device based on the identification information.
[0079] In this embodiment, the analyzer in the containerization suite can be used to analyze the specific type of heterogeneous devices at the underlying level of the container system. Identification information can refer to various identification information of the heterogeneous device, such as device code, device name, and device model, or other fields within the device information. This embodiment does not limit the specific type of identification information. Specifically, the analyzer in the containerization suite can collect identification information of heterogeneous devices in the container system, such as the name of the heterogeneous device, and then determine the target device type corresponding to the heterogeneous device based on this identification information. This allows the containerization suite in the electronic device to accurately determine the target device type through the analyzer, which can improve the accuracy of subsequent adaptation operations to some extent.
[0080] S303. Through the plugin manager, determine the target mapping relationship between the device type and the toolkit plugin based on the toolkit plugins registered in the plugin manager and the device type corresponding to the toolkit plugin.
[0081] S304. Using the plugin manager, determine the target toolset plugin corresponding to the target device type based on the target device type and the target mapping relationship.
[0082] In this embodiment, the plugin manager in the containerization suite can be used to manage toolkit plugins corresponding to different heterogeneous devices. The plugin manager can pre-register toolkit plugins corresponding to various heterogeneous device types, such as containerization toolkits for various heterogeneous devices, which can containerize heterogeneous resources. Specifically, during registration, since a toolkit plugin is essentially a binary file, the plugin manager can record information such as the device name, file path, and executable file name corresponding to each toolkit plugin. This information can be stored, for example, as a software cache, facilitating subsequent comparison and matching with the target device type.
[0083] Specifically, the plugin manager establishes a target mapping relationship between device types and toolset plugins based on registered toolset plugins and device types. After the analyzer in the electronic device containerization suite determines the target device type corresponding to the underlying heterogeneous device, the plugin manager in the containerization suite searches for and determines the target toolset plugin corresponding to the target device type in the target mapping relationship based on the target device type and target mapping relationship. In this way, the plugin manager in the containerization suite can accurately determine the corresponding target toolset plugin based on the target mapping relationship, realizing the adaptation of a device plugin to different types of heterogeneous devices and improving the flexibility of heterogeneous device adaptation in container systems.
[0084] S305. Based on the target toolset plugin, perform adaptation operations for heterogeneous devices corresponding to the target device type, so that the target container can execute target commands based on heterogeneous devices.
[0085] In one possible implementation, the adaptation operation in step S305 may specifically include the following:
[0086] Based on the target toolset plugins, mount the heterogeneous devices corresponding to the target device type; for the heterogeneous devices, perform the environment configuration operations corresponding to the target device type.
[0087] In this embodiment, after determining the target toolset plugin, the containerization suite in the electronic device can execute the target toolset plugin, that is, perform the adaptation operation corresponding to the target device type. This execution process can be performed by the containerization suite or by other applications in the electronic device; this embodiment does not limit this. Specifically, the electronic device can mount heterogeneous devices corresponding to the target device type according to the target toolset plugin, such as mounting at least one heterogeneous resource card. Then, it can perform environment configuration operations corresponding to the target device type for the heterogeneous device, such as reading shared files of dynamic link libraries and reading executable files, to complete the environment configuration operation. In this way, the computing resources on the Kubernetes side of the container system can be unified, without needing to report different resource values for different heterogeneous devices, nor needing to deploy matching device plugins for different types of heterogeneous devices. Adaptation to different heterogeneous devices can be achieved based on a single device plugin, which can improve the flexibility of heterogeneous device adaptation, reduce costs, and also ensure the stability and availability of the container system.
[0088] It should be understood that in the various embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0089] Based on any of the above embodiments, Figure 4 This is a schematic diagram of an architecture for heterogeneous device adaptation provided for an exemplary embodiment of this application. For example... Figure 4 As shown, in the Kubernetes system 401, the proxy node sends a resource allocation request to the device plugin, and the device plugin returns a resource allocation request to the proxy node. Then, Kubernetes starts the target container. Because the front-end interface of the containerization suite 402 is registered in the pre-start phase of the target container, this front-end interface can obtain the target container's startup instructions. Furthermore, this front-end interface exposes the target unified protocol to the Kubernetes system; that is, the front-end interface interacts with the device plugin through the target unified protocol.
[0090] Next, the analyzer in containerization suite 402 analyzes the target device types corresponding to the multiple heterogeneous devices at the underlying level, and then sends the target device type to the plugin manager in containerization suite 402. This plugin manager has registered toolkit plugins corresponding to multiple device types, such as... Figure 4 The toolkit plugins shown are D, E, and F. The plugin manager searches and matches the target toolkit plugins within the target mapping relationship between device types and toolkit plugins based on the target device type to determine the corresponding target toolkit plugin. The electronic device can then select this target toolkit plugin to perform adaptation operations corresponding to the target device type on heterogeneous devices, such as mounting resource cards and completing environment configurations, thus achieving adaptation between the target container and the heterogeneous device. Afterward, the target container component (Pod) can execute target commands based on the heterogeneous device.
[0091] The containerization suite in this embodiment serves as a general-purpose container runtime, capable of shielding the details of the underlying hardware without requiring device plugins to report underlying hardware resource values. The front-end interface of the containerization suite exposes a unified target protocol to device plugins in the Kubernetes system, enabling one device plugin to adapt to multiple heterogeneous devices. Compared to related technologies where one heterogeneous device corresponds to one device plugin, this embodiment uses a general-purpose device plugin to adapt to multiple heterogeneous devices, resulting in greater flexibility in heterogeneous device adaptation. The Kubernetes system also does not need to distinguish between hardware device types for underlying heterogeneous resources, thus avoiding stability and availability risks to the entire container cluster caused by device plugin adaptation, updates, and upgrades.
[0092] Figure 5 Please refer to the structural schematic diagram of a heterogeneous device adapter provided for an exemplary embodiment of this application. Figure 5 The heterogeneous device adapter 50 includes:
[0093] The acquisition module 51 is used to obtain the startup command of the target container through the front-end interface. The front-end interface interacts with the device plugins in the container system corresponding to the target container based on the target unified protocol.
[0094] The identification module 52 is used to identify the target device type corresponding to multiple heterogeneous devices in the container system according to the startup command, and determine the target toolkit plugin corresponding to the target device type.
[0095] The adaptation module 53 is used to perform adaptation operations on heterogeneous devices corresponding to the target device type based on the target toolset plugin, so that the target container can execute target commands based on the heterogeneous device.
[0096] In one possible implementation, the target unification protocol includes target environment variables corresponding to multiple heterogeneous devices; the environment variables corresponding to each heterogeneous device are all target environment variables; and the environment variables corresponding to device plug-ins in the container system are target environment variables.
[0097] In one possible implementation, the identification module 52 is specifically used for:
[0098] The analyzer collects the identification information corresponding to each heterogeneous device.
[0099] The target device type corresponding to the heterogeneous device is determined based on the identification information.
[0100] In one possible implementation, the identification module 52 is specifically used for:
[0101] The plugin manager determines the target mapping relationship between the device type and the toolkit plugin based on the toolkit plugins registered in the plugin manager and the device type corresponding to the toolkit plugins.
[0102] The plugin manager determines the target toolset plugins corresponding to the target device type based on the target device type and the target mapping relationship.
[0103] In one possible implementation, the adapter module 53 is specifically used for:
[0104] Based on the target toolset plugins, mount the heterogeneous devices corresponding to the target device type;
[0105] For heterogeneous devices, perform the environment configuration operation corresponding to the target device type.
[0106] In one possible implementation, the front-end interface is a hook interface under the container runtime standard OCI; the front-end interface is registered in the pre-startup phase of the target container.
[0107] The heterogeneous device adapter 50 provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0108] Figure 6 For a schematic diagram of an electronic device provided as an exemplary embodiment of this application, please refer to [link / reference]. Figure 6 The electronic device 60 may include a processor 61 and a memory 62. Exemplarily, the processor 61 and the memory 62 are interconnected via a bus 63.
[0109] Memory 62 stores instructions executed by the computer;
[0110] The processor 61 executes computer execution instructions stored in the memory 62, causing the processor 61 to perform the heterogeneous device adaptation method as described in the above method embodiment.
[0111] Accordingly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the heterogeneous device adaptation method of the above-described method embodiments.
[0112] Accordingly, embodiments of this application may also provide a computer program product, including a computer program, which, when executed by a processor, can implement the heterogeneous device adaptation method shown in the above method embodiments.
[0113] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0114] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0115] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0116] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0117] In a typical configuration, a computing device includes one or more processors, input / output interfaces, network interfaces, and memory.
[0118] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0119] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0120] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0121] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method for adapting heterogeneous devices, characterized in that, include: The startup command of the target container is obtained through a front-end interface, which interacts with the device plugins in the container system corresponding to the target container based on the target unified protocol. Based on the startup command, identify the target device types corresponding to the multiple heterogeneous devices in the container system, and determine the target toolkit plugins corresponding to the target device types; Based on the target toolset plugin, an adaptation operation is performed on the heterogeneous device corresponding to the target device type, so that the target container executes the target command based on the heterogeneous device.
2. The method according to claim 1, characterized in that, The target unified protocol includes target environment variables corresponding to multiple heterogeneous devices; the environment variables corresponding to each of the heterogeneous devices are all the target environment variables; the environment variables corresponding to the device plug-ins in the container system are the target environment variables.
3. The method according to claim 1, characterized in that, The identification of the target device types corresponding to the multiple heterogeneous devices in the container system includes: The analyzer collects the identification information corresponding to each of the heterogeneous devices. The target device type corresponding to the heterogeneous device is determined based on the identification information.
4. The method according to claim 1, characterized in that, The step of determining the target toolset plugin corresponding to the target device type includes: The target mapping relationship between the device type and the toolkit plugin is determined by the plugin manager based on the toolkit plugins registered in the plugin manager and the device type corresponding to the toolkit plugins. The plugin manager determines the target toolset plugin corresponding to the target device type based on the target device type and the target mapping relationship.
5. The method according to claim 1, characterized in that, The step of performing adaptation operations for heterogeneous devices corresponding to the target device type based on the target toolset plugin includes: Based on the target toolset plugin, mount the heterogeneous device corresponding to the target device type; For the heterogeneous device, perform the environment configuration operation corresponding to the target device type.
6. The method according to any one of claims 1 to 5, characterized in that, The front-end interface is a hook interface under the container runtime standard OCI; the front-end interface is registered in the pre-startup phase of the target container.
7. A heterogeneous device adapter, characterized in that, include: The acquisition module is used to acquire the startup command of the target container through a front-end interface, wherein the front-end interface interacts with the device plugins in the container system corresponding to the target container based on the target unified protocol. The identification module is used to identify the target device types corresponding to multiple heterogeneous devices in the container system according to the startup command, and to determine the target toolkit plugins corresponding to the target device types. An adaptation module is used to perform an adaptation operation on heterogeneous devices corresponding to the target device type based on the target toolset plugin, so that the target container can execute target commands based on the heterogeneous device.
8. An electronic device, characterized in that, include: Memory and processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the heterogeneous device adaptation method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the heterogeneous device adaptation method according to any one of claims 1 to 6.
10. A computer program product, characterized in that, It includes a computer program, which, when executed by a computer, implements the heterogeneous device adaptation method as described in any one of claims 1 to 6.