You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "mehrdadh (via GitHub)" <gi...@apache.org> on 2023/01/31 17:20:17 UTC

[GitHub] [tvm] mehrdadh commented on a diff in pull request #13818: [microTVM] Update Zephyr version and Zephyr SDK version

mehrdadh commented on code in PR #13818:
URL: https://github.com/apache/tvm/pull/13818#discussion_r1091373572


##########
apps/microtvm/zephyr/template_project/launch_microtvm_api_server.sh:
##########
@@ -0,0 +1,41 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+function show_usage() {
+    cat <<EOF
+This script is for running microtvm_api_server.

Review Comment:
   added



##########
gallery/how_to/work_with_microtvm/install_zephyr.rst:
##########
@@ -34,19 +34,18 @@ Install Zephyr
         export ZEPHYR_BASE=${ZEPHYR_PROJECT_PATH}/zephyr
         west init ${ZEPHYR_PROJECT_PATH}
         cd ${ZEPHYR_BASE}
-        git checkout v2.7-branch
+        git checkout v3.2-branch
         cd ..
         west update
         west zephyr-export
         chmod -R o+w ${ZEPHYR_PROJECT_PATH}
 
         # Install Zephyr SDK
-        ZEPHYR_SDK_VERSION=0.13.2
-        ZEPHYR_SDK_FILE="/content/zephyr-sdk-linux-setup.run"
-        wget --no-verbose -O $ZEPHYR_SDK_FILE \
-            https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/zephyr-sdk-${ZEPHYR_SDK_VERSION}-linux-x86_64-setup.run
-        chmod +x $ZEPHYR_SDK_FILE
-        "$ZEPHYR_SDK_FILE" -- -d /content/zephyr-sdk --quiet
+        cd /content
+        wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.15.2/zephyr-sdk-0.15.2_linux-x86_64.tar.gz
+        tar xvf zephyr-sdk-0.15.2_linux-x86_64.tar.gz
+        mv zephyr-sdk-0.15.2 zephyr-sdk
+        rm zephyr-sdk-0.15.2_linux-x86_64.tar.gz

Review Comment:
   done



##########
tests/micro/project_api/test_project_api.py:
##########
@@ -40,15 +42,36 @@
 

Review Comment:
   `west_cmd` can be passed as a project option, we also had option to pass it as pytest argument before but since project api uses the west from ENV, we removed that



##########
apps/microtvm/zephyr/template_project/microtvm_api_server.py:
##########
@@ -68,9 +68,14 @@
 
 # Used to check Zephyr version installed on the host.
 # We only check two levels of the version.
-ZEPHYR_VERSION = 2.7
+ZEPHYR_VERSION = 3.2
 
-WEST_CMD = default = sys.executable + " -m west" if sys.executable else None
+try:
+    PYTHON_CMD = subprocess.check_output(["which", "python3.8"], encoding="utf-8").strip("\n")

Review Comment:
   done



##########
apps/microtvm/zephyr/template_project/launch_microtvm_api_server.sh:
##########
@@ -0,0 +1,41 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+function show_usage() {
+    cat <<EOF
+This script is for running microtvm_api_server.
+Usage: launch_microtvm_api_server.sh <microtvm_api_server.py> --read-fd <READ_FD_PATH> --write-fd <WRITE_FD_PATH>
+EOF
+}
+
+if [ "$#" -lt 5 -o "$1" == "--help" ]; then
+    show_usage
+    exit -1
+fi
+
+west_file_path=$(which west)
+
+# Remove space and extra characters
+line=$(head -n 1 ${west_file_path})

Review Comment:
   what we are trying to do here is to reuse the python that west was installed in and separate that from TVM python ENV. The ideal solution is to create a virtual python ENV for zephyr, install west in it and use that. That seems a bit complicated, so I decided to postpone that for now. Currently, Zephyr is installed in the global python3.8 vs TVM which is in a pythoon3.7 virtual ENV



##########
apps/microtvm/zephyr/template_project/microtvm_api_server.py:
##########
@@ -680,12 +695,7 @@ def build(self, options):
                 st.st_mode | stat.S_IEXEC,
             )
 
-        check_call(["cmake", "-GNinja", ".."], cwd=BUILD_DIR, env=env)
-
-        args = ["ninja"]
-        if verbose:
-            args.append("-v")
-        check_call(args, cwd=BUILD_DIR, env=env)
+        check_call(options["west_cmd"].split(" ") + ["build"], cwd=API_SERVER_DIR, env=env)

Review Comment:
   it's because west could be in this format: `python3.8 -m west`



##########
apps/microtvm/arduino/template_project/launch_microtvm_api_server.sh:
##########
@@ -0,0 +1,43 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+function show_usage() {
+    cat <<EOF
+This script is for running microtvm_api_server.
+Usage: launch_microtvm_api_server.sh <microtvm_api_server.py> --read-fd <READ_FD_PATH> --write-fd <WRITE_FD_PATH>
+EOF
+}
+
+if [ "$#" -lt 5 -o "$1" == "--help" ]; then
+    show_usage
+    exit -1
+fi
+
+ARDUINO_VENV_PATH=${HOME}/.tvm/micro_arduino

Review Comment:
   Initially I didn't plan for this, but since we are testing both in the same image and the new image has different Python env I had to make this changes. Would it be okay to update the PR title and description to cover all these changes?



##########
apps/microtvm/arduino/template_project/launch_microtvm_api_server.sh:
##########
@@ -0,0 +1,43 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+function show_usage() {
+    cat <<EOF
+This script is for running microtvm_api_server.

Review Comment:
   added



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org