Skip to content

Commit

Permalink
move vta.exec.rpc_server to new vta_onboard package
Browse files Browse the repository at this point in the history
 * split the dependency away from vta package
  • Loading branch information
areusch committed Aug 2, 2021
1 parent da2a765 commit 49f6ca5
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 10 deletions.
6 changes: 3 additions & 3 deletions apps/vta_rpc/start_rpc_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# 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
Expand All @@ -19,4 +19,4 @@ PROJROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )"

export PYTHONPATH=${PYTHONPATH}:${PROJROOT}/python:${PROJROOT}/vta/python
export PYTHONPATH=${PYTHONPATH}:/home/xilinx/pynq
python3 -m vta.exec.rpc_server
python3 -m vta_onboard.exec.rpc_server
2 changes: 1 addition & 1 deletion apps/vta_rpc/start_rpc_server_to_tracker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ TARGET=$(python ${VTA_CONFIG} --target)

export PYTHONPATH=${PYTHONPATH}:${PROJROOT}/python:${PROJROOT}/vta/python
export PYTHONPATH=${PYTHONPATH}:/home/xilinx/pynq
python3 -m vta.exec.rpc_server --tracker fleet:9190 --key $TARGET
python3 -m vta_onboard.exec.rpc_server --tracker fleet:9190 --key $TARGET
17 changes: 14 additions & 3 deletions vta/python/vta/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
Besides the compiler toolchain, it also includes utility functions to
configure the hardware environment and access remote device through RPC.
"""
import logging
import sys

from .autotvm import module_loader
Expand All @@ -29,8 +30,18 @@

__version__ = "0.1.0"

# do not from tvm import topi when running vta.exec.rpc_server
# to maintain minimum dependency on the board
if sys.argv[0] not in ("-c", "-m"):
_LOG = logging.getLogger(__name__)

# do not from tvm import topi when __main__ is in vta_onboard
# to maintain minimum Python dependencies on the board.
# TODO(vta-team): move board-only logic imported above into vta_onboard.
if "vta_onboard" not in sys.modules:
from . import top
from .build_module import build_config, lower, build
else:
_LOG.warning(
"NOTE: some sub-packages of vta were not imported because the vta_onboard package "
"was detected in sys.modules. VTA assumes this indicates you are running on the "
"FPGA board. The full vta package requires dependencies that are too burdensome "
"to install in this environment."
)
18 changes: 18 additions & 0 deletions vta/python/vta_onboard/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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.

"""Defines a package that can be run onboard the FPGA's microcontroller."""
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
"""
from __future__ import absolute_import

# A marker used in vta.__init__ to detect whether to skip top-level imports to save time in starting
# the RPC server. Must appear before importing vta package.
VTA_SKIP_PACKAGE_IMPORTS = True

import logging
import argparse
import os
Expand All @@ -30,8 +34,8 @@
from tvm.contrib import cc
from vta import program_bitstream

from ..environment import get_env, pkg_config
from ..libinfo import find_libvta
from vta.environment import get_env, pkg_config
from vta.libinfo import find_libvta


def server_start():
Expand Down Expand Up @@ -124,7 +128,7 @@ def reconfig_runtime(cfg_json):


def main():
"""Main funciton"""
"""Main function"""
parser = argparse.ArgumentParser()
parser.add_argument(
"--host", type=str, default="0.0.0.0", help="The host IP address the server binds to"
Expand Down

0 comments on commit 49f6ca5

Please sign in to comment.