Closed MaxBareiss closed 4 years ago
That symbol is in libtvm.so
(using readelf --syms
).
So it either can't find that lib, or it hasn't properly linked to it - as this is what happened in #149 for libc10.so
and other libraries.
Has your target_link_libraries
line inCMakeLists.txt
got tvm
in it? (See my suggested patch in #149)
My pytorch did not have libtorch_cpu.so
or libtorch_cuda.so
(not sure why), so below is the patch I used:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a6108e6..b656518 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,7 +32,7 @@ add_subdirectory(${TVM_DIR})
pybind11_add_module(_torch_tvm SHARED ${TORCH_TVM_SRCS})
target_link_libraries(_torch_tvm PUBLIC
- torch pybind11 tvm tvm_topi)
+ torch c10 torch_python pybind11 tvm tvm_topi)
target_include_directories(_torch_tvm PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
This fix was included in my first request (I forgot to mention it) and it did not fix the problem. The following commands have the following outputs:
$ readelf -Ws build/tvm/libtvm.so | grep _ZTIN3tvm4NodeE
7483: 00000000045e81d8 40 OBJECT WEAK DEFAULT 21 _ZTIN3tvm4NodeE
49707: 00000000045e81d8 40 OBJECT WEAK DEFAULT 21 _ZTIN3tvm4NodeE
$ readelf -Ws build/_torch_tvm.cpython-35m-x86_64-linux-gnu.so | grep _ZTIN3tvm4NodeE
315: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND _ZTIN3tvm4NodeE
To double-check the linking is working you can try:
$ objdump -p _torch_tvm.cpython-36m-x86_64-linux-gnu.so | grep NEEDED
NEEDED libc10.so
NEEDED libtorch_cpu.so
NEEDED libtorch_python.so
NEEDED libtvm.so
NEEDED libLLVM-6.0.so.1
NEEDED libstdc++.so.6
NEEDED libm.so.6
NEEDED libgcc_s.so.1
NEEDED libc.so.6
NEEDED ld-linux-x86-64.so.2
And you should see a similar list including libtvm.so
.
If this is the case then for some reason the pytests can't find the library. I am using a python 3.6 virtual environment when building (though I did have some success with an anaconda environment, though haven't tried it recently).
Using strace python setup.py test
the log output shows it found libtvm.so
in the python environment here: py3.6env-tvm/lib/python3.6/site-packages/tvm-0.6.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so
So maybe the python setup.py install
step hasn't worked?
This issue was caused because my installed tvm was v0.6.0 from master, but this repo requires that the included facebookexperimental version be installed. Uninstalling the upstream tvm and following the tvm install instructions on the included tvm solves this issue.
I am using Ubuntu 16.04, pytorch 1.4.0, latest master version of pytorch-tvm, and it builds correctly. However, when running tests, it appears to fail to import this library:
This is a different undefined symbol than other issues (#149, #93).