TVM device_type need to be 1 Error
See original GitHub issueimport numpy as np
import nnvm.compiler
import nnvm.testing
import tvm
from tvm.contrib import graph_runtime
import mxnet as mx
from mxnet import ndarray as nd
ctx = tvm.gpu()
# load the module back.
data_shape = (1,3,112,112)
loaded_json = open("./model_gpu_tvm_mobile.json").read()
loaded_lib = tvm.module.load("./model_gpu_tvm_mobile.so")
loaded_params = bytearray(open("./model_gpu_tvm_mobile.params", "rb").read())
input_data = tvm.nd.array(np.random.uniform(size=data_shape).astype("float32"))
module = graph_runtime.create(loaded_json, loaded_lib, ctx)
module.load_params(loaded_params)
# Tiny benchmark test.
import time
for i in range(100):
t0 = time.time()
module.run(data=input_data)
print(time.time() - t0)
python3 mobile_model_gpu.py
Traceback (most recent call last):
File "mobile_model_gpu.py", line 25, in <module>
module.run(data=input_data)
File "/opt/github/tvm/python/tvm/contrib/graph_runtime.py", line 151, in run
self._run()
File "/opt/github/tvm/python/tvm/_ffi/_ctypes/function.py", line 185, in __call__
ctypes.byref(ret_val), ctypes.byref(ret_tcode)))
File "/opt/github/tvm/python/tvm/_ffi/base.py", line 71, in check_call
raise TVMError(py_str(_LIB.TVMGetLastError()))
tvm._ffi.base.TVMError: [12:44:07] /opt/github/tvm/src/runtime/module_util.cc:53: Check failed: ret == 0 (-1 vs. 0) Assert fail: (dev_type == 1), device_type need to be 1
Stack trace returned 10 entries:
[bt] (0) /usr/local/lib/libtvm.so(+0x73859d) [0x7f6f0f47359d]
[bt] (1) /usr/local/lib/libtvm.so(+0xe746f3) [0x7f6f0fbaf6f3]
[bt] (2) /usr/local/lib/libtvm.so(+0xeb3767) [0x7f6f0fbee767]
[bt] (3) /usr/local/lib/libtvm.so(+0xeb1b17) [0x7f6f0fbecb17]
[bt] (4) /usr/local/lib/libtvm.so(TVMFuncCall+0x5e) [0x7f6f0fb991ee]
[bt] (5) /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(ffi_call_unix64+0x4c) [0x7f6f1499ce20]
[bt] (6) /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(ffi_call+0x2eb) [0x7f6f1499c88b]
[bt] (7) /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(_ctypes_callproc+0x49a) [0x7f6f1499701a]
[bt] (8) /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(+0x9fcb) [0x7f6f1498afcb]
[bt] (9) python3(PyObject_Call+0x47) [0x5c20e7]
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
[TE Compiler] Device type error in UpdateMainWorkspaceSize ...
I have no idea why the TE compiler is looking for llvm in 0 instead of 1 . The most weird thing is,...
Read more >Error when I try to run the function: device_type need to be 4
Hi, I am moving my firsts steps in tvm, and I have this code I am using to optimize a reduction: @autotvm.template def...
Read more >tvm.runtime — tvm 0.11.dev0 documentation - Apache TVM
Construct a TVM device with given device type and id. cpu ([dev_id]) ... b – True if module (or one of its imports)...
Read more >Error Handling Guide — tvm 0.11.dev0 documentation
TVM contains structured error classes to indicate specific types of error. Please raise a specific error type when possible, so that users can...
Read more >tvm.target — tvm 0.11.dev0 documentation - Apache TVM
Returns the device_type for this target. list_kinds () ... Not all allowed cpu str will be valid, LLVM will throw an error.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Arjun8900 if you want to compile gpu model change
target = tvm.target.create("llvm -mcpu=haswell")
totarget = tvm.target.cuda("llvm device=0")
@mdv3101 How did you solve it?