Skip to content

Commit ffd6a1b

Browse files
zhangguanheng66fmassa
authored andcommitted
Run CI unittests in parallel (#3445)
Summary: * enable parallel tests * disable parallelism for GPU tests * [test] limit maximum processes on linux * [debug] limit max processes even further * [test] use subprocesses over threads * [test] limit intra-op threads * only limit intra op threads for CPU tests * [poc] use low timeout for showcasing * [poc] fix syntax * set timeout to 5 minutes * fix timeout on windows Reviewed By: fmassa Differential Revision: D26756257 fbshipit-source-id: f2fc4753a67a1505f01116119926eec365693ab9 Co-authored-by: Francisco Massa <[email protected]>
1 parent 7029839 commit ffd6a1b

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

.circleci/unittest/linux/scripts/environment.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ channels:
55
- conda-forge
66
dependencies:
77
- pytest
8+
- pytest-xdist
9+
- pytest-timeout
810
- pytest-cov
911
- codecov
1012
- pip

.circleci/unittest/linux/scripts/run_test.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,20 @@ eval "$(./conda/bin/conda shell.bash hook)"
66
conda activate ./env
77

88
export PYTORCH_TEST_WITH_SLOW='1'
9+
if [ "${CU_VERSION:-}" == cpu ] ; then
10+
NUMPROCESSES="auto"
11+
export OMP_NUM_THREADS="1"
12+
else
13+
NUMPROCESSES="1"
14+
fi
15+
916
python -m torch.utils.collect_env
10-
pytest --cov=torchvision --junitxml=test-results/junit.xml -v --durations 20 test --ignore=test/test_datasets_download.py
17+
pytest \
18+
--numprocesses=$NUMPROCESSES \
19+
--timeout=300 \
20+
--cov=torchvision \
21+
--junitxml=test-results/junit.xml \
22+
--verbose \
23+
--durations 20 \
24+
--ignore=test/test_datasets_download.py \
25+
test

.circleci/unittest/windows/scripts/environment.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ channels:
55
- conda-forge
66
dependencies:
77
- pytest
8+
- pytest-xdist
9+
- pytest-timeout
810
- pytest-cov
911
- codecov
1012
- pip

.circleci/unittest/windows/scripts/run_test.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,20 @@ eval "$(./conda/Scripts/conda.exe 'shell.bash' 'hook')"
66
conda activate ./env
77

88
export PYTORCH_TEST_WITH_SLOW='1'
9+
if [ "${CU_VERSION:-}" == cpu ] ; then
10+
NUMPROCESSES="auto"
11+
export OMP_NUM_THREADS="1"
12+
else
13+
NUMPROCESSES="1"
14+
fi
15+
916
python -m torch.utils.collect_env
10-
pytest --cov=torchvision --junitxml=test-results/junit.xml -v --durations 20 test --ignore=test/test_datasets_download.py
17+
pytest \
18+
--numprocesses=$NUMPROCESSES \
19+
--timeout=300 \
20+
--cov=torchvision \
21+
--junitxml=test-results/junit.xml \
22+
--verbose \
23+
--durations 20 \
24+
--ignore=test/test_datasets_download.py \
25+
test

0 commit comments

Comments
 (0)