Table of contents
Contributing code
We use the version control system git and the repository is available on github:
https://github.com/OpenANN/OpenANN
Contributing code to OpenANN usually works as follows:
- Fork the repository (you need a github account).
- Clone the repository:
git clone git@github.com:<YourAccount>/OpenANN.git
- Create a new branch to add new features / fixes / documentation etc.:
git checkout -b <BranchName>
- Work on the new branch, commit and finally push your changes to your fork:
git push origin <BranchName>
- Open a pull request to the main repository. A core developer will review and possibly merge your request.
Directories
- OpenANN - Header files that are exposed to the user
- benchmarks - Standard ANN benchmarks
- cmake - CMake macros
- doc - Additional doxygen documentation files
- examples - OpenANN showcase
- lib - External libraries
- python - Python language bindings
- src - Implementation files for libopenann
- test - Contains the OpenANN test suite
Improving the code quality
There is always a lot of work that can be done to improve the quality of code, e.g.:
- Writing unit tests: check out the test directory to see how it works
- Writing documentation: more API documentation, guides, how-tos, ...
- Checking for memory leaks, access of unallocated memory, etc. with Valgrind
- Adding more checks and asserts (note that these checks must not affect the performance of the code)
- Profiling and optimizing code for performance
Those tasks are great entry points to contribute to the library and we are glad to receive any improvements.
Coding Style
We have a coding style. To apply that style automatically, you can use the tool Artistic Style. You can run the following command in the OpenANN main directory:
astyle --options=.astylerc --recursive "OpenANN/*.h" "src/*.cpp" "examples/*.h" "examples/*.cpp" "benchmarks/*.h" "benchmarks/*.cpp" "test/*.h" "test/*.cpp"
Test Suite
To build the OpenANN test suite you have to build the target TestSuite:
make TestSuite
You can run the tests with
test/TestSuite
or
test/TestSuite -qt
The latter will only work if Qt and the Qt headers are installed. Usually all tests should be succesful.
FAQ
What can I do to contribute to OpenANN?
There is a list of open issues at our github page: issues.
How can I verify my contribution?
- Write unit tests.
- Use Cppcheck:
cppcheck -q --enable=all <files>
.
- Maybe add an example or a benchmark for major components like a new type of learner.
- Use valgrind to check for memory leaks etc.
How can I minimize the time that is required to switch between different build types (Debug and Release)?
Both build types can be maintained simultanously:
mkdir build/Debug
mkdir build/Release
cd build/Debug
cmake -D CMAKE_BUILD_TYPE:String=Debug ../..
make
cd ../Release
cmake -D CMAKE_BUILD_TYPE:String=Release ../..
make