This repository has been archived by the owner on Jul 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #823 from Hakuyume/chainer-ci
pfnCI (pytest)
- Loading branch information
Showing
32 changed files
with
320 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
configs { | ||
key: "chainercv.py2.stable" | ||
value { | ||
requirement { | ||
cpu: 32 | ||
memory: 64 | ||
} | ||
time_limit: { | ||
seconds: 900 | ||
} | ||
command: "sh .pfnci/tests.sh" | ||
environment_variables { | ||
key: "PYTHON" | ||
value: "2" | ||
} | ||
environment_variables { | ||
key: "CHAINER" | ||
value: "5.2.0" | ||
} | ||
} | ||
} | ||
|
||
configs { | ||
key: "chainercv.py3.stable" | ||
value { | ||
requirement { | ||
cpu: 32 | ||
memory: 64 | ||
} | ||
time_limit: { | ||
seconds: 900 | ||
} | ||
command: "sh .pfnci/tests.sh" | ||
environment_variables { | ||
key: "PYTHON" | ||
value: "3" | ||
} | ||
environment_variables { | ||
key: "CHAINER" | ||
value: "5.2.0" | ||
} | ||
} | ||
} | ||
|
||
configs { | ||
key: "chainercv.py2.latest" | ||
value { | ||
requirement { | ||
cpu: 32 | ||
memory: 64 | ||
} | ||
time_limit: { | ||
seconds: 900 | ||
} | ||
command: "sh .pfnci/tests.sh" | ||
environment_variables { | ||
key: "PYTHON" | ||
value: "2" | ||
} | ||
environment_variables { | ||
key: "CHAINER" | ||
value: "6.0.0b2" | ||
} | ||
} | ||
} | ||
|
||
configs { | ||
key: "chainercv.py3.latest" | ||
value { | ||
requirement { | ||
cpu: 32 | ||
memory: 64 | ||
} | ||
time_limit: { | ||
seconds: 900 | ||
} | ||
command: "sh .pfnci/tests.sh" | ||
environment_variables { | ||
key: "PYTHON" | ||
value: "3" | ||
} | ||
environment_variables { | ||
key: "CHAINER" | ||
value: "6.0.0b2" | ||
} | ||
} | ||
} | ||
|
||
configs { | ||
key: "chainercv.py2.stable.gpu" | ||
value { | ||
requirement { | ||
cpu: 4 | ||
memory: 16 | ||
gpu: 1 | ||
} | ||
command: "sh .pfnci/tests_gpu.sh" | ||
environment_variables { | ||
key: "PYTHON" | ||
value: "2" | ||
} | ||
environment_variables { | ||
key: "CHAINER" | ||
value: "5.2.0" | ||
} | ||
} | ||
} | ||
|
||
configs { | ||
key: "chainercv.py3.stable.gpu" | ||
value { | ||
requirement { | ||
cpu: 4 | ||
memory: 16 | ||
gpu: 1 | ||
} | ||
command: "sh .pfnci/tests_gpu.sh" | ||
environment_variables { | ||
key: "PYTHON" | ||
value: "3" | ||
} | ||
environment_variables { | ||
key: "CHAINER" | ||
value: "5.2.0" | ||
} | ||
} | ||
} | ||
|
||
configs { | ||
key: "chainercv.py2.latest.gpu" | ||
value { | ||
requirement { | ||
cpu: 4 | ||
memory: 16 | ||
gpu: 1 | ||
} | ||
command: "sh .pfnci/tests_gpu.sh" | ||
environment_variables { | ||
key: "PYTHON" | ||
value: "2" | ||
} | ||
environment_variables { | ||
key: "CHAINER" | ||
value: "6.0.0b2" | ||
} | ||
} | ||
} | ||
|
||
configs { | ||
key: "chainercv.py3.latest.gpu" | ||
value { | ||
requirement { | ||
cpu: 4 | ||
memory: 16 | ||
gpu: 1 | ||
} | ||
command: "sh .pfnci/tests_gpu.sh" | ||
environment_variables { | ||
key: "PYTHON" | ||
value: "3" | ||
} | ||
environment_variables { | ||
key: "CHAINER" | ||
value: "6.0.0b2" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#! /usr/bin/env sh | ||
set -eux | ||
|
||
TEMP=$(mktemp -d) | ||
mount -t tmpfs tmpfs ${TEMP}/ -o size=100% | ||
apt-get install -y --no-install-recommends unzip | ||
gsutil -q cp gs://chainercv-pfn-public-ci/datasets-tiny.zip ${TEMP}/ | ||
unzip -q ${TEMP}/datasets-tiny.zip -d ${TEMP}/ | ||
rm ${TEMP}/datasets-tiny.zip | ||
|
||
docker run --interactive --rm \ | ||
--volume $(pwd):/chainercv/ --workdir /chainercv/ \ | ||
--volume ${TEMP}/.chainer/:/root/.chainer/ \ | ||
--env MPLBACKEND=agg \ | ||
hakuyume/chainercv:chainer${CHAINER}-devel \ | ||
sh -ex << EOD | ||
pip${PYTHON} install --user pytest-xdist | ||
pip${PYTHON} install --user -e . | ||
python${PYTHON} -m pytest --color=no -n $(nproc) \ | ||
-m 'not pfnci_skip and not gpu and not mpi' tests/ | ||
mpiexec -n 2 --allow-run-as-root \ | ||
python${PYTHON} -m pytest --color=no \ | ||
-m 'not pfnci_skip and not gpu and mpi' tests/ | ||
EOD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#! /usr/bin/env sh | ||
set -eux | ||
|
||
TEMP=$(mktemp -d) | ||
mount -t tmpfs tmpfs ${TEMP}/ -o size=100% | ||
mkdir -p ${TEMP}/.chainer | ||
|
||
docker run --runtime=nvidia --interactive --rm \ | ||
--volume $(pwd):/chainercv/ --workdir /chainercv/ \ | ||
--volume ${TEMP}/.chainer/:/root/.chainer/ \ | ||
--env MPLBACKEND=agg \ | ||
hakuyume/chainercv:chainer${CHAINER}-devel \ | ||
sh -ex << EOD | ||
pip${PYTHON} install --user -e . | ||
python${PYTHON} -m pytest --color=no \ | ||
-m 'not pfnci_skip and gpu and not mpi' tests/ | ||
mpiexec -n 2 --allow-run-as-root \ | ||
python${PYTHON} -m pytest --color=no \ | ||
-m 'not pfnci_skip and gpu and mpi' tests/ | ||
EOD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import unittest | ||
|
||
from chainer.testing.attr import check_available | ||
from chainer.testing.attr import gpu # NOQA | ||
from chainer.testing.attr import slow # NOQA | ||
|
||
|
||
try: | ||
import pytest | ||
pfnci_skip = pytest.mark.pfnci_skip | ||
|
||
except ImportError: | ||
from chainer.testing.attr import _dummy_callable | ||
pfnci_skip = _dummy_callable | ||
|
||
|
||
def mpi(f): | ||
check_available() | ||
import pytest | ||
|
||
try: | ||
import mpi4py.MPI # NOQA | ||
available = True | ||
except ImportError: | ||
available = False | ||
|
||
return unittest.skipUnless( | ||
available, 'mpi4py is not installed')(pytest.mark.mpi(f)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import six | ||
|
||
from chainer import testing | ||
|
||
|
||
def parameterize(*params): | ||
""":func:`chainer.testing.parameterize` for `pytest-xdist`. | ||
:func:`chainer.testing.parameterize` cannot work with `pytest-xdist` | ||
when the params contain functions (lambdas), classes, and random values. | ||
This wrapper replaces the params with their indices | ||
and restore the original params in :meth:`setUp`. | ||
""" | ||
|
||
def deco(cls): | ||
setUp_orig = cls.setUp | ||
|
||
def setUp(self): | ||
param = params[self._chainercv_parameterize_index] | ||
print('params: {}'.format(param)) | ||
for k, v in six.iteritems(param): | ||
setattr(self, k, v) | ||
setUp_orig(self) | ||
|
||
cls.setUp = setUp | ||
|
||
params_indices = [ | ||
{'_chainercv_parameterize_index': i} for i in range(len(params))] | ||
return testing.parameterize(*params_indices)(cls) | ||
|
||
return deco |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.