# US 2023/0409921 A1 · Multi-node distributed training method and apparatus, device and readable medium

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2023/0409921 A1
- Document ID: US20230409921A1
- Status: Published application
- Kind: A1
- Application number: 18/035,489
- Filed: 2021-09-28
- Published: 2023-12-21
- Earliest claimed: 2020-11-28
- Assignees: Inspur Suzhou Intelligent Technology Co., Ltd.
- Applicants: Inspur Suzhou Intelligent Technology Co., Ltd.
- Inventors: Lianshui ZHAO; Shaohua WU
- Web page: https://patentgrep.com/patent/US20230409921A1

## CPC

- G06N 3/098: Distributed learning, e.g. federated learning
- G06N 3/063: using electronic means
- Y02D 10/00: Energy efficient computing, e.g. low power processors, power management or thermal management
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- Y02D: CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE

## Abstract

The present application discloses a method for multi-node distributed training. The method includes: in each of nodes, establishing an independent training calculation chart, covering all of GPUs and CPUs in each of the nodes by using the training calculation chart, and adding the CPUs of each of the nodes into a deep-learning-model distributed-training frame; copying initial training parameters in GPUs of a host node into CPUs of the host node, and sending the initial training parameters in the CPUs of the host node to the CPUs of other nodes; copying the initial training parameters received by the CPUs of the other nodes into GPUs of the respective nodes, performing a protocolling operation to a gradient by using the training calculation chart, and copying a first-level gradient obtained after the protocolling into CPUs of the respective nodes; and performing protocolling again to the first-level gradient in the CPUs of the respective nodes, and copying a second-level gradient obtained after the protocolling into the GPUs of the respective nodes. The present application further discloses the corresponding apparatus, computer device and readable storage medium. The present application, by combining the advantages of the two training modes of Horovod and Replicated, increases the training efficiency.

## Claims

### Claim 1

A method for multi-node distributed training, wherein the method comprises:
in each of nodes, establishing an independent training calculation chart, covering all of GPUs and CPUs in each of the nodes by using the training calculation chart, and adding the CPUs of each of the nodes into a deep-learning-model distributed-training frame;
copying initial training parameters in GPUs of a host node into CPUs of the host node, and based on a broadcasting operation of the deep-learning-model distributed-training frame, sending the initial training parameters in the CPUs of the host node to CPUs of other nodes;
copying the initial training parameters received by the CPUs of the other nodes into GPUs of the respective nodes, performing a protocolling operation to a gradient by using the training calculation chart, and copying a first-level gradient obtained after the protocolling into CPUs of the respective nodes; and
based on a global protocolling operation of the deep-learning-model distributed-training frame, performing protocolling again to the first-level gradient in the CPUs of the respective nodes, and copying a second-level gradient obtained after the protocolling into the GPUs of the respective nodes.

### Claim 2 (depends on 1)

The method for multi-node distributed training according to claim 1, wherein the operation of, in each of the nodes, establishing the independent training calculation chart, covering all of the GPUs and the CPUs in each of the nodes by using the training calculation chart comprises:
in each of the nodes, establishing an independent calculation chart in a form of Replicated, and covering all of the GPUs and the CPUs in each of the nodes by using the calculation chart.

### Claim 3 (depends on 1)

The method for multi-node distributed training according to claim 1, wherein the operation of adding the CPUs of each of the nodes into the deep-learning-model distributed-training frame comprises:
adding the CPUs of each of the nodes into a Horovod training frame.

### Claim 4 (depends on 1)

The method for multi-node distributed training according to claim 1, wherein the operation of performing the protocolling operation to the gradient by using the training calculation chart comprises:
solving a sum or an average value of gradients of all of the GPUs in the node.

### Claim 5 (depends on 1)

The method for multi-node distributed training according to claim 1, wherein the operation of performing the protocolling operation to the gradient by using the training calculation chart comprises:
invoking a protocolling operation in a GPU communication library, and based on the protocolling operation, solving a sum or an average of gradients.

### Claim 6

(canceled)

### Claim 7

(canceled)

### Claim 8

(canceled)

### Claim 9

A computer device, wherein the computer device comprises:
at least one processor; and
a memory, wherein the memory stores a computer instruction that is executable in the processor, and the instruction, when executed by the processor, causes the processor to:
in each of nodes, establish an independent training calculation chart, cover all of GPUs and CPUs in each of the nodes by using the training calculation chart, and add the CPUs of each of the nodes into a deep-learning-model distributed-training frame;
copy initial training parameters in GPUs of a host node into CPUs of the host node, and based on a broadcasting operation of the deep-learning-model distributed-training frame, send the initial training parameters in the CPUs of the host node to CPUs of other nodes;
copy the initial training parameters received by the CPUs of the other nodes into GPUs of the respective nodes, perform a protocolling operation to a gradient by using the training calculation chart, and copy a first-level gradient obtained after the protocolling into CPUs of the respective nodes; and
based on a global protocolling operation of the deep-learning-model distributed-training frame, perform protocolling again to the first-level gradient in the CPUs of the respective nodes, and copy a second-level gradient obtained after the protocolling into the GPUs of the respective nodes.

### Claim 10

A computer-readable storage medium, the computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, causes the processor to:
in each of nodes, establish an independent training calculation chart, cover all of GPUs and CPUs in each of the nodes by using the training calculation chart, and add the CPUs of each of the nodes into a deep-learning-model distributed-training frame;
copy initial training parameters in GPUs of a host node into CPUs of the host node, and based on a broadcasting operation of the deep-learning-model distributed-training frame, send the initial training parameters in the CPUs of the host node to CPUs of other nodes;
copy the initial training parameters received by the CPUs of the other nodes into GPUs of the respective nodes, perform a protocolling operation to a gradient by using the training calculation chart, and copy a first-level gradient obtained after the protocolling into CPUs of the respective nodes; and
based on a global protocolling operation of the deep-learning-model distributed-training frame, perform protocolling again to the first-level gradient in the CPUs of the respective nodes, and copy a second-level gradient obtained after the protocolling into the GPUs of the respective nodes.

### Claim 11 (depends on 1)

The method for multi-node distributed training according to claim 1, wherein the operation of, based on a broadcasting operation of the deep-learning-model distributed-training frame, sending the initial training parameters in the CPUs of the host node to CPUs of other nodes comprises:
by using a broadcasting operation of Horovod, broadcasting the initial training parameters into the CPUs of the other nodes.

### Claim 12 (depends on 1)

The method for multi-node distributed training according to claim 1, wherein the method is suitable for all of deep-learning frames, including Tensorflow, Pytorch and MxNet, and suitable for all of accelerators for accelerating training of deep-learning models, including other ASICs such as GPU and TPU.

### Claim 13 (depends on 2)

The method for multi-node distributed training according to claim 2, wherein each node comprises calculation accelerators;
in each of the calculation accelerators, all of the calculation charts are the same and include a respective set of training parameters, and the sum of the calculation charts of each of the calculation accelerators forms one complete calculation chart.

### Claim 14 (depends on 13)

The method for multi-node distributed training according to claim 13, wherein the deep-learning-model distributed-training frame is a Horovod training frame, and the Horovod training frame is configured for:
ensuring that all of the calculation accelerators have the same training parameters; and
coordinating the gradients of each of the calculation accelerators to perform the protocolling operation.

### Claim 15 (depends on 9)

The computer device according to claim 9, wherein in each of the nodes, establish the independent training calculation chart, and cover all of the GPUs and the CPUs in each of the nodes by using the training calculation chart comprises:
in each of the nodes, establishing an independent calculation chart in a form of Replicated, and covering all of the GPUs and the CPUs in each of the nodes by using the calculation chart.

### Claim 16 (depends on 9)

The computer device according to claim 9, wherein add the CPUs of each of the nodes into the deep-learning-model distributed-training frame comprises:
adding the CPUs of each of the nodes into a Horovod training frame.

### Claim 17 (depends on 9)

The computer device according to claim 9, wherein perform the protocolling operation to the gradient by using the training calculation chart comprises:
solving a sum or an average value of gradients of all of the GPUs in the node.

### Claim 18 (depends on 9)

The computer device according to claim 9, wherein perform the protocolling operation to the gradient by using the training calculation chart comprises:
invoking a protocolling operation in a GPU communication library, and based on the protocolling operation, solving a sum or an average of gradients.

### Claim 19 (depends on 9)

The computer device according to claim 9, wherein based on a broadcasting operation of the deep-learning-model distributed-training frame, send the initial training parameters in the CPUs of the host node to CPUs of other nodes comprises:
by using a broadcasting operation of Horovod, broadcasting the initial training parameters into the CPUs of the other nodes.

### Claim 20 (depends on 9)

The computer device according to claim 9, wherein operations of the processor are suitable for all of deep-learning frames, including Tensorflow, Pytorch and MxNet, and suitable for all of accelerators for accelerating training of deep-learning models, including other ASICs such as GPU and TPU.

### Claim 21 (depends on 10)

The computer-readable storage medium according to claim 10, wherein in each of the nodes, establish the independent training calculation chart, and cover all of the GPUs and the CPUs in each of the nodes by using the training calculation chart comprises:
in each of the nodes, establishing an independent calculation chart in a form of Replicated, and covering all of the GPUs and the CPUs in each of the nodes by using the calculation chart.

### Claim 22 (depends on 10)

The computer-readable storage medium according to claim 10, wherein add the CPUs of each of the nodes into the deep-learning-model distributed-training frame comprises:
adding the CPUs of each of the nodes into a Horovod training frame.

### Claim 23 (depends on 10)

The computer-readable storage medium according to claim 10, wherein perform the protocolling operation to the gradient by using the training calculation chart comprises:
solving a sum or an average value of gradients of all of the GPUs in the node.
