Commit e920c099 by Lianmin Zheng Committed by Tianqi Chen

[AUTOTVM] Support multiple targets load in tophub (#1803)

parent ad4c142b
...@@ -51,32 +51,35 @@ def context(target, extra_files=None): ...@@ -51,32 +51,35 @@ def context(target, extra_files=None):
Parameters Parameters
---------- ----------
target: Target target: Target or List of Target
The compilation target The compilation target
extra_files: list of str, optional extra_files: list of str, optional
Extra log files to load Extra log files to load
""" """
best_context = ApplyHistoryBest([]) best_context = ApplyHistoryBest([])
if isinstance(target, str): targets = target if isinstance(target, (list, tuple)) else [target]
target = _target.create(target)
for tgt in targets:
possible_names = [] if isinstance(tgt, str):
for opt in target.options: tgt = _target.create(tgt)
if opt.startswith("-device"):
device = _alias(opt[8:]) possible_names = []
possible_names.append(device) for opt in tgt.options:
possible_names.append(target.target_name) if opt.startswith("-device"):
device = _alias(opt[8:])
all_packages = list(PACKAGE_VERSION.keys()) possible_names.append(device)
for name in possible_names: possible_names.append(tgt.target_name)
name = _alias(name)
if name in all_packages: all_packages = list(PACKAGE_VERSION.keys())
check_backend(name) for name in possible_names:
name = _alias(name)
filename = "%s_%s.log" % (name, PACKAGE_VERSION[name]) if name in all_packages:
best_context.load(os.path.join(AUTOTVM_TOPHUB_ROOT_PATH, filename)) check_backend(name)
break # only load one file to avoid some fallback template mismatch problem
filename = "%s_%s.log" % (name, PACKAGE_VERSION[name])
best_context.load(os.path.join(AUTOTVM_TOPHUB_ROOT_PATH, filename))
break # only load one file to avoid some fallback template mismatch problem
if extra_files: if extra_files:
for filename in extra_files: for filename in extra_files:
......
...@@ -22,12 +22,20 @@ from mxnet.model import load_checkpoint ...@@ -22,12 +22,20 @@ from mxnet.model import load_checkpoint
###################################################################### ######################################################################
# Set the parameters here # Preliminary and Set parameters
# ----------------------- # ------------------------------
# We should build TVM with sort support, in TVM root directory
#
# .. code-block:: bash
#
# echo "set(USE_SORT ON)" > config.mk
# make -j8
#
# .. note:: # .. note::
# #
# Currently we support compiling SSD on CPU only. # Currently we support compiling SSD on CPU only.
# GPU support is in progress. # GPU support is in progress.
#
model_name = "ssd_resnet50_512" model_name = "ssd_resnet50_512"
model_file = "%s.zip" % model_name model_file = "%s.zip" % model_name
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment