You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/09/28 20:05:35 UTC

[GitHub] [incubator-tvm] leandron commented on a change in pull request #6578: [tvmc] Introduce 'run' subcommand (part 4/4)

leandron commented on a change in pull request #6578:
URL: https://github.com/apache/incubator-tvm/pull/6578#discussion_r496201533



##########
File path: python/tvm/driver/tvmc/runner.py
##########
@@ -0,0 +1,450 @@
+# 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.
+"""
+Provides support to run compiled networks both locally and remotely.
+"""
+import json
+import logging
+import os
+import tarfile
+import tempfile
+
+import numpy as np
+import tvm
+from tvm import rpc
+from tvm.autotvm.measure import request_remote
+from tvm.contrib import graph_runtime as runtime
+from tvm.contrib.debugger import debug_runtime
+
+from . import common
+from .common import TVMCException
+from .main import register_parser
+
+
+# pylint: disable=invalid-name
+logger = logging.getLogger("TVMC")
+
+
+@register_parser
+def add_run_parser(subparsers):
+    """ Include parser for 'run' subcommand """
+
+    parser = subparsers.add_parser("run", help="run a compiled module")
+    parser.set_defaults(func=drive_run)
+
+    # TODO --device needs to be extended and tested to support other targets,
+    #      like 'cl', 'webgpu', etc (@leandron)
+    parser.add_argument(
+        "--device",
+        choices=["cpu", "gpu"],
+        default="cpu",
+        help="target device to run the compiled module",
+    )

Review comment:
       I took some time thinking about this option, and playing with it on my machine. I concluded that users might get confused and have expectations if we use `—target` terminology here, as we have it in other subcommands.
   
   This is why I decided to go with the terminology used by the underlying APIs, and call it device instead. What do you think?




----------------------------------------------------------------
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.

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