.gitlab-ci.yml 10.9 KB
Newer Older
Y
yejianwu 已提交
1
stages:
L
Liangliang He 已提交
2
  - prepare
L
Liangliang He 已提交
3 4 5 6
  - linting
  - build
  - test
  - extra
7

L
Liangliang He 已提交
8 9 10 11 12 13
setenv:
  stage: prepare
  script:
    - export CCACHE_NOHASHDIR=1
    - export CCACHE_BASEDIR=${CI_PROJECT_DIR}

14
cpplint:
L
Liangliang He 已提交
15
  stage: linting
16
  script:
L
Liangliang He 已提交
17
    - sh tools/cpplint.sh
L
Liangliang He 已提交
18

L
Liangliang He 已提交
19 20
pylint:
  stage: linting
L
Liangliang He 已提交
21
  script:
22
    - pycodestyle . --filename=*.py --exclude=examples,third_party
Y
yejianwu 已提交
23

L
Liangliang He 已提交
24
build_docs:
L
Liangliang He 已提交
25
  stage: build
L
Liangliang He 已提交
26 27
  script:
    - cd docs
L
Liangliang He 已提交
28
    - pyenv local 3.6.3 && make html
L
Liangliang He 已提交
29
    - CI_LATEST_OUTPUT_PATH=/mace-build-output/$CI_PROJECT_NAME/latest
L
Liangliang He 已提交
30 31
    - CI_JOB_OUTPUT_PATH=/mace-build-output/$CI_PROJECT_NAME/$CI_PIPELINE_ID
    - rm -rf $CI_JOB_OUTPUT_PATH
L
Liangliang He 已提交
32 33 34 35 36 37 38 39 40 41
    - mkdir -p $CI_JOB_OUTPUT_PATH
    - cp -r _build/html $CI_JOB_OUTPUT_PATH/docs
    - rm -rf $CI_LATEST_OUTPUT_PATH
    - mkdir -p $CI_LATEST_OUTPUT_PATH
    - cp -r _build/html $CI_LATEST_OUTPUT_PATH/docs

  artifacts:
    paths:
      - docs/_build

L
Liangliang He 已提交
42
cmake_build_android-armeabi-v7a:
L
Liangliang He 已提交
43
  stage: build
L
Liangliang He 已提交
44
  script:
45
    - RUNTIME=GPU QUANTIZE=OFF bash tools/cmake/cmake-build-armeabi-v7a.sh
46
    - LIBMACE32_FULL_SIZE=`stat -c%s build/cmake-build/armeabi-v7a/install/lib/libmace.so`
47
    - if (( LIBMACE32_FULL_SIZE > 1400000 )) ; then echo "The libmace.so size too large"; exit 1; fi
L
Liangliang He 已提交
48

L
Liangliang He 已提交
49
cmake_build_android-arm64-v8:
L
Liangliang He 已提交
50
  stage: build
L
Liangliang He 已提交
51
  script:
52
    - RUNTIME=GPU QUANTIZE=OFF bash tools/cmake/cmake-build-arm64-v8a.sh
53
    - LIBMACE64_FULL_SIZE=`stat -c%s build/cmake-build/arm64-v8a/install/lib/libmace.so`
54
    - if (( LIBMACE64_FULL_SIZE > 2300000 )) ; then echo "The libmace.so size too large"; exit 1; fi
L
Liangliang He 已提交
55

L
Liangliang He 已提交
56
bazel_build:
L
Liangliang He 已提交
57 58
  stage: build
  script:
59 60 61
    - bash tools/bazel_build_standalone_lib.sh
    - bash tools/bazel_build_standalone_lib.sh --abi=armeabi-v7a --runtimes=cpu
    - bash tools/bazel_build_standalone_lib.sh --abi=armeabi-v7a --runtimes=cpu,gpu
62 63
    - LIBMACE32_FULL_SIZE=`stat -c%s build/lib/armeabi-v7a/libmace.so`
    - if (( LIBMACE32_FULL_SIZE > 1400000 )) ; then echo "The libmace.so size too large"; exit 1; fi
64 65 66 67
    - bash tools/bazel_build_standalone_lib.sh --abi=armeabi-v7a --runtimes=cpu,gpu,dsp
    - bash tools/bazel_build_standalone_lib.sh --abi=armeabi-v7a --runtimes=cpu,gpu,apu
    - bash tools/bazel_build_standalone_lib.sh --abi=arm64-v8a --runtimes=cpu
    - bash tools/bazel_build_standalone_lib.sh --abi=arm64-v8a --runtimes=cpu,gpu
68 69
    - LIBMACE64_FULL_SIZE=`stat -c%s build/lib/arm64-v8a/libmace.so`
      - if (( LIBMACE64_FULL_SIZE > 2300000 )) ; then echo "The libmace.so size too large"; exit 1; fi
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
    - bash tools/bazel_build_standalone_lib.sh --abi=arm64-v8a --runtimes=cpu,gpu,dsp
    - bash tools/bazel_build_standalone_lib.sh --abi=arm64-v8a --runtimes=cpu,gpu,apu
    - bash tools/bazel_build_standalone_lib.sh --abi=arm_linux_gnueabihf --runtimes=cpu
    - bash tools/bazel_build_standalone_lib.sh --abi=arm_linux_gnueabihf --runtimes=cpu,gpu
    - bash tools/bazel_build_standalone_lib.sh --abi=aarch64_linux_gnu --runtimes=cpu
    - bash tools/bazel_build_standalone_lib.sh --abi=aarch64_linux_gnu --runtimes=cpu,gpu
    - bash tools/bazel_build_standalone_lib.sh --abi=host
    - bash tools/bazel_build_standalone_lib.sh --static
    - bash tools/bazel_build_standalone_lib.sh --abi=armeabi-v7a --runtimes=cpu --static
    - bash tools/bazel_build_standalone_lib.sh --abi=armeabi-v7a --runtimes=cpu,gpu --static
    - bash tools/bazel_build_standalone_lib.sh --abi=armeabi-v7a --runtimes=cpu,gpu,dsp --static
    - bash tools/bazel_build_standalone_lib.sh --abi=armeabi-v7a --runtimes=cpu,gpu,apu --static
    - bash tools/bazel_build_standalone_lib.sh --abi=arm64-v8a --runtimes=cpu --static
    - bash tools/bazel_build_standalone_lib.sh --abi=arm64-v8a --runtimes=cpu,gpu --static
    - bash tools/bazel_build_standalone_lib.sh --abi=arm64-v8a --runtimes=cpu,gpu,dsp --static
    - bash tools/bazel_build_standalone_lib.sh --abi=arm64-v8a --runtimes=cpu,gpu,apu --static
    - bash tools/bazel_build_standalone_lib.sh --abi=arm_linux_gnueabihf --runtimes=cpu --static
    - bash tools/bazel_build_standalone_lib.sh --abi=arm_linux_gnueabihf --runtimes=cpu,gpu --static
    - bash tools/bazel_build_standalone_lib.sh --abi=aarch64_linux_gnu --runtimes=cpu --static
    - bash tools/bazel_build_standalone_lib.sh --abi=aarch64_linux_gnu --runtimes=cpu,gpu --static
    - bash tools/bazel_build_standalone_lib.sh --abi=host --static
L
Liangliang He 已提交
91 92
  only:
    - triggers
B
Bin Li 已提交
93

L
Liangliang He 已提交
94 95 96 97 98 99 100 101 102 103 104
build_android_demo:
  stage: build
  script:
    - ANDROID_NDK_HOME_SAVED=${ANDROID_NDK_HOME}
    - export ANDROID_NDK_HOME=/opt/android-ndk-r17b
    - pushd examples/android/ && bash build.sh static && bash build.sh dynamic && popd
    - export ANDROID_NDK_HOME=${ANDROID_NDK_HOME_SAVED}
  only:
    - triggers

mace_cc_test:
L
Liangliang He 已提交
105 106
  stage: test
  script:
L
Liangliang He 已提交
107 108 109 110 111 112
    - if [ -z "$TARGET_SOCS" ]; then TARGET_SOCS=random; fi
    - >
      if ping -c 1 v9.git.n.xiaomi.com 1>/dev/null 2>&1; then
        GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone git@v9.git.n.xiaomi.com:deep-computing/generic-mobile-devices.git
        DEVICE_CONF_FILE=generic-mobile-devices/devices.yml
      fi
113
    - python tools/bazel_adb_run.py --target="//test/ccunit:mace_cc_test" --device_yml=${DEVICE_CONF_FILE} --run_target=True --stdout_processor=unittest_stdout_processor --target_abis=armeabi-v7a,arm64-v8a --target_socs=$TARGET_SOCS
L
Liangliang He 已提交
114

L
Liangliang He 已提交
115
mace_cc_benchmark:
L
Liangliang He 已提交
116 117
  stage: test
  script:
L
Liangliang He 已提交
118 119
    - if [ -z "$TARGET_SOCS" ]; then TARGET_SOCS=random; fi
    - python tools/bazel_adb_run.py --target="//test/ccbenchmark:mace_cc_benchmark" --run_target=True --stdout_processor=ops_benchmark_stdout_processor --target_abis=armeabi-v7a,arm64-v8a --target_socs=$TARGET_SOCS --args="--filter=.*SIGMOID.*"
L
Liangliang He 已提交
120 121
  only:
    - triggers
Y
yejianwu 已提交
122

L
Liangliang He 已提交
123 124
model_tests:
  stage: test
L
liuqi 已提交
125
  script:
L
Liangliang He 已提交
126 127 128 129 130 131 132 133 134 135 136
    - pwd
    - rm -rf mace-models
    - rm -rf generic-mobile-devices
    - GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone git@github.com:XiaoMi/mace-models.git
    - CONF_FILE=mace-models/mobilenet-v1/mobilenet-v1.yml
    - >
      if ping -c 1 v9.git.n.xiaomi.com 1>/dev/null 2>&1; then
        GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone git@v9.git.n.xiaomi.com:deep-computing/generic-mobile-devices.git
        DEVICE_CONF_FILE=generic-mobile-devices/devices.yml
      fi
    - if [ -z "$TARGET_SOCS" ]; then TARGET_SOCS=random; fi
L
Liangliang He 已提交
137
    - python tools/converter.py convert --config=${CONF_FILE}  --target_socs=$TARGET_SOCS --model_graph_format=file --model_data_format=file --cl_mem_type=buffer
138
    - python tools/converter.py run --config=${CONF_FILE} --target_socs=$TARGET_SOCS --device_yml=${DEVICE_CONF_FILE} --round=1 --target_abis=armeabi-v7a --validate --model_graph_format=file --model_data_format=file
L
Liangliang He 已提交
139
    - CONF_FILE=mace-models/mobilenet-v2/mobilenet-v2-host.yml
L
Liangliang He 已提交
140 141
    - python tools/converter.py convert --config=${CONF_FILE} --target_socs=$TARGET_SOCS --model_graph_format=file --model_data_format=file
    - python tools/converter.py run --config=${CONF_FILE} --target_socs=$TARGET_SOCS --round=1 --validate --model_graph_format=file --model_data_format=file --address_sanitizer
L
liyin 已提交
142
    - python tools/converter.py run --config=${CONF_FILE} --target_socs=$TARGET_SOCS --round=5 --model_graph_format=file --model_data_format=file --benchmark
L
Liangliang He 已提交
143 144
    - python tools/converter.py convert --config=${CONF_FILE} --target_socs=$TARGET_SOCS --model_graph_format=code --model_data_format=file
    - python tools/converter.py run --config=${CONF_FILE} --target_socs=$TARGET_SOCS --round=1 --validate --model_graph_format=code --model_data_format=file
L
liyin 已提交
145
    - python tools/converter.py run --config=${CONF_FILE} --target_socs=$TARGET_SOCS --round=5 --model_graph_format=code --model_data_format=file --benchmark
L
Liangliang He 已提交
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161

quantization_tests:
  stage: test
  script:
    - pwd
    - rm -rf mace-models
    - GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone git@github.com:XiaoMi/mace-models.git
    - >
      if ping -c 1 v9.git.n.xiaomi.com 1>/dev/null 2>&1; then
        GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone git@v9.git.n.xiaomi.com:deep-computing/generic-mobile-devices.git
        DEVICE_CONF_FILE=generic-mobile-devices/devices.yml
      fi
    - if [ -z "$TARGET_SOCS" ]; then TARGET_SOCS=random; fi
    - >
      for CONF_FILE in mace-models/mobilenet-v1/mobilenet-v1-quantize-friendly.yml mace-models/mobilenet-v1/mobilenet-v1-quantize-retrain-for-check-only.yml mace-models/mobilenet-v1/mobilenet-v1-quantize-retrain-dsp.yml;
      do
L
Liangliang He 已提交
162 163
      python tools/converter.py convert --config=${CONF_FILE} --target_socs=$TARGET_SOCS --model_graph_format=file --model_data_format=file || exit 1;
      python tools/converter.py run --config=${CONF_FILE} --target_socs=$TARGET_SOCS --device_yml=${DEVICE_CONF_FILE} --round=1 --validate --model_graph_format=file --model_data_format=file || exit 1;
L
Liangliang He 已提交
164
      done
B
Bin Li 已提交
165 166 167 168 169 170 171
    - >
      CONF_FILE=mace-models/mobilenet-v1/mobilenet-v1-quantize-retrain-hta.yml;
      GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone --single-branch --branch hta git@v9.git.n.xiaomi.com:deep-computing/mace.git mace_hta --depth 1;
      mv mace_hta/third_party/hta/ third_party/;
      python tools/converter.py convert --config=${CONF_FILE} --model_graph_format=file --model_data_format=file || exit 1;
      python tools/converter.py run --config=${CONF_FILE} --round=1 --validate --model_graph_format=file --model_data_format=file || exit 1;
      rm -rf mace_hta third_party/hta;
L
Liangliang He 已提交
172 173 174
    - rm -rf mace-models

dynamic_linking_test:
L
Liangliang He 已提交
175 176
  stage: extra
  script:
177
    - export ANDROID_NDK_HOME=/opt/android-ndk-r17b
L
Liangliang He 已提交
178 179 180 181 182 183 184 185 186 187
    - rm -rf mace-models
    - rm -rf generic-mobile-devices
    - GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone git@github.com:XiaoMi/mace-models.git
    - CONF_FILE=mace-models/mobilenet-v1/mobilenet-v1.yml
    - >
      if ping -c 1 v9.git.n.xiaomi.com 1>/dev/null 2>&1; then
        GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone git@v9.git.n.xiaomi.com:deep-computing/generic-mobile-devices.git
        DEVICE_CONF_FILE=generic-mobile-devices/devices.yml
      fi
    - if [ -z "$TARGET_SOCS" ]; then TARGET_SOCS=random; fi
B
Bin Li 已提交
188 189
    - python tools/converter.py convert --config=${CONF_FILE}  --target_socs=$TARGET_SOCS --model_graph_format=file --model_data_format=file --cl_mem_type=buffer || exit 1;
    - python tools/converter.py run --config=${CONF_FILE} --target_socs=$TARGET_SOCS --device_yml=${DEVICE_CONF_FILE} --round=1 --validate --model_graph_format=file --model_data_format=file --mace_lib_type=dynamic || exit 1;
L
Liangliang He 已提交
190
    - rm -rf mace-models
L
Liangliang He 已提交
191 192
  only:
    - triggers
张志敏 已提交
193

194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
micro:
  stage: test
  tags:
    - mace-micro
  image: mace-micro-dev
  before_script:
    - git submodule deinit -f .
    - git submodule sync
    - git submodule update --init .
  script:
    - bash micro/tools/ci/model_convert.sh
    - bash micro/tools/ci/cross_build.sh
    - bash micro/tools/ci/host_build_and_run_examples.sh
    - bash micro/tools/ci/host_build_and_run_tests.sh
    - bash micro/tools/ci/build_mbed_example.sh