Routing method, electronic equipment and storage medium

By determining routing information in the slave nodes and main nodes of the distributed system, the problem that existing systems cannot adapt to complex topology structures for RCP calls is solved, and the adaptation and unified management of tree-type, chain-type, combined connection and other structures are realized.

CN119697084APending Publication Date: 2025-03-25SHENZHEN INTELLIFUSION TECHNOLOGIES CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The existing master-slave distributed systems cannot adapt to nodes of complex topological structures such as tree connections, chain connections, and combined connections for remote procedure calls (RCP calls).

Method used

By determining routing information in each slave node and master node, the master node sends call instructions to the target slave node based on the routing information of the slave node and its own routing information, thereby realizing the adaptation of the complex topological structure.

Benefits of technology

It realizes the adaptation of distributed systems to complex topological structures, and can make RCP calls in structures such as tree connections, chain connections, and combined connections to uniformly manage network resources of distributed systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119697084A_ABST
    Figure CN119697084A_ABST
Patent Text Reader

Abstract

The invention provides a routing method, electronic equipment and a storage medium. The method is applied to a distributed system, wherein the distributed system comprises a master node and at least one slave node. The method comprises the following steps of: determining routing information of each slave node by each slave node based on node information of each slave node; based on the node information of each slave node and the node information of the master node, the master node determines routing information of the master node; based on the routing information of the master node and the routing information of each slave node, the master node sends a calling instruction to a target slave node; and the master node receives a processing result of processing the calling instruction by the target slave node. According to the application, discrete nodes in a distributed system can be unified into a network which is logically and tightly connected, so that a main node can conveniently plan and manage network resources of the whole distributed system as a whole, and nodes of complex topological structures such as a tree connection structure and the like can be adapted to carry out RCP calling.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of communications and relates to network communication technology, and in particular to a routing method, an electronic device and a storage medium. Background Art

[0002] With the development of chip technology and the evolution of interconnection technology, the nodes in the master-slave distributed system are constantly emerging with star-connected, chain-connected, combined-connected and other topological structures. However, the existing master-slave distributed system is only suitable for star-connected nodes to perform remote procedure calls (RCP calls), but it is difficult to adapt to complex topological structures such as chain-connected and combined-connected nodes to perform RCP calls. Summary of the invention

[0003] The embodiment of the present application discloses a routing method, an electronic device and a storage medium, which solves the problem that a master-slave distributed system cannot adapt to nodes of complex topological structures such as tree connection structures, chain connections, and combined connections for RCP calls.

[0004] The present application provides a routing method, which is applied to a distributed system, wherein the distributed system includes a master node and at least one slave node, and the method includes: based on the node information of each slave node, each slave node determines the routing information of each slave node; based on the node information of each slave node and the node information of the master node, the master node determines the routing information of the master node; based on the routing information of the master node and the routing information of each slave node, the master node sends a call instruction to a target slave node; the master node receives the processing result of the target slave node processing the call instruction.

[0005] In some embodiments of the present application, based on the node information of each slave node, each slave node determines the routing information of each slave node, including: each slave node obtains the node information of each slave node and the node information of the child nodes of each slave node through an initialization operation, and the child nodes of each slave node include the jump nodes of each slave node; and generates the routing information of each slave node according to the node information of each slave node and the node information of the child nodes of each slave node.

[0006] In some embodiments of the present application, the method further includes: each slave node establishing a link connection between each slave node and a corresponding child node based on the node information of each slave node and the node information of the child node of each slave node.

[0007] In some embodiments of the present application, the master node determines the routing information of the master node based on the node information of each slave node and the node information of the master node, including: the master node obtains the node information of all nodes through an initialization operation, and determines the routing information of the master node based on the node information of all nodes; and establishes a link connection between the master node and each slave node based on the routing information of the master node.

[0008] In some embodiments of the present application, based on the routing information of the master node and the routing information of each slave node, the master node sends a call instruction to the target slave node, including: according to the routing information of the master node, the routing information of each slave node and the node address of the target slave node, the master node determines a forwarding node, and forwards the call instruction to the target slave node through the forwarding node.

[0009] In some embodiments of the present application, the master node determines a forwarding node according to the routing information of the master node, the routing information of each slave node and the node address of the target slave node, and forwards the call instruction through the forwarding node to send the call instruction to the target slave node, including: according to the routing information of the master node and the node address of the target slave node, the master node determines the Nth forwarding node of the next level jump, and sends the call instruction to the Nth forwarding node of the next level jump of the master node; the Nth forwarding node The node obtains the target address of the call instruction; if the target address is the same as the node address of the Nth forwarding node, the Nth forwarding node determines the Nth forwarding node as the target slave node; if the target address is different from the node address of the Nth forwarding node, the Nth forwarding node sends the call instruction to the (N+1)th forwarding node according to the routing information of the Nth forwarding node, until a forwarding node is determined to have the same node address as the target address, and the determined forwarding node is used as the target node.

[0010] In some embodiments of the present application, sending the call instruction to the Nth forwarding node of the next level hop of the main node includes: addressing the Nth forwarding node of the next level hop of the main node according to a preset addressing rule.

[0011] In some embodiments of the present application, after the master node determines the routing information of the master node based on the node information of each slave node and the node information of the master node, the method further includes: the master node obtains the quality of service (QOS) parameters of each slave node; and determines the target slave node based on the QOS parameters of each slave node, wherein the QOS parameters include the number of node hops from the master node, the data transmission rate, and the graphics processor processing capability.

[0012] The present application also provides an electronic device, which includes a processor and a memory, and the processor is used to implement the routing method when executing a computer program stored in the memory.

[0013] The present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the routing method is implemented.

[0014] In the routing method in the embodiment of the present application, each slave node determines the routing information of each slave node based on the node information of each slave node; the master node determines the routing information of the master node based on the routing information of each slave node and the node information of the master node, and sends a call instruction to the target slave node based on the routing information of the master node and the routing information of each slave node. In this way, the embodiment of the present application unifies the discrete nodes in the distributed system into a logically tightly connected network, which facilitates the master node to coordinate and manage the network resources of the entire distributed system. At the same time, the master node in the embodiment of the present application, based on the above-mentioned routing information, can send a call instruction to the slave nodes in the distributed system with complex topological structures such as tree connection structure, chain connection, and combined connection, thereby solving the problem that the distributed system can adapt to complex topological structures for RCP calls. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 A schematic diagram of the network topology of a distributed system.

[0016] Figure 2 A schematic diagram of a network topology structure provided for an embodiment of the present application.

[0017] Figure 3 A flowchart of a routing method provided in an embodiment of the present application.

[0018] Figure 4 A schematic diagram of the code of the first preset routing table provided in an embodiment of the present application.

[0019] Figure 5 A schematic diagram of setting a first preset routing table for a distributed system provided in an embodiment of the present application.

[0020] Figure 6 The present invention is a flow chart of a method for determining routing information of a slave node and routing information of a master node in an embodiment of the present application.

[0021] Figure 7 This is a flow chart of a method for a master node to send a call instruction to slave node 1 in an embodiment of the present application.

[0022] Figure 8This is a flow chart of a method for a master node to send a call instruction to a slave node 4 in an embodiment of the present application.

[0023] Fig. 9 A schematic diagram of a distributed system provided in an embodiment of the present application.

[0024] Fig.10 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] To facilitate understanding, some illustrations of concepts related to the embodiments of the present application are given by way of example for reference.

[0026] It should be noted that in this application, "at least one" means one or more, and "more than one" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.

[0027] With the continuous evolution of chip technology, the forms of embedded system architecture and distributed system are becoming more and more diverse. For example, new distributed system architectures such as homogeneous multi-core systems, heterogeneous multi-core systems, and chiplet-interconnected on-chip networks are constantly emerging and widely used. The numerous distributed system architectures have also put forward new requirements for software architecture. It is necessary to introduce interconnected software to uniformly manage the numerous software entities running on multiple nodes and connect them in series for division of labor and collaboration. Among the many interconnected software, especially for master-slave scenarios, the Remote Procedure Call (RCP call) mechanism has many advantages such as powerful functions, unified programming paradigm, convenient software porting, and easy centralized control. Therefore, RPC-called interconnected software is widely used.

[0028] At present, the nodes in the master-slave distributed system continue to emerge with topological structures such as star connection, tree connection, chain connection, and combined connection. However, the existing master-slave distributed system is only suitable for star-connected nodes for RCP calls, but it is difficult to adapt to nodes with complex topological structures such as tree connection, chain connection, and combined connection for RCP calls. In addition, when making RCP calls, the nodes of the existing master-slave distributed system are generally directly carried on shared memory media for data transmission, but it is difficult to carry on transmission media such as Peripheral Component Interconnect Express (PCIE) connection, on-chip network interconnection, and serial port connection. As a result, the application scenarios of the existing distributed system are relatively limited when making calls such as RCP.

[0029] refer to Figure 1 The figure shows a schematic diagram of the network topology of a distributed system. The distributed system includes a master node and at least one slave node. The master node is directly connected to slave nodes 1, 2, 3 and 4. Figure 1 The master node and slave nodes 1, 2, 3 and 4 form a star connection structure. Figure 2 The diagram is a schematic diagram of the network topology provided by the embodiment of the present application. The master node is connected to slave node 1 and slave node 2, and slave node 2 is connected to slave node 3 and slave node 4, wherein slave node 1, slave node 3 and slave node 4 are leaf nodes or edge nodes. Figure 2 The master node and slave nodes 1, 2, 3 and 4 form a tree connection structure. It should be noted that the distributed system in the embodiment of the present application can be an embedded distributed system or a distributed system with a heterogeneous architecture.

[0030] like Figure 1 As shown in Figure 1, since the master node is directly connected to slave nodes 1, 2, 3, and 4, the master node in the distributed system can Figure 1 However, for any slave node in Figure 2 In the distributed system with a tree-type connection structure, since the master node is not connected to slave nodes 3 and 4, the master node cannot make RCP calls to slave nodes 3 and 4. Similarly, for distributed systems with complex topological structures such as chain connections and combined connections, if the master node is not directly connected to the slave nodes, the master node cannot make RCP calls to the slave nodes.

[0031] In order to solve the problem that a master-slave distributed system cannot adapt to nodes with complex topological structures such as tree connection structures, chain connections, and combined connections for RCP calls, the present application proposes a routing method, an electronic device, and a storage medium, wherein each slave node determines the routing information of each slave node based on the node information of each slave node; the master node determines the routing information of the master node based on the routing information of each slave node and the node information of the master node, and sends a call instruction to the target slave node based on the routing information of the master node and the routing information of each slave node. In this way, based on the routing information, the master node can send a call instruction to the slave nodes in the distributed system with complex topological structures such as tree connection structures, chain connections, and combined connections, thereby solving the problem that the distributed system can adapt to complex topological structures for RCP calls.

[0032] The following will be Figure 2 The routing method in this application is introduced by taking a distributed system with a tree-type connection structure as an example. Figure 3 As shown, it is a flowchart of the routing method provided by the embodiment of the present application, which is applied in an electronic device. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.

[0033] Step S301: Each slave node determines routing information of each slave node based on node information of each slave node.

[0034] Step S302: The master node determines the routing information of the master node based on the node information of each slave node and the node information of the master node.

[0035] In some embodiments of the present application, when the distributed system is powered on, the master node and the slave node are networked and a link connection is established. In some embodiments of the present application, each slave node determines the routing information of each slave node based on the node information of each slave node, including: the slave node obtains the node information of the slave node and the node information of the child node of the slave node through an initialization operation when powered on, and generates the routing information of the slave node according to the node information of the slave node and the node information of the child node of the slave node. Wherein, the child node of the slave node refers to the hop node of the slave node.

[0036] In some embodiments of the present application, the slave node establishes a link connection between the node and the corresponding child node according to the node information of the slave node and the node information of the child node of the slave node. In some embodiments of the present application, the slave node also sends the node information of the slave node to the master node.

[0037] In some embodiments of the present application, the master node determines the routing information of the master node based on the node information of each slave node and the node information of the master node, including: the master node obtains the node information of all nodes in the distributed system through an initialization operation when it is powered on, determines the routing information of the master node based on the node information of all nodes, and establishes a link connection between the master node and any slave node based on the routing information of the master node.

[0038] In some embodiments of the present application, a corresponding first preset routing table can be pre-set for all nodes on the distributed system, wherein the first preset routing table includes a next-level hop node, media information, and link parameters. The next-level hop node is used to indicate the node of the next hop of the corresponding node. The media information may include media such as pcie bus, serial port, shared memory, etc. The link parameters include parameters such as Transmission Control Protocol (TCP), Internet Protocol (IP), port, and address of the next-level hop node. Reference Figure 4 As shown, it is a schematic diagram of the code of the first preset routing table provided in an embodiment of the present application. Figure 4 In the example, the code "device_id: 0" indicates that the next-level hop node is a node with a device tag of "0", the code "connect: pcie" indicates that the media information is a pcie bus, and the code "connect: {"targetld":0, "port":200}" indicates that the link parameters are: the port is 200, and the address of the next-level hop node is "0"; the code "device_id: 1" indicates that the next-level hop node is a node with a device tag of "1", the code "connect: shm" indicates that the media information is a shared memory (shm), and the code "connect: {"targetld":14, "port":150}" indicates that the link parameters are: the port is 150, and the address of the next-level hop node is "14". It should be noted that the above-mentioned first preset routing table, media information and link parameters are only used as examples for explanation, and the specific contents of the first preset routing table, media information and link parameters are not limited. In the embodiment of the present application, more content can be set in the first preset routing table, media information and link parameters as needed, and the present application does not impose any restrictions on this. Figure 4 The code of the first preset routing table shown indicates that two nodes of the next level are connected through the pcie bus and the shm link respectively.

[0039] refer to Figure 5 FIG. 1 is a schematic diagram of setting a first preset routing table for a distributed system according to an embodiment of the present application. Figure 5As shown, the first preset routing table of each node only illustrates the next level hop node. In the first preset routing table of the master node, the next level hop node of the master node includes slave node 1 and slave node 2; in the first preset routing table of slave nodes 1, 3, and 4, slave nodes 1, 3, and 4 have no next level hop node, that is, slave nodes 1, 3, and 4 are leaf nodes; in the first preset routing table of slave node 2, the next level hop node of slave node 2 includes slave node 3 and slave node 4, that is, slave node 3 and slave node 4 are child nodes of slave node 2. In some embodiments of the present application, the master node and each slave node load their respective first preset routing tables when powered on.

[0040] In some embodiments of the present application, when the main node is powered on, the corresponding first preset routing table is loaded, and the initialization function is called based on the first preset routing table of the main node to perform node detection and link establishment. Through the initialization function, the main node parses the first preset routing table to determine the node information of the main node, determines the next level hop node of the main node as the first target node according to the node information of the main node, and sends a trigger initialization function notification to the first target node. In some embodiments of the present application, the node information of the main node includes the next level hop node of the main node, media information, and link parameters.

[0041] The first target node loads the corresponding first preset routing table when it is powered on, and when receiving the trigger initialization function notification sent by the main node, the initialization function is called based on the first preset routing table of the first target node to perform node detection and link establishment. Through the initialization function, the first target node parses the corresponding first preset routing table to determine the node information of the first target node, and determines whether the first preset routing table includes the next-level hop node of the first target node according to the node information of the first target node. The node information of the first target node may include the next-level hop node, media information, and link parameters of the first target node. If there is no next-level hop node of the first target node, the first target node sends the node information of the first target node to the main node; if there is a next-level hop node of the first target node, the first target node uses the next-level hop node of the first target node as the second target node, and the second target node is a child node of the first target node, and sends a trigger initialization function notification to the second target node.

[0042] The second target node loads the corresponding first preset routing table when it is powered on, and when receiving the trigger initialization function notification sent by the first target node, the initialization function is called based on the first preset routing table of the second target node to perform node detection and link establishment. Through the initialization function, the second target node parses the corresponding first preset routing table to determine the node information of the second target node, and judges whether the first preset routing table includes the next level hop node of the second target node according to the node information of the second target node. Wherein the node information of the second target node includes the next level hop node of the second target node, media information, and link parameters. If there is no next level hop node of the second target node, the second target node sends the node information of the second target node to the first target node. The first target node sends the received node information of the second target node to the main node. If there is a next level hop node of the second target node, the second target node uses the next level hop node of the second target node as the third target node, and the third target node is a child node of the second target node, and sends a trigger initialization function notification to the third target node, so that the third target node processes the initialization function notification. In the embodiment of the present application, the first target node also establishes a link connection between the first target node and the next-level hop node according to the node information sent by the next-level hop node (such as the second target node) of the first target node.

[0043] The process of the third target node processing the trigger initialization function notification is similar to the process of the first and second target nodes processing the trigger initialization function notification, and recursively sends the trigger initialization function notification to the next target node function in turn, until all nodes have completed the processing of the trigger initialization function notification. In an embodiment of the present application, the first target node determines the routing information of the first target node based on the node information of the first target node and the node information sent from the first target node. The second target node determines the routing information of the second target node based on the node information of the second target node and the node information sent from the second target node.

[0044] The master node receives the node information sent by all the next-level hop nodes of the master node, determines the routing information of the master node based on the received node information and the acquired node information of the master node, and establishes a link connection between the master node and any slave node based on the routing information of the master node. In this way, all nodes in the distributed system complete the link connection.

[0045] The following will be combined Figure 5-6 The method flow for determining the routing information of the slave node and the master node is described in detail. Figure 6 , which is a flow chart of a method for determining routing information of a slave node and routing information of a master node in an embodiment of the present application.

[0046] When the master node is powered on, the first preset routing table corresponding to the master node is loaded, and the initialization function is called based on the first preset routing table of the master node. Through the initialization function, the master node records the number of detected nodes as 1, marked as nodes=1, parses the first preset routing table corresponding to the master node, and determines that the next-level hop nodes of the master node are slave nodes 1 and slave nodes 2, and sends a trigger initialization function notification to slave nodes 1 and slave nodes 2 respectively. Among them, slave nodes 1 and slave nodes 2 can be used as the above-mentioned first target nodes.

[0047] When slave node 1 is powered on, the first preset routing table of slave node 1 is loaded, and when receiving the trigger initialization function notification sent by the master node, the initialization function is called based on the first preset routing table of slave node 1. Through the initialization function, slave node 1 records the number of nodes detected and marks the number of nodes as nodes=1, and parses the first preset routing table of slave node 1 to determine the node information of slave node 1. Slave node 1 determines the routing information of slave node 1 according to the node information of slave node 1. The node information of slave node 1 includes no next-level hop node, the media information of node 1, and the link parameters of node 1. Slave node 1 determines that there is no next-level hop node in the first preset routing table of slave node 1 according to the node information of slave node 1, and then sends the node information or routing information of slave node 1 to the master node.

[0048] The master node records the number of detected nodes based on the node information sent by slave node 1 and marks the number of nodes as nodes=2; determines the routing path for the master node to access slave node 1, and establishes a link connection with slave node 1 based on the routing path for the master node to access slave node 1. For example, refer to Figure 5 , the routing path for the master node to access slave node 1 includes the routing from the master node to slave node 1.

[0049] The slave node 2 loads the first preset routing table of the slave node 2 when it is powered on, and upon receiving the trigger initialization function notification sent by the master node, the initialization function is called based on the first preset routing table of the slave node 2. Through the initialization function, the slave node 2 records the number of nodes detected and marks the number of nodes as nodes=1, and parses the corresponding first preset routing table to determine the node information of the slave node 2. The node information of the slave node 2 includes the next-level hop node being node 3, the media information of node 3, the link parameters of node 3, the next-level hop node being node 4, the media information of node 4, and the link parameters of node 4. The slave node 2 determines that the next-level hop nodes in the first preset routing table of the slave node 2 are slave nodes 3 and slave nodes 4 according to the node information of the slave node 2, and sends the trigger initialization function notification to the slave node 3 and the slave node 4 respectively, so that the slave node 3 and the slave node 4 execute the initialization function.

[0050] When slave node 3 is powered on, the first preset routing table of slave node 3 is loaded, and when receiving the trigger initialization function notification sent by slave node 2, the initialization function is called based on the first preset routing table of slave node 3. Through the initialization function, slave node 3 parses the corresponding first preset routing table to determine the node information of slave node 3. Slave node 3 determines the routing information of slave node 1 according to the node information of slave node 3. The node information of slave node 3 includes no next-level hop node, media information of slave node 3, and link parameters of slave node 3. Slave node 3 determines that there is no next-level hop node in the first preset routing table of slave node 3 according to the corresponding node information, and then sends the node information of slave node 3 to slave node 2. Slave node 2 records the number of nodes detected and marks the number of nodes as nodes=2, and establishes a link connection with slave node 3 according to the node information sent by slave node 3.

[0051] When the slave node 4 is powered on, the first preset routing table of the slave node 4 is loaded, and when the trigger initialization function notification sent by the slave node 2 is received, the initialization function is called based on the first preset routing table of the slave node 4. Through the initialization function, the slave node 4 records the number of nodes detected and marks the number of nodes as nodes=1, and parses the corresponding first preset routing table to determine the node information of the slave node 4. The slave node 4 determines the routing information of the slave node 4 according to the node information of the slave node 4. The node information of the slave node 4 includes no next-level hop node, the media information of the node 4, and the link parameters of the node 4. The slave node 4 determines that there is no next-level hop node in the first preset routing table of the slave node 4 according to the corresponding node information, and then sends the node information of the slave node 4 to the slave node 2. The slave node 2 records the number of nodes detected and marks the number of nodes as nodes=3, and establishes a link connection with the slave node 4 according to the node information sent by the slave node 4.

[0052] Slave node 2 determines the routing information of slave node 2 according to the node information of slave node 2, the node information of slave node 3, and the node information of slave node 4. Slave node 2 also sends the node information of slave node 2, the node information of slave node 3, the node information of slave node 4, or the routing information of slave node 2 to the master node. In some embodiments of the present application, the master node also records the number of nodes detected according to the node information of the master node, the node information of slave node 1, the node information of slave node 2, the node information of slave node 3, and the node information of slave node 4, and sets the number of nodes nodes=5, and determines the routing information of the master node, and establishes a link connection between the master node and any slave node according to the routing information of the master node.

[0053] Specifically, the master node determines the routing path for the master node to access slave node 2 according to the node information of slave node 2, and establishes a link connection with slave node 2 according to the routing path for the master node to access slave node 2; determines the routing path for the master node to access slave node 3 according to the node information of slave node 3, and establishes a link connection with slave node 3 according to the routing path for the master node to access slave node 3; determines the routing path for the master node to access slave node 4 according to the node information of slave node 4, and establishes a link connection with slave node 4 according to the routing path for the master node to access slave node 4. For example, refer to Figure 5 The routing path for the master node to access slave node 2 includes routing from the master node to slave node 2; the routing path for the master node to access slave node 3 includes routing from the master node to slave node 2 and routing from slave node 2 to slave node 3; the routing path for the master node to access slave node 4 includes routing from the master node to slave node 2 and routing from slave node 2 to slave node 4.

[0054] It should be noted that the node detection and link establishment of the master node and each slave node are performed through their own initialization functions. The processes of the initialization functions of the master node and each node are the same, and the only difference is that the first preset routing table used by the initialization functions of the master node and each slave node is different. After the master node executes the initialization function, based on the node information of the master node and the node information of each slave node, each node in the distributed system completes networking, and the master node can obtain the node information of all nodes.

[0055] Step S303: Based on the routing information of the master node and the routing information of each slave node, the master node sends a call instruction to the target slave node.

[0056] In some embodiments of the present application, the call instruction includes a source address, a target address, and a processing task. In some embodiments of the present application, based on the routing information of the master node and the routing information of each slave node, the master node sends the call instruction to the target slave node, including: the master node determines the forwarding node according to the routing information of the master node, the routing information of each slave node, and the target address; and forwards the call instruction through the forwarding node to send the call instruction to the target slave node. In some embodiments of the present application, the call instruction is an RCP call instruction.

[0057] In some embodiments of the present application, the forwarding node includes at least one slave node, the master node determines the forwarding node according to the routing information of the master node, the routing information of each slave node and the target address, and forwarding the call instruction through the forwarding node to send the call instruction to the target slave node includes: the master node determines the first forwarding node of the next level jump according to the routing information of the master node and the node address of the target slave node, and sends the call instruction to the first forwarding node of the next level jump of the master node based on the node address of the forwarding node of the next level jump; the first forwarding node obtains the target address of the call instruction; determines whether the target address is the same as the node address of the first forwarding node; if the target address is the same as the node address of the first forwarding node, the first forwarding node determines the first forwarding node as the target slave node, and processes the processing task in the call instruction; if the target address is not the same as the node address of the first forwarding node; the first forwarding node sends the call instruction to the second forwarding node of the next level jump of the first forwarding node according to the routing information of the first forwarding node. The second forwarding node determines whether the target address in the call instruction is the same as the node address of the second forwarding node. If they are the same, the second forwarding node is determined to be the target slave node. If they are not the same, the call instruction is continued to be forwarded to the forwarding node of the next level jump until the target slave node receives the call instruction. It should be noted that the processing process of the second forwarding node for the call instruction is the same as the processing process of the first forwarding node for the call instruction, and this application will not be described in detail.

[0058] For example, the Nth forwarding node of the next level jump is determined according to the routing information of the master node and the node address of the target slave node, and the call instruction is sent to the Nth forwarding node of the next level jump of the master node. The Nth forwarding node is used for: step a, obtaining the target address of the call instruction; step b, if the target address is the same as the node address of the Nth forwarding node, the Nth forwarding node determines that the Nth forwarding node is the target slave node; step c, if the target address is not the same as the node address of the Nth forwarding node, the Nth forwarding node sends the call instruction to the (N+1)th forwarding node of the next level jump of the Nth forwarding node according to the routing information of the Nth forwarding node; step d, updating N according to N=N+1; the Nth forwarding node executes steps ad, and until the Nth forwarding node is determined to be the target slave node. In some embodiments of the present application, N is a positive integer greater than 0.

[0059] In some embodiments of the present application, the call instruction is an RPC call instruction. It should be noted that the content of the call instruction in the embodiments of the present application is only an example, and more content may be included in actual applications, and the present application does not limit this.

[0060] The following will be combined Figure 5 , 7 -8 respectively introduces the method flow of the master node sending a call instruction to the target slave node. Figure 7 As shown, it is a flow chart of the method for the master node to send a call instruction to the slave node 1 in the embodiment of the present application. The master node starts the call function, and the call function includes the call instruction. The master node searches the second preset routing table corresponding to the master node to determine that the first forwarding node of the next level jump of the master node is the slave node 1 (marked as Next hop=slave node 1), wherein the second preset routing table of the master node includes the routing information of the master node. The master node sends a notification of triggering the call function to the slave node 1. The slave node 1 responds to the notification of triggering the call function, starts the call function, and obtains the target address of the call instruction. The slave node 1 searches the second preset routing table corresponding to the slave node 1 according to the target address, determines that the node of the next level jump of the slave node 1 is the slave node 1 (marked as Next hop=slave node 1), and thus determines that the slave node 1 is the target slave node. The slave node 1 processes the processing task in the call instruction and sends the processing result of the processing task to the master node.

[0061] In some embodiments of the present application, when determining that the node of the next level jump from node 1 is slave node 1, slave node 1 can determine that the target address is the same as the node address of slave node 1, and thus slave node 1 is the target slave node. In some embodiments of the present application, the second preset routing table of slave node 1 includes routing information of slave node 1, for example, the routing information of slave node 1 includes the node address of slave node 1 and no next level jump node.

[0062] refer to Figure 8 As shown, it is a flow chart of the method for the master node to send a call instruction to the slave node 4 in an embodiment of the present application. The master node starts the call function, and the call function includes the call instruction. The master node searches the second preset routing table corresponding to the master node to determine that the first forwarding node of the next level jump of the master node is the slave node 2. The master node sends a notification of triggering the call function to the slave node 2. The slave node 2 responds to the notification of triggering the call function, starts the call function, and obtains the target address of the call instruction. The slave node 2 searches the second preset routing table corresponding to the slave node 2 according to the target address, and determines that the node of the next level jump of the slave node 2 is the slave node 4. In some embodiments of the present application, when it is determined that the node of the next level jump of the slave node 2 is the slave node 4, the slave node 2 can determine that the target address is not the same as the node address of the slave node 2. In some embodiments of the present application, the second preset routing table corresponding to the slave node 2 includes the routing information of the slave node 2. For example, the routing information of slave node 2 includes the node address of slave node 2, the nodes to be jumped from slave node 2 to the next level are slave node 3 and slave node 4. Since the target address of the call instruction points to slave node 4, slave node 2 determines that the target address is different from the node address of slave node 2, and sends a notification to slave node 2 to trigger the call function.

[0063] Slave node 4 responds to the notification of triggering calling function sent by slave node 2, starts calling function, and obtains the target address of calling instruction. Slave node 4 searches the second preset routing table corresponding to slave node 4 according to the target address, determines that the node of the next level jump of slave node 4 is slave node 4 itself, thereby determines that slave node 4 is the target slave node. Slave node 4 processes the processing task in the calling instruction, and sends the processing result of the processing task to the master node. In some embodiments of the present application, the second preset routing table corresponding to slave node 4 includes the routing information of slave node 4. For example, the routing information of slave node 4 includes the node address of slave node 4 and the node without the next level jump. Because the target address of calling instruction points to slave node 4, slave node 4 judges that the target address is the same as the node address of slave node 4.

[0064] In the embodiment of the present application, all nodes in the distributed system run the same recursive logic of calling functions, so all nodes have a unified software architecture at the software level, reducing the development workload of the routing method in the embodiment of the present application.

[0065] In some embodiments of the present application, when the node forwards the call instruction to the node of the next level jump, the node addresses the node of the next level jump of the node according to the preset addressing rule, and sends the call instruction to the node of the next level jump. In some embodiments of the present application, addressing the node of the next level jump of the node according to the preset addressing rule includes: addressing all nodes in the distributed system according to a preset fixed and unique address, and addressing the node of the next level jump of the node according to the addressed node address.

[0066] For example, refer to Figure 5 As shown, the distributed system includes five nodes, namely, the master node, slave node 1, slave node 2, slave node 3 and slave node 4. Each node is pre-assigned a fixed and unique node address. When the master node takes slave node 1 as the target slave node and sends a call instruction to slave node 1, the master node searches the master node's routing table according to the assigned node address of slave node 1 to determine that the node of the next level jump is slave node 1, addresses slave node 1 according to the node address of slave node 1, and sends the call instruction to node 1.

[0067] In other embodiments of the present application, addressing the node of the next level of hop of the node according to a preset addressing rule includes: addressing all nodes in the distributed system according to the node and the child nodes of the node; addressing the node of the next level of hop of the node according to the addressed node address, the child nodes of the node representing the hop nodes of the node.

[0068] refer to Fig. 9As shown, it is a schematic diagram of a distributed system provided by an embodiment of the present application. The distributed system includes a master node, slave node 1, slave node 2, slave node 3, slave node 4, slave node 5, slave node 6, slave node 7, slave node 8, slave node 9, slave node 10, and slave node 11. Among them, slave nodes 1-11 are child nodes of the master node; slave nodes 3-5 are child nodes of slave node 2; slave nodes 7-8 are child nodes of slave node 6; slave node 8 is a child node of slave node 7; slave nodes 10-11 are child nodes of slave node 9; and slave node 11 is a child node of slave node 10.

[0069] If the node is a master node, addressing the nodes of the next level jump of the master node according to the preset addressing rules includes: addressing the master node as id0, addressing slave node 1 as id1, addressing slave node 2 as id2, addressing slave node 3 as id3, addressing slave node 4 as id4, addressing slave node 5 as id5, addressing slave node 6 as id6, addressing slave node 7 as id7, addressing slave node 8 as id8, addressing slave node 9 as id9, addressing slave node 10 as id10, and addressing slave node 11 as id11; addressing the nodes of the next level jump of the master node according to the addressed node addresses.

[0070] If the node is node 1, addressing the node of the next level jump from node 1 according to the preset addressing rule includes: addressing the slave node 1 as id0, addressing the slave node 2 as id1, addressing the slave node 3 as id2, and addressing the slave node 4 as id3; addressing the node of the next level jump from node 1 according to the addressed node address.

[0071] If the node is node 2, addressing the node of the next level jump from node 2 according to the preset addressing rule includes: addressing node 2 as id0; and addressing the node of the next level jump from node 2 according to the addressed node address.

[0072] If the node is node 3, addressing the node of the next level jump from node 3 according to the preset addressing rule includes: addressing node 3 as id0; and addressing the node of the next level jump from node 3 according to the addressed node address.

[0073] If the node is node 4, addressing the node of the next level jump from node 4 according to the preset addressing rule includes: addressing node 4 as id0; and addressing the node of the next level jump from node 4 according to the addressed node address.

[0074] If the node is node 5, addressing the node of the next level jump from node 5 according to the preset addressing rule includes: addressing node 5 as id0; and addressing the node of the next level jump from node 5 according to the addressed node address.

[0075] If the node is node 6, addressing the node of the next level jump from node 6 according to the preset addressing rule includes: addressing node 6 as id0, addressing node 7 as id1, and addressing node 8 as id2; addressing the node of the next level jump from node 6 according to the addressed node address.

[0076] If the node is node 7, addressing the node of the next level jump from node 7 according to the preset addressing rule includes: addressing the slave node 7 as id0, addressing the slave node 8 as id1; and addressing the node of the next level jump from node 7 according to the addressed node address.

[0077] If the node is node 8, addressing the node of the next level jump from node 8 according to the preset addressing rule includes: addressing node 8 as id0; and addressing the node of the next level jump from node 8 according to the addressed node address.

[0078] If the node is node 9, addressing the node of the next level jump from node 9 according to the preset addressing rule includes: addressing the slave node 9 as id0, addressing the slave node 10 as id1, and addressing the slave node 11 as id2; addressing the node of the next level jump from node 9 according to the addressed node address.

[0079] If the node is node 10, addressing the node of the next level jump from node 10 according to the preset addressing rule includes: addressing the slave node 10 as id0, addressing the slave node 11 as id1; and addressing the node of the next level jump from node 10 according to the addressed node address.

[0080] If the node is node 11, addressing the node of the next level jump from node 11 according to the preset addressing rule includes: addressing node 11 as id0; and addressing the node of the next level jump from node 11 according to the addressed node address.

[0081] For example, if the node is a master node, and the master node sends an RPC call instruction to node 11, the master node addresses all nodes in the distributed system, addresses node 9 as id8, addresses the node of the next level jump of the master node according to the addressed node address as node 9 addressed as id8, sends an RPC call instruction to node 9 addressed as id8, and notifies node 9 that the target address of the RPC call instruction is id2. Node 9 receives the RPC call instruction and continues to send the RPC call instruction to node 10 addressed as id1, and notifies node 10 that the target address of the RPC call instruction is id1. When node 10 receives the RPC call instruction, it continues to send the RPC call instruction to node 11 addressed as id0, and notifies node 11 that the target address of the RPC call instruction is id0.

[0082] Step S304: the master node receives the processing result of the target slave node processing the call instruction.

[0083] In the embodiment of the present application, the target slave node responds to the call instruction, processes the processing task in the call instruction to obtain a processing result, and sends the processing result to the master node. The master node receives the processing result sent by the target slave node. In some embodiments of the present application, the processing task can be a control instruction, such as startup, shutdown, temperature adjustment, and data storage tasks. The present application does not limit the type of processing tasks.

[0084] In some embodiments of the present application, the slave node may send the processing result along the reverse path of the calling instruction's routing path, where the calling instruction's routing path is the routing path from the master node to the target slave node. Figure 5 As shown, the source address of the call instruction is the node address of the master node, and the destination address is the node address of slave node 4, so the routing path of the call instruction is the routing path composed of the master node, slave node 2, and slave node 4. Slave node 4, as the target slave node, can send the processing result of the call instruction to the master node according to the reverse path of the routing path (the path composed of slave node 4, slave node 2, and master node).

[0085] In some embodiments of the present application, after step S302, the method further includes: the master node obtains the Quality of Service (QOS) parameters of the slave node, and determines the target slave node according to the QOS parameters. In some embodiments of the present application, the QOS parameters include the number of node jumps from the master node, the data transmission rate, and the GPU processing power. The number of node jumps from the master node represents the number of nodes that the master node needs to jump to route to the corresponding slave node. In some embodiments of the present application, the master node preferentially selects the slave node with a small number of node jumps from the master node, a high data transmission rate, and a strong GPU processing power as the target slave node.

[0086] In the embodiment of the present application, each slave node determines the routing information of each slave node based on the node information of each slave node; the master node determines the routing information of the master node based on the routing information of each slave node and the node information of the master node, and sends a call instruction to the target slave node based on the routing information of the master node and the routing information of each slave node. In this way, the embodiment of the present application unifies the discrete nodes in the distributed system into a logically tightly connected network, which facilitates the master node to coordinate and manage the network resources of the entire distributed system. At the same time, the master node in the embodiment of the present application can send a call instruction to the slave nodes in the distributed system with complex topological structures such as tree connection structure, chain connection, and combined connection based on the above routing information, thereby solving the problem that the distributed system can adapt to complex topological structures for RCP calls.

[0087] Fig.101 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 10 can be a device corresponding to a master node or a slave node. For example, the electronic device 10 can be a mobile phone, a tablet computer, a smart wearable device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, a netbook, an energy storage device, a power distribution device, a vehicle-mounted device, a server, etc. The embodiment of the present application does not impose any restrictions on the specific type of the electronic device.

[0088] like Fig.10 As shown, the electronic device 10 may include a display screen 100, a communication module 101, a memory 102, a processor 103, an input / output (I / O) interface 104, and a bus 105. The processor 103 is coupled to the display screen 100, the communication interface 101, the memory 102, and the I / O interface 104 through the bus 105.

[0089] The display screen 100 may be a touch screen, which is an inductive touch-sensitive liquid crystal display device. Alternatively, the display screen 100 may also be a non-touch screen.

[0090] The communication module 101 may include a wired communication module and / or a wireless communication module. The wired communication module may provide one or more wired communication solutions such as Universal Serial Bus (USB), Controller Area Network (CAN), etc. The wireless communication module may provide one or more wireless communication solutions such as Wireless Fidelity (Wi-Fi), Bluetooth (BT), mobile communication network, Frequency Modulation (FM), Near Field Communication (NFC), Infrared (IR), etc.

[0091] The memory 102 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM). The random access memory can be directly read and written by the processor 103, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.

[0092] Random access memory can include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), etc.

[0093] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110. The non-volatile memory may include a disk storage device and a flash memory.

[0094] The memory 102 is used to store one or more computer programs. The one or more computer programs are configured to be executed by the processor 103. The one or more computer programs include multiple instructions, and when the multiple instructions are executed by the processor 103, the routing method executed on the electronic device 10 can be implemented.

[0095] In other embodiments, the electronic device 10 further includes an external memory interface for connecting to an external memory to expand the storage capacity of the electronic device 10 .

[0096] The processor 103 may include one or more processing units, for example, the processor 103 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processor (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0097] The processor 103 provides computing and control capabilities. For example, the processor 103 is used to execute a computer program stored in the memory 102 to implement the above-mentioned routing method.

[0098] The I / O interface 104 is used to provide a channel for user input or output. For example, the I / O interface 104 can be used to connect various input and output devices, such as a mouse, keyboard, touch device, display screen, etc., so that the user can enter information or visualize information.

[0099] The bus 105 is at least used to provide a channel for mutual communication among the communication module 101 , the memory 102 , the processor 103 , and the I / O interface 104 in the electronic device 10 .

[0100] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 10. In other embodiments of the present application, the electronic device 10 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0101] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. The computer program includes program instructions. The method implemented when the program instructions are executed can refer to the methods in the above-mentioned embodiments of the present application.

[0102] The computer-readable storage medium may be an internal memory of the electronic device of the above-mentioned embodiment, such as a hard disk or memory of the electronic device. The computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device.

[0103] In some embodiments, the computer-readable storage medium may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the electronic device, etc.

[0104] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0105] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0106] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0107] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0108] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A routing method, applied in a distributed system, characterized in that: The distributed system includes a master node and at least one slave node, and the method includes: Based on the node information of each slave node, each slave node determines the routing information of each slave node; Based on the node information of each slave node and the node information of the master node, the master node determines the routing information of the master node; Based on the routing information of the master node and the routing information of each slave node, the master node sends a call instruction to the target slave node; The master node receives a processing result of the target slave node processing the call instruction.

2. The routing method according to claim 1, characterized in that: Based on the node information of each slave node, each slave node determines the routing information of each slave node, including: Each slave node acquires node information of each slave node and node information of child nodes of each slave node through initialization operation, wherein the child nodes of each slave node include the jump nodes of each slave node; The routing information of each slave node is generated according to the node information of each slave node and the node information of the child node of each slave node.

3. The routing method according to claim 2, characterized in that: The method further comprises: Each slave node establishes a link connection between each slave node and a corresponding child node according to the node information of each slave node and the node information of the child node of each slave node.

4. The routing method according to claim 1, characterized in that: The master node determines the routing information of the master node based on the node information of each slave node and the node information of the master node, including: The master node obtains node information of all nodes through initialization operation, and determines routing information of the master node according to the node information of all nodes; According to the routing information of the master node, a link connection between the master node and each slave node is established.

5. The routing method according to claim 1, characterized in that: Based on the routing information of the master node and the routing information of each slave node, the master node sending a call instruction to the target slave node includes: According to the routing information of the master node, the routing information of each slave node and the node address of the target slave node, the master node determines a forwarding node, and forwards the call instruction to the target slave node through the forwarding node.

6. The routing method according to claim 5, characterized in that: The master node determines a forwarding node according to the routing information of the master node, the routing information of each slave node and the node address of the target slave node, and forwards the call instruction through the forwarding node to send the call instruction to the target slave node, including: According to the routing information of the master node and the node address of the target slave node, the master node determines the Nth forwarding node of the next level jump, and sends the call instruction to the Nth forwarding node of the next level jump of the master node; The Nth forwarding node obtains the target address of the call instruction; If the target address is the same as the node address of the Nth forwarding node, the Nth forwarding node determines the Nth forwarding node as the target slave node; If the target address is different from the node address of the Nth forwarding node, the Nth forwarding node sends the call instruction to the (N+1)th forwarding node according to the routing information of the Nth forwarding node, until a forwarding node is determined to have the same node address as the target address, and the determined forwarding node is used as the target node.

7. The routing method according to claim 6, characterized in that: The step of sending the call instruction to the Nth forwarding node of the next level jump of the main node comprises: The Nth forwarding node of the next level jump of the main node is addressed according to the preset addressing rule.

8. The routing method according to claim 1, characterized in that: After the master node determines the routing information of the master node based on the node information of each slave node and the node information of the master node, the method further includes: The master node obtains the quality of service (QOS) parameter of each slave node; The target slave node is determined according to the QOS parameters of each slave node, wherein the QOS parameters include the number of node hops from the master node, the data transmission rate and the processing capacity of the graphics processor.

9. An electronic device, characterized in that: The electronic device comprises a processor and a memory, wherein the processor is configured to execute a computer program stored in the memory to implement the routing method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by a processor, the routing method according to any one of claims 1 to 8 is implemented.

Citation Information

Cited By

  • Routing method, electronic device, and storage medium

    WO2026129901A1