kparzysz-quic commented on code in PR #12504:
URL: https://github.com/apache/tvm/pull/12504#discussion_r1042559184
##########
python/tvm/contrib/hexagon/pytest_plugin.py:
##########
@@ -175,31 +182,50 @@ def hexagon_server_process(
"rpc_server_port": rpc_server_port_for_session,
"adb_server_socket": adb_server_socket,
}
- launcher = HexagonLauncher(serial_number=android_serial_number,
rpc_info=rpc_info)
+ workerinput = getattr(request.config, "workerinput", None)
+ if workerinput is None: # single-process execution
+ device_adr = read_device_list()[0]
+ else: # running in a subprocess here
+ device_adr = workerinput["device_adr"]
+ launcher = HexagonLauncher(serial_number=device_adr, rpc_info=rpc_info)
try:
if not skip_rpc:
launcher.start_server()
- yield launcher
+ yield {"launcher": launcher, "device_adr": device_adr}
finally:
if not skip_rpc:
launcher.stop_server()
+def read_device_list():
+ return android_serial_number()
+
+
+def pytest_configure(config):
+ # read device list if we are on the master
+ if not hasattr(config, "workerinput"):
+ config.iplist = read_device_list()
+
+
+def pytest_configure_node(node):
+ # the master for each node fills slaveinput dictionary
+ # which pytest-xdist will transfer to the subprocess
+ node.workerinput["device_adr"] = node.config.iplist.pop()
Review Comment:
This causes an error when we try to run these tests in parallel on simulator:
```IINTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File
"/usr2/kparzysz/.local/lib/python3.6/site-packages/_pytest/main.py", line 266,
in wrap_session
INTERNALERROR> config.hook.pytest_sessionstart(session=session)
[...]
INTERNALERROR> File
"/usr2/kparzysz/.local/lib/python3.6/site-packages/pluggy/_callers.py", line
39, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File
"/local/mnt/workspace/kparzysz/aitools/tvm-upstream/python/tvm/contrib/hexagon/pytest_plugin.py",
line 242, in pytest_configure_node
INTERNALERROR> node.workerinput["device_adr"] = node.config.iplist.pop()
INTERNALERROR> IndexError: pop from empty list
```
@farshidsp
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]