NNICTLDOC.md 13.1 KB
Newer Older
QuanluZhang's avatar
QuanluZhang committed
1
# nnictl
Chi Song's avatar
Chi Song committed
2

QuanluZhang's avatar
QuanluZhang committed
3
## Introduction
Chi Song's avatar
Chi Song committed
4

QuanluZhang's avatar
QuanluZhang committed
5
6
7
__nnictl__ is a command line tool, which can be used to control experiments, such as start/stop/resume an experiment, start/stop NNIBoard, etc.

## Commands
Chi Song's avatar
Chi Song committed
8

QuanluZhang's avatar
QuanluZhang committed
9
nnictl support commands:
Chi Song's avatar
Chi Song committed
10

11
12
13
14
15
16
17
18
19
20
21
22
23
* [nnictl create](#create)
* [nnictl resume](#resume)
* [nnictl stop](#stop)
* [nnictl update](#update)
* [nnictl trial](#trial)
* [nnictl top](#top)
* [nnictl experiment](#experiment)
* [nnictl config](#config)
* [nnictl log](#log)
* [nnictl webui](#webui)
* [nnictl tensorboard](#tensorboard)
* [nnictl package](#package)
* [nnictl --version](#version)
Chi Song's avatar
Chi Song committed
24

Yan Ni's avatar
Yan Ni committed
25
### Manage an experiment
26

Yan Ni's avatar
Yan Ni committed
27
<a name="create"></a>
28
29

![](https://placehold.it/15/1589F0/000000?text=+) `nnictl create`
30
31
32
33
34
35
36

  * Description

    You can use this command to create a new experiment, using the configuration specified in config file. 

    After this command is successfully done, the context will be set as this experiment, which means the following command you issued is associated with this experiment, unless you explicitly changes the context(not supported yet).

QuanluZhang's avatar
QuanluZhang committed
37
  * Usage
38
39
40
41
42
43
44

    ```bash
    nnictl create [OPTIONS]
    ```

  * Options

Chi Song's avatar
Chi Song committed
45
46
47
48
  |Name, shorthand|Required|Default|Description|
  |------|------|------|------|
  |--config, -c|  True| |YAML configure file of the experiment|
  |--port, -p|False| |the port of restful server|
49
50
  |--debug, -d|False||set debug mode|

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
  * Examples

    > create a new experiment with the default port: 8080

    ```bash
    nnictl create --config nni/examples/trials/mnist/config.yml
    ```

    > create a new experiment with specified port 8088

    ```bash
    nnictl create --config nni/examples/trials/mnist/config.yml --port 8088
    ```

    > create a new experiment with specified port 8088 and debug mode

    ```bash
    nnictl create --config nni/examples/trials/mnist/config.yml --port 8088 --debug
    ```

71
72
73
74
  Note:
  ```
  Debug mode will disable version check function in Trialkeeper.
  ```
75

Yan Ni's avatar
Yan Ni committed
76
<a name="resume"></a>
77
78

![](https://placehold.it/15/1589F0/000000?text=+) `nnictl resume`
QuanluZhang's avatar
QuanluZhang committed
79
80

  * Description
Chi Song's avatar
Chi Song committed
81
82
83

    You can use this command to resume a stopped experiment.

QuanluZhang's avatar
QuanluZhang committed
84
  * Usage
Chi Song's avatar
Chi Song committed
85
86
87
88
89

    ```bash
    nnictl resume [OPTIONS]
    ```

90
91
  * Options

Chi Song's avatar
Chi Song committed
92
93
  |Name, shorthand|Required|Default|Description|
  |------|------|------ |------|
94
  |id|  True| |The id of the experiment you want to resume|  
Chi Song's avatar
Chi Song committed
95
  |--port, -p|  False| |Rest port of the experiment you want to resume|
96
  |--debug, -d|False||set debug mode|
Chi Song's avatar
Chi Song committed
97

98
99
100
101
102
103
104
105
  * Example

    > resume an experiment with specified port 8088

    ```bash
    nnictl resume [experiment_id] --port 8088
    ```

Yan Ni's avatar
Yan Ni committed
106
<a name="stop"></a>
107
108

![](https://placehold.it/15/1589F0/000000?text=+) `nnictl stop`
109

QuanluZhang's avatar
QuanluZhang committed
110
  * Description
Chi Song's avatar
Chi Song committed
111
112
113

    You can use this command to stop a running experiment or multiple experiments.

QuanluZhang's avatar
QuanluZhang committed
114
  * Usage
Chi Song's avatar
Chi Song committed
115
116
117
118

    ```bash
    nnictl stop [id]
    ```
119

120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
  * Details & Examples

    1. If there is no id specified, and there is an experiment running, stop the running experiment, or print error message.

      ```bash
      nnictl stop
      ```

    2. If there is an id specified, and the id matches the running experiment, nnictl will stop the corresponding experiment, or will print error message.

      ```bash
      nnictl stop [experiment_id]
      ```

    3. Users could use 'nnictl stop all' to stop all experiments.

      ```bash
      nnictl stop all
      ```
    4. If the id ends with *, nnictl will stop all experiments whose ids matchs the regular.
    5. If the id does not exist but match the prefix of an experiment id, nnictl will stop the matched experiment.
    6. If the id does not exist but match multiple prefix of the experiment ids, nnictl will give id information.
142

Yan Ni's avatar
Yan Ni committed
143
<a name="update"></a>
144
145

![](https://placehold.it/15/1589F0/000000?text=+) `nnictl update`
146
147
148
149
150
151
152
153
154
155
156
157
158
159

  * __nnictl update searchspace__
    * Description

      You can use this command to update an experiment's search space.

    * Usage

      ```bash
      nnictl update searchspace [OPTIONS]
      ```

    * Options

160
161
162
163
164
165
166
167
168
169
170
171
    |Name, shorthand|Required|Default|Description|
    |------|------|------ |------|
    |id|  False| |ID of the experiment you want to set|
    |--filename, -f|  True| |the file storing your new search space|

    * Example

      `update experiment's new search space with file dir 'examples/trials/mnist/search_space.json'`

      ```bash
      nnictl update searchspace [experiment_id] --file examples/trials/mnist/search_space.json
      ```
172
173
174
175
176
177
178
179
180
181
182
183
184
185

  * __nnictl update concurrency__  
    * Description

      You can use this command to update an experiment's concurrency.

    * Usage

      ```bash
      nnictl update concurrency [OPTIONS]
      ```

    * Options

186
187
188
189
190
191
192
193
194
195
196
197
    |Name, shorthand|Required|Default|Description|
    |------|------|------ |------|
    |id|  False| |ID of the experiment you want to set|
    |--value, -v|  True| |the number of allowed concurrent trials|

    * Example

      > update experiment's concurrency

      ```bash
      nnictl update concurrency [experiment_id] --value [concurrency_number]
      ```
198
199
200
201
202

  * __nnictl update duration__  

    * Description

203
      You can use this command to update an experiment's duration.  
204
205
206
207
208
209

    * Usage

      ```bash
      nnictl update duration [OPTIONS]
      ```
210

211
212
    * Options

213
214
215
216
217
218
219
220
221
222
223
224
    |Name, shorthand|Required|Default|Description|
    |------|------|------ |------|
    |id|  False| |ID of the experiment you want to set|
    |--value, -v|  True| |the experiment duration will be NUMBER seconds. SUFFIX may be 's' for seconds (the default), 'm' for minutes, 'h' for hours or 'd' for days.|

    * Example

      > update experiment's duration

      ```bash
      nnictl update duration [experiment_id] --value [duration]
      ```
225
226
227
228
229
230
231
232
233
234
235
236
237
238

  * __nnictl update trialnum__  
    * Description

      You can use this command to update an experiment's maxtrialnum.

    * Usage

      ```bash
      nnictl update trialnum [OPTIONS]
      ```

    * Options

239
240
241
242
243
244
245
246
247
248
249
250
    |Name, shorthand|Required|Default|Description|
    |------|------|------ |------|
    |id|  False| |ID of the experiment you want to set|
    |--value, -v|  True| |the new number of maxtrialnum you want to set|

    * Example

      > update experiment's trial num

      ```bash
      nnictl update trialnum --id [experiment_id] --value [trial_num]
      ```
251

Yan Ni's avatar
Yan Ni committed
252
<a name="trial"></a>
253
254

![](https://placehold.it/15/1589F0/000000?text=+) `nnictl trial`
Chi Song's avatar
Chi Song committed
255

QuanluZhang's avatar
QuanluZhang committed
256
  * __nnictl trial ls__
Chi Song's avatar
Chi Song committed
257

QuanluZhang's avatar
QuanluZhang committed
258
    * Description
Chi Song's avatar
Chi Song committed
259
260
261
262

      You can use this command to show trial's information.

    * Usage
263

Chi Song's avatar
Chi Song committed
264
265
266
      ```bash
      nnictl trial ls
      ```
QuanluZhang's avatar
QuanluZhang committed
267

268
    * Options
Chi Song's avatar
Chi Song committed
269

270
271
272
    |Name, shorthand|Required|Default|Description|
    |------|------|------ |------|
    |id|  False| |ID of the experiment you want to set|
SparkSnail's avatar
SparkSnail committed
273

QuanluZhang's avatar
QuanluZhang committed
274
  * __nnictl trial kill__
275
276
277
278
279
280
281
282
283
284
285

    * Description

      You can use this command to kill a trial job.

    * Usage

      ```bash
      nnictl trial kill [OPTIONS]
      ```

286
    * Options
287

288
289
290
291
292
293
294
295
296
297
298
299
    |Name, shorthand|Required|Default|Description|
    |------|------|------ |------|
    |id|  False| |ID of the trial to be killed|
    |--experiment, -E|  True| |Experiment id of the trial|

    * Example

      > kill trail job

      ```bash
      nnictl trial [trial_id] --vexperiment [experiment_id]
      ```
300

Yan Ni's avatar
Yan Ni committed
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
  * __nnictl trial export__
    * Description
        You can use this command to export reward & hyper-parameter of trial jobs to a csv file.

    * Usage
        ```bash
        nnictl trial export [OPTIONS]
        ```
    * Options
    
  |Name, shorthand|Required|Default|Description|
  |------|------|------ |------|
  |id|  False| |ID of the experiment    |
  |--file|  True| |File path of the output csv file     |


Yan Ni's avatar
Yan Ni committed
317
<a name="top"></a>
318
319

![](https://placehold.it/15/1589F0/000000?text=+) `nnictl top`
SparkSnail's avatar
SparkSnail committed
320

321
322
323
324
325
326
327
328
329
330
331
332
  * Description

    Monitor all of running experiments.

  * Usage

    ```bash
    nnictl top
    ```

  * Options  

Chi Song's avatar
Chi Song committed
333
334
335
336
  |Name, shorthand|Required|Default|Description|
  |------|------|------ |------|
  |id|  False| |ID of the experiment you want to set|
  |--time, -t|  False| |The interval to update the experiment status, the unit of time is second, and the default value is 3 second.|
337

Yan Ni's avatar
Yan Ni committed
338
<a name="experiment"></a>
339
340

![](https://placehold.it/15/1589F0/000000?text=+) `Manage experiment information`
QuanluZhang's avatar
QuanluZhang committed
341
342

* __nnictl experiment show__
Chi Song's avatar
Chi Song committed
343

QuanluZhang's avatar
QuanluZhang committed
344
  * Description
SparkSnail's avatar
SparkSnail committed
345

Chi Song's avatar
Chi Song committed
346
347
348
349
350
351
352
353
    Show the information of experiment.

  * Usage

    ```bash
    nnictl experiment show
    ```

354
  * Options
Chi Song's avatar
Chi Song committed
355

Chi Song's avatar
Chi Song committed
356
357
358
  |Name, shorthand|Required|Default|Description|
  |------|------|------ |------|
  |id|  False| |ID of the experiment you want to set|
SparkSnail's avatar
SparkSnail committed
359
360

* __nnictl experiment status__
Chi Song's avatar
Chi Song committed
361

SparkSnail's avatar
SparkSnail committed
362
363
  * Description

Chi Song's avatar
Chi Song committed
364
365
366
367
368
369
370
371
    Show the status of experiment.

  * Usage

    ```bash
    nnictl experiment status
    ```

372
  * Options
Chi Song's avatar
Chi Song committed
373

Chi Song's avatar
Chi Song committed
374
375
376
  |Name, shorthand|Required|Default|Description|
  |------|------|------ |------|
  |id|  False| |ID of the experiment you want to set|
SparkSnail's avatar
SparkSnail committed
377
378

* __nnictl experiment list__
379

SparkSnail's avatar
SparkSnail committed
380
  * Description
QuanluZhang's avatar
QuanluZhang committed
381

Chi Song's avatar
Chi Song committed
382
383
384
    Show the information of all the (running) experiments.

  * Usage
385

Chi Song's avatar
Chi Song committed
386
387
388
389
    ```bash
    nnictl experiment list
    ```

Yan Ni's avatar
Yan Ni committed
390
<a name="config"></a>
391
392

![](https://placehold.it/15/1589F0/000000?text=+) `nnictl config show`
393
394
395
396
397
398
399
400
401
402
403

  * Description

    Display the current context information.

  * Usage

    ```bash
    nnictl config show
    ```

Yan Ni's avatar
Yan Ni committed
404
<a name="log"></a>
405
406

![](https://placehold.it/15/1589F0/000000?text=+) `Manage log`
Chi Song's avatar
Chi Song committed
407

QuanluZhang's avatar
QuanluZhang committed
408
* __nnictl log stdout__
Chi Song's avatar
Chi Song committed
409
410
411
412
413
414
415
416
417
418
419

  * Description

    Show the stdout log content.

  * Usage

    ```bash
    nnictl log stdout [options]
    ```

420
  * Options
Chi Song's avatar
Chi Song committed
421

Chi Song's avatar
Chi Song committed
422
423
424
425
426
427
  |Name, shorthand|Required|Default|Description|
  |------|------|------ |------|
  |id|  False| |ID of the experiment you want to set|
  |--head, -h| False| |show head lines of stdout|
  |--tail, -t|  False| |show tail lines of stdout|
  |--path, -p|  False| |show the path of stdout file|
Chi Song's avatar
Chi Song committed
428

429
430
431
432
433
434
435
436
  * Example

    > Show the tail of stdout log content

    ```bash
    nnictl log stdout [experiment_id] --tail [lines_number]
    ```

QuanluZhang's avatar
QuanluZhang committed
437
438
* __nnictl log stderr__
  * Description
Chi Song's avatar
Chi Song committed
439
440

    Show the stderr log content.
441

QuanluZhang's avatar
QuanluZhang committed
442
  * Usage
Chi Song's avatar
Chi Song committed
443
444
445
446
447

    ```bash
    nnictl log stderr [options]
    ```

448
  * Options
Chi Song's avatar
Chi Song committed
449

Chi Song's avatar
Chi Song committed
450
451
452
453
454
455
  |Name, shorthand|Required|Default|Description|
  |------|------|------ |------|
  |id|  False| |ID of the experiment you want to set|
  |--head, -h| False| |show head lines of stderr|
  |--tail, -t|  False| |show tail lines of stderr|
  |--path, -p|  False| |show the path of stderr file|
456
457

* __nnictl log trial__
458

459
460
  * Description
  
Chi Song's avatar
Chi Song committed
461
    Show trial log path.
462
463
  
  * Usage
SparkSnail's avatar
SparkSnail committed
464

465
466
467
468
469
470
    ```bash  
    nnictl log trial [options]
    ```

  * Options

Chi Song's avatar
Chi Song committed
471
472
  |Name, shorthand|Required|Default|Description|
  |------|------|------ |------|
473
474
  |id|  False| |ID of the trial to be found the log path|
  |--experiment, -E|  False| |Experiment ID of the trial, required when id is not empty.|
475

Yan Ni's avatar
Yan Ni committed
476
<a name="webui"></a>
477
478

![](https://placehold.it/15/1589F0/000000?text=+) `Manage webui`
Chi Song's avatar
Chi Song committed
479

SparkSnail's avatar
SparkSnail committed
480
* __nnictl webui url__
SparkSnail's avatar
SparkSnail committed
481

Yan Ni's avatar
Yan Ni committed
482
<a name="tensorboard"></a>
483
484

![](https://placehold.it/15/1589F0/000000?text=+) `Manage tensorboard`
Chi Song's avatar
Chi Song committed
485

SparkSnail's avatar
SparkSnail committed
486
* __nnictl tensorboard start__
Chi Song's avatar
Chi Song committed
487
488
489
490
491
492
493
494
495
496
497

  * Description

    Start the tensorboard process.
  
  * Usage

    ```bash
    nnictl tensorboard start
    ```

498
  * Options
Chi Song's avatar
Chi Song committed
499

Chi Song's avatar
Chi Song committed
500
501
502
503
504
  |Name, shorthand|Required|Default|Description|
  |------|------|------ |------|
  |id|  False| |ID of the experiment you want to set|
  |--trialid|  False| |ID of the trial|
  |--port|  False| 6006|The port of the tensorboard process|
Chi Song's avatar
Chi Song committed
505
506
507
508
509
510
511
512

  * Detail

    1. NNICTL support tensorboard function in local and remote platform for the moment, other platforms will be supported later.   
    2. If you want to use tensorboard, you need to write your tensorboard log data to environment variable [NNI_OUTPUT_DIR] path.  
    3. In local mode, nnictl will set --logdir=[NNI_OUTPUT_DIR] directly and start a tensorboard process.
    4. In remote mode, nnictl will create a ssh client to copy log data from remote machine to local temp directory firstly, and then start a tensorboard process in your local machine. You need to notice that nnictl only copy the log data one time when you use the command, if you want to see the later result of tensorboard, you should execute nnictl tensorboard command again.
    5. If there is only one trial job, you don't need to set trialid. If there are multiple trial jobs running, you should set the trialid, or you could use [nnictl tensorboard start --trialid all] to map --logdir to all trial log paths.
SparkSnail's avatar
SparkSnail committed
513
514

* __nnictl tensorboard stop__
515
516
517
518
519
520
521
522
523
524
525
526
  * Description

    Stop all of the tensorboard process. 

  * Usage

    ```bash
    nnictl tensorboard stop
    ```

  * Options

Chi Song's avatar
Chi Song committed
527
528
529
  |Name, shorthand|Required|Default|Description|
  |------|------|------ |------|
  |id|  False| |ID of the experiment you want to set|
Yan Ni's avatar
Yan Ni committed
530
531

<a name="package"></a>
532
533

![](https://placehold.it/15/1589F0/000000?text=+) `Manage package`
534

Yan Ni's avatar
Yan Ni committed
535
* __nnictl package install__
536
537
538
539
540
541
542
543
544
545
546
547
  * Description

    Install the packages needed in nni experiments.

  * Usage

    ```bash
    nnictl package install [OPTIONS]
    ```

  * Options

Chi Song's avatar
Chi Song committed
548
549
550
  |Name, shorthand|Required|Default|Description|
  |------|------|------ |------|
  |--name|  True| |The name of package to be installed|
Yan Ni's avatar
Yan Ni committed
551

552
553
554
555
556
557
558
559
  * Example

    > Install the packages needed in tuner SMAC

    ```bash
    nnictl package install --name=SMAC
    ```

Yan Ni's avatar
Yan Ni committed
560
* __nnictl package show__
561
562
563
564
565
566
567
568
569
570
571
572

  * Description

    List the packages supported.

  * Usage

    ```bash
    nnictl package show
    ```

<a name="version"></a>
573
574

![](https://placehold.it/15/1589F0/000000?text=+) `Check NNI version`
575
576
577
578
579
580
581
582
583
584
585
586

* __nnictl --version__

  * Description

    Describe the current version of NNI installed.

  * Usage

    ```bash
    nnictl --version
    ```