_help.py 7.54 KB
Newer Older
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
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""SuperBench CLI help."""

from knack.help import CLIHelp
from knack.help_files import helps

CLI_NAME = 'sb'
WELCOME_MESSAGE = r"""
   _____                       ____                  _
  / ____|                     |  _ \                | |
 | (___  _   _ _ __   ___ _ __| |_) | ___ _ __   ___| |__
  \___ \| | | | '_ \ / _ \ '__|  _ < / _ \ '_ \ / __| '_ \
  ____) | |_| | |_) |  __/ |  | |_) |  __/ | | | (__| | | |
 |_____/ \__,_| .__/ \___|_|  |____/ \___|_| |_|\___|_| |_|
              | |
              |_|

Welcome to the SB CLI!
"""

helps['version'] = """
    type: command
    short-summary: Print the current SuperBench CLI version.
    examples:
        - name: print version
          text: {cli_name} version
""".format(cli_name=CLI_NAME)

helps['deploy'] = """
    type: command
    short-summary: Deploy the SuperBench environments to all given nodes.
    examples:
35
36
37
38
        - name: deploy default image on local GPU node
          text: {cli_name} deploy --host-list localhost
        - name: deploy image "superbench/cuda:11.1" to all nodes in ./host.ini
          text: {cli_name} deploy --docker-image superbench/cuda:11.1 --host-file ./host.ini
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
        - name: deploy image "superbench/rocm:4.0" to node-0 and node-2, using key file id_rsa for ssh
          text: {cli_name} deploy --docker-image superbench/rocm:4.0 --host-list node-0,node-2 --private-key id_rsa
""".format(cli_name=CLI_NAME)

helps['exec'] = """
    type: command
    short-summary: Execute the SuperBench benchmarks locally.
    examples:
        - name: execute all benchmarks using image "superbench/cuda:11.1" and default benchmarking configuration
          text: {cli_name} exec --docker-image superbench/cuda:11.1
        - name: execute all benchmarks using image "superbench/rocm:4.0" and custom config file ./config.yaml
          text: {cli_name} exec --docker-image superbench/rocm:4.0 --config-file ./config.yaml
""".format(cli_name=CLI_NAME)

helps['run'] = """
    type: command
    short-summary: Run the SuperBench benchmarks distributedly.
    examples:
57
58
59
        - name: run all benchmarks on local GPU node
          text: {cli_name} run --host-list localhost
        - name: run all benchmarks on all nodes in ./host.ini using image "superbench/cuda:11.1"
60
            and default benchmarking configuration
61
          text: {cli_name} run --docker-image superbench/cuda:11.1 --host-file ./host.ini
62
63
64
65
        - name: run kernel launch benchmarks on host directly without using Docker
          text: >
            {cli_name} run --no-docker --host-list localhost
            --config-override superbench.enable=kernel-launch superbench.env.SB_MICRO_PATH=/path/to/superbenchmark
66
67
68
69
        - name: Collect system info on all nodes in ./host.ini" without running benchmarks
          text: {cli_name} run --get-info --host-file ./host.ini -C superbench.enable=none
        - name: Collect system info on all nodes in ./host.ini" while running benchmarks
          text: {cli_name} run --get-info --host-file ./host.ini
70
71
""".format(cli_name=CLI_NAME)

72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
helps['benchmark'] = """
    type: group
    short-summary: Commands to manage benchmarks.
"""

helps['benchmark list'] = """
    type: command
    examples:
        - name: list all benchmarks
          text: {cli_name} benchmark list
        - name: list all benchmarks ending with "-bw"
          text: {cli_name} benchmark list --name [a-z]+-bw
""".format(cli_name=CLI_NAME)

helps['benchmark list-parameters'] = """
    type: command
    examples:
        - name: list parameters for all benchmarks
          text: {cli_name} benchmark list-parameters
        - name: list parameters for all benchmarks which starts with "pytorch-"
          text: {cli_name} benchmark list-parameters --name pytorch-[a-z]+
""".format(cli_name=CLI_NAME)

95
helps['node'] = """
96
    type: group
97
98
99
100
101
102
103
104
105
106
107
108
    short-summary: Get detailed information or configurations on the local node.
"""

helps['node info'] = """
    type: command
    short-summary: Get system info.
    examples:
        - name: get system info of the local node
          text: {cli_name} node info
""".format(cli_name=CLI_NAME)

helps['result'] = """
109
    type: group
110
111
112
113
114
    short-summary: Process or analyze the results of SuperBench benchmarks.
"""

helps['result diagnosis'] = """
    type: command
115
116
117
    short-summary: >
        Filter the defective machines automatically from benchmarking results
        according to rules defined in rule file.
118
119
    examples:
        - name: run data diagnosis and output the results in excel format
120
121
122
123
124
          text: >
            {cli_name} result diagnosis
            --data-file outputs/results-summary.jsonl
            --rule-file rule.yaml
            --baseline-file baseline.json
125
            --output-file-format excel
126
        - name: run data diagnosis and output the results in jsonl format
127
128
129
130
131
132
133
          text: >
            {cli_name} result diagnosis
            --data-file outputs/results-summary.jsonl
            --rule-file rule.yaml
            --baseline-file baseline.json
            --output-file-format jsonl
        - name: run data diagnosis and output the results in json format
134
135
136
137
138
          text: >
            {cli_name} result diagnosis
            --data-file outputs/results-summary.jsonl
            --rule-file rule.yaml
            --baseline-file baseline.json
139
            --output-file-format json
140
141
142
143
144
145
146
147
148
149
150
151
152
153
        - name: run data diagnosis and output the results in markdown format
          text: >
            {cli_name} result diagnosis
            --data-file outputs/results-summary.jsonl
            --rule-file rule.yaml
            --baseline-file baseline.json
            --output-file-format md
        - name: run data diagnosis and output the results in html format
          text: >
            {cli_name} result diagnosis
            --data-file outputs/results-summary.jsonl
            --rule-file rule.yaml
            --baseline-file baseline.json
            --output-file-format html
154
155
156
157
158
159
160
161
        - name: run data diagnosis and output the results of all nodes in json format
          text: >
            {cli_name} result diagnosis
            --data-file outputs/results-summary.jsonl
            --rule-file rule.yaml
            --baseline-file baseline.json
            --output-file-format json
            --output-all
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
""".format(cli_name=CLI_NAME)

helps['result summary'] = """
    type: command
    short-summary: >
        Generate the readable summary of benchmarking results
        according to rules defined in rule file.
    examples:
        - name: run result summary and output the results in excel format
          text: >
            {cli_name} result summary
            --data-file outputs/results-summary.jsonl
            --rule-file rule.yaml
            --output-file-format excel
        - name: run result summary and output the results in markdown format
          text: >
            {cli_name} result summary
            --data-file outputs/results-summary.jsonl
            --rule-file rule.yaml
            --output-file-format md
        - name: run result summary and output the results in html format
          text: >
            {cli_name} result summary
            --data-file outputs/results-summary.jsonl
            --rule-file rule.yaml
            --output-file-format html
188
""".format(cli_name=CLI_NAME)
189

190
191
192
193
194
195
196
197
198
199

class SuperBenchCLIHelp(CLIHelp):
    """SuperBench CLI help loader."""
    def __init__(self, cli_ctx=None):
        """Init CLI help loader.

        Args:
            cli_ctx (knack.cli.CLI, optional): CLI Context. Defaults to None.
        """
        super().__init__(cli_ctx=cli_ctx, welcome_message=WELCOME_MESSAGE)