Skip to content

[Hexagon] Add support to run on multiple devices#12504

Merged
kparzysz-quic merged 13 commits intoapache:mainfrom
farshidsp:farshidsp/hexagon/add_parallelism_worker
Aug 24, 2022
Merged

[Hexagon] Add support to run on multiple devices#12504
kparzysz-quic merged 13 commits intoapache:mainfrom
farshidsp:farshidsp/hexagon/add_parallelism_worker

Conversation

@farshidsp
Copy link
Contributor

This PR enables running on multiple devices . Hexagon_luncher_process will create a a single server on each device and assigns a worker to a test whenever a new device becomes available where pytest-xdist will transfer to the subprocess.

To run on multiple devices, set the ANDROID_SERIAL_NUMBER to devices separated by a comma. E.g: export ANDROID_SERIAL_NUMBER="xxx.xxx.xx.xxx:xxxx,yyy.yyy.yy.yyy:yyyy,zzz.zzz.zz.zzz:zzzz".

And run the test using the following command:
py.test --tx {number_of_devices}*popen --dist=load test_file

The number_of_devices cab be less or equal to the actually number of devices set in the ANDROID_SERIAL_NUMBER.

Tests can still be run on a single device or simulator as before. E.g:

export ANDROID_SERIAL_NUMBER="xxx.xxx.xx.xxx:xxxx"
pytest test_file

@mehrdadh @Lunderberg @csullivan



@pytest.fixture(scope="session")
def android_serial_number() -> Optional[str]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain why is it not a fixture anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since pytest_configure(config) is a pytest hook, there were no easy way to have it use a pytest fixtures.
Maybe I'm missing the point, but I did not see the usefulness of having the android_serial_number as a pytest.fixture and by removing it, it solved the previous error.

@kparzysz-quic kparzysz-quic merged commit bf65b39 into apache:main Aug 24, 2022
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
* working in parralel using worker

* creating launchers per test and clean up

* clean up

* ci change to distrube tests

* ci work with any number of devices

* fix running on simulator

* adding function docstring

* fix android_serial_number to always return a list of string

* lint issue

* fix internal error when skipping tests while androideserial number is not set

* lint issue
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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes an error when we try to run these tests in parallel on simulator:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants