Segmentation method and device for computational graph of deep learning task, equipment and medium
By marking and updating operator target devices in deep learning tasks and merging adjacent operators, the problem of loose subgraph segmentation is solved, data transmission pressure is reduced, and resources are saved.
Patent Information
- Application Number
- CN202410771332.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2024-10-01
AI Technical Summary
The existing calculation graph segmentation method for deep learning tasks results in loose subgraph segmentation, which increases the data transmission pressure between the host and the computing device and consumes too many resources.
By marking the target device of the operator that can be executed by the computing device as the computing device, and marking the rest as the host, updating the target device based on the tuple data source processed by the operator, merging adjacent operators to improve the subgraph integrity, Ensure each subgraph executes on the target device.
This avoids the looseness of subgraph division, reduces the data transmission pressure between the host and the computing device, and saves data computing and transmission resources.
Smart Images

Figure CN118733259A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, in particular to the field of deep learning and deep learning compilation technology, and specifically to a method, device, electronic device, computer-readable storage medium and computer program product for segmenting a computational graph of a deep learning task. Background Art
[0002] Artificial intelligence is a discipline that studies how to use computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.
[0003] Tensor Virtual Machine (TVM) is an open source deep learning compiler stack that allows users to efficiently execute deep learning models on different hardware platforms. An important feature of TVM is BYOC (Bring Your Own Codegen to TVM), which is a framework that allows users to integrate their own AI chip accelerators into TVM to achieve optimized support for specific hardware. The core idea of BYOC is to divide the computation graph of the deep learning model into different subgraphs, which can be customized and optimized based on the characteristics and optimization strategies of the hardware.
[0004] The methods described in this section are not necessarily methods that have been previously conceived or employed. Unless otherwise indicated, it should not be assumed that any method described in this section is considered to be prior art simply because it is included in this section. Similarly, unless otherwise indicated, the issues mentioned in this section should not be considered to have been recognized in any prior art. Summary of the invention
[0005] The present disclosure provides a method, apparatus, electronic device, computer-readable storage medium, and computer program product for segmenting a computational graph of a deep learning task.
[0006] According to one aspect of the present disclosure, a method for segmenting a computational graph of a deep learning task is provided, comprising: generating a computational graph based on the deep learning task, the computational graph including multiple operators, the deep learning task being executed by a computing system consisting of a host and a computing device; marking a target device of an operator belonging to a first operator type among the multiple operators as a computing device, and marking a target device of an operator not belonging to the first operator type among the multiple operators as a host, wherein the operators of the first operator type can be executed by the computing device; for a first operator among the multiple operators for processing tuples, updating the target device of the first operator based on the source of each data contained in the tuple processed by the first operator; and merging adjacent operators with the same target device among the multiple operators to obtain multiple subgraphs, so that each subgraph in the multiple subgraphs is executed on the corresponding target device.
[0007] According to another aspect of the present disclosure, a device for splitting a computational graph of a deep learning task is provided, comprising: a generation unit, configured to generate a computational graph based on the deep learning task, the computational graph comprising multiple operators, and the deep learning task is executed by a computing system consisting of a host and a computing device; a marking unit, configured to mark a target device of an operator belonging to a first operator type among multiple operators as a computing device, and mark a target device of an operator not belonging to the first operator type among multiple operators as a host, wherein the operators of the first operator type can be executed by the computing device; a first updating unit, configured to update a target device of a first operator for processing tuples among multiple operators based on a source of each data contained in the tuple processed by the first operator; and a merging unit, configured to merge adjacent operators with the same target device among multiple operators to obtain multiple subgraphs, so that each subgraph in the multiple subgraphs is executed on a corresponding target device.
[0008] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so as to enable the at least one processor to perform the method for segmenting the computational graph of the above-mentioned deep learning task.
[0009] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the method for segmenting a computational graph of the above-mentioned deep learning task.
[0010] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, wherein the computer program implements the above-mentioned method for segmenting the computational graph of the deep learning task when executed by a processor.
[0011] According to one or more embodiments of the present disclosure, it is possible to avoid loose subgraph segmentation, increase the data transmission pressure between the host and the computing device during subsequent execution, and save data computing and data transmission resources.
[0012] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0014] Figure 1 A schematic diagram showing an exemplary system in which the various methods described herein may be implemented according to an embodiment of the present disclosure;
[0015] Figure 2 A flowchart of a method for segmenting a computational graph of a deep learning task according to an embodiment of the present disclosure is shown;
[0016] Figure 3 A flowchart of determining at least one target operator according to an embodiment of the present disclosure is shown;
[0017] Figure 4 A flowchart of a method for segmenting a computational graph of a deep learning task according to an exemplary embodiment of the present disclosure is shown;
[0018] Figure 5 A structural block diagram of a device for segmenting a computational graph of a deep learning task according to an embodiment of the present disclosure is shown;
[0019] Figure 6 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0020] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0021] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, temporal relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.
[0022] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations.
[0023] In the related technology, in the operator used to process tuples, once the tuple contains a constant, the target device of the operator will be marked as the host. This often causes a small number of operators whose target devices are hosts to be mixed with operators whose target devices are computing devices, resulting in low integrity of the subgraph and loose subgraph segmentation, which in turn causes problems such as excessive pressure on data transmission between the host and the computing device and excessive resource consumption.
[0024] An embodiment of the present disclosure provides a method for segmenting a computational graph of a deep learning task. First, the target devices of operators that can be executed by a computing device are marked as computing devices, and the rest are marked as hosts. Subsequently, for a first operator for processing a tuple, the target device of the first operator is further updated based on the data source in its tuple, so that the target device of the first operator can be consistent with the data source in the processed tuple. On this basis, the merged subgraph has a higher integrity, thereby avoiding loose subgraph segmentation, increasing the data transmission pressure between the host and the computing device during subsequent execution, and saving data calculation and data transmission resources.
[0025] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0026] Figure 1 FIG. 1 is a schematic diagram of an exemplary system 100 in which various methods and apparatuses described herein may be implemented according to an embodiment of the present disclosure. Figure 1 , the system 100 includes one or more client devices 101, 102, 103, 104, 105, and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. The client devices 101, 102, 103, 104, 105, and 106 may be configured to execute one or more applications.
[0027] In an embodiment of the present disclosure, the server 120 may run one or more services or software applications that enable the above-mentioned method of segmenting the computational graph of the deep learning task to be performed.
[0028] In some embodiments, server 120 may also provide other services or software applications, which may include non-virtualized environments and virtualized environments. In some embodiments, these services may be provided as web-based services or cloud services, such as provided to users of client devices 101, 102, 103, 104, 105, and / or 106 under a software as a service (SaaS) model.
[0029] exist Figure 1 In the configuration shown, the server 120 may include one or more components that implement the functions performed by the server 120. These components may include software components, hardware components, or a combination thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 may in turn utilize one or more client applications to interact with the server 120 to utilize the services provided by these components. It should be understood that a variety of different system configurations are possible, which may differ from the system 100. Therefore, Figure 1 is one example of a system for implementing the various methods described herein and is not intended to be limiting.
[0030] The user may use client devices 101, 102, 103, 104, 105 and / or 106 to send compilation instructions for deep learning tasks. The client device may provide an interface that enables the user of the client device to interact with the client device. The client device may also output information to the user via the interface. Figure 1 Only six client devices are depicted, but one skilled in the art will appreciate that the present disclosure may support any number of client devices.
[0031] Client devices 101, 102, 103, 104, 105 and / or 106 may include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptop computers), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, game systems, thin clients, various messaging devices, sensors or other sensing devices, etc. These computer devices may run various types and versions of software applications and operating systems, such as MICROSOFT Windows, APPLE iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as GOOGLE Chrome OS); or include various mobile operating systems, such as MICROSOFT Windows Mobile OS, iOS, Windows Phone, Android. Portable handheld devices may include cellular phones, smart phones, tablet computers, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. Game systems may include various handheld game devices, Internet-enabled game devices, etc. Client devices are capable of executing various different applications, such as various Internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and may use various communication protocols.
[0032] The network 110 may be any type of network known to those skilled in the art that may support data communications using any of a variety of available protocols, including but not limited to TCP / IP, SNA, IPX, etc. By way of example only, the one or more networks 110 may be a local area network (LAN), an Ethernet-based network, a token ring, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a blockchain network, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, WIFI), and / or any combination of these and / or other networks.
[0033] Server 120 may include one or more general purpose computers, dedicated server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running virtual operating systems, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that may be virtualized to maintain a server's virtual storage device). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.
[0034] The computing units in the server 120 may run one or more operating systems including any of the above operating systems and any commercially available server operating systems. The server 120 may also run any of a variety of additional server applications and / or middle-tier applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.
[0035] In some implementations, server 120 may include one or more applications to analyze and consolidate data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105, and / or 106. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105, and / or 106.
[0036] In some embodiments, the server 120 may be a server of a distributed system, or a server combined with a blockchain. The server 120 may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in a cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services.
[0037] The system 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store information such as audio files and video files. The databases 130 may reside in various locations. For example, the database used by the server 120 may be local to the server 120, or may be remote from the server 120 and may communicate with the server 120 via a network-based or dedicated connection. The databases 130 may be of different types. In some embodiments, the databases used by the server 120 may be, for example, relational databases. One or more of these databases may store, update, and retrieve data to and from the databases in response to commands.
[0038] In some embodiments, one or more of the databases 130 may also be used by applications to store application data. The databases used by the applications may be different types of databases, such as a key-value store, an object store, or a conventional store backed by a file system.
[0039] Figure 1The system 100 may be configured and operated in various ways to enable the application of various methods and apparatuses described in the present disclosure.
[0040] According to the embodiments of the present disclosure, Figure 2 As shown, a method for segmenting a computational graph of a deep learning task is provided, including: step S201, generating a computational graph based on the deep learning task, the computational graph including multiple operators, and the deep learning task is executed by a computing system composed of a host and a computing device; step S202, marking the target device of an operator belonging to a first operator type among multiple operators as a computing device, and marking the target device of an operator not belonging to the first operator type among multiple operators as a host, wherein the operators of the first operator type can be executed by the computing device; step S203, for a first operator among multiple operators for processing tuples, updating the target device of the first operator based on the source of each data contained in the tuple processed by the first operator; and step S204, merging adjacent operators with the same target device among multiple operators to obtain multiple subgraphs, so that each subgraph in the multiple subgraphs is executed on the corresponding target device.
[0041] Therefore, first, the target devices of the operators that can be executed by the computing device are marked as computing devices, and the rest are marked as hosts; then, for the first operator used to process the tuple, the target device of the first operator is further updated based on the data source in its tuple, so that the target device of the first operator can be consistent with the data source in the processed tuple. On this basis, the merged subgraph has higher integrity, which can avoid loose subgraph segmentation, increase the data transmission pressure between the host and the computing device in the subsequent execution process, and save data calculation and data transmission resources.
[0042] In some embodiments, the above-mentioned deep learning tasks can be performed by a computing system composed of a host and a computing device. Among them, the deep learning task can be any task performed by a deep learning neural network, including but not limited to natural language processing, image processing, speech processing, etc.
[0043] In the context of deep learning compilation and execution, especially in frameworks such as TVM (Tensor Virtual Machine), host and device can generally refer to different computing resources or execution environments.
[0044] The host can be a computer or processor that runs an operating system and major management tasks. In deep learning tasks, the host may be a device that performs high-level control logic, data pre-processing, post-processing, and model scheduling. It can be a full-featured general-purpose processor (such as a CPU) with an operating system and a rich software ecosystem.
[0045] The computing device can be a hardware accelerator that is specifically designed to perform specific types of computations (such as parallel computing, matrix operations, etc.). In the case of deep learning tasks, it can be a GPU (graphics processing unit), FPGA (field programmable gate array), ASIC (application-specific integrated circuit), or a specialized AI chip. The execution on the computing device can be operations directly supported by the corresponding hardware, such as the CUDA core (Compute Unified Device Architecture Core) on a GPU or a specific instruction set on an AI chip.
[0046] In some embodiments, generating a computational graph based on the deep learning task may be to determine each function, network layer or other operation in the deep learning network as a plurality of operators, and use each operator as a node in the computational graph, and connect these nodes to form a complete computational graph based on the direction of data flow and dependencies between the operators.
[0047] The user first defines components such as network layers, activation functions, and loss functions, which are converted into nodes in the computational graph in the framework. Then, by specifying the direction and dependencies of data flow, these nodes are connected to form a complete computational graph.
[0048] In some embodiments, the target device may be marked based on the operator type of the operator, wherein the operator type may include, for example, an operation type, a function type, a calculation type, etc., which are not limited here.
[0049] In some embodiments, the operator type that can be executed by the computing device can be determined as a first operator type, and the target device of the operator of the first operator type can be marked as a computing device, and the target device of the operator that does not belong to the first operator type among the multiple operators can be marked as a host.
[0050] In some embodiments, the operator type may be determined by manual labeling.
[0051] In some embodiments, marking a target device of an operator belonging to a first operator category among multiple operators as a computing device, and marking a target device of an operator not belonging to the first operator category among multiple operators as a host may include: obtaining a registered operator category on the computing device side as the first operator category; and for each operator among the multiple operators, in response to the operator belonging to the first operator category, marking the target device of the operator as a computing device, otherwise, marking the target device of the operator as a host.
[0052] If an operator supports running on a computing device, the TVM framework process requires that the operator be registered on the computing device first.
[0053] In some embodiments, the types of operators that support running on the computing device can be recorded when registering the operator, so that the above-mentioned first operator type can be obtained automatically and efficiently; then, when marking the target devices of the operator, the target devices of the operators belonging to the above-mentioned first operator type can all be marked as computing devices, and the rest can be marked as hosts.
[0054] Therefore, the first operator type is determined by acquiring the registered operator types on the computing device side, and the target device is automatically marked for the operator of the corresponding operator type, thereby improving the target device marking efficiency and accuracy.
[0055] In some embodiments, the multiple operators may include one or more first operators that finally process a tuple. Wherein, a tuple is a data type. A tuple may include multiple data (which may be constants, outputs of other operators, or values of variables). In programming, a tuple is usually an ordered set of fixed size, which can contain elements of different types.
[0056] In some embodiments, the first operator may perform some processing on the tuple, such as constructing intermediate results of a data stream, which may then be further processed by other operators; or for example, creating a tuple, accessing elements in a tuple, unpacking a tuple, determining the length of a tuple, etc., which are not limited here.
[0057] In some embodiments, for a first operator among multiple operators for processing tuples, based on the source of each data contained in the tuple processed by the first operator, updating the target device of the first operator may be to determine whether the tuple contains intermediate data calculated by other operators. If so, the target device of such operator is marked as a computing device; if not (that is, the data in the tuple processed by the first operator are all defined constants), the target device of the first operator is marked as a host.
[0058] In some embodiments, for a first operator among multiple operators for processing tuples, updating the target device of the first operator based on the source of each data contained in the tuple processed by the first operator may include: in response to detecting that the tuple processed by the first operator contains at least one intermediate data calculated by at least one other operator, updating the target device of the first operator based on the target device of each operator in at least one other operator; and in response to detecting that the tuple processed by the first operator does not contain the intermediate data calculated by other operators, updating the target device of the first operator to the host.
[0059] In some embodiments, for a first operator among multiple operators for processing tuples, based on the source of each data contained in the tuple processed by the first operator, updating the target device of the first operator may also be to mark the target device of the first operator for processing tuples containing only constants as a host; for a first operator with intermediate data in the tuple, it is necessary to further determine the target device of the first operator based on the current target device of the operator that calculates each intermediate data. In some embodiments, when there are more than a preset number of operators among the operators that calculate the intermediate data, and their currently marked devices are all computing devices, the target device of the first operator is recorded as a computing device.
[0060] Therefore, by updating the target device of the operator that only contains constants in the tuple to the host; at the same time, for the operator that contains intermediate data calculated by other operators in the tuple, the target device of the first operator is updated according to the target devices of each operator, so that the target device of the first operator can be consistent with the target device of the operator it depends on, the integrity of the subgraph is further improved, and the data transmission pressure between the host and the computing device is reduced.
[0061] In some embodiments, updating the target device of the first operator based on the target device of each operator in at least one other operator may include: in response to determining that the current target device of each operator in at least one other operator is a computing device, updating the target device of the first operator to a computing device; and in response to determining that there is at least one operator in at least one other operator whose current target device is a host, updating the target device of the first operator to a host.
[0062] In some embodiments, the target device of the first operator used to process a tuple containing only constants can be marked as a host; for the first operator in which intermediate data exists in the tuple, when the current target devices of the operators that calculate the intermediate data in the tuple are all computing devices, the target device of the first operator can be marked as a computing device; if there is an intermediate data in the tuple and the current target device of the operator from which it comes is the host, the target device of the first operator can be marked as the host.
[0063] Therefore, by updating the target device of the first operator whose target devices are all computing devices to a computing device; otherwise, updating its target device to a host, the target device of the first operator can be further improved to be consistent with the target device of the operator it depends on, thereby further improving the integrity of the subgraph and reducing the data transmission pressure between the host and the computing device.
[0064] After marking the target device for each operator using the above method, operators with the same and adjacent target devices among multiple operators can be further merged to obtain multiple subgraphs, thereby completing the subgraph segmentation of the computational graph. Among them, the target devices of each operator in each subgraph are the same, that is, each subgraph corresponds to a target device. In the subsequent deep learning task execution process, each subgraph can be sent to the corresponding target device for execution by the corresponding target device.
[0065] In some embodiments, the method for segmenting the computational graph of the above-mentioned deep learning task may also include: before merging adjacent operators with the same target device among multiple operators, obtaining user configuration information, the user configuration information including target operator identification information and preset devices; and determining at least one target operator based on the target operator identification information to update the target device of each operator in the at least one target operator to a preset device.
[0066] Therefore, by obtaining the user's configuration information and updating the target device of the corresponding target operator according to the user configuration information, the subgraph division can be adjusted according to user needs, thereby improving the flexibility and controllability of subgraph segmentation.
[0067] In some embodiments, an interface for uploading configuration information may be provided to the user. The user may upload the relevant configuration information and automatically configure the target device of each operator in the computation graph.
[0068] In some embodiments, the configuration information may include target operator identification information and preset devices, which are used to mark the target device of the operator matching the target operator identification information as a preset device. The preset device may be a host or a computing device, which may be set based on user needs.
[0069] In some embodiments, the target operator identification information is the operator name, such as Figure 3 As shown, based on the target operator identification information, determining at least one target operator to update the target device of each operator in the at least one target operator to a preset device may include: step S301, according to the dependency relationship between the operators in the calculation graph, identifying in turn whether the operator identification information of each operator matches the target operator identification information; step S302, in response to identifying a first target operator whose operator identification information matches the target operator identification information, determining the first target operator and each operator that depends on the first target operator as at least one target operator; and step S303, updating the target device of each operator in the at least one target operator to a preset device.
[0070] Therefore, by setting the target operator identification information as the operator name of the target operator and traversing the operators according to the operator dependencies in the computational graph, the first identified operator whose name matches the target operator can be used as the target operator, and the target devices of the operator and other operators that directly or indirectly depend on the operator can be updated to preset devices, thereby achieving efficient configuration of the target devices of each operator.
[0071] In some embodiments, the target operator identification information may be an operator name.
[0072] In some embodiments, a user can upload string type operator configuration information through an interface, and in a computational graph, identify the operator name of each operator in turn according to the dependency relationship between operator nodes, until an operator whose name matches the operator name in the configuration information is identified, then the operator and subsequent operators in the computational graph (operators that are dependent on the operator) are determined as target operators, and the target devices of all target operators are marked as preset devices.
[0073] In some embodiments, a global label (initialized to false) can be set for each operator in the computation graph. When an operator matching the operator name in the configuration information is identified, the label of the operator and the subsequent operators can be set to true. When marking the target device, if the label is detected to be true, the target device is marked as a preset device. Because the computation graph operator nodes are traversed sequentially and have no jump relationship, all subsequent operators starting from the configured operator can be segmented into the subgraph of the preset device, thereby achieving the purpose of cutting the graph by location area to complete specific optimization.
[0074] In some embodiments, the target operator identification information is at least one target operator number, and based on the target operator identification information, determining at least one target operator to update the target device of each operator in the at least one target operator to a preset device may include: based on the at least one target operator number, determining at least one target operator corresponding to the operator number among multiple operators; and updating the target device of each operator in the at least one target operator to a preset device.
[0075] Therefore, by setting the target operator identification information as the target operator number, and obtaining the operator with the corresponding number in the calculation graph accordingly, and updating its target device to the preset device, accurate configuration of each operator target device can be achieved.
[0076] In some embodiments, the target operator identification information may be one or more target operator numbers.
[0077] In some embodiments, each operator in the computation graph may include a unique operator number, and the user may upload list-type operator configuration information with a content type of int data type through the interface, and based on each target operator number in the list, obtain the target operator of the corresponding operator number, and mark the target device of each target operator as a preset device. Since the computation graph includes the topological relationship between operators in the deep learning model, and each operator node has a unique number, the operator that is to be segmented to the preset device side can be arbitrarily controlled by the number, thereby achieving the purpose of arbitrary subgraph segmentation.
[0078] Figure 4 A flowchart of a method for segmenting a computational graph of a deep learning task according to an exemplary embodiment of the present disclosure is shown.
[0079] In some exemplary embodiments, Figure 4 As shown, a method for segmenting a computational graph of a deep learning task is provided, including: step S401, obtaining a registered operator type on the computing device side as a first operator type, and marking the target devices of all operators of the first operator type as computing devices; step S402, for each first operator used to process a tuple, marking the target device of the first operator based on the source of each data in the tuple; step S403, in response to receiving user configuration information, obtaining at least one target operator according to the configuration information, and marking the target device of each target operator as a preset device; step S404, in response to not receiving user configuration information, or completing the configuration of the target operator based on the user configuration information, merging multiple operators to obtain multiple subgraphs.
[0080] In some embodiments, Figure 5 As shown, a device 500 for segmenting a computational graph of a deep learning task is provided, comprising: a generating unit 510, configured to generate a computational graph based on the deep learning task, the computational graph comprising a plurality of operators, and the deep learning task is executed by a computing system consisting of a host and a computing device; a marking unit 520, configured to mark the target device of an operator belonging to a first operator type among a plurality of operators as a computing device, and to mark the target device of an operator not belonging to the first operator type among a plurality of operators as a host, wherein the operators of the first operator type can be executed by the computing device; a first updating unit 530, configured to update the target device of the first operator for processing tuples among a plurality of operators based on the source of each data contained in the tuple processed by the first operator; and a merging unit 540, configured to merge adjacent operators with the same target device among a plurality of operators to obtain a plurality of subgraphs, so that each subgraph in the plurality of subgraphs is executed on the corresponding target device.
[0081] Among them, the operations performed by units 510 to 540 in the above-mentioned device for segmenting the calculation graph of the deep learning task 500 are similar to the operations of steps S201 to S205 in the above-mentioned method for segmenting the calculation graph of the deep learning task, and will not be repeated here.
[0082] Therefore, through the computing graph segmentation device 500 of the above-mentioned deep learning task, the target device of the operator that can be executed by the computing device is first marked as the computing device, and the rest are marked as the host; then, for the first operator used to process the tuple, the target device of the first operator is further updated based on the data source in its tuple, so that the target device of the first operator can be consistent with the data source in the processed tuple. On this basis, the merged subgraph has a higher integrity, thereby avoiding the loose segmentation of the subgraph, increasing the data transmission pressure between the host and the computing device during the subsequent execution process, and saving data calculation and data transmission resources.
[0083] In some embodiments, the first update unit may include: a first update subunit, configured to update the target device of the first operator based on the target device of each operator in at least one other operator in response to detecting that the tuple processed by the first operator contains at least one intermediate data calculated by at least one other operator; and a second update subunit, configured to update the target device of the first operator to the host in response to detecting that all data in the tuple processed by the first operator are constants.
[0084] In some embodiments, the first update subunit can be further configured to: in response to determining that the current target device of each operator in at least one other operator is a computing device, update the target device of the first operator to a computing device; and in response to determining that there is at least one operator in at least one other operator whose current target device is a host, update the target device of the first operator to a host.
[0085] In some embodiments, the marking unit may include: a first acquisition subunit, configured to acquire the operator type that has completed registration on the computing device side as a first operator type; and a marking subunit, configured to, for each operator among multiple operators, in response to the operator belonging to the first operator type, mark the target device of the operator as a computing device, otherwise, mark the target device of the operator as a host.
[0086] In some embodiments, the device for segmenting the computational graph of the above-mentioned deep learning task may also include: a first acquisition unit, configured to acquire user configuration information before merging adjacent operators with the same target device among multiple operators, the user configuration information including target operator identification information and preset devices; and a first determination unit, configured to determine at least one target operator based on the target operator identification information, so as to update the target device of each operator in the at least one target operator to a preset device.
[0087] In some embodiments, the target operator identification information is the operator name, and the first determination unit may include: an identification subunit, configured to identify, in turn, whether the operator identification information of each operator matches the target operator identification information based on the dependency relationship between the operators in the computation graph; a first determination subunit, configured to, in response to identifying a first target operator whose operator identification information matches the target operator identification information, determine the first target operator and each operator that depends on the first target operator as at least one target operator; and a third update subunit, configured to update the target device of each operator in the at least one target operator to a preset device.
[0088] In some embodiments, the target operator identification information is at least one target operator number, and the first determination unit may include: a second determination subunit, configured to determine at least one target operator corresponding to the operator number among multiple operators based on the at least one target operator number; and a fourth update subunit, configured to update the target device of each operator in the at least one target operator to a preset device.
[0089] According to an embodiment of the present disclosure, an electronic device, a readable storage medium and a computer program product are also provided.
[0090] refer to Figure 6 , a block diagram of an electronic device 600 that can be used as a server or client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0091] like Figure 6As shown, the electronic device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0092] Multiple components in the electronic device 600 are connected to the I / O interface 605, including: an input unit 606, an output unit 607, a storage unit 608, and a communication unit 609. The input unit 606 can be any type of device that can input information to the electronic device 600. The input unit 606 can receive input digital or character information and generate key signal input related to user settings and / or function control of the electronic device, and can include but is not limited to a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and / or a remote controller. The output unit 607 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 608 can include but is not limited to a disk, an optical disk. The communication unit 609 allows the electronic device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth device, an 802.11 device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0093] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as the segmentation method of the computational graph of the above-mentioned deep learning task. For example, in some embodiments, the segmentation method of the computational graph of the above-mentioned deep learning task may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the segmentation method of the computational graph of the above-mentioned deep learning task may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured in any other appropriate manner (for example, by means of firmware) to perform the above-mentioned method of segmenting the computational graph of the deep learning task.
[0094] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0095] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0096] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0097] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0098] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0099] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0100] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0101] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but only by the claims after authorization and their equivalent scope. Various elements in the embodiments or examples can be omitted or replaced by their equivalent elements. In addition, each step can be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples can be combined in various ways. It is important that with the evolution of technology, many elements described herein can be replaced by equivalent elements that appear after the present disclosure.
Claims
1. A method for segmenting a computational graph of a deep learning task, the method comprising: Generate a computation graph based on the deep learning task, wherein the computation graph includes a plurality of operators, and the deep learning task is executed by a computing system composed of a host and a computing device; Marking a target device of an operator belonging to a first operator category among the multiple operators as a computing device, and marking a target device of an operator not belonging to the first operator category among the multiple operators as a host, wherein the operator of the first operator category can be executed by the computing device; For a first operator among the multiple operators for processing tuples, based on sources of each data included in the tuple processed by the first operator, updating a target device of the first operator; and Adjacent operators with the same target device among the multiple operators are merged to obtain multiple subgraphs, so that each subgraph among the multiple subgraphs is executed on the corresponding target device.
2. The method according to claim 1, wherein: The updating of the target device of a first operator for processing tuples among the multiple operators based on the source of each data contained in the tuple processed by the first operator comprises: In response to detecting that the tuple processed by the first operator contains at least one intermediate data calculated by at least one other operator, updating the target device of the first operator based on the target device of each operator of the at least one other operator; and In response to detecting that the tuple processed by the first operator does not contain intermediate data calculated by other operators, the target device of the first operator is updated to a host.
3. The method according to claim 2, wherein: The updating of the target device of the first operator based on the target device of each operator in the at least one other operator comprises: In response to determining that the current target device of each operator in the at least one other operator is a computing device, updating the target device of the first operator to the computing device; and In response to determining that there is at least one operator whose current target device is a host among the at least one other operator, the target device of the first operator is updated to the host.
4. The method according to any one of claims 1 to 3, wherein: The step of marking the target device of an operator belonging to the first operator type among the multiple operators as a computing device, and marking the target device of an operator not belonging to the first operator type among the multiple operators as a host comprises: Acquire the operator type that has completed registration on the computing device side as the first operator type; and For each operator among the multiple operators, in response to the operator belonging to the first operator category, a target device of the operator is marked as a computing device; otherwise, the target device of the operator is marked as a host.
5. The method according to any one of claims 1 to 4, further comprising: Before merging adjacent operators with the same target device among the multiple operators, obtaining user configuration information, the user configuration information including target operator identification information and preset devices; as well as Based on the target operator identification information, at least one target operator is determined, so as to update the target device of each operator in the at least one target operator to the preset device.
6. The method according to claim 5, wherein: The target operator identification information is an operator name, and determining at least one target operator based on the target operator identification information to update the target device of each operator in the at least one target operator to the preset device includes: According to the dependency relationship between operators in the computation graph, identifying in turn whether the operator identification information of each operator matches the target operator identification information; In response to identifying a first target operator whose operator identification information matches the target operator identification information, determining the first target operator and each operator dependent on the first target operator as the at least one target operator; and The target device of each operator in the at least one target operator is updated to the preset device.
7. The method according to claim 5, wherein: The target operator identification information is at least one target operator number, and the determining at least one target operator based on the target operator identification information to update the target device of each operator in the at least one target operator to the preset device includes: Based on the at least one target operator number, determining at least one target operator corresponding to the operator number among the multiple operators; and The target device of each operator in the at least one target operator is updated to the preset device.
8. A device for segmenting a computational graph of a deep learning task, the device comprising: A generating unit, configured to generate a computing graph based on the deep learning task, wherein the computing graph includes a plurality of operators, and the deep learning task is executed by a computing system composed of a host and a computing device; a marking unit, configured to mark a target device of an operator belonging to a first operator category among the plurality of operators as a computing device, and mark a target device of an operator not belonging to the first operator category among the plurality of operators as a host, wherein the operator of the first operator category can be executed by the computing device; a first updating unit configured to update, for a first operator among the plurality of operators for processing tuples, a target device of the first operator based on a source of each data included in the tuple processed by the first operator; and The merging unit is configured to merge adjacent operators with the same target device among the multiple operators to obtain multiple subgraphs, so that each subgraph among the multiple subgraphs is executed on the corresponding target device.
9. The device according to claim 8, wherein: The first updating unit comprises: a first updating subunit configured to, in response to detecting that a tuple processed by the first operator contains at least one intermediate data calculated by at least one other operator, update a target device of the first operator based on a target device of each of the at least one other operator; and The second updating subunit is configured to update the target device of the first operator to a host in response to detecting that all data in the tuple processed by the first operator are constants.
10. The device according to claim 9, wherein: The first updating subunit is further configured to: In response to determining that the current target device of each operator in the at least one other operator is a computing device, updating the target device of the first operator to the computing device; as well as In response to determining that there is at least one operator whose current target device is a host among the at least one other operator, the target device of the first operator is updated to the host.
11. The device according to any one of claims 8 to 10, wherein: The marking unit comprises: a first acquisition subunit, configured to acquire an operator type that has completed registration on the computing device side as the first operator type; and The marking subunit is configured to mark, for each operator among the multiple operators, a target device of the operator as a computing device in response to the operator belonging to the first operator type, otherwise, mark the target device of the operator as a host.
12. The device according to any one of claims 8 to 11, further comprising: A first acquisition unit is configured to acquire user configuration information before merging adjacent operators with the same target device among the multiple operators, wherein the user configuration information includes target operator identification information and a preset device; as well as The first determining unit is configured to determine at least one target operator based on the target operator identification information, so as to update the target device of each operator in the at least one target operator to the preset device.
13. The device according to claim 12, wherein: The target operator identification information is an operator name, and the first determining unit includes: An identification subunit, configured to identify in turn whether the operator identification information of each operator matches the target operator identification information according to the dependency relationship between the operators in the computation graph; A first determining subunit is configured to, in response to identifying a first target operator whose operator identification information matches the target operator identification information, determine the first target operator and each operator dependent on the first target operator as the at least one target operator; and The third updating subunit is configured to update the target device of each operator in the at least one target operator to the preset device.
14. The device according to claim 12, wherein: The target operator identification information is at least one target operator number, and the first determining unit includes: a second determining subunit configured to determine, based on the at least one target operator number, at least one target operator corresponding to the operator number among the multiple operators; and The fourth updating subunit is configured to update the target device of each operator in the at least one target operator to the preset device.
15. An electronic device, comprising: at least one processor; as well as a memory communicatively coupled to the at least one processor; in 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 to enable the at least one processor to perform the method according to any one of claims 1 to 7.
16. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1-7.
17. A computer program product comprising a computer program, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
