ThunderSVM How To

This page is for key instructions of intalling, using and contributing to ThunderSVM. ThunderSVM has been used by many users, and everyone can contribute to ThunderSVM to make it better.

Install ThunderSVM

Please refer to Getting Started for installation and some examples of training SVMs using ThunderSVM.

Improve documentations

Most of the documents can be viewed on GitHub, although the documents look much better in Read the Doc. The HTML files of our documents are generated by Sphinx, and the source files of the documents are written using Markdown. In the following, we describe how to setup the Sphinx environment for ThunderSVM.

  • Install sphinx
pip install sphinx
  • Install Makedown Parser
pip install recommonmark

Note that recommonmark has a bug when working with Sphinx in some platforms, so you may need to hack into transform.py to fix the problem by yourself. You can find the instruction of hacking in this link.

  • Install Sphinx theme
pip install sphinx_rtd_theme
  • Generate HTML

    Go to the “docs“ directory of ThunderSVM and run:

make html

At this point, make sure you have generated the documents of ThunderSVM. You can build the documents in your machine to see the outcome.

Contribute to ThunderSVM

You need to fetch the latest version of ThunderSVM before submitting a pull request.

git remote add upstream https://github.com/Xtra-Computing/thundersvm.git
git fetch upstream
git rebase upstream/master

Test ThunderSVM

We recommend our contributors using Linux as the development platform where ThunderSVM is relatively well tested.

Please note that cmake .. [-D<options>=<args>] produces a CMakeCache.txt file. You need to remove it or the whole build directory, before you can run a new cmake command with different configurations. Also please note that the test build will not generate binaries like thundersvm-train.

Build test on Linux

  • Clone ThunderSVM repository
git clone https://github.com/Xtra-Computing/thundersvm.git
git submodule update --init src/test/googletest
  • Build the binary for testing
mkdir build
cd build
cmake .. -DBUILD_TESTS=ON
make -j runtest

If make -j runtest doesn‘t work, please use make runtest instead. Make sure all the test cases pass. You can also add more test cases in the test module of ThunderSVM.

Build test on MacOS

  • Clone ThunderSVM repository
git clone https://github.com/Xtra-Computing/thundersvm.git
git submodule init eigen && git submodule update
git submodule update --init src/test/googletest
  • Build the binary for testing
mkdir build
cd build
cmake .. -DCMAKE_CXX_COMPILER=[path_to_g++]/usr/local/bin/g++-7 -DCMAKE_C_COMPILER=[path_to_gcc] -DUSE_CUDA=OFF -DBUILD_TESTS=ON
make -j runtest

Where [path_to_g++] and [path_to_gcc] typically look like /usr/local/bin/g++-7 and /usr/local/bin/gcc-7, respectively.

Build test on Windows

  • Clone ThunderSVM repository
git clone https://github.com/Xtra-Computing/thundersvm.git
git submodule update --init src/test/googletest
  • Build the binary for testing
mkdir build
cd build
cmake .. -DBUILD_SHARED_LIBS=TRUE -DBUILD_TESTS=ON -G "Visual Studio 14 2015 Win64"
cmake --build . --target runtest

You need to change the Visual Studio version if you are using a different version of Visual Studio. Visual Studio can be downloaded from this link. The above commands generate some Visual Studio project files, open the Visual Studio project to build ThunderSVM. Please note that CMake should be 3.4 or above for Windows.

Build python wheel file

You have to ensure the repository is identical to the latest one.

  • Clone ThunderSVM repository
git clone https://github.com/Xtra-Computing/thundersvm.git
  • Build the binary
cd thundersvm
mkdir build && cd build && cmake .. && make -j
  • Build the python wheel file
    • change directory to python cd ../python
    • update the version you are going to release in setup.py
python3 setup.py bdist_wheel
twine upload dist/* --verbose
  • [Recommended] Draw a new release on Release
    • state the bug fixed or new functions.