Skip to content

Commit

Permalink
Add check random_fill exists on remote devices
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenGene committed Sep 6, 2020
1 parent 80b5271 commit 4c561d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions python/tvm/auto_scheduler/measure.py
Expand Up @@ -695,9 +695,11 @@ def timed_func():
try:
args = [ndarray.empty(get_const_tuple(x.shape), x.dtype, ctx) for x in
build_res.args]
assert tvm.get_global_func("tvm.contrib.random.random_fill", True), \
"Please make sure USE_RANDOM is ON in the config.cmake"
random_fill = remote.get_function("tvm.contrib.random.random_fill")
try:
random_fill = remote.get_function("tvm.contrib.random.random_fill")
except AttributeError:
raise AttributeError("Please make sure USE_RANDOM is ON in the config.cmake "
"on the remote devices")
for arg in args:
random_fill(arg)
ctx.sync()
Expand Down
8 changes: 5 additions & 3 deletions python/tvm/autotvm/measure/measure_methods.py
Expand Up @@ -511,9 +511,11 @@ def run_through_rpc(measure_input, build_result,
if ref_input:
args = [nd.array(x, ctx=ctx) for x in ref_input]
else:
assert tvm.get_global_func("tvm.contrib.random.random_fill", True), \
"Please make sure USE_RANDOM is ON in the config.cmake"
random_fill = remote.get_function("tvm.contrib.random.random_fill")
try:
random_fill = remote.get_function("tvm.contrib.random.random_fill")
except AttributeError:
raise AttributeError("Please make sure USE_RANDOM is ON in the config.cmake "
"on the remote devices")
args = [nd.empty(x[0], dtype=x[1], ctx=ctx) for x in build_result.arg_info]
for arg in args:
random_fill(arg)
Expand Down

0 comments on commit 4c561d3

Please sign in to comment.