[ROCm] use pytest-xdist for fast pytest (#14261)

### Description

Use pytest-xdist to distribute tests across multiple CPUs to speed up
test execution.
Use pytest-rerunfailures to rerun failed test in case of pytest-xdist
crash.
`pytest -n 16` can reduce pytest time from 80 minutes to 20 minutes.


### Motivation and Context
Now kernel explorer pytest of ROCm CI takes nearly 1 hour 20 minutes. It
will take longer time when we add more tunableOp in the future.
This commit is contained in:
PeixuanZuo 2023-01-13 16:57:50 +08:00 committed by GitHub
parent 9bd9206928
commit d3a09cf77f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -84,7 +84,7 @@ jobs:
inputs:
script: |-
export KERNEL_EXPLORER_BUILD_DIR=./build/Release
pytest ./onnxruntime/python/tools/kernel_explorer/
pytest ./onnxruntime/python/tools/kernel_explorer/ -n 16 --reruns 1
displayName: 'Run kernel explorer tests'
condition: and(succeededOrFailed(), eq(variables.onnxruntimeBuildSucceeded, 'true'))

View file

@ -37,7 +37,9 @@ RUN pip install \
sentencepiece \
dill==0.3.4 \
wget \
pytorch_lightning==1.6.0
pytorch_lightning==1.6.0 \
pytest-xdist \
pytest-rerunfailures
RUN pip install torch-ort --no-dependencies
ENV ORTMODULE_ONNX_OPSET_VERSION=15