Task execution optimization method, device, equipment, medium and product

By decomposing artificial intelligence tasks into multiple task operations and determining the allocation plan based on execution time, ensuring that the task operations match the most suitable equipment, the problems of resource waste and inefficient execution in the existing technology are solved, and efficient and flexible task execution optimization is achieved.

CN119781930APending Publication Date: 2025-04-08深圳开鸿数字产业发展有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411882144.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

The prior art has shortcomings in the allocation and execution efficiency of artificial intelligence tasks, especially in the absence of sufficient consideration of resource waste and inefficient execution caused by the specific architecture and characteristics of each device.

Method used

A task execution optimization method is proposed. By decomposing artificial intelligence tasks into multiple task operations and determining the allocation plan based on the execution time of each task operation, the task operation matches the most suitable device, and if it does not match, it is reconstructed and/or replaced to adapt to the target device.

Benefits of technology

It significantly improves the efficiency of task execution, optimizes the utilization of computing resources, ensures that tasks run on the most suitable devices, reduces execution failures and resource waste caused by device incompatibility, and enhances the flexibility and robustness of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119781930A_ABST
    Figure CN119781930A_ABST
Patent Text Reader

Abstract

The present application discloses a task execution optimization method, device, equipment, medium and product, which relates to the field of artificial intelligence computing technology. The method includes: decomposing a preset artificial intelligence task into multiple task operations, and for each task operation, determining the initial device used to perform the task operation, and determining the execution time required for the initial device to perform the task operation; determining the allocation scheme according to the execution time corresponding to each task operation; for any task operation among the multiple task operations, determining the target device corresponding to the task operation, assigning the task operation to the target device, and when the target device performs the task operation, parallelly detecting whether the task operation is compatible with the target device; if not, reconstructing and / or replacing the task operation according to the target device, and continuing to perform the task operation on the target device until all task operations are completed. The present application optimizes artificial intelligence tasks for devices and improves the efficiency of task execution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence computing technology, and in particular to task execution optimization methods, devices, equipment, media and products. Background Art

[0002] As the scale of artificial intelligence tasks continues to grow, the computational complexity has increased significantly, and artificial intelligence tasks usually need to be completed collaboratively on multiple heterogeneous devices. However, the existing technology has obvious deficiencies in handling these tasks, especially in terms of task allocation and execution efficiency. The existing technology often directly allocates task operations to different hardware devices (such as CPU (Central Processing Unit, central processing unit), GPU (Graphics Processing Unit, graphics processing unit), NPU (Neural Processing Unit)), without fully considering the specific architecture and characteristics of each device, resulting in resource waste and low execution efficiency. For example, some operations may be more suitable for execution on a graphics processor with high parallel processing capabilities, but in actual deployment, they are allocated to a central processing unit that does not have the corresponding advantages. In addition, due to the lack of in-depth understanding of the target device and the lack of optimization for different devices, the full utilization of hardware characteristics is affected, and some devices cannot fully utilize their hardware resources, limiting the overall performance of computing tasks. Summary of the invention

[0003] The main purpose of this application is to provide a task execution optimization method, device, equipment, medium and product, aiming to optimize artificial intelligence tasks for the device and improve task execution efficiency.

[0004] To achieve the above objectives, this application proposes a task execution optimization method, including:

[0005] Decomposing a preset artificial intelligence task into a plurality of task operations, for each task operation, determining at least one initial device for executing the task operation, and determining the execution time required for the at least one initial device to execute the task operation; determining an allocation scheme according to the execution time corresponding to each task operation, wherein the allocation scheme includes a mapping relationship between the task operations and the initial devices, so as to minimize the total execution time of all task operations;

[0006] For any one of the multiple task operations, determine a target device corresponding to the task operation from the initial device according to the allocation scheme, allocate the task operation to the target device, and when the target device executes the task operation, detect in parallel whether the task operation is compatible with the target device;

[0007] If not, the task operation is reconstructed and / or replaced according to the target device, and the reconstructed and / or replaced task operation is continued to be executed on the target device until all task operations are completed.

[0008] In one embodiment, the step of determining the execution time required for at least one initial device to perform a task operation includes:

[0009] determining a match between at least one initial device and the mission operation;

[0010] Determine the execution cost of the task operation executed on each initial device, wherein the execution cost includes time cost and resource consumption cost;

[0011] For each execution device, the ratio between the execution cost of the initial device and the matching degree of the initial device is determined as the execution time.

[0012] In one embodiment, the step of determining a degree of matching between at least one initial device and a task operation comprises:

[0013] Vectorize the task operation and generate task vectors;

[0014] Perform vector processing on the computing resources of each initial device to generate a resource vector corresponding to each initial device;

[0015] Determine the cosine of the angle between each resource vector and the task vector;

[0016] The cosine value is taken as the match between the task operation and each initial device.

[0017] In one embodiment, the step of determining the allocation scheme according to the execution time corresponding to each task operation includes:

[0018] Inputting the execution time corresponding to each task operation into a preset minimization total execution time model;

[0019] Determine the target execution time corresponding to each task operation in the execution time corresponding to each task operation according to the total execution time minimization model, wherein the minimum total execution time includes the target execution time corresponding to each task operation;

[0020] For each task operation, determine the initial device corresponding to the task operation according to the target execution time corresponding to the task operation, establish a mapping relationship between the task operation and the corresponding initial device, and build an allocation plan based on the mapping relationship.

[0021] In one embodiment, the step of reconstructing the task operation according to the target device includes:

[0022] If a new task operation adapted to the target device is detected, the task operation and the new task operation are combined into a task operation combination, wherein the reconstructing includes combining the task operation and the new task operation into the task operation combination, and the task operation combination is adapted to the target device; and / or,

[0023] When the computing resources of the target device do not meet the resource requirements of the task operation, and deleting or simplifying the task operation does not affect the task processing result of the artificial intelligence task, deleting or simplifying the task operation, wherein the reconstruction includes deleting or simplifying the task operation, and the simplified task operation is adapted to the target device; and / or,

[0024] When the data format of the task operation does not match the data format of the target device, the data format of the task operation is converted into a data format that matches the data format of the target device, wherein the reconstruction includes converting the data format of the task operation into a data format that matches the data format of the target device, and the converted task operation is adapted to the target device.

[0025] In one embodiment, the step of replacing the task operation according to the target device includes:

[0026] Determine an instruction operation corresponding to the task operation in an instruction set of the target device, wherein the instruction operation is adapted to the target device;

[0027] Replace the task action with the instruction action.

[0028] In addition, to achieve the above purpose, the present application also proposes a task execution optimization device, which includes:

[0029] A decomposition module decomposes a preset artificial intelligence task into multiple task operations, and for each task operation, determines at least one initial device for executing the task operation, and determines the execution time required for the at least one initial device to execute the task operation; determines an allocation scheme according to the execution time corresponding to each task operation, wherein the allocation scheme includes a mapping relationship between the task operations and the initial devices, so as to minimize the total execution time of all task operations;

[0030] an allocation module, for any one of the multiple task operations, determining a target device corresponding to the task operation from the initial device according to the allocation scheme, allocating the task operation to the target device, and detecting in parallel whether the task operation is compatible with the target device when the target device executes the task operation;

[0031] The adaptation module reconstructs and / or replaces the task operation according to the target device if it is not compatible, and continues to execute the reconstructed and / or replaced task operation on the target device until all task operations are completed.

[0032] In addition, to achieve the above objectives, the present application also proposes a task execution optimization device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the task execution optimization method as described above.

[0033] In addition, to achieve the above-mentioned purpose, the present application also proposes a medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the task execution optimization method as described above are implemented.

[0034] In addition, to achieve the above-mentioned purpose, the present application also provides a product, which is a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the task execution optimization method as described above are implemented.

[0035] One or more technical solutions proposed in this application have at least the following technical effects:

[0036] The present application decomposes a preset artificial intelligence task into multiple task operations. For each task operation, at least one initial device for executing the task operation is determined, and the execution time required for at least one initial device to execute the task operation is determined; an allocation scheme is determined based on the execution time corresponding to each task operation, wherein the allocation scheme includes a mapping relationship between the task operation and the initial device, so as to minimize the total execution time of all task operations, thereby significantly improving the efficiency of task execution and optimizing the utilization of computing resources; for any task operation among the multiple task operations, a target device corresponding to the task operation is determined from the initial device according to the allocation scheme, the task operation is allocated to the target device, and when the target device executes the task operation, whether the task operation is compatible with the target device is detected in parallel, so as to ensure that the task can be run on the most suitable device, and reduce execution failure and resource waste caused by device incompatibility; if it is not compatible, the task operation is reconstructed and / or replaced according to the target device, and the reconstructed and / or replaced task operation is continued to be executed on the target device until all task operations are executed. This mechanism enhances the flexibility and robustness of the system, and can ensure the continuity and integrity of task execution even in the event of device incompatibility or task changes. In summary, this application optimizes artificial intelligence tasks for devices to improve task execution efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0039] Figure 1 This is a flowchart of the first embodiment of the task execution optimization method of this application;

[0040] Figure 2 Another flowchart of the optimization method for executing the task of this application;

[0041] Figure 3 This is another flowchart of the optimization method for executing the task of this application;

[0042] Figure 4 This is a schematic diagram of the module structure of the task execution optimization device according to an embodiment of the present application;

[0043] Figure 5 A schematic diagram of the device structure of the hardware operating environment involved in the task execution optimization method in the embodiment of the present application.

[0044] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0045] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0046] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0047] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a terminal system, etc. The following takes the system as an example to illustrate this embodiment and the following embodiments.

[0048] Based on this, this embodiment provides a task execution optimization method, referring to Figure 1 , Figure 1 This is a flowchart of the task execution optimization method of this application. The task execution optimization method includes steps S10 to S30:

[0049] Step S10, decomposing the preset artificial intelligence task into multiple task operations, for each task operation, determining at least one initial device for executing the task operation, and determining the execution time required for the at least one initial device to execute the task operation; determining an allocation scheme according to the execution time corresponding to each task operation, wherein the allocation scheme includes a mapping relationship between the task operation and the initial device, so as to minimize the total execution time of all task operations;

[0050] It should be noted that preset AI tasks refer to AI-related tasks that are defined in advance and need to be performed by computers or specific devices, such as image recognition, natural language processing, etc. Task operations decompose AI tasks into specific, executable subtasks or steps, and each task operation completes a part of the work in the AI ​​task. The initial device is the device considered for performing the task operation, which may include different types of computing units such as CPU, GPU, NPU, etc. The execution time is the length of time required to perform a task operation on a specific device. The allocation plan is a plan for allocating task operations to specific devices based on the execution time of the task operation and the device capabilities, with the aim of minimizing the total execution time.

[0051] Decompose the preset AI task into multiple specific task operations, which are the basic units for completing the entire task. Next, for each task operation, determine at least one initial device that can execute it, and calculate the execution time required for these devices to perform the task operation. This step is to understand the execution capabilities and efficiency of different devices and provide a basis for subsequent task allocation. Then, according to the execution time of each task operation, formulate an allocation plan. The goal of this plan is to find a mapping relationship between task operations and devices so that the total execution time of all task operations is minimized. This usually involves complex optimization algorithms and calculation processes to ensure the efficiency and accuracy of the allocation plan.

[0052] Furthermore, in the task allocation process, in order to cope with unforeseen situations such as equipment failures and network delays, we introduced a fault-tolerant mechanism. By allocating backup execution devices to critical tasks or setting up an automatic retry mechanism, we ensure that even if an emergency occurs, the task can be successfully completed within the preset target execution time, thereby ensuring the stability of the system and the reliability of the task.

[0053] Exemplarily, the task decomposition is represented as a directed acyclic graph, and its formula is represented as formula (1):

[0054] G=(V,E) Formula (I);

[0055] Where V = {v1,v2,…,v n} is the task operation of the task, n is a positive integer, and the demand for each task operation is represented by a vector vi , where \(i\) is a positive integer, \(1 < i < n\), and \(E=\{(v i ,v j )\}\) represents the data dependency relationship between the \(i\)-th task operation and the \(j\)-th task operation. \(j\) is a positive integer, \(1 < j < n\), and the requirement of each task operation is represented as a vector \(R i =(r_1,r_2,\cdots,r k ). \(k\) is a positive integer, and \(r h \) represents the computing resource requirements (such as memory, computing cores, bandwidth, etc.). \(h\) is a positive integer, \(1 < h < k\).

[0056] Step S20: For any one of the multiple task operations, determine the target device corresponding to the task operation from the initial devices according to the allocation scheme, allocate the task operation to the target device, and when the task operation is executed on the target device, detect in parallel whether the task operation is compatible with the target device;

[0057] It should be noted that the target device is the device selected according to the allocation scheme to execute a specific task operation.

[0058] After formulating the allocation scheme, start executing the task operations. For each task operation, determine a target device from the initial devices according to the allocation scheme and allocate the task operation to it. When the task operation is executed on the target device, the system will detect in parallel whether the task operation is compatible with the target device. This step is to promptly discover and handle any possible compatibility issues.

[0059] In cloud computing or edge computing scenarios, dynamic task decomposition and device adaptation can further optimize resource allocation. For example, when a new task operation is added or the load of an existing task operation changes, the system can automatically adjust the task decomposition strategy and device allocation scheme to adapt to the new resource environment. In addition, for application scenarios with high real-time requirements (such as autonomous driving, remote medical treatment, etc.), the system can evaluate the execution time of the task operation and the device status in real time to ensure that the task is accurately processed in the shortest time. Further, to achieve more efficient dynamic task decomposition and device adaptation, it is recommended to introduce machine learning algorithms to predict the execution efficiency of different devices for different task operations. By collecting historical data and training the model, the system can more accurately evaluate the execution capabilities of devices and the complexity of task operations, thereby making more reasonable task decomposition and device allocation decisions.

[0060] Exemplarily, optimize the task operation according to formula (two):

[0061] v i ' = f(v i ,S d ) Formula (two);

[0062] Among them, vi is the original task operation, v i ′ is the optimized task operation, S d Indicates the resource status of the target device, f(v i ,S d ) is a function that optimizes the original task operation based on the resource status of the target device.

[0063] Step S30: If it is not compatible, the task operation is reconstructed and / or replaced according to the target device, and the reconstructed and / or replaced task operation is continued to be executed on the target device until all task operations are completed.

[0064] It should be noted that refactoring is to modify or adjust the task operation to adapt to the characteristics and requirements of the target device, which may include code optimization, algorithm adjustment, and integration, deletion, simplification or adjustment of task operations. Replacement is to replace the original operation with another more suitable task operation (the task operation here is the same as the original task operation) when the task operation is incompatible with the target device or the execution efficiency is low.

[0065] If it is detected that the task operation is not compatible with the target device, the system will immediately take measures to reconstruct and / or replace it. Reconstruction may involve adjusting the code or algorithm of the task operation to adapt to the characteristics and requirements of the target device. Replacement is to replace the original operation with another more suitable task operation. These measures are intended to ensure that the task operation can be smoothly executed on the target device and maintain a high execution efficiency. After reconstruction and / or replacement, the task operation will be assigned to the target device for execution again. This process will continue until all task operations are executed. In this way, the present embodiment can efficiently execute preset artificial intelligence tasks while making full use of the computing power and resources of different devices.

[0066] Furthermore, in order to further improve the system's adaptability, it is recommended to introduce an online learning mechanism to dynamically adjust the reconstruction / replacement strategy. By continuously collecting feedback data during task execution and training the model, the system can gradually learn the optimal reconstruction / replacement strategy for different devices in different scenarios, thereby further improving task execution efficiency and system stability.

[0067] The operations of detecting whether the task operation is compatible with the target device and reconstructing and / or replacing the task operation are performed asynchronously through the asynchronous task model. This asynchronous task is particularly suitable for application scenarios that need to process large amounts of data or perform complex calculations, such as scientific computing, big data analysis, image processing, etc. In these scenarios, task operations often take a long time and are prone to blocking the main thread, affecting the user experience. Through asynchronous task processing, the responsiveness and user experience of the program can be significantly improved. Furthermore, different priorities can be set for asynchronous tasks according to the urgency and importance of the task operation. Ensure that high-priority tasks can obtain computing resources first, thereby improving the performance of the overall program. For frequently executed task operations, consider caching the results so that the cached results can be directly returned in subsequent requests to reduce unnecessary computing overhead. Add error handling and retry mechanisms to asynchronous tasks to ensure that automatic retries or appropriate remedial measures can be taken when task execution fails.

[0068] Exemplarily, the function of the asynchronous task model is expressed as formula (III):

[0069] T 总 =max(T 迁移 ,T 执行 ) Formula (III);

[0070] Among them, T 迁移 is the time required for the migration task, T 执行 The time required to perform the task, T 总 is the total time required.

[0071] The function of the event-driven model is expressed as formula (IV):

[0072] e i+1 =f(e i , condition) formula (4);

[0073] Where i is a positive integer. i Indicates a task operation reconstruction or replacement, e i+1 Indicates the next task operation reconstruction or replacement, f(e i , condition) is a function used to calculate the reconstruction or replacement of e from the current task operation i Go to the next task to refactor or replace i+1 conversion.

[0074] This embodiment decomposes the preset artificial intelligence task into multiple task operations. For each task operation, at least one initial device for executing the task operation is determined, and the execution time required for at least one initial device to execute the task operation is determined; an allocation scheme is determined according to the execution time corresponding to each task operation, wherein the allocation scheme includes a mapping relationship between the task operation and the initial device, so as to minimize the total execution time of all task operations, thereby significantly improving the efficiency of task execution and optimizing the utilization of computing resources; for any task operation among the multiple task operations, a target device corresponding to the task operation is determined from the initial device according to the allocation scheme, the task operation is allocated to the target device, and when the target device executes the task operation, whether the task operation is compatible with the target device is detected in parallel, so as to ensure that the task can be run on the most suitable device, thereby reducing execution failure and resource waste caused by device incompatibility; if it is not compatible, the task operation is reconstructed and / or replaced according to the target device, and the reconstructed and / or replaced task operation is continued to be executed on the target device until all task operations are executed. This mechanism enhances the flexibility and robustness of the system, and can ensure the continuity and integrity of task execution even in the event of device incompatibility or task change. In summary, this embodiment optimizes the artificial intelligence tasks for the device to improve the task execution efficiency.

[0075] In a feasible implementation, step S30 includes step T10:

[0076] Step T10, determining the instruction operation corresponding to the task operation in the instruction set of the target device, wherein the instruction operation is adapted to the target device;

[0077] Step T20, replacing the task operation with the instruction operation.

[0078] It should be noted that an incompatible task operation refers to a task operation that cannot be directly run on the target device due to incompatibility with the target device's instruction set or low execution efficiency during execution. The target device's instruction set refers to a set of instructions that the target device can recognize and execute, which define the basic operations and operation methods of the device. An instruction operation refers to a task operation that can be adapted to the target device's instruction set after conversion or optimization and can be efficiently executed on the target device.

[0079] First, we identify those incompatible task operations. These operations may be marked as incompatible because they are incompatible with the instruction set of the target device or are inefficiently executed on it. Once these incompatible task operations are identified, we need to process them to ensure the smooth execution of the entire task. Next, we map these incompatible task operations to instruction operations that are adapted to the instruction set of the target device. The core of this step is the conversion and optimization of task operations. We analyze the instruction set of the target device to understand the types of instructions that it can execute efficiently. Then, based on these instruction types, we convert the incompatible task operations into instruction operations that can be executed efficiently on the target device, or directly search for instruction operations corresponding to the incompatible task operations from the instruction set. This conversion process may involve algorithm adjustment, code optimization, or instruction set adaptation of the task operation. After completing the conversion or search, we replace the original incompatible task operation with the converted and optimized instruction operation. This step ensures that the task operation can be executed smoothly on the target device and the execution efficiency is improved. The replaced instruction operation can make full use of the computing resources of the target device to achieve more efficient task execution.

[0080] For example, suppose we have an image processing task written in a high-level programming language, and the target device is an embedded system that only supports low-level instruction sets. In this case, the original high-level language task operation may not be directly executed on the target device. At this point, we can convert the image processing algorithm in the original task operation into low-level instruction operations that the target device can execute, such as pixel operations, color conversion, etc. After the conversion is completed, we replace the original high-level language task operations with these low-level instruction operations, thereby ensuring that the image processing task can be executed smoothly on the target device.

[0081] Exemplarily, the task operation is optimized according to formula (V):

[0082]

[0083] Among them, v i is the original task operation, v i ′ is the task operation after replacement, The instruction set supported by the target device, It is a function that replaces the original task operation according to the instruction set supported by the target device.

[0084] Exemplarily, the general matrix multiplication on the GPU is replaced by the hardware acceleration instruction of the NPU and is expressed as formula (VI):

[0085] v GPU =MatMul(A,B)→v NPU=HardwareMatMul(A,B)Formula (VI);

[0086] Among them, v GPU is a task operation running on the GPU. MatMul(A,B) means performing matrix multiplication on matrix A and matrix B on the GPU. NPU It is a task operation running on the NPU, and HardwareMatMul(A,B) represents a function for performing matrix multiplication using a hardware accelerator on the NPU.

[0087] This embodiment achieves effective processing of incompatible task operations, ensuring that the task can be efficiently executed on the target device.

[0088] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the first embodiment can be referred to the above introduction, and will not be repeated in the following. Figure 2 The step S10 also includes steps A10 to A30:

[0089] Step A10, determining a matching degree between at least one initial device and a task operation;

[0090] Step A20, determining the execution cost of the task operation on each initial device, wherein the execution cost includes time cost and resource consumption cost;

[0091] Step A30: for each execution device, determine the ratio between the execution cost of the initial device and the matching degree of the initial device as the execution time.

[0092] It should be noted that the matching degree refers to the degree of adaptation between the initial device and the task operation, which is used to measure whether the device is suitable for performing the task operation. The execution cost is the total cost required to perform the task operation, including the time cost (the time required to perform the task) and the resource consumption cost (the hardware resources, electricity, etc. consumed when performing the task). In this embodiment, the execution time refers specifically to the ratio between the execution cost of the initial device and the matching degree, which is used to comprehensively evaluate the efficiency and suitability of the device in performing the task operation.

[0093] First, this embodiment involves a situation where a task operation needs to be performed on at least one initial device. In order to select the most suitable device to perform the task, the following steps need to be performed: the first step is to determine the degree of matching. The purpose of this step is to evaluate the degree of adaptation between each initial device and the task operation. The determination of the degree of matching may be based on the performance parameters of the device (such as computing power, storage capacity, etc.), the type of task operation (such as computing intensive), and the current state of the device (such as whether it is idle, whether relevant resources have been loaded, etc.). By comprehensively considering these factors, a matching value can be calculated for each device, and the higher the value, the better the degree of adaptation between the device and the task operation. The second step is to determine the execution cost. This step requires calculating the total cost required for each initial device to perform the task operation, which includes time cost and resource consumption cost. Time cost refers to the time required for the device to complete the task operation, which can be estimated by simulated execution or historical data. Resource consumption cost includes hardware resources (such as memory, etc.) and electricity consumed when executing the task, and these costs can be estimated by the performance parameters and power consumption data of the device. The third step is to calculate the execution time. This step combines the results of the first two steps to calculate an execution time value for each initial device. This execution time does not refer to the actual time to execute the task, but the ratio between the execution cost and the matching degree of the device. Specifically, the execution cost of each device is divided by its matching degree to obtain a ratio. This ratio reflects the overall efficiency and suitability of the device when performing the task operation: the lower the ratio, the more efficient and suitable the device is when performing the task; the higher the ratio, the less likely the device is to be the best choice for the task.

[0094] Exemplarily, the execution time calculation formula is expressed as formula (VII):

[0095]

[0096] Among them, T ij is the task operation v i and target device D j The execution time required for execution on ij is the task operation v i On the target device D j The execution cost required for execution on i ,D j ) is the task operation v i and target device D j degree of matching.

[0097] This embodiment can comprehensively evaluate the efficiency and suitability of each initial device when performing task operations, thereby selecting the most suitable device to perform the task. This method has high flexibility and accuracy in practical applications and can make the best decision based on different task requirements and device status.

[0098] In one possible implementation, refer to Figure 3 , step A10 also includes steps A101 to A104:

[0099] Step A101, vectorizing the task operation to generate a task vector;

[0100] Step A102, vectorizing the computing resources of each initial device to generate a resource vector corresponding to each initial device;

[0101] Step A103, determining the cosine value of the angle between each resource vector and the task vector;

[0102] In step A104, the cosine value is used as the matching degree between the task operation and each initial device.

[0103] It should be noted that vectorization refers to the process of converting the characteristics of task operations or computing resources into vector form. A vector is an array containing multiple numerical values, which is used to represent the characteristics or attributes of an object. The task vector is a vector obtained after vectorization of the task operation. It contains the characteristic information of the task operation, such as the required computing amount, memory requirements, etc. The resource vector is a vector obtained after vectorization of the computing resources of each initial device. It reflects the computing power, memory size and other resource characteristics of the device. The angle cosine value is the cosine value of the angle between two vectors, which is used to measure the similarity or matching degree between the two vectors. The closer the cosine value is to 1, the more similar the two vectors are; the closer the cosine value is to -1, the more opposite the two vectors are; when the cosine value is 0, it means that the two vectors are orthogonal (that is, there is no correlation).

[0104] First, the task operation and a series of initial devices that need to be processed in this embodiment have different computing resources. In order to select the device that is most suitable for executing the task, we need to perform the following steps: the first step is to vectorize the task operation. The purpose of this step is to convert the characteristics of the task operation into a vector form so as to perform the matching degree calculation later. Specifically, we can construct a task vector according to the requirements of the task operation (such as computing amount, memory requirement, etc.). For example, if the task operation requires a large amount of computing resources and less memory resources, then the computing amount part in the task vector will have a higher value, while the memory requirement part will have a lower value. The second step is to vectorize the computing resources of each initial device. The purpose of this step is to convert the computing resource characteristics of each device into a vector form. Similar to the task vector, we can construct a resource vector according to the resource characteristics such as the computing power and memory size of the device. For example, if a device has strong computing power but small memory, then the computing power part in its resource vector will have a higher value, while the memory part will have a lower value. The third step is to determine the cosine value of the angle between each resource vector and the task vector. The purpose of this step is to calculate the similarity or matching degree between the task vector and each resource vector. We can use the vector dot product formula to calculate the cosine value, which is the dot product of two vectors divided by the product of their respective moduli. The closer the cosine value is to 1, the more similar the task vector is to the resource vector, that is, the more suitable the device is for performing the task operation. The fourth step is to use the cosine value as the match between the task operation and each initial device. This step is to use the cosine value calculated in the third step as the basis for the match. We can choose the most suitable device for performing the task based on the size of the match. Specifically, we can sort the match from high to low, and then select the device with the highest match as the best choice for performing the task.

[0105] Exemplarily, the matching degree calculation formula is expressed as formula (eight):

[0106]

[0107] Among them, M(v i ,D j ) is the task operation v i and target device D j The matching degree, S j is the resource vector, R i is the demand vector, R i ·S j is the dot product of two vectors, ‖R i ‖·||S j|| is the product of the moduli of two vectors. The ratio of the two can be used to obtain the cosine value of the angle between the two vectors, which can be used to determine the similarity of the vectors. The value range of formula (8) is between [-1,1]. When S j and R i When the directions are exactly the same, the matching degree is 1, indicating that the equipment resources fully meet the task requirements. j and R i When the direction is completely opposite, the matching degree is -1, indicating that the equipment resources do not match the task requirements at all. j and R i When completely vertical, the matching degree is 0, indicating that there is no correlation between the equipment resources and the task requirements.

[0108] For example, the acquisition node demand vector R = (100, 200, 50) and the GPU device resource vector S GPU =(120,180,60), the matching degree is calculated as 0.9 according to formula (8), then the nodes with high matching degree are preferentially allocated to GPU, and other nodes are migrated to NPU.

[0109] This embodiment can calculate the matching degree between the task operation and the initial device, so as to select the device most suitable for performing the task. This method has high practicality and accuracy in practical applications, and can help us quickly find the most suitable device to perform the task operation.

[0110] In a feasible implementation manner, step S10 further includes steps B10 to B30:

[0111] Step B10, inputting the execution time corresponding to each task operation into a preset minimum total execution time model;

[0112] Step B20, determining the target execution time corresponding to each task operation in the execution time corresponding to each task operation according to the total execution time minimization model, wherein the minimum total execution time includes the target execution time corresponding to each task operation;

[0113] Step B30, for each task operation, determine the initial device corresponding to the task operation according to the target execution time corresponding to the task operation, establish a mapping relationship between the task operation and the corresponding initial device, and construct an allocation plan based on the mapping relationship.

[0114] It should be noted that the total execution time minimization model is a mathematical or algorithmic model used to calculate how to allocate tasks between given task operations and optional initial devices so that the total execution time of all tasks is minimized. It may take into account multiple factors such as the execution time of tasks, the processing power of devices, and the dependencies between tasks. The target execution time refers to the expected execution time of each task operation under the condition of minimizing the total execution time, calculated by the total execution time minimization model. This time is the result of model optimization and is used to guide task allocation. The mapping relationship refers to a corresponding relationship between task operations and initial devices, that is, determining which task will be executed on which device. This relationship is obtained after optimization by the total execution time minimization model. The allocation scheme is a specific plan or scheme that allocates all task operations to the corresponding initial devices based on the mapping relationship. It contains each task operation and its corresponding execution device and target execution time.

[0115] This embodiment aims to find the best initial device allocation scheme for a series of task operations by minimizing the total execution time model. The specific process is as follows: First, we need to input the execution time corresponding to each task operation into the preset minimum total execution time model. These execution times may be based on historical data, simulation tests or calculations, and they reflect the time required to execute the task on different devices. Next, the model will calculate the target execution time corresponding to each task operation through an optimization algorithm based on these input execution times, as well as factors such as the capabilities of the device and the dependencies between tasks. These target execution times are obtained under the condition of minimizing the total execution time, and they may be different from the initial input execution time because the model will try to optimize the total execution time by adjusting the task allocation. With these target execution times, we can determine an initial device for each task operation. This is done by comparing the target execution time of the task operation with the execution time that may be provided on each device. Specifically, we will select the device that can make the actual execution time of the task operation closest to its target execution time as the execution device. In this way, we have established a mapping relationship between the task operation and the initial device. Finally, based on this mapping relationship, we can construct an allocation scheme. This plan lists in detail each task operation, its corresponding execution device, and the target execution time. This plan is what we are looking for, the optimal task allocation plan that can minimize the total execution time.

[0116] Furthermore, tasks usually have different priorities. High-priority tasks need to be processed faster, while low-priority tasks can wait. Introducing priorities into the minimization of total execution time model can be achieved by assigning weights or priority labels to tasks. The minimization of total execution time model can then take these weights into account when allocating resources to ensure that high-priority tasks get more resources and are executed faster. At the same time, the minimization of total execution time model can take into account real-time load. The model needs to be able to obtain the current status information of the device, such as CPU usage, memory occupancy, etc. The minimization of total execution time model can then use this information to evaluate the device's ability to handle new tasks and assign tasks accordingly. The minimization of total execution time model can take into account energy consumption. The model needs to be able to evaluate the energy consumption of different devices when executing tasks. This can be achieved by using energy consumption monitoring tools or estimating based on the specifications and performance of the devices. The minimization of total execution time model can then take energy consumption factors into account when allocating tasks to select the device with the lowest energy consumption to execute the task. In order to achieve a more comprehensive optimization, the model needs to take the above factors into consideration. This may require the use of complex algorithms and heuristic methods, such as genetic algorithms, simulated annealing algorithms, or particle swarm optimization algorithms. These algorithms can find the optimal task allocation solution under multiple constraints such as task dependencies, priorities, real-time load and energy consumption of devices. In addition, the model needs to be able to update device status and task information in real time to cope with dynamically changing computing environments. This can be achieved by using real-time data stream processing technology and event-driven architecture to ensure that the model can respond to changes in device status and task requirements in a timely manner.

[0117] Exemplarily, the model for minimizing the total execution time is expressed as formula (IX):

[0118]

[0119] Among them, T ij is the task operation v i and target device D j The execution time required for execution, x ij For task operation v i Whether to assign to target device D j Boolean variable, The total execution time of n (n is a positive integer) assigned tasks operating on m (m is a positive integer) target devices can be calculated.

[0120] This embodiment achieves efficient allocation of artificial intelligence tasks to target devices by using a model that minimizes the total execution time, effectively utilizes limited computing resources, and improves the efficiency and quality of task execution.

[0121] Based on the first or second embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those in the first or second embodiment can be referred to the above description, and will not be described in detail later. The step S30 also includes any one of the steps C10 to C30:

[0122] Step C10, if a new task operation adapted to the target device is detected, the task operation and the new task operation are combined into a task operation combination, wherein the reconstruction includes combining the task operation and the new task operation into the task operation combination, and the task operation combination is adapted to the target device;

[0123] It should be noted that the target device provides performance optimization functions for specific types of task operations or task operation combinations, such as parallel computing, hardware acceleration, etc. In this embodiment, if a new task operation adapted to the target device is detected, that is, the target device provides a performance optimization function for the combination of the new task operation and the currently executed task operation, the new task operation and the currently executed task operation are merged into a task operation combination, so as to utilize the optimization support of the target device and improve the execution efficiency.

[0124] The system needs to detect whether the target device provides optimized support for the combination of multiple task operations. This detection can be based on the target device's hardware characteristics, software support, driver and other information. For example, some graphics processor devices may provide dedicated hardware acceleration for consecutive matrix multiplication and addition operations. In this case, it is necessary to detect whether the target device has such optimized support. When it is detected that the target device has optimized support for the combination of multiple task operations, the system will merge these task operations as candidates. The merging process needs to ensure that the new task operation can correctly reflect the logic and computing requirements of the original task operation, and at the same time can make full use of the optimization support of the target device.

[0125] Specifically, merging operations may involve the following steps: First, the system needs to analyze the input, output, and calculation logic of each task operation to ensure that they can be merged into a new task operation. Based on the type of optimization support of the target device, the system needs to determine a suitable merging strategy. For example, if the target device provides optimization support for matrix multiplication and addition operations that are executed continuously, the system may choose to merge these two operations into a composite operation containing multiplication and addition. Based on the merging strategy and the logic of the original task operation, the system generates a new task operation. This new task operation implements the calculation logic of the original task operation internally and can take advantage of the optimization support of the target device. After the merge is completed, the system needs to verify and test the new task operation to ensure its correctness and performance. This can include comparing the output results of the new task operation with the original task operation, and measuring the execution time of the new task operation on the target device.

[0126] Exemplarily, if it is detected that the target device GPU has optimized support for the combination of convolution operation and activation operation, the convolution operation Conv(W, X) and the activation operation ReLU(W, X) are reconstructed on the GPU, which is specifically expressed as formula (10):

[0127] v GPU =Conv(W,X)+ReLU(W,X) Formula (X);

[0128] Among them, v GPU Represents task operations on the GPU.

[0129] Step C20, when the computing resources of the target device do not meet the resource requirements of the task operation, and deleting or simplifying the task operation does not affect the task processing result of the artificial intelligence task, deleting or simplifying the task operation, wherein the reconstruction includes deleting or simplifying the task operation, and the simplified task operation is adapted to the target device;

[0130] It should be noted that the resource requirements of a task operation refer to the computing resources required to perform a specific task operation, including CPU, memory, storage space, computing power, etc. These resource requirements are usually determined by the nature, scale and complexity of the task operation. The computing resources of the target device refer to the computing resources available on the target device (such as a server, a personal computer, a mobile device, etc.), including processor performance, memory size, storage space, graphics processing capabilities, etc. These resources determine the type and scale of the task operation that the target device can perform. In this embodiment, matching refers to the adaptability or compatibility between the resource requirements of the task operation and the computing resources of the target device. If the resource requirements of the task operation are within the computing resource range of the target device, and the task operation can be efficiently executed on the target device, it is considered to be matched. Deleting or simplifying a task operation refers to optimizing the task operation to reduce its resource requirements or simplify its calculation process. Deleting an operation may involve removing unnecessary calculation steps or data, while simplifying an operation may involve optimizing an algorithm, reducing the amount of calculation, or reducing data accuracy.

[0131] First, the system needs to detect whether the resource requirements of the task operation match the computing resources of the target device. This usually involves a quantitative assessment of the resource requirements of the task operation and comparing it with the computing resources of the target device. If the resource requirements of the task operation are within the computing resources of the target device, it is considered a match and the task operation can be successfully executed. However, if the resource requirements of the task operation exceed the computing resources of the target device, the system needs to further determine whether the task operation can be deleted or simplified so that it can be executed on the target device. This judgment is based on two conditions: first, deleting or simplifying the task operation does not affect the final calculation result, that is, the optimized task operation can still produce the correct result; second, deleting or simplifying the task operation can significantly reduce the resource requirements so that it matches the computing resources of the target device. After judging that the above conditions are met, the system can optimize the task operation. The optimization process may involve deleting unnecessary calculation steps or data, simplifying the algorithm or calculation process, reducing data accuracy, etc. These optimization measures are intended to reduce the resource requirements of the task operation so that it can be successfully executed on the target device.

[0132] For example, suppose there is a complex computing task whose resource requirements exceed the computing capabilities of the target device. After the system detects this, it may analyze the individual task operations in the computing task and find that some of these operations have a small impact on the final result or can be replaced by other means. In this case, the system may choose to remove these operations or simplify their calculation process to reduce the overall resource requirements and enable the computing task to be executed on the target device.

[0133] Step C30, when the data format of the task operation does not match the data format of the target device, convert the data format of the task operation into a data format that matches the data format of the target device, wherein the reconstruction includes converting the data format of the task operation into a data format that matches the data format of the target device, and the converted task operation is adapted to the target device.

[0134] It should be noted that the data format of the task operation refers to the attributes such as the arrangement mode, data type, and data size of the data involved in the task operation, which determine how the data is processed and stored in the calculation process. The data format of the target device refers to the specific format of the data that the target device (such as a server, a personal computer, a mobile device, etc.) can accept and process. This is usually related to factors such as the hardware architecture, the operating system, and the data interface of the target device. In the present embodiment, matching refers to the compatibility or consistency between the data format of the task operation and the data format of the target device. If the two formats are the same or can be compatible with each other through simple conversion, they are considered to be matched. Adjusting the data format refers to modifying the data format in the task operation so that it matches the data format of the target device. This may involve operations such as conversion of data types, adjustment of data size, and change of data arrangement mode.

[0135] First, the system needs to detect whether the data format of the task operation matches the data format of the target device. This usually involves parsing the data format of the task operation and comparing it with the data format specification of the target device. If the two formats are the same or can be compatible with each other through simple conversion, the task operation can be executed smoothly. However, if the data format of the task operation does not match the data format of the target device, the system needs to adjust the data format of the task operation. This adjustment process may involve the following steps: The system needs to analyze the differences between the data format of the task operation and the data format of the target device in detail, including differences in data type, data size, data arrangement, etc. Based on the analysis results of the data format difference, the system needs to determine a suitable adjustment strategy. This may include data type conversion (such as converting integers to floating-point numbers), data size adjustment (such as expanding the data size from 32 bits to 64 bits), data arrangement change (such as converting data from row-major to column-major), etc. According to the determined adjustment strategy, the system modifies the data format in the task operation accordingly to match the data format of the target device. After the data format adjustment is completed, the system needs to verify the adjusted data format to ensure its correctness. This can include checking whether the data type conversion is accurate, whether the data size meets the requirements of the target device, whether the data arrangement is consistent with the target device, etc.

[0136] This embodiment is applicable to cross-platform and cross-device data transmission and processing scenarios. For example, in the data interaction between the mobile application and the back-end server, since different devices and platforms may support different data formats, the data needs to be formatted to ensure compatibility. Further, automated data format conversion tools can be developed to reduce the tediousness and errors of manual conversion. These tools can automatically convert data from one format to another according to predefined rules or templates. It is also possible to promote the standardization of data formats to reduce the differences in data formats between different devices and platforms. By formulating a unified data format standard, the data conversion process can be simplified and data compatibility and processing efficiency can be improved. During data transmission and processing, changes in data formats are detected in real time and updated as needed. This can ensure seamless transmission and processing of data between different devices and platforms.

[0137] For example, suppose that the data format involved in a task operation is a 32-bit integer array, while the target device can only process a 64-bit floating point array. In this case, after the system detects the data format mismatch, it will determine an adjustment strategy to convert the data from 32-bit integers to 64-bit floating point numbers and perform the corresponding data format adjustment operation. After the adjustment is completed, the system will verify the adjusted data format to ensure that it can be correctly executed on the target device.

[0138] For example, when the GPU load is too high, the task operation is migrated to the NPU. However, if it is detected that the data format of the task operation does not match the data format of the NPU, the data format is adjusted, that is, the acceleration instruction is replaced, which is specifically expressed as formula (XI):

[0139] v NPU =HardwareConv+ReLU(W,X) Formula (XI);

[0140] Among them, v NPU Indicates the task operation on the NPU. HardwareConv indicates the convolution operation performed on the hardware accelerator.

[0141] This embodiment can make full use of the optimization support of the target device and merge multiple task operations into a new task operation, thereby improving the execution efficiency of the computing task. On the premise of ensuring the correctness of the computing task, it can improve the computing efficiency, reduce resource consumption, and enhance the adaptability of the computing task on different target devices. It can ensure that the data format of the task operation matches the data format of the target device, thereby avoiding computing errors or performance degradation caused by incompatible data formats.

[0142] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the task execution optimization method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0143] This application also provides a task execution optimization device, please refer to Figure 4 , the task execution optimization device comprises:

[0144] The decomposition module 10 decomposes the preset artificial intelligence task into multiple task operations, and for each task operation, determines at least one initial device for executing the task operation, and determines the execution time required for the at least one initial device to execute the task operation; determines an allocation scheme according to the execution time corresponding to each task operation, wherein the allocation scheme includes a mapping relationship between the task operations and the initial devices, so as to minimize the total execution time of all task operations;

[0145] The allocation module 20 determines, for any one of the multiple task operations, a target device corresponding to the task operation from the initial device according to the allocation scheme, allocates the task operation to the target device, and when the target device executes the task operation, simultaneously detects whether the task operation is compatible with the target device;

[0146] If it is not compatible, the adaptation module 30 reconstructs and / or replaces the task operation according to the target device, and continues to execute the reconstructed and / or replaced task operation on the target device until all task operations are completed.

[0147] The task execution optimization device provided by the present application adopts the task execution optimization method in the above embodiment, and can optimize artificial intelligence tasks for the device to improve the efficiency of task execution. Compared with the prior art, the beneficial effects of the task execution optimization device provided by the present application are the same as the beneficial effects of the task execution optimization method provided by the above embodiment, and other technical features in the task execution optimization device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0148] The present application provides a task execution optimization device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the task execution optimization method in the above-mentioned embodiment one.

[0149] Reference below Figure 5, which shows a schematic diagram of the structure of a task execution optimization device suitable for implementing the embodiment of the present application. The task execution optimization device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The task execution optimization device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0150] like Figure 5 As shown, the task execution optimization device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the task execution optimization device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the task execution optimization device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a task execution optimization device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0151] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0152] The task execution optimization device provided by the present application adopts the task execution optimization method in the above embodiment, and can optimize artificial intelligence tasks for the device to improve the efficiency of task execution. Compared with the prior art, the beneficial effects of the task execution optimization device provided by the present application are the same as the beneficial effects of the task execution optimization method provided by the above embodiment, and the other technical features in the task execution optimization device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0153] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0154] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0155] The present application provides a medium, which is a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the task execution optimization method in the above-mentioned embodiment.

[0156] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0157] The above-mentioned computer-readable storage medium may be included in the task execution optimization device; or it may exist independently without being assembled into the task execution optimization device.

[0158] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the task execution optimization device, the task execution optimization device:

[0159] Decomposing a preset artificial intelligence task into a plurality of task operations, for each task operation, determining at least one initial device for executing the task operation, and determining the execution time required for the at least one initial device to execute the task operation; determining an allocation scheme according to the execution time corresponding to each task operation, wherein the allocation scheme includes a mapping relationship between the task operations and the initial devices, so as to minimize the total execution time of all task operations;

[0160] For any one of the multiple task operations, determine a target device corresponding to the task operation from the initial device according to the allocation scheme, allocate the task operation to the target device, and when the target device executes the task operation, detect in parallel whether the task operation is compatible with the target device;

[0161] If not, the task operation is reconstructed and / or replaced according to the target device, and the reconstructed and / or replaced task operation is continued to be executed on the target device until all task operations are completed.

[0162] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0163] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0164] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0165] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned task execution optimization method, and can optimize artificial intelligence tasks for devices to improve task execution efficiency. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the task execution optimization method provided in the above-mentioned embodiment, and will not be repeated here.

[0166] The present application also provides a product, which is a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the task execution optimization method as described above are implemented.

[0167] The computer program product provided in this application can optimize artificial intelligence tasks for devices and improve task execution efficiency. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the task execution optimization method provided in the above embodiment, and will not be repeated here.

[0168] The above are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or directly / indirectly applied in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A task execution optimization method, characterized in that: The task execution optimization method comprises: Decomposing a preset artificial intelligence task into a plurality of task operations, for each task operation, determining at least one initial device for executing the task operation, and determining the execution time required for the at least one initial device to execute the task operation; determining an allocation scheme according to the execution time corresponding to each task operation, wherein the allocation scheme includes a mapping relationship between the task operation and the initial device, so as to minimize the total execution time of all the task operations; For any one of the multiple task operations, determine a target device corresponding to the task operation from the initial device according to the allocation scheme, allocate the task operation to the target device, and when the target device executes the task operation, detect in parallel whether the task operation is compatible with the target device; If not, the task operation is reconstructed and / or replaced according to the target device, and the reconstructed and / or replaced task operation is continued to be executed on the target device until all task operations are completed.

2. The task execution optimization method according to claim 1, characterized in that: The step of determining the execution time required for the at least one initial device to perform the task operation comprises: determining a degree of match between the at least one initial device and the task operation; Determine the execution cost of the task operation executed on each of the initial devices, wherein the execution cost includes time cost and resource consumption cost; For each execution device, a ratio between the execution cost of the initial device and the matching degree of the initial device is determined as the execution time.

3. The task execution optimization method according to claim 2, characterized in that: The step of determining the degree of matching between the at least one initial device and the task operation comprises: Performing vectorization processing on the task operation to generate a task vector; Performing vector processing on the computing resources of each of the initial devices to generate a resource vector corresponding to each initial device; Determining the cosine value of the angle between each of the resource vectors and the task vector; The cosine value is used as the matching degree between the task operation and each of the initial devices.

4. The task execution optimization method according to claim 1, characterized in that: The step of determining the allocation scheme according to the execution time corresponding to each task operation includes: Inputting the execution time corresponding to each of the task operations into a preset minimization total execution time model; Determine the target execution time corresponding to each task operation in the execution time corresponding to each task operation according to the minimization total execution time model, wherein the minimum total execution time includes the target execution time corresponding to each task operation; For each of the task operations, the initial device corresponding to the task operation is determined according to the target execution time corresponding to the task operation, a mapping relationship between the task operation and the corresponding initial device is established, and the allocation plan is constructed according to the mapping relationship.

5. The task execution optimization method according to claim 1, characterized in that: The step of reconstructing the task operation according to the target device comprises: If a new task operation adapted to the target device is detected, the task operation and the new task operation are combined into a task operation combination, wherein the reconstruction includes combining the task operation and the new task operation into a task operation combination, and the task operation combination is adapted to the target device; and / or, When the computing resources of the target device do not meet the resource requirements of the task operation, and deleting or simplifying the task operation does not affect the task processing result of the artificial intelligence task, deleting or simplifying the task operation, wherein the reconstruction includes deleting or simplifying the task operation, and the simplified task operation is adapted to the target device; and / or, When the data format of the task operation does not match the data format of the target device, the data format of the task operation is converted into a data format that matches the data format of the target device, wherein the reconstruction includes converting the data format of the task operation into a data format that matches the data format of the target device, and the converted task operation is adapted to the target device.

6. The task execution optimization method according to claim 1, characterized in that: The step of replacing the task operation according to the target device comprises: Determining an instruction operation corresponding to the task operation in an instruction set of the target device, wherein the instruction operation is adapted to the target device; The task operation is replaced by the instruction operation.

7. A task execution optimization device, characterized in that: The task execution optimization device comprises: A decomposition module decomposes a preset artificial intelligence task into multiple task operations, and for each task operation, determines at least one initial device for executing the task operation, and determines the execution time required for the at least one initial device to execute the task operation; determines an allocation scheme according to the execution time corresponding to each task operation, wherein the allocation scheme includes a mapping relationship between the task operation and the initial device, so as to minimize the total execution time of all the task operations; an allocation module, for any one of the plurality of task operations, determining a target device corresponding to the task operation from the initial device according to the allocation scheme, allocating the task operation to the target device, and detecting in parallel whether the task operation is compatible with the target device when the target device executes the task operation; The adaptation module reconstructs and / or replaces the task operation according to the target device if it is not compatible, and continues to execute the reconstructed and / or replaced task operation on the target device until all task operations are completed.

8. A task execution optimization device, characterized in that: The task execution optimization device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the task execution optimization method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the task execution optimization method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the task execution optimization method according to any one of claims 1 to 6 are implemented.