File “C:\Anaconda3\lib\site-packages\tvm-0.6.dev0-py3.6-win-amd64.egg\tvm\module.py”, line 144, in export_library
fcompile(file_name, files, **kwargs)
File “C:\Anaconda3\lib\site-packages\tvm-0.6.dev0-py3.6-win-amd64.egg\tvm\contrib\cc.py”, line 51, in create_shared
_windows_shared(output, objects, options)
File “C:\Anaconda3\lib\site-packages\tvm-0.6.dev0-py3.6-win-amd64.egg\tvm\contrib\cc.py”, line 141, in _windows_shared
raise RuntimeError(msg)
Hi @myproject24, I solved this problem by initializing the necessary variables before the execution of python script. In my system with Visual Studio 2019, I had to execute vcvars64.bat located at C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat before running the python script.
Please note that initializing 32bit variables might lead to errors.
I ran the relay_quick_start.py script for testing my installation. Few things that I did which might help you:
I built LLVM from scratch in windows before building the tvm.
I added all the necessary dll dependencies’ paths for tvm.dll in System Environment Variables.
I added the path to cl.exe to System Environment variables because nvcc by default uses cl.exe in Windows to compile the *.cu scripts.(Additional comments, I tried running nvcc with clang/clang++ but no luck)
After doing all these I landed into the above problem of Windows.h not found error. It is because we need to initialize some system variables before running the python script.
I initialized my Anaconda environment and then ran the vcvars64.bat followed by python relay_quick_start.py.
Now I got a new error related to LLVM compiler. The script needed a certain file which was not built during my custom build operation of LLVM before tvm build phase. So, I had to download LLVM from their webpage and install it. At this point, I have my custom built LLVM at C:\Program Files(x86) and LLVM binaries downloaded from internet at C:\Program Files\.
I added the path to the LLVM\bin (internet version) to system PATH. And I got my code working without errors.
Hi @r4ghu I have tried your solution still I am facing the same problem, did you change anything in this script relay_quick_start.py because I have modified export function like
temp = util.tempdir()
path_lib = temp.relpath(“D:\tvm\tvm\nnvm\python\deploy_lib.dll”)
lib.export_library(path_lib)
with open(temp.relpath(“D:\tvm\tvm\nnvm\python\deploy_graph.json”), “w”) as fo:
fo.write(graph.json())
with open(temp.relpath(“D:\tvm\tvm\nnvm\python\deploy_param.params”), “wb”) as fo:
fo.write(nnvm.compiler.save_param_dict(params))
is this correct? here I am saving tvm library as .dll.
temp = util.tempdir()
path_lib = temp.relpath(“deploy_lib.dll”)
lib.export_library(path_lib)
with open(temp.relpath(“deploy_graph.json”), “w”) as fo:
fo.write(graph.json())
with open(temp.relpath(“deploy_param.params”), “wb”) as fo:
fo.write(nnvm.compiler.save_param_dict(params))