Skip to content

Commit

Permalink
[FIX,RPC] Skip RPC tests when using multiprocessing's spawn method (a…
Browse files Browse the repository at this point in the history
…pache#6858)

The rpc tests are broken when running under pytest with multiprocessing
using spawn. I suspect this is because pytest tests each function in a
separate process and does not import the full module.
  • Loading branch information
tkonolige authored and trevor-m committed Dec 4, 2020
1 parent 301ce5c commit 3d597d6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/python/unittest/test_runtime_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@
from tvm.contrib import utils, cc
from tvm.rpc.tracker import Tracker

# tkonolige: The issue as I understand it is this: multiprocessing's spawn
# method launches a new process and then imports the relevant modules. This
# means that all registered functions must exist at the top level scope. In
# this file they are, so all is well when we run this file directly.
# However, when run under pytest, the functions aren't registered on the
# server. I believe this is because pytest is also using multiprocessing to
# run individual functions. Somewhere along the way, the imports are being
# lost, so the server ends up not registering the functions.
pytestmark = pytest.mark.skipif(
multiprocessing.get_start_method() != "fork",
reason=(
"pytest + multiprocessing spawn method causes tvm.register_func to "
"not work on the rpc.Server."
),
)


@tvm.testing.requires_rpc
def test_bigendian_rpc():
Expand Down

0 comments on commit 3d597d6

Please sign in to comment.