A heterogeneous environment package and dependency unified management method for AI edge inference

CN123011305APending Publication Date: 2026-10-30SHENZHEN TIANJUE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611207142.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-11
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0004]为了克服现有技术的不足,本发明的目的是提供一种面向AI边缘推理的异构环境包与依赖统一管理方法,解决现有面向AI边缘推理的C++工程中源码工程依赖、预编译环境包依赖、编译器版本约束、构建配置与运行时环境变量配置相互割裂导致的人工部署成本高、异构边缘设备适配困难的问题

Benefits of technology

[0056]本发明提供了一种面向AI边缘推理的异构环境包与依赖统一管理方法,通过源码工程依赖树与环境包依赖树的联动解析,解决了人工逐个检查子工程依赖清单的问题,实现了从目标工程及其下级源码依赖工程中自动提取环境包依赖;通过环境包依赖描述文件递归展开传递依赖,解决了因遗漏间接依赖导致部署失败的问题,实现了形成包含直接环境包依赖和间接环境包依赖的环境包依赖闭包;通过设备环境指纹和分级环境包匹配机制,解决了边缘设备现场本地编译大型依赖的问题,实现了根据目标设备的操作系统信息和编译器版本优先复用异构预编译环境包;通过运行时环境变量配置,解决了频繁手动填写固定路径的问题,实现了在运行阶段通过读取环境变量获得依赖路径。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123011305A_ABST
    Figure CN123011305A_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of software engineering management, and provides a heterogeneous environment package and dependency unified management method for AI edge inference, which comprises: list analysis, dependency tree construction, root dependency set establishment, dependency closure construction, device environment fingerprint generation, hierarchical matching, environment package deployment, engineering resource synchronization, environment variable writing and reading; through linkage analysis of the source code engineering dependency tree and the environment package dependency tree, the environment package dependency can be automatically extracted; through recursive expansion and transmission of the dependency described in the environment package dependency description file to form a dependency closure, the deployment failure risk is reduced; through the device environment fingerprint and hierarchical matching mechanism, the heterogeneous pre-compiled package is preferentially reused, and the possibility of on-site compilation of the edge device is reduced; through the runtime environment variable configuration, the directory and other paths of the pre-compiled package are written into the environment variable, so that the C++ inference application reads the variable to obtain the dependency path at runtime, and the fixed path is avoided to be hard-coded in the code or script.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of software engineering management technology, and in particular to a unified management method for heterogeneous environment packages and dependencies for AI edge inference. Background Technology

[0002] In industrial vision and AI edge inference scenarios, C++ projects are often used to support high-performance inference, image processing, acceleration operators, and device-side business logic. These projects typically rely on internal source code repositories, third-party pre-compiled libraries, specific compiler versions, CMake build configurations, and runtime dynamic libraries for GPUs or inference engines. Compared to typical server environments, industrial edge devices are characterized by diverse operating system versions, inconsistent compiler versions, limited computing power, unstable on-site network conditions, and high manual maintenance costs.

[0003] However, existing solutions have the following main shortcomings: First, source code project dependencies and environment package dependencies are disconnected. Source code management tools are mainly used to handle source code repository retrieval and version locking, while package management tools focus more on environment package dependency management and build integration. When an AI inference project needs both an internal source code library and multiple pre-compiled environment packages, developers usually need to manually coordinate the dependency order, version, and path between multiple tools. Second, there is a lack of linkage mechanism between the source code project dependency tree and the environment package dependency tree. In actual projects, the main project may declare some environment package dependencies, and source code dependency projects may also continue to declare their own environment package dependencies; at the same time, an environment package itself may also depend on other runtime packages, basic library packages, or inference engine components. Existing solutions usually cannot automatically extract the root dependencies of environment packages from the source code project dependency tree and further recursively expand the transitive dependencies of environment packages. Third, environment package matching in heterogeneous environments is not suitable for edge environments. Traditional package management processes often require local building or manual configuration adjustment when packages do not match completely. For edge industrial control computers, compiling large dependencies on-site may be time-consuming, or even infeasible due to computing power, storage, or system pruning. Fourth, there is a disconnect between build-time and runtime dependencies. AI inference projects require not only header files and linked libraries, but also environment variable configurations such as runtime directories, dynamic library directories, and inference engine resource directories. Existing tools can often solve some compile-time issues, but problems may still occur where compilation succeeds but the dynamic library cannot be found at runtime. Summary of the Invention

[0004] To overcome the shortcomings of existing technologies, the purpose of this invention is to provide a unified management method for heterogeneous environment packages and dependencies for AI edge inference, which solves the problems of high manual deployment costs and difficulty in adapting to heterogeneous edge devices caused by the fragmentation of source code project dependencies, pre-compiled environment package dependencies, compiler version constraints, build configuration and runtime environment variable configuration in existing C++ projects for AI edge inference.

[0005] To achieve the above objectives, the present invention provides the following solution:

[0006] A method for unified management of heterogeneous environment packages and dependencies for AI edge inference, comprising:

[0007] Receive and parse user task instructions and a structured dependency list; the structured dependency list includes: source code dependency entries, environment package dependency entries, compiler version constraint entries, and project resource synchronization operation entries;

[0008] Based on the source code dependency entries, the corresponding source code dependency projects are recursively extracted to obtain the source code project dependency tree;

[0009] A root dependency set of environment packages is established by reading the environment package dependency entries corresponding to each source code dependency project in the target project and the source code project dependency tree.

[0010] Based on the dependency description files in the environment package repository, the transitive dependencies of the environment packages in the root dependency set of the environment package are recursively expanded to obtain the environment package dependency closure.

[0011] Generate a device environment fingerprint based on the target device's operating system type, operating system version, and compiler version;

[0012] Based on the device environment fingerprint, the compiler version constraint entries, and the version constraints in each environment package dependency entry, the environment packages in the environment package dependency closure are matched hierarchically.

[0013] Download and deploy the matched heterogeneous pre-compiled environment package;

[0014] A build configuration fragment is generated based on the source code project dependency tree, the environment package dependency closure, and the installation directory information of the deployed environment packages, and project resources are synchronized according to the project resource synchronization operation entries;

[0015] Write the runtime directory, library directory, resource directory, or installation root directory of the deployed environment package to the runtime environment variables, and read the dependency paths of the environment variables during the runtime phase.

[0016] Preferably, receiving and parsing user task instructions and structured dependency lists further includes:

[0017] A task description object is generated by parsing the user task instructions; the task description object includes: task type, target project path, target build object identifier, compiler version, pending dependencies, and execution options.

[0018] The execution order of the steps is based on the task description object generation process.

[0019] Preferably, the corresponding source code dependency projects are recursively extracted based on the source code dependency entries to obtain a source code project dependency tree, including:

[0020] Obtain the source code repository address, local directory, and structured dependency manifest path for each source code dependency entry;

[0021] If the local directory does not exist, retrieve the source code dependency project corresponding to the source code dependency entry;

[0022] If the local directory already exists, update or check the status based on the task type;

[0023] Read the structured dependency list from the source code dependency projects, identify the lower-level source code dependency entries, and establish a hierarchical relationship between the lower-level source code dependency projects and the parent source code dependency projects;

[0024] Mark the source code dependency projects that have been processed. When there are no unprocessed lower-level source code dependency entries, output the source code project dependency tree.

[0025] Preferably, an environment package root dependency set is established by reading the environment package dependency entries corresponding to each source code dependency project in the target project and the source code project dependency tree, including:

[0026] Environment package dependencies are extracted by traversing the structured dependency list corresponding to each source code dependency project in the dependency tree of the target project and the source code project. The environment package dependencies include: environment package name, version constraints, compiler version constraints, and project resource synchronization operations.

[0027] When multiple projects declare the same environment package, they are merged based on the environment package name, version constraints, and compiler version constraints, retaining the source project, manifest path, and synchronization operation to obtain the source code project-environment package association.

[0028] Preferably, the transitive dependencies of environment packages in the root dependency set of the environment package are recursively expanded according to the dependency description files in the environment package repository to obtain the environment package dependency closure, including:

[0029] Set the environment package dependencies in the root dependency set of the environment package as objects to be resolved, and query the dependency description file corresponding to the objects to be resolved in the environment package repository;

[0030] Read the lower-level environment package dependencies in the dependency description file and add any unprocessed lower-level environment packages to the set to be parsed;

[0031] Environment packages that do not have dependency description files are preserved as leaf environment packages in the environment package dependency tree;

[0032] When the set to be parsed is empty, the output environment package depends on the closure.

[0033] Preferably, the device environment fingerprint includes: operating system identifier, system version identifier, and compiler version identifier.

[0034] Preferably, based on the device environment fingerprint, the compiler version constraint entries, and the version constraints in each environment package dependency entry, hierarchical matching of environment packages in the environment package dependency closure is performed, and the matched heterogeneous pre-compiled environment packages are downloaded and deployed, including:

[0035] Query the environment package repository index based on environment package name, version constraints, compiler version constraints, and device environment fingerprint;

[0036] Environment packages that match the same operating system type, operating system version, compiler version, and environment package version during the query are identified as exact match environment packages;

[0037] If no exact matching environment package is found, the system sequentially queries the operating system environment package, the compiler version environment package, and the general channel environment package.

[0038] Record the matching level, repository path, version information, and source project for each matching environment package to obtain a list of environment packages to be deployed;

[0039] If no candidate environment package meets the compatibility requirements, the environment package is recorded as an unmatched environment package and the name and version constraint information of the environment package are output.

[0040] Preferably, downloading and deploying the matched heterogeneous pre-compiled environment package includes:

[0041] Compare the list of environment packages to be deployed with the local environment package index;

[0042] When the target deployment environment package is not a local environment package, download and decompress the corresponding compressed package;

[0043] When the target deployment environment package is a local version or an environment package whose update time does not meet the requirements, update the corresponding environment package;

[0044] If the target deployment environment package is a package that already meets the requirements locally, skip the download.

[0045] After deployment, update the local environment package index to record the environment package name, version number, compiler version, installation path, library directory, runtime directory, and resource directory.

[0046] Preferably, a build configuration fragment is generated based on the source code project dependency tree, the environment package dependency closure, and the installation directory information of the deployed environment packages, and project resources are synchronized according to the project resource synchronization operation entries, including:

[0047] Generate source code dependency import configuration based on the source code project dependency tree, generate environment package import configuration based on the environment package dependency tree and the local environment package installation path, and write the build configuration fragment into the target project build configuration file;

[0048] Perform a copy or move operation based on the source file or directory, the relative path of the target project, and the synchronization type in the project resource synchronization operation entry.

[0049] If the source resource does not exist or the target path is not writable, log the exception and output the synchronization failure item.

[0050] Preferably, the runtime directory, library directory, resource directory, or installation root directory of the deployed environment package is written into the runtime environment variables, and the dependency paths of the environment variables are read during the runtime phase, including:

[0051] Perform path normalization, null value judgment, and path duplication judgment on the runtime directory, library directory, resource directory, or installation root directory in the deployed heterogeneous pre-compiled environment package;

[0052] Generate environment variable names; the environment variable names include: environment package identifier and directory type;

[0053] When the target environment variable does not exist or the existing variable value does not contain the target directory, write the variable value to the user-level or system-level environment variable.

[0054] Skip writing if the existing variable value already meets the requirements.

[0055] The present invention discloses the following technical effects:

[0056] This invention provides a unified management method for heterogeneous environment packages and dependencies for AI edge inference. By linking the source code project dependency tree with the environment package dependency tree, it solves the problem of manually checking sub-project dependency lists one by one, enabling automatic extraction of environment package dependencies from the target project and its subordinate source code dependency projects. Through recursive expansion of transitive dependencies using environment package dependency description files, it solves the problem of deployment failure due to missed indirect dependencies, achieving the formation of environment package dependency closures containing both direct and indirect environment package dependencies. Through device environment fingerprinting and a hierarchical environment package matching mechanism, it solves the problem of large dependencies being compiled locally on edge devices, enabling the priority reuse of heterogeneous pre-compiled environment packages based on the target device's operating system information and compiler version. Through runtime environment variable configuration, it solves the problem of frequently manually filling in fixed paths, enabling the acquisition of dependency paths by reading environment variables during the runtime phase. Attached Figure Description

[0057] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0058] Figure 1 A schematic diagram of a unified management process for heterogeneous environment packages and dependencies for AI edge inference provided in an embodiment of the present invention;

[0059] Figure 2 A flowchart of heterogeneous dependency management provided for embodiments of the present invention;

[0060] Figure 3 This is a schematic diagram illustrating the relationship between source code project dependencies and environment package dependencies provided in an embodiment of the present invention. Detailed Implementation

[0061] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0062] The purpose of this invention is to provide a unified management method for heterogeneous environment packages and dependencies for AI edge inference, which solves the problems of high manual deployment costs and difficulty in adapting to heterogeneous edge devices caused by the fragmentation of source code project dependencies, pre-compiled environment package dependencies, compiler version constraints, build configuration and runtime environment variable configuration in existing C++ projects for AI edge inference.

[0063] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0064] Figure 1 This is a schematic diagram of a unified management process for heterogeneous environment packages and dependencies for AI edge inference provided in an embodiment of the present invention. Figure 2 The heterogeneous dependency management flowchart provided in the embodiments of the present invention is as follows: Figure 1 and Figure 2 As shown, this invention provides a method for unified management of heterogeneous environment packages and dependencies for AI edge inference, including:

[0065] Step 100: Receive and parse the user task instructions and structured dependency list; the structured dependency list includes: source code dependency entries, environment package dependency entries, compiler version constraint entries, and project resource synchronization operation entries;

[0066] Step 200: Recursively extract the corresponding source code dependency projects based on the source code dependency entries to obtain the source code project dependency tree;

[0067] Step 300: Establish an environment package root dependency set by reading the environment package dependency entries corresponding to each source code dependency project in the target project and the source code project dependency tree;

[0068] Step 400: Recursively expand the transitive dependencies of the environment packages in the root dependency set of the environment packages according to the dependency description files in the environment package repository to obtain the environment package dependency closure;

[0069] Step 500: Generate a device environment fingerprint based on the target device's operating system type, operating system version, and compiler version;

[0070] Step 600: Based on the device environment fingerprint, the compiler version constraint entries, and the version constraints in each environment package dependency entry, perform hierarchical matching of the environment packages in the environment package dependency closure;

[0071] Step 700: Download and deploy the matched heterogeneous pre-compiled environment package;

[0072] Step 800: Generate a build configuration fragment based on the source code project dependency tree, the environment package dependency closure, and the installation directory information of the deployed environment packages, and synchronize project resources according to the project resource synchronization operation entries;

[0073] Step 900: Write the runtime directory, library directory, resource directory or installation root directory of the deployed environment package into the runtime environment variables, and read the dependency paths of the environment variables during the runtime phase.

[0074] Preferably, this embodiment aims to provide a unified management method for heterogeneous environment packages and dependencies for AI edge inference. This method transforms the deployment process of AI inference projects on edge devices from multiple fragmented operations into a continuous, automated process through unified task scheduling, source code project dependency tree parsing, environment package dependency tree parsing, device environment fingerprint generation, environment package hierarchical matching, heterogeneous pre-compiled environment package deployment, build configuration generation, project resource synchronization, and runtime environment variable writing.

[0075] Furthermore, this embodiment uses a structured dependency list as a unified input. The system first parses the task instructions and the structured dependency list to obtain the task description object and the mixed dependency resolution result; then, it recursively obtains the source code dependency projects according to the source code dependency entries, forming a source code project dependency tree; next, it reads the structured dependency list corresponding to each source code dependency project, extracts environment package dependencies and forms an environment package root dependency set, and records the source of environment package dependencies; the system continues to read the dependency description files in the environment package repository, recursively expands transitive dependencies, and forms an environment package dependency tree or an environment package dependency closure; then, it generates a device environment fingerprint according to the target device's operating system type, operating system version and compiler version, and performs hierarchical matching and deployment of the environment package; finally, it generates a build configuration based on the directory information of the deployed environment package, performs project resource synchronization, and writes the required directories to the environment variables, enabling the C++ inference application to obtain the dependency path by reading the environment variables.

[0076] Furthermore, this embodiment includes a unified scheduling engine, a source code project dependency tree parsing module, an environment package dependency tree parsing module, a heterogeneous environment matching module, and a build and runtime environment variable configuration module.

[0077] The unified scheduling engine is used to parse user task instructions, generate task description objects that include task type, target project path, target build object identifier, compiler version, pending dependencies and execution options, and control the calling order of subsequent modules based on the task description objects.

[0078] The source code project dependency tree parsing module is used to read source code dependency entries in the structured dependency list, obtain the corresponding source code dependency projects, and continue to read the structured dependency lists in the lower-level source code dependency projects; when there are no unprocessed lower-level source code dependency entries, the source code project dependency tree is output.

[0079] The environment package dependency tree parsing module is used to read the structured dependency list of the target project and each source code dependent project, collect the environment package dependencies, form the environment package root dependency set; then, based on the dependency description file in the environment package repository, it recursively expands the environment package transitive dependencies, and outputs the environment package dependency tree, environment package dependency closure and source relationship.

[0080] The heterogeneous environment matching module is used to collect target device operating system information and compiler version, and generate device environment fingerprint; it performs hierarchical matching of environment packages based on the device environment fingerprint, environment package constraints and environment package repository index, and performs download, decompression and local index update for missing or pending environment packages.

[0081] The build and runtime environment variable configuration module is used to generate build configuration fragments based on the source code project dependency tree, environment package dependency tree, and deployed environment packages, perform project resource synchronization, and write the runtime directory, library directory, resource directory, or installation root directory of the environment package into user-level or system-level environment variables, so that C++ inference applications can read the environment variables to obtain the dependency paths during the runtime phase.

[0082] Specifically, the elements are described as follows:

[0083] Element 1: Structured Dependency List. The structured dependency list is used to uniformly declare source code dependencies, environment package dependencies, compiler version constraints, and project resource synchronization operations. The system parses this list to generate mixed dependency resolution results.

[0084] Element 2: Source Code Project Dependency Tree. The source code project dependency tree is a hierarchical structure of source code dependencies recursively generated based on the structured dependency list of the target project and its subordinate source code dependent projects. A source code dependent project is the basic unit within this hierarchy, not a single source code file.

[0085] Element 3: Package Dependency Tree. The package dependency tree describes the direct and transitive dependencies between heterogeneous pre-compiled environment packages. A package dependency closure is a complete set of environment packages that includes direct package dependencies and all transitive package dependencies.

[0086] Element 4: Source Code Project - Environment Package Relationship. This relationship records which source code project declares the environment package dependencies, which structured dependency list imports them, or whether they are imported via other environment packages.

[0087] Element 5: Heterogeneous Pre-compiled Environment Package. A heterogeneous pre-compiled environment package is a binary environment package used for edge deployment, including package name, version number, compiler version, operating system identifier, installation path, runtime file directory, and update time. In one embodiment, the heterogeneous pre-compiled environment package is a LeanPackage.

[0088] Element 6: Build Import Templates. Build import templates are used to generate dependency import statements, build object configurations, and target addition statements that are recognizable by the target project, enabling the target project to reference source code project dependencies and heterogeneous pre-compiled environment packages.

[0089] Element 7, runtime environment variable configuration, refers to the process of generating, validating, updating, and writing environment variables. Writing runtime environment variables is the specific execution operation within this process. Runtime environment variable configuration is used to write runtime directories, library directories, resource directories, or installation root directories from heterogeneous pre-compiled environment packages into environment variables, enabling C++ inference applications to locate dynamic library files, inference engine runtime files, or other required resource files during runtime by reading these environment variables.

[0090] Preferably, the method implementation process is as follows:

[0091] Step 1: Receive task instructions and a structured dependency list.

[0092] The system receives task commands and execution options from the user. Task commands may include installation, cloning, updating, status checks, importing, object generation, dependency addition, etc. The processed objects include command text, command parameters, the current working directory, and a structured dependency list.

[0093] Step 2: Parse the task instructions and generate a task description object.

[0094] The unified scheduling engine parses task instructions to obtain a task description object. This task description object includes the task type, target project path, target build object identifier, specified compiler version, pending dependencies, and execution options, which determine the order in which subsequent modules are called.

[0095] Step 3: Parse the structured dependency list to generate mixed dependency resolution results.

[0096] The system reads the structured dependency list, identifies source code dependency entries, environment package dependency entries, compiler version constraint entries, and project resource synchronization operation entries, and generates a mixed dependency resolution result.

[0097] Step 4: Build the source code project dependency tree.

[0098] The system retrieves source code dependency entries from the mixed dependency resolution results. For each source code dependency entry, the system reads the corresponding source code repository address, local directory, and structured dependency manifest path; if the local directory does not exist, it retrieves the corresponding source code dependency project; if the local directory already exists, it performs an update or status check based on the task type.

[0099] The system continues to read the structured dependency list from the acquired source code dependency projects, identifies lower-level source code dependency entries, and establishes a hierarchical relationship between lower-level source code dependency projects and their parent source code dependency projects. The system marks the processed source code dependency projects; when there are no unprocessed lower-level source code dependency entries, it outputs the source code project dependency tree.

[0100] Step 5: Generate the environment package root dependency set.

[0101] The system traverses the dependency tree of the target project and the source code project, reading the environment package dependencies from the corresponding structured dependency list. Each environment package dependency includes at least the environment package name, version constraints, compiler version constraints, and project resource synchronization operations.

[0102] The system aggregates environment package dependencies into a root dependency set. When multiple projects declare the same environment package, they are merged based on the environment package name, version constraints, and compiler version constraints, while retaining the source project, manifest path, and synchronization operation to form a source code project-environment package association.

[0103] Step 6: Recursively expand the environment package dependency tree.

[0104] The system uses environment package dependencies in the root dependency set as the objects to be resolved, and queries the corresponding dependency description file in the environment package repository. The system reads the lower-level environment package dependencies from the dependency description file and adds any unprocessed lower-level environment packages to the set to be resolved.

[0105] For environment packages that have already been resolved, the system will not expand them again; for environment packages that do not have dependency description files, the system will keep them as leaf environment packages in the environment package dependency tree. When the set to be resolved is empty, an environment package dependency tree or an environment package dependency closure is formed.

[0106] Step 7: Generate device environment fingerprint.

[0107] The system collects the target device's operating system type, operating system version, and compiler version, standardizes the collected results, and generates a device environment fingerprint. The device environment fingerprint includes at least the operating system identifier, system version identifier, and compiler version identifier, and serves as the query condition for environment package matching.

[0108] Step 8: Perform hierarchical environment package matching.

[0109] The system queries the environment package repository index based on the environment package name, version constraints, compiler version constraints, and device environment fingerprint. The system prioritizes searching for environment packages where the operating system type, operating system version, compiler version, and environment package version are all consistent. If no exact match is found, the system sequentially queries environment packages compatible with the operating system, environment packages compatible with the compiler version, and then general channel environment packages.

[0110] The system records the matching level, repository path, version information, and source project for each matching environment package, forming a list of environment packages to be deployed. When no candidate environment package meets the preset compatibility conditions, the system records the corresponding environment package as an unmatched environment package and outputs information such as the environment package name and version constraints. Subsequent deployment processing will skip this package.

[0111] Step 9: Deploy the heterogeneous pre-compiled environment package.

[0112] The system compares the list of environment packages to be deployed with the local environment package index. For environment packages that do not exist locally, the system downloads and decompresses the corresponding compressed package; for environment packages that exist locally but whose version or update time does not meet the requirements, the system updates the corresponding environment package; for environment packages that already meet the requirements locally, the download is skipped.

[0113] After deployment, the system updates the local environment package index, recording the environment package name, version number, compiler version, installation path, library directory, runtime directory, and resource directory.

[0114] Step 10: Generate build configuration and perform project resource synchronization.

[0115] The system generates source code dependency import configurations based on the source code project dependency tree, generates environment package import configurations based on the environment package dependency tree and the local environment package installation path, and writes the build configuration fragments into the target project's build configuration file. For existing identical import configurations, the system does not write them again.

[0116] For project resource synchronization operations, the system performs copy or move operations based on the environment package installation path, source file or directory, target project relative path and synchronization type; when the source resource does not exist or the target path is not writable, the system records the exception and outputs the synchronization failure item.

[0117] Step 11: Write to runtime environment variables.

[0118] The system obtains the runtime directory, library directory, resource directory or installation root directory from the deployed heterogeneous pre-compiled environment package, and performs path normalization, null value judgment and path duplication judgment on the directory.

[0119] The system generates environment variable names based on "environment package identifier + directory type" and generates corresponding variable values ​​according to the directory type. When the target environment variable does not exist, or the existing variable value does not contain a directory, the system writes the variable value to the user-level or system-level environment variable. If the existing variable value already meets the requirements, the writing is skipped. During the runtime phase, C++ inference applications obtain the dependency paths of dynamic libraries, runtime files, or resource files by reading environment variables.

[0120] Step 12: Output the status check results.

[0121] The system checks the source code dependency status in the source code project dependency tree, the integrity of the environment package dependency tree, the local environment package installation path, the build configuration writing results, the project resource synchronization results, and the runtime environment variable writing results. When an exception is found, the system outputs the corresponding project, environment package, processing stage, and failure reason, and stops or skips the corresponding subsequent processing.

[0122] Furthermore, the module implementation method:

[0123] Unified scheduling engine: Outputs task description objects and controls the order of calls for dependency resolution, environment package matching, build configuration, and environment variable writing.

[0124] Source code project dependency tree parsing module: The input is the source code dependency entries in the structured dependency list, and the output is the source code project dependency tree containing the hierarchical relationship of the source code dependency projects.

[0125] Environment package dependency tree parsing module: The input is the environment package dependencies of the target project and the source code dependent projects, and the output is the root dependency set of environment packages, the environment package dependency tree, the environment package dependency closure and the source relationship.

[0126] Heterogeneous environment matching module: The input is the device environment fingerprint and the environment package dependency tree, and the output is the list of environment packages to be deployed and the local environment package deployment results.

[0127] The build and runtime environment variable configuration module takes as input the source code project dependency tree, environment package dependency tree, and local environment package directory, and outputs the build configuration fragment, project resource synchronization results, and runtime environment variable writing results.

[0128] Specifically, the implementation methods for the elements are as follows:

[0129] 1) Structured dependency list.

[0130] The structured dependency list is a uniformly compiled input file in this embodiment, containing source code dependencies, environment package dependencies, compiler version constraints, and project resource synchronization operations. After reading the list, the system distributes different entries to the corresponding modules for processing, while retaining their source relationships.

[0131] 2) Source code project dependency tree.

[0132] The source code project dependency tree is used to describe the hierarchical relationship between the target project and its source code dependent projects. Each source code dependent project represents a source code project, source code repository, or local source code directory that is included in the dependency relationship, and can continue to contain its own structured dependency list.

[0133] 3) Environment package dependency tree.

[0134] Environment package dependency trees are used to describe the direct and transitive dependencies between heterogeneous pre-compiled environment packages. The system recursively expands environment package dependencies through environment package dependency description files to obtain environment package dependency trees or environment package dependency closures.

[0135] 4) Relationship between source code project and environment package.

[0136] This relationship is used to record the sources of environment package dependencies, including whether the environment package is declared by the target project, declared by the source code dependency project, or imported by other environment packages. This information can be used for dependency troubleshooting, status checks, and deployment result output.

[0137] 5) Heterogeneous pre-compiled environment packages.

[0138] Heterogeneous pre-compiled environment packages are binary environment packages used for edge deployments. They may include a package name, version number, compiler version, operating system identifier, installation path, header file directory, library file directory, and runtime file directory. Their standardized directory structure enables the system to automatically identify build-time and runtime dependencies.

[0139] 6) Build the import template.

[0140] The build import template is used to generate dependency import statements, build object configurations, and target addition statements that the target project can recognize, enabling the target project to reference source code project dependencies and heterogeneous pre-compiled environment packages.

[0141] 7) Runtime environment variable configuration.

[0142] Runtime environment variable configuration is used to record the runtime directory, library directory, resource directory, or installation root directory of heterogeneous pre-compiled environment packages. The system writes environment variables through the operating system environment variable interface, user-level environment configuration files, or system-level environment configuration files; C++ inference applications obtain dependency paths by reading these environment variables. The system performs path normalization and duplicate checks before writing to avoid redundant configuration.

[0143] refer to Figure 3 An example is as follows:

[0144] Taking target project P as an example, the structured dependency list of target project P declares that the source code depends on project A, the source code depends on project B, and environment package Z. The structured dependency list of source code depending on project A declares environment package X, and the structured dependency list of source code depending on project B declares environment package Y.

[0145] The system first generates a source code project dependency tree based on the structured dependency list of the target project P, where the target project P is the root project, and source code dependent projects A and B are the subordinate source code dependent projects. The system then reads the structured dependency lists of source code dependent projects A and B to obtain the root dependency sets X, Y, and Z of the environment packages, and records that environment package X originates from source code dependent project A, environment package Y originates from source code dependent project B, and environment package Z originates from the target project P.

[0146] In the environment package repository, the dependency description file of environment package X declares its dependency on environment package M, and the dependency description file of environment package Y declares its dependency on environment package N. After the system recursively reads the dependency description files, it forms an environment package dependency closure containing X, Y, Z, M, and N.

[0147] The system collects the target device's operating system type, operating system version, and compiler version to generate a device environment fingerprint. Based on this fingerprint, it performs hierarchical matching on X, Y, Z, M, and N, and deploys the successfully matched heterogeneous pre-compiled environment packages.

[0148] After deployment, the system generates a build configuration fragment for the target project P, writing the runtime directory, library directory, resource directory, or installation root directory of the corresponding environment package into the environment variables. The C++ inference application reads these environment variables during runtime to obtain the dependency paths and complete the startup process.

[0149] Furthermore, the implementation results are as follows: Compared with existing technologies, this embodiment can form source code project dependency trees and environment package dependency trees based on a unified structured dependency list, and associate the two through source relationships; it can recursively expand environment package transitive dependencies to form environment package dependency closures; it can preferentially reuse heterogeneous pre-compiled environment packages based on device environment fingerprints; and it can automatically generate build configurations, synchronize project resources, and write them to runtime environment variables. This reduces the need for manual dependency checks, manual path configuration, and local compilation at edge environments, improving the consistency and maintainability of AI inference project deployment.

[0150] The beneficial effects of this invention are as follows:

[0151] (1) This invention can automatically extract environment package dependencies from the target project and its subordinate source code dependency projects by linking the source code project dependency tree and the environment package dependency tree, thereby reducing the workload of manually checking the dependency list of each sub-project.

[0152] (2) By recursively expanding transitive dependencies through environment package dependency description files, an environment package dependency closure containing direct and indirect environment package dependencies can be formed, reducing the risk of deployment failure due to missing indirect dependencies.

[0153] (3) Through the relationship between source code project and environment package, it is possible to record whether the environment package is declared by the target project, declared by the source code dependent project, or introduced by other environment packages, thereby improving the ability to investigate dependencies, check status, and interpret deployment results.

[0154] (4) Through the device environment fingerprint and hierarchical environment package matching mechanism, heterogeneous pre-compiled environment packages can be reused preferentially according to the operating system information and compiler version of the target device, reducing the probability of large dependencies being compiled locally on the edge device.

[0155] (5) By configuring runtime environment variables, the runtime directory, library directory, resource directory or installation root directory of heterogeneous pre-compiled environment packages can be written into the environment variables, so that C++ inference applications can obtain the dependency path by reading the environment variables during the runtime phase, reducing the need to manually fill in fixed paths in C++ code or build scripts.

[0156] (6) By comparing the local environment package index with the environment package repository index, only missing or pending environment packages are downloaded and decompressed, reducing duplicate downloads and improving the efficiency of edge deployment.

[0157] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0158] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for unified management of heterogeneous environment packages and dependencies for AI edge inference, characterized in that, include: Receive and parse user task instructions and structured dependency lists; The structured dependency list includes: source code dependency entries, environment package dependency entries, compiler version constraint entries, and project resource synchronization operation entries; Based on the source code dependency entries, the corresponding source code dependency projects are recursively extracted to obtain the source code project dependency tree; A root dependency set of environment packages is established by reading the environment package dependency entries corresponding to each source code dependency project in the target project and the source code project dependency tree. Based on the dependency description files in the environment package repository, the transitive dependencies of the environment packages in the root dependency set of the environment package are recursively expanded to obtain the environment package dependency closure. Generate a device environment fingerprint based on the target device's operating system type, operating system version, and compiler version; Based on the device environment fingerprint, the compiler version constraint entries, and the version constraints in each environment package dependency entry, the environment packages in the environment package dependency closure are matched hierarchically. Download and deploy the matched heterogeneous pre-compiled environment package; A build configuration fragment is generated based on the source code project dependency tree, the environment package dependency closure, and the installation directory information of the deployed environment packages, and project resources are synchronized according to the project resource synchronization operation entries; Write the runtime directory, library directory, resource directory, or installation root directory of the deployed environment package to the runtime environment variables, and read the dependency paths of the environment variables during the runtime phase.

2. The heterogeneous environment package and dependency unified management method for AI edge inference according to claim 1, characterized in that, It also receives and parses user task instructions and structured dependency lists, and includes: A task description object is generated by parsing the user task instructions; the task description object includes: task type, target project path, target build object identifier, compiler version, pending dependencies, and execution options. The execution order of the steps is based on the task description object generation process.

3. The heterogeneous environment package and dependency unified management method for AI edge inference according to claim 1, characterized in that, Based on the source code dependency entries, the corresponding source code dependency projects are recursively extracted to obtain the source code project dependency tree, including: Obtain the source code repository address, local directory, and structured dependency manifest path for each source code dependency entry; If the local directory does not exist, retrieve the source code dependency project corresponding to the source code dependency entry; If the local directory already exists, update or check the status based on the task type; Read the structured dependency list from the source code dependency projects, identify the lower-level source code dependency entries, and establish a hierarchical relationship between the lower-level source code dependency projects and the parent source code dependency projects; Mark the source code dependency projects that have been processed. When there are no unprocessed lower-level source code dependency entries, output the source code project dependency tree.

4. The heterogeneous environment package and dependency unified management method for AI edge inference according to claim 1, characterized in that, An environment package root dependency set is established by reading the environment package dependency entries corresponding to each source code dependency project in the target project and the source code project dependency tree, including: Environment package dependencies are extracted by traversing the structured dependency list corresponding to each source code dependency project in the dependency tree of the target project and the source code project. The environment package dependencies include: environment package name, version constraints, compiler version constraints, and project resource synchronization operations. When multiple projects declare the same environment package, they are merged based on the environment package name, version constraints, and compiler version constraints, retaining the source project, manifest path, and synchronization operation to obtain the source code project-environment package association.

5. The heterogeneous environment package and dependency unified management method for AI edge inference according to claim 1, characterized in that, Based on the dependency description files in the environment package repository, the transitive dependencies of the environment packages in the root dependency set of the environment packages are recursively expanded to obtain the environment package dependency closure, including: Set the environment package dependencies in the root dependency set of the environment package as objects to be resolved, and query the dependency description file corresponding to the objects to be resolved in the environment package repository; Read the lower-level environment package dependencies in the dependency description file and add any unprocessed lower-level environment packages to the set to be parsed; Environment packages that do not have dependency description files are preserved as leaf environment packages in the environment package dependency tree; When the set to be parsed is empty, the output environment package depends on the closure.

6. The heterogeneous environment package and dependency unified management method for AI edge inference according to claim 1, characterized in that, The device environment fingerprint includes: operating system identifier, system version identifier, and compiler version identifier.

7. The heterogeneous environment package and dependency unified management method for AI edge inference according to claim 1, characterized in that, Based on the device environment fingerprint, the compiler version constraint entries, and the version constraints in each environment package dependency entry, hierarchical matching of environment packages in the environment package dependency closure is performed, and the matched heterogeneous pre-compiled environment packages are downloaded and deployed, including: Query the environment package repository index based on environment package name, version constraints, compiler version constraints, and device environment fingerprint; Environment packages that match the same operating system type, operating system version, compiler version, and environment package version during the query are identified as exact match environment packages; If no exact matching environment package is found, the system sequentially queries the operating system environment package, the compiler version environment package, and the general channel environment package. Record the matching level, repository path, version information, and source project for each matching environment package to obtain a list of environment packages to be deployed; If no candidate environment package meets the compatibility requirements, the environment package is recorded as an unmatched environment package and the name and version constraint information of the environment package are output.

8. The heterogeneous environment package and dependency unified management method for AI edge inference according to claim 1, characterized in that, Download and deploy the matched heterogeneous pre-compiled environment packages, including: Compare the list of environment packages to be deployed with the local environment package index; When the target deployment environment package is not a local environment package, download and decompress the corresponding compressed package; When the target deployment environment package is a local version or an environment package whose update time does not meet the requirements, update the corresponding environment package; If the target deployment environment package is a package that already meets the requirements locally, skip the download. After deployment, update the local environment package index to record the environment package name, version number, compiler version, installation path, library directory, runtime directory, and resource directory.

9. A method for unified management of heterogeneous environment packages and dependencies for AI edge inference according to claim 1, characterized in that, A build configuration fragment is generated based on the source code project dependency tree, the environment package dependency closures, and the installation directory information of the deployed environment packages. Project resource synchronization is then performed according to the project resource synchronization operation entries, including: Generate source code dependency import configuration based on the source code project dependency tree, generate environment package import configuration based on the environment package dependency tree and the local environment package installation path, and write the build configuration fragment into the target project build configuration file; Perform a copy or move operation based on the source file or directory, the relative path of the target project, and the synchronization type in the project resource synchronization operation entry. If the source resource does not exist or the target path is not writable, log the exception and output the synchronization failure item.

10. A method for unified management of heterogeneous environment packages and dependencies for AI edge inference according to claim 1, characterized in that, Write the runtime directory, library directory, resource directory, or installation root directory of the deployed environment package to the runtime environment variables, and read the dependency paths of the environment variables during runtime, including: Perform path normalization, null value judgment, and path duplication judgment on the runtime directory, library directory, resource directory, or installation root directory in the deployed heterogeneous pre-compiled environment package; Generate environment variable names; the environment variable names include: environment package identifier and directory type; When the target environment variable does not exist or the existing variable value does not contain the target directory, write the variable value to the user-level or system-level environment variable. Skip writing if the existing variable value already meets the requirements.