This is an automated email from the ASF dual-hosted git repository.
areusch pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 7a5f4e0c41 [microTVM] Refactor RVM scripts and fix DNS network issue
(#11741)
7a5f4e0c41 is described below
commit 7a5f4e0c4124031fbc4412395b3ba31625959fea
Author: Mehrdad Hessar <[email protected]>
AuthorDate: Thu Jun 16 12:49:21 2022 -0700
[microTVM] Refactor RVM scripts and fix DNS network issue (#11741)
* refactor scripts
* address comments
---
.../arduino/base-box/base_box_setup.sh | 35 +++---------
apps/microtvm/reference-vm/base-box-tool.py | 9 +++-
.../base_box_setup.sh => base_box_setup_common.sh} | 62 +++++++++-------------
.../reference-vm/zephyr/base-box/base_box_setup.sh | 47 +++-------------
.../reference-vm/zephyr/base-box/base_box_test.sh | 3 +-
docker/install/ubuntu_install_core.sh | 2 +
docker/install/ubuntu_install_python.sh | 7 ++-
7 files changed, 55 insertions(+), 110 deletions(-)
diff --git a/apps/microtvm/reference-vm/arduino/base-box/base_box_setup.sh
b/apps/microtvm/reference-vm/arduino/base-box/base_box_setup.sh
index cde9d38b2d..8ce9a5a0fa 100644
--- a/apps/microtvm/reference-vm/arduino/base-box/base_box_setup.sh
+++ b/apps/microtvm/reference-vm/arduino/base-box/base_box_setup.sh
@@ -26,42 +26,19 @@ if [ -e "$HOME/skip_zeroing_disk" ]; then
skip_zeroing_disk=1
fi
-sudo apt update
-sudo apt install -y build-essential
-sudo apt-get --purge remove modemmanager # required to access serial ports.
+# Install common configs
+~/base_box_setup_common.sh
+rm -f ~/base_box_setup_common.sh
-sudo apt install -y --no-install-recommends git \
- cmake cmake-data \
- ninja-build gperf ccache dfu-util device-tree-compiler wget \
- python3-dev python3-pip python3-setuptools python3-tk python3-wheel
xz-utils file \
- make gcc gcc-multilib g++-multilib libsdl2-dev
-
-OLD_HOSTNAME=$(hostname)
-sudo hostnamectl set-hostname microtvm
-sudo sed -i.bak "s/${OLD_HOSTNAME}/microtvm.localdomain/g" /etc/hosts
-
-# Poetry deps
-sudo apt install -y python3-venv
-
-# TVM deps
-sudo apt install -y llvm
-
-# ONNX deps
-sudo apt install -y protobuf-compiler libprotoc-dev
+# Poetry
+sed -i "/^# If not running interactively,/ i source \$HOME/.poetry/env"
~/.bashrc
+sed -i "/^# If not running interactively,/ i\\ " ~/.bashrc
# TODO do we need this?
echo 'export PATH=$HOME/vagrant/bin:"$PATH"' >> ~/.profile
source ~/.profile
echo PATH=$PATH
-# Poetry
-curl -sSL
https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py |
python3
-sed -i "/^# If not running interactively,/ i source \$HOME/.poetry/env"
~/.bashrc
-sed -i "/^# If not running interactively,/ i\\ " ~/.bashrc
-
-# Python 3.7
-sudo apt install -y python3.7
-
# Clean box for packaging as a base box
sudo apt-get clean
if [ $skip_zeroing_disk -eq 0 ]; then
diff --git a/apps/microtvm/reference-vm/base-box-tool.py
b/apps/microtvm/reference-vm/base-box-tool.py
index db89f32332..c012d6f52a 100755
--- a/apps/microtvm/reference-vm/base-box-tool.py
+++ b/apps/microtvm/reference-vm/base-box-tool.py
@@ -53,8 +53,15 @@ ALL_PLATFORMS = (
# Extra scripts required to execute on provisioning
# in [platform]/base-box/base_box_provision.sh
EXTRA_SCRIPTS = {
- "arduino": (),
+ "arduino": (
+ "apps/microtvm/reference-vm/base_box_setup_common.sh",
+ "docker/install/ubuntu_install_core.sh",
+ "docker/install/ubuntu_install_python.sh",
+ ),
"zephyr": (
+ "apps/microtvm/reference-vm/base_box_setup_common.sh",
+ "docker/install/ubuntu_install_core.sh",
+ "docker/install/ubuntu_install_python.sh",
"docker/install/ubuntu_init_zephyr_project.sh",
"docker/install/ubuntu_install_zephyr_sdk.sh",
"docker/install/ubuntu_install_cmsis.sh",
diff --git a/apps/microtvm/reference-vm/arduino/base-box/base_box_setup.sh
b/apps/microtvm/reference-vm/base_box_setup_common.sh
old mode 100644
new mode 100755
similarity index 52%
copy from apps/microtvm/reference-vm/arduino/base-box/base_box_setup.sh
copy to apps/microtvm/reference-vm/base_box_setup_common.sh
index cde9d38b2d..04d57e4480
--- a/apps/microtvm/reference-vm/arduino/base-box/base_box_setup.sh
+++ b/apps/microtvm/reference-vm/base_box_setup_common.sh
@@ -19,60 +19,48 @@
set -e
set -x
-skip_zeroing_disk=0
-if [ -e "$HOME/skip_zeroing_disk" ]; then
- echo "NOTE: will not zero disk at the end due to VMWare Fusion bug"
- echo "See:
https://communities.vmware.com/t5/VMware-Fusion-Discussions/VMWare-Fusion-Pro-11-15-6-16696540-causes-macOS-crash-during/m-p/2284011#M139190"
- skip_zeroing_disk=1
-fi
+# Fix network DNS issue
+sudo sed -i 's/DNSSEC=yes/DNSSEC=no/' /etc/systemd/resolved.conf
+sudo systemctl restart systemd-resolved
sudo apt update
sudo apt install -y build-essential
sudo apt-get --purge remove modemmanager # required to access serial ports.
+# Core
+sudo ~/ubuntu_install_core.sh
+rm -f ~/ubuntu_install_core.sh
+
sudo apt install -y --no-install-recommends git \
- cmake cmake-data \
- ninja-build gperf ccache dfu-util device-tree-compiler wget \
- python3-dev python3-pip python3-setuptools python3-tk python3-wheel
xz-utils file \
- make gcc gcc-multilib g++-multilib libsdl2-dev
+ gperf ccache dfu-util device-tree-compiler xz-utils file \
+ gcc gcc-multilib g++-multilib libsdl2-dev
-OLD_HOSTNAME=$(hostname)
-sudo hostnamectl set-hostname microtvm
-sudo sed -i.bak "s/${OLD_HOSTNAME}/microtvm.localdomain/g" /etc/hosts
+# Cmake
+wget --no-verbose https://apt.kitware.com/keys/kitware-archive-latest.asc
+sudo apt-key add kitware-archive-latest.asc
+sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
+sudo apt update
+sudo apt install -y --no-install-recommends \
+ cmake=3.22.2-0kitware1ubuntu18.04.1
cmake-data=3.22.2-0kitware1ubuntu18.04.1 \
+
+# Python
+sudo ~/ubuntu_install_python.sh
+rm -f ~/ubuntu_install_python.sh
# Poetry deps
sudo apt install -y python3-venv
# TVM deps
+# TODO(mehrdadh): replace with ubuntu_install_llvm.sh
sudo apt install -y llvm
# ONNX deps
sudo apt install -y protobuf-compiler libprotoc-dev
-# TODO do we need this?
-echo 'export PATH=$HOME/vagrant/bin:"$PATH"' >> ~/.profile
-source ~/.profile
-echo PATH=$PATH
-
# Poetry
curl -sSL
https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py |
python3
-sed -i "/^# If not running interactively,/ i source \$HOME/.poetry/env"
~/.bashrc
-sed -i "/^# If not running interactively,/ i\\ " ~/.bashrc
-
-# Python 3.7
-sudo apt install -y python3.7
-# Clean box for packaging as a base box
-sudo apt-get clean
-if [ $skip_zeroing_disk -eq 0 ]; then
- echo "Zeroing disk..."
- EMPTY_FILE="$HOME/EMPTY"
- dd if=/dev/zero "of=${EMPTY_FILE}" bs=1M || /bin/true
- if [ ! -e "${EMPTY_FILE}" ]; then
- echo "failed to zero empty sectors on disk"
- exit 2
- fi
- rm -f "${EMPTY_FILE}"
-else
- echo "NOTE: skipping zeroing disk due to command-line argument."
-fi
+# Host name
+OLD_HOSTNAME=$(hostname)
+sudo hostnamectl set-hostname microtvm
+sudo sed -i.bak "s/${OLD_HOSTNAME}/microtvm.localdomain/g" /etc/hosts
diff --git a/apps/microtvm/reference-vm/zephyr/base-box/base_box_setup.sh
b/apps/microtvm/reference-vm/zephyr/base-box/base_box_setup.sh
index 0c98713932..a1959e5d3b 100644
--- a/apps/microtvm/reference-vm/zephyr/base-box/base_box_setup.sh
+++ b/apps/microtvm/reference-vm/zephyr/base-box/base_box_setup.sh
@@ -26,38 +26,14 @@ if [ -e "$HOME/skip_zeroing_disk" ]; then
skip_zeroing_disk=1
fi
-sudo apt update
-sudo apt install -y build-essential
-sudo apt-get --purge remove modemmanager # required to access serial ports.
+# Install common configs
+~/base_box_setup_common.sh
+rm -f ~/base_box_setup_common.sh
-# Zephyr
-wget --no-verbose https://apt.kitware.com/keys/kitware-archive-latest.asc
-sudo apt-key add kitware-archive-latest.asc
-sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
-sudo apt update
-# NOTE: latest cmake cannot be installed due to
-# https://github.com/zephyrproject-rtos/zephyr/issues/30232
-sudo apt install -y --no-install-recommends git \
- cmake=3.22.2-0kitware1ubuntu18.04.1
cmake-data=3.22.2-0kitware1ubuntu18.04.1 \
- ninja-build gperf ccache dfu-util device-tree-compiler wget \
- python3-dev python3-pip python3-setuptools python3-tk python3-wheel
xz-utils file \
- make gcc gcc-multilib g++-multilib libsdl2-dev
-
-# Avahi, so that ssh microtvm works.
-# apt install -y avahi-daemon
-
-OLD_HOSTNAME=$(hostname)
-sudo hostnamectl set-hostname microtvm
-sudo sed -i.bak "s/${OLD_HOSTNAME}/microtvm.localdomain/g" /etc/hosts
-
-# Poetry deps
-sudo apt install -y python3-venv
-
-# TVM deps
-sudo apt install -y llvm
-
-# ONNX deps
-sudo apt install -y protobuf-compiler libprotoc-dev
+# Poetry
+sed -i "/^# If not running interactively,/ i source \$HOME/.poetry/env"
~/.bashrc
+sed -i "/^# If not running interactively,/ i export
ZEPHYR_BASE=$HOME/zephyr/zephyr" ~/.bashrc
+sed -i "/^# If not running interactively,/ i\\ " ~/.bashrc
# nrfjprog
NRF_COMMANDLINE_TOOLS_FILE=nRFCommandLineToolsLinuxamd64.tar.gz
@@ -95,15 +71,6 @@ sudo apt install -y python3.8-dev
sudo find ~/zephyr-sdk -name '*.rules' -exec cp {} /etc/udev/rules.d \;
sudo udevadm control --reload
-# Poetry
-curl -sSL
https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py |
python3
-sed -i "/^# If not running interactively,/ i source \$HOME/.poetry/env"
~/.bashrc
-sed -i "/^# If not running interactively,/ i export
ZEPHYR_BASE=$HOME/zephyr/zephyr" ~/.bashrc
-sed -i "/^# If not running interactively,/ i\\ " ~/.bashrc
-
-# Python 3.7
-sudo apt install -y python3.7
-
# Clean box for packaging as a base box
sudo apt-get clean
if [ $skip_zeroing_disk -eq 0 ]; then
diff --git a/apps/microtvm/reference-vm/zephyr/base-box/base_box_test.sh
b/apps/microtvm/reference-vm/zephyr/base-box/base_box_test.sh
index accaef50ff..49f86a6ef9 100755
--- a/apps/microtvm/reference-vm/zephyr/base-box/base_box_test.sh
+++ b/apps/microtvm/reference-vm/zephyr/base-box/base_box_test.sh
@@ -30,5 +30,4 @@ fi
board=$1
-pytest tests/micro/zephyr/test_zephyr.py --zephyr-board=${board}
-pytest tests/micro/zephyr/test_zephyr_aot.py --zephyr-board=${board}
+pytest tests/micro/zephyr --zephyr-board=${board}
diff --git a/docker/install/ubuntu_install_core.sh
b/docker/install/ubuntu_install_core.sh
index eba4318f07..d20eeeba69 100755
--- a/docker/install/ubuntu_install_core.sh
+++ b/docker/install/ubuntu_install_core.sh
@@ -18,6 +18,8 @@
set -e
set -u
+# Used for debugging RVM build
+set -x
set -o pipefail
# install libraries for building c++ core on ubuntu
diff --git a/docker/install/ubuntu_install_python.sh
b/docker/install/ubuntu_install_python.sh
index c8856f299b..eff7504d47 100755
--- a/docker/install/ubuntu_install_python.sh
+++ b/docker/install/ubuntu_install_python.sh
@@ -18,6 +18,8 @@
set -e
set -u
+# Used for debugging RVM build
+set -x
set -o pipefail
# install python and pip, don't modify this, modify install_python_package.sh
@@ -33,8 +35,11 @@ apt-install-and-clear -y python-pip python-dev python3.6
python3.6-dev
rm -f /usr/bin/python3 && ln -s /usr/bin/python3.6 /usr/bin/python3
+# python 3.7
+apt-get install -y python3.7
+
# Install pip
-cd /tmp && wget -q https://bootstrap.pypa.io/get-pip.py && python3.6 get-pip.py
+wget -q https://bootstrap.pypa.io/get-pip.py && python3.7 get-pip.py
# Pin pip and setuptools versions
pip3 install pip==19.3.1 setuptools==58.4.0