I recently spent two weeks debugging in the Windwos environment and found some problems about AutoTVM.
My env: windows10 intel-CPU ; TVM 0.7dev; python 3.6; LLVM 9.0;
1.On windows, 0.0.0.0 is a non-routable meta-address used to designate an invalid, unknown, or non-applicable target (a ‘no particular address’ place holder). So replace 0.0.0.0 with 127.0.0.1 . example
2.On windows,pickle function’s closure seems problematic.
"..\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
Can't pickle local object '_wrap_build_func.<locals>._wrapped'
I change the code to this:
def _wrap_build_func(build_func,measure_input, tmp_dir, **kwargs):
if not hasattr(build_func, "output_format"):
raise AttributeError("Expect build_func to have the attribute output_format.")
output_format = build_func.output_format
tic = time.time()
try:
filename = os.path.join(tmp_dir, "tmp_func_%0x.%s" % (
getrandbits(64), output_format))
# TODO(tvm-team) consider linline _build_func_common
func, arg_info = _build_func_common(measure_input, **kwargs)
func.export_library(filename, build_func)
except Exception as e: # pylint: disable=broad-except
return BuildResult(None, None, e, time.time() - tic)
return BuildResult(filename, arg_info, None, time.time() - tic)
The use of ‘_wrap_build_func’ function also change, but the changes will be minimal.
3.If the windows10 version < 17063, no ‘tar’ command. My method:
I download the Cygwin and install tar from it. Then, add it to environment variable.You can use the 'tar' command on Windows Command Prompt.
4.If path on the ‘tar’ command contain ‘:’ (example ‘D;\User\xxx’), need to add the ‘–force-local’. tar code
xxxxxxxx
md += [output]
cmd += ["--force-local"]
cmd += ["-C", temp.temp_dir]
cmd += temp.listdir()
xxxxxxxxxx
5.On the untar function ‘code’, If the ‘tar_file’ and ‘directory’ path is in ‘xxx\xxx\xxx’ format and ‘\’ needs to be replaced with ‘/’. Otherwise,Python failed to execute the tar command.
if platform.system() == "Windows":
if tar_file.find('\\') != -1:
tar_file = '/'.join(tar_file.split('\\'))
if directory.find('\\') != -1:
directory = '/'.join(directory.split('\\'))
6.The Windows Socket error 10048 , Address already in use.So add 10048 to the list
7.Use the LocalRunner ,after starting the Tracker, server don’t connect it. You need to compile cpp_rpc and start the tvm_rpc.exe. You also can use process-pool.
8.The basegraphtuner. benchmark_layout_transform is creating tracker and server in a loop,On windows this’s a big price to pay. code 1 and code 2.
I think we can add some judgment reuse tracker and server.example:
def set_task(self, task):
if self.tracker and server:
self.task = task
tracker = Tracker('0.0.0.0', port=9000, port_end=10000, silent=True)
device_key = '$local$device$%d' % tracker.port
server = Server('0.0.0.0', port=9000, port_end=10000,
key=device_key,
use_popen=True, silent=True,
tracker_addr=(tracker.host, tracker.port))
self.key = device_key
self.host = tracker.host
self.port = tracker.port
super(LocalRunner, self).set_task(task)
self.server = server
self.tracker = tracker
return self.server, self.tracker
9." Compilation error: lld-link: error: : undefined symbol: tvm_main"
This is a temporary fix, annotation “tvm_main”: