This is a document used to record tips in MXNet codebase for reviewers and contributors. Most of them are summarized through lessons during the contributing and process.
auto as long as it is short.const Expr&) over passing by value. Except when the function consumes the value by copy constructor or move, pass by value is better than pass by const reference in such cases.const member function when possible.We use cpplint to enforce the code style. Because different version of cpplint might change by its version, it is recommended to use the same version of the cpplint as the master. You can also use the following command via docker.
ci/build.py -R --docker-registry mxnetci --platform ubuntu_cpu --docker-build-retries 3 --shm-size 500m /work/runtime_functions.sh sanity_cpp
cpplint is also not perfect, when necessary, you can use disable cpplint on certain code regions.
make pylintpython 3.6 and above.Our tests are maintained in the /tests folder. We use the following testing tools:
python3 -m pip install opencv-python python3 -m pip install -r ci/docker/install/requirements
python3 -m pip install -e ./python
python3 -m pytest tests/python/unittest/test_smoke.py
python3 -m pytest tests/python/unittest/test_smoke.py::test_18927
python3 -m pytest tests/python/unittest/
Our CI pipelines check for a wide variety of configuration on all platforms. To locate and reproduce a test issue in PR, you can refer to the process described in #18723