Commit 48f8b052 authored by Gems Guo's avatar Gems Guo
Browse files

Fixed IC build issues

parent c19e2a52
...@@ -4,15 +4,15 @@ language: python ...@@ -4,15 +4,15 @@ language: python
python: python:
- "3.6" - "3.6"
before_install: before_install:
- sudo apt-get install -y python3-pip python3-setuptools
- wget https://nodejs.org/dist/v10.9.0/node-v10.9.0-linux-x64.tar.xz - wget https://nodejs.org/dist/v10.9.0/node-v10.9.0-linux-x64.tar.xz
- tar xf node-v10.9.0-linux-x64.tar.xz - tar xf node-v10.9.0-linux-x64.tar.xz
- sudo mv node-v10.9.0-linux-x64 /usr/local/node - sudo mv node-v10.9.0-linux-x64 /usr/local/node
- export PATH=/usr/local/node/bin:$PATH - export PATH=/usr/local/node/bin:$PATH
install: install:
- make - make
- sudo make dev-install - make install
- export PATH=$HOME/.nni/bin:$PATH
before_script: before_script:
- cd test/naive - cd test/naive
script: script:
- python run.py - python3 run.py
\ No newline at end of file \ No newline at end of file
BIN_PATH ?= /usr/bin BIN_PATH ?= $(HOME)/.nni/bin/
NODE_PATH ?= /usr/share NNI_PATH ?= $(HOME)/.nni/
EXAMPLE_PATH ?= /usr/share/nni/examples
SRC_DIR := ${PWD} SRC_DIR := ${PWD}
...@@ -21,33 +20,33 @@ build: ...@@ -21,33 +20,33 @@ build:
install: install:
mkdir -p $(NODE_PATH)/nni mkdir -p $(NNI_PATH)
mkdir -p $(EXAMPLE_PATH) mkdir -p $(BIN_PATH)
### Installing NNI Manager ### ### Installing NNI Manager ###
cp -rT src/nni_manager/dist $(NODE_PATH)/nni/nni_manager cp -rT src/nni_manager/dist $(NNI_PATH)nni_manager
cp -rT src/nni_manager/node_modules $(NODE_PATH)/nni/nni_manager/node_modules cp -rT src/nni_manager/node_modules $(NNI_PATH)nni_manager/node_modules
### Installing Web UI ### ### Installing Web UI ###
cp -rT src/webui/build $(NODE_PATH)/nni/webui cp -rT src/webui/build $(NNI_PATH)webui
ln -sf $(NODE_PATH)/nni/nni_manager/node_modules/serve/bin/serve.js $(BIN_PATH)/serve ln -sf $(NNI_PATH)nni_manager/node_modules/serve/bin/serve.js $(BIN_PATH)serve
### Installing Python SDK dependencies ### ### Installing Python SDK dependencies ###
pip3 install -r src/sdk/pynni/requirements.txt pip3 install -r src/sdk/pynni/requirements.txt
### Installing Python SDK ### ### Installing Python SDK ###
cd src/sdk/pynni && python3 setup.py install cd src/sdk/pynni && pip3 install -e .
### Installing nnictl ### ### Installing nnictl ###
cd tools && python3 setup.py install cd tools && pip3 install -e .
echo '#!/bin/sh' > $(BIN_PATH)/nnimanager echo '#!/bin/sh' > $(BIN_PATH)nnimanager
echo 'cd $(NODE_PATH)/nni/nni_manager && node main.js $$@' >> $(BIN_PATH)/nnimanager echo 'cd $(NNI_PATH)nni_manager && node main.js $$@' >> $(BIN_PATH)nnimanager
chmod +x $(BIN_PATH)/nnimanager chmod +x $(BIN_PATH)nnimanager
install -m 755 tools/nnictl $(BIN_PATH)/nnictl install -m 755 tools/nnictl $(BIN_PATH)nnictl
### Installing examples ### ### Installing examples ###
cp -rT examples $(EXAMPLE_PATH) cp -rT examples $(NNI_PATH)examples
dev-install: dev-install:
...@@ -61,10 +60,8 @@ dev-install: ...@@ -61,10 +60,8 @@ dev-install:
uninstall: uninstall:
-rm -r $(EXAMPLE_PATH) -rm -r $(NNI_PATH)
-rm -r $(NODE_PATH)/nni -rm -r $(BIN_PATH)
-pip3 uninstall -y nnictl -pip3 uninstall -y nnictl
-pip3 uninstall -y nni -pip3 uninstall -y nni
-rm $(BIN_PATH)/nnictl
-rm $(BIN_PATH)/nnimanager
-rm $(BIN_PATH)/serve
...@@ -25,7 +25,7 @@ assessor: ...@@ -25,7 +25,7 @@ assessor:
optimizationMode: Maximize optimizationMode: Maximize
trial: trial:
trialCommand: python mnist.py trialCommand: python mnist.py
trialCodeDir: /usr/share/nni/examples/trials/mnist-annotation trialCodeDir: $HOME/.nni/examples/trials/mnist-annotation
trialGpuNum: 0 trialGpuNum: 0
``` ```
For our built-in assessors, you need to fill two fields: `assessorName` which chooses NNI provided assessors (refer to [here]() for built-in assessors), `optimizationMode` which includes Maximize and Minimize (you want to maximize or minimize your trial result). For our built-in assessors, you need to fill two fields: `assessorName` which chooses NNI provided assessors (refer to [here]() for built-in assessors), `optimizationMode` which includes Maximize and Minimize (you want to maximize or minimize your trial result).
...@@ -54,7 +54,7 @@ assessor: ...@@ -54,7 +54,7 @@ assessor:
assessorGpuNum: 0 assessorGpuNum: 0
trial: trial:
trialCommand: python mnist.py trialCommand: python mnist.py
trialCodeDir: /usr/share/nni/examples/trials/mnist-annotation trialCodeDir: $HOME/.nni/examples/trials/mnist-annotation
trialGpuNum: 0 trialGpuNum: 0
``` ```
You only need to fill three field: `assessorCommand`, `assessorCodeDir` and `assessorGpuNum`. You only need to fill three field: `assessorCommand`, `assessorCodeDir` and `assessorGpuNum`.
\ No newline at end of file
...@@ -57,7 +57,7 @@ Requirements: ...@@ -57,7 +57,7 @@ Requirements:
Run the following command to create an experiemnt for [mnist] Run the following command to create an experiemnt for [mnist]
```bash ```bash
nnictl create --config /usr/share/nni/examples/trials/mnist-annotation/config.yaml nnictl create --config $HOME/.nni/examples/trials/mnist-annotation/config.yaml
``` ```
This command will start the experiment and WebUI. The WebUI endpoint will be shown in the output of this command (for example, `http://localhost:8080`). Open this URL using your browsers. You can analyze your experiment through WebUI, or open trials' tensorboard. This command will start the experiment and WebUI. The WebUI endpoint will be shown in the output of this command (for example, `http://localhost:8080`). Open this URL using your browsers. You can analyze your experiment through WebUI, or open trials' tensorboard.
...@@ -69,9 +69,9 @@ An experiment is to run multiple trial jobs, each trial job tries a configuratio ...@@ -69,9 +69,9 @@ An experiment is to run multiple trial jobs, each trial job tries a configuratio
* Provide a yaml experiment configure file * Provide a yaml experiment configure file
* (optional) Provide or choose an assessor * (optional) Provide or choose an assessor
**Prepare trial**: Let's use a simple trial example, e.g. mnist, provided by NNI. After you installed NNI, NNI examples have been put in /usr/share/nni/examples, run `ls /usr/share/nni/examples/trials` to see all the trial examples. You can simply execute the following command to run the NNI mnist example: **Prepare trial**: Let's use a simple trial example, e.g. mnist, provided by NNI. After you installed NNI, NNI examples have been put in $HOME/.nni/examples, run `ls $HOME/.nni/examples/trials` to see all the trial examples. You can simply execute the following command to run the NNI mnist example:
python /usr/share/nni/examples/trials/mnist-annotation/mnist.py python $HOME/.nni/examples/trials/mnist-annotation/mnist.py
This command will be filled in the yaml configure file below. Please refer to [here]() for how to write your own trial. This command will be filled in the yaml configure file below. Please refer to [here]() for how to write your own trial.
...@@ -82,7 +82,7 @@ This command will be filled in the yaml configure file below. Please refer to [h ...@@ -82,7 +82,7 @@ This command will be filled in the yaml configure file below. Please refer to [h
*tunerName* is used to specify a tuner in NNI, *optimizationMode* is to indicate whether you want to maximize or minimize your trial's result. *tunerName* is used to specify a tuner in NNI, *optimizationMode* is to indicate whether you want to maximize or minimize your trial's result.
**Prepare configure file**: Since you have already known which trial code you are going to run and which tuner you are going to use, it is time to prepare the yaml configure file. NNI provides a demo configure file for each trial example, `cat /usr/share/nni/examples/trials/mnist-annotation/config.yaml` to see it. Its content is basically shown below: **Prepare configure file**: Since you have already known which trial code you are going to run and which tuner you are going to use, it is time to prepare the yaml configure file. NNI provides a demo configure file for each trial example, `cat $HOME/.nni/examples/trials/mnist-annotation/config.yaml` to see it. Its content is basically shown below:
``` ```
authorName: your_name authorName: your_name
...@@ -102,7 +102,7 @@ tuner: ...@@ -102,7 +102,7 @@ tuner:
optimizationMode: Maximize optimizationMode: Maximize
trial: trial:
trialCommand: python mnist.py trialCommand: python mnist.py
trialCodeDir: /usr/share/nni/examples/trials/mnist-annotation trialCodeDir: $HOME/.nni/examples/trials/mnist-annotation
trialGpuNum: 0 trialGpuNum: 0
``` ```
...@@ -110,7 +110,7 @@ Here *useAnnotation* is true because this trial example uses our python annotati ...@@ -110,7 +110,7 @@ Here *useAnnotation* is true because this trial example uses our python annotati
With all these steps done, we can run the experiment with the following command: With all these steps done, we can run the experiment with the following command:
nnictl create --config /usr/share/nni/examples/trials/mnist-annotation/config.yaml nnictl create --config $HOME/.nni/examples/trials/mnist-annotation/config.yaml
You can refer to [here](NNICTLDOC.md) for more usage guide of *nnictl* command line tool. You can refer to [here](NNICTLDOC.md) for more usage guide of *nnictl* command line tool.
......
...@@ -30,7 +30,7 @@ tuner: ...@@ -30,7 +30,7 @@ tuner:
optimizationMode: Maximize optimizationMode: Maximize
trial: trial:
trialCommand: python mnist.py trialCommand: python mnist.py
trialCodeDir: /usr/share/nni/examples/trials/mnist-annotation trialCodeDir: $HOME/.nni/examples/trials/mnist-annotation
trialGpuNum: 0 trialGpuNum: 0
#machineList can be empty if the platform is local #machineList can be empty if the platform is local
machineList: machineList:
......
...@@ -5,7 +5,7 @@ maxExecDuration: 1h ...@@ -5,7 +5,7 @@ maxExecDuration: 1h
maxTrialNum: 1 maxTrialNum: 1
#choice: local, remote #choice: local, remote
trainingServicePlatform: local trainingServicePlatform: local
searchSpacePath: /usr/share/nni/examples/trials/cifar10/search_space.json searchSpacePath: $HOME/.nni/examples/trials/cifar10/search_space.json
#choice: true, false #choice: true, false
useAnnotation: false useAnnotation: false
tuner: tuner:
...@@ -15,5 +15,5 @@ tuner: ...@@ -15,5 +15,5 @@ tuner:
optimizationMode: Maximize optimizationMode: Maximize
trial: trial:
trialCommand: python3 cifar10.py trialCommand: python3 cifar10.py
trialCodeDir: /usr/share/nni/examples/trials/cifar10 trialCodeDir: $HOME/.nni/examples/trials/cifar10
trialGpuNum: 0 trialGpuNum: 0
\ No newline at end of file
...@@ -9,8 +9,8 @@ trainingServicePlatform: local ...@@ -9,8 +9,8 @@ trainingServicePlatform: local
useAnnotation: false useAnnotation: false
tuner: tuner:
tunerCommand: python3 __main__.py tunerCommand: python3 __main__.py
tunerCwd: /usr/share/nni/examples/tuners/ga_customer_tuner tunerCwd: $HOME/.nni/examples/tuners/ga_customer_tuner
trial: trial:
trialCommand: python3 trial.py trialCommand: python3 trial.py
trialCodeDir: /usr/share/nni/examples/trials/ga_squad trialCodeDir: $HOME/.nni/examples/trials/ga_squad
trialGpuNum: 0 trialGpuNum: 0
\ No newline at end of file
...@@ -14,5 +14,5 @@ tuner: ...@@ -14,5 +14,5 @@ tuner:
optimizationMode: Maximize optimizationMode: Maximize
trial: trial:
trialCommand: python3 mnist.py trialCommand: python3 mnist.py
trialCodeDir: /usr/share/nni/examples/trials/mnist-annotation trialCodeDir: $HOME/.nni/examples/trials/mnist-annotation
trialGpuNum: 0 trialGpuNum: 0
\ No newline at end of file
...@@ -5,7 +5,7 @@ maxExecDuration: 1h ...@@ -5,7 +5,7 @@ maxExecDuration: 1h
maxTrialNum: 1 maxTrialNum: 1
#choice: local, remote #choice: local, remote
trainingServicePlatform: local trainingServicePlatform: local
searchSpacePath: /usr/share/nni/examples/trials/mnist-keras/search_space.json searchSpacePath: $HOME/.nni/examples/trials/mnist-keras/search_space.json
#choice: true, false #choice: true, false
useAnnotation: false useAnnotation: false
tuner: tuner:
...@@ -15,5 +15,5 @@ tuner: ...@@ -15,5 +15,5 @@ tuner:
optimizationMode: Maximize optimizationMode: Maximize
trial: trial:
trialCommand: python3 mnist-keras.py trialCommand: python3 mnist-keras.py
trialCodeDir: /usr/share/nni/examples/trials/mnist-keras trialCodeDir: $HOME/.nni/examples/trials/mnist-keras
trialGpuNum: 0 trialGpuNum: 0
\ No newline at end of file
...@@ -14,5 +14,5 @@ tuner: ...@@ -14,5 +14,5 @@ tuner:
optimizationMode: Maximize optimizationMode: Maximize
trial: trial:
trialCommand: python3 mnist.py trialCommand: python3 mnist.py
trialCodeDir: /usr/share/nni/examples/trials/mnist-smartparam trialCodeDir: $HOME/.nni/examples/trials/mnist-smartparam
trialGpuNum: 0 trialGpuNum: 0
\ No newline at end of file
...@@ -5,7 +5,7 @@ maxExecDuration: 1h ...@@ -5,7 +5,7 @@ maxExecDuration: 1h
maxTrialNum: 1 maxTrialNum: 1
#choice: local, remote #choice: local, remote
trainingServicePlatform: local trainingServicePlatform: local
searchSpacePath: /usr/share/nni/examples/trials/mnist/search_space.json searchSpacePath: $HOME/.nni/examples/trials/mnist/search_space.json
#choice: true, false #choice: true, false
useAnnotation: false useAnnotation: false
tuner: tuner:
...@@ -15,5 +15,5 @@ tuner: ...@@ -15,5 +15,5 @@ tuner:
optimizationMode: Maximize optimizationMode: Maximize
trial: trial:
trialCommand: python3 mnist.py trialCommand: python3 mnist.py
trialCodeDir: /usr/share/nni/examples/trials/mnist trialCodeDir: $HOME/.nni/examples/trials/mnist
trialGpuNum: 0 trialGpuNum: 0
\ No newline at end of file
...@@ -29,7 +29,7 @@ from .constants import STDOUT_FULL_PATH, STDERR_FULL_PATH ...@@ -29,7 +29,7 @@ from .constants import STDOUT_FULL_PATH, STDERR_FULL_PATH
def start_web_ui(port): def start_web_ui(port):
'''start web ui''' '''start web ui'''
cmds = ['serve', '-s', '-n', '/usr/share/nni/webui', '-l', str(port)] cmds = ['serve', '-s', '-n', '$HOME/.nni/webui', '-l', str(port)]
stdout_file = open(STDOUT_FULL_PATH, 'a+') stdout_file = open(STDOUT_FULL_PATH, 'a+')
stderr_file = open(STDERR_FULL_PATH, 'a+') stderr_file = open(STDERR_FULL_PATH, 'a+')
webui_process = Popen(cmds, stdout=stdout_file, stderr=stderr_file) webui_process = Popen(cmds, stdout=stdout_file, stderr=stderr_file)
......
...@@ -9,7 +9,8 @@ setuptools.setup( ...@@ -9,7 +9,8 @@ setuptools.setup(
install_requires = [ install_requires = [
'requests', 'requests',
'pyyaml', 'pyyaml',
'psutil' 'psutil',
'astor'
], ],
author = 'Microsoft NNI Team', author = 'Microsoft NNI Team',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment