This is a guide aimed towards contributors of ChainerX which is mostly implemented in C++. It describes how to build the project and how to run the test suite so that you can get started contributing.
Please refer to the Chainer Contribution Guide for the more general contribution guideline that is not specific to ChainerX. E.g. how to download the source code, manage git branches, send pull requests or contribute to Chainer’s Python code base.
There is a public ChainerX Product Backlog.
Running the test suite¶
The test suite can be built by passing
It is not built by default.
Once built, run the suite with the following command from within the
$ cd chainerx_cc/build $ ctest -V
The ChainerX C++ coding standard is mostly based on the Google C++ Style Guide and principles.
ChainerX is formatted using clang-format.
To fix the formatting in-place, run the following command from
$ cd chainerx_cc $ scripts/run-clang-format.sh --in-place
$ cd chainerx_cc $ scripts/run-cpplint.sh
To run clang-tidy, run
make clang-tidy from the build directory:
$ cd chainerx_cc/build $ make clang-tidy
The thread sanitizer can be used to detect thread-related bugs, such as data races.
To enable the thread sanitizer, pass
You can run the test with
ctest -V as usual and you will get warnings if the thread sanitizer detects any issues.
CUDA runtime is known to cause a thread leak error as a false alarm.
In such case, disable the thread leak detection using environment variable
Python contributions and unit tests¶
To test the Python binding, run the following command at the repository root:
The above command runs all the tests in the repository, including Chainer and ChainerMN. To run only ChainerX tests, specify the test directory:
$ pytest tests/chainerx_tests
Run tests with coverage:
$ pytest --cov --no-cov-on-fail --cov-fail-under=80 tests/chainerx_tests
Run tests without CUDA GPU:
$ pytest -m 'not cuda' tests/chainerx_tests