File size: 3,729 Bytes
45361be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Multi Inter Node Tactician (M.I.N.T)

Tool designed to configure machines for Multi Node distributed training. This involves setting up the
host machines for high performance training (HugePages, CPU performance mode, etc...) and managing
docker containers in the cluster.

## Requirements

MINT handles downloading the below packages prior to configuring the machines and containers.
`pdsh` is a parallel shell tool that allows running commands on multiple machines using only SSH.
`pdsh` is the main method of running MINT across the machines in the cluster

* pdsh
* [Docker Compose](https://docs.docker.com/compose/)

MINT will replicate itself to all machines in the cluster (tools and dockerfiles) for ease of management
and training on same file locations.

## Configuration

Update `config.properties` to coordinate machine updates and desired docker container setup.

``` [properties]
# Hostfile, nodes to control
HOSTFILE="./hostfile"

# Directory that stores docker content (dockerfiles, docker-compose, etc...)
DOCKER_DIR="~/G2/docker/gpt3"

# Base Docker Image used 
BASE_IMAGE="vault.habana.ai/gaudi-docker/1.9.0/ubuntu20.04/habanalabs/pytorch-installer-1.13.1:latest"

DATASET_DIR="/data/preprocessed_c4_spm/"
```

Update `hostfile` with the IP addreses of the nodes in the desired cluster. Example

``` [hostfile]
192.168.132.1
192.168.132.2
```

## Host System Management

`configure_system.sh` handles preparing the cluster for distributed training.

``` [bash]
configure_system.sh -h
Usage: ./configure_system.sh [-c command] [-r command] [-p command] [-d command] [-h]
   -c configure ... Configure Command to setup ssh, ssh_home, hugepages, duplicate_repo, duplicate_datasets, all
                    i.e (./configure_system.sh -c ssh, ssh_home, hugepages, duplicate_repo, duplicate_datasets, all)
   -r reload    ... Reload (driver)
                    i.e (./configure_system.sh -r driver)
   -p ports     ... Control/check Gaudi Network Ports (up, down, status, idc)
                    i.e (./configure_system.sh -p status)
   -d docker    ... Configure Docker Environment (install-compose, pull-base)
                    i.e (./configure_system.sh -d install-compose)
   -s ............. Secret Commands. Used to run any bash commands
   -h ............. Optional; show help
                    i.e (./configure_system.sh -h)
This wrapper script configures and updates nodes specified in hostfile

Requirements:
- pdsh

```

### Setup Host Machines

Run list of below commands to prepare machines for large model distributed training

``` [bash]
# Setup passwordless ssh, syncs docker files & tools to all machines, and updates Hugepages
./configure_system.sh -c all

# Bring up Gaudi Network Ports
./configure_system.sh -p up

# Install Docker Compose
./configure_system.sh -d install-compose

# Pull Docker Base Image
./configure_system.sh -d pull-base
```

## Docker Container Management

Leveraging Docker Compose to build and run containers across the cluster.
`control_containers.sh` handles managing docker containers (build, up, down, etc...)

``` [bash]
Usage: ./control_containers.sh [-b] [-u] [-d] [-r] [-h]
   -b ...... Build image based on local Dockerfile
   -u ...... Bring Containers Up
   -u ...... Bring Containers Down
   -r ...... Restart Containers
   -h ...... Optional; show help
This script runs docker compose commands to handle mutli-node configurations.

Requirements:
- pdsh
- docker compose
- Dockerfile to build
```

Run below commands to build and bring up containers on each machine in the cluster:

``` [bash]
# Build Images on each machine in the cluster
./control_containers.sh -b

# Launches Containers on each machine in the cluster
./control_containers.sh -u
```