Getting Started

Getting the source code

You can download the latest stable released version, or you can get the latest source code version by cloning our git repository:

git clone https://github.com/shapelets/khiva

Dependencies

Khiva relies on a number of open source libraries and tools which are required to get it running.

Tools:

Note

All versions of Khiva Library require a fully C++11-compliant compiler.

Libraries:

Windows

Installation

Prerequisites

  • Install Python-64bits and add the installation path to the environment variable path, 32-bits version won’t work.
  • Install ArrayFire 3.6.2 and add the installation path to the environment variable path.
  • Install Vcpkg and add the installation path to the environment variable path.
  • Install chocolatey to manage windows dependencies and add the installation path to the environment variable path.

Once we have installed all Khiva dependencies, we are ready to install Khiva by using the installers (Option 1) or from source code (Option 2).

(Option 1) Build using a batch installer

In the tools directory you can find the script install.bat. You must indicate the path to your vcpkg installation directory.

  • Usage: install.bat <path_to_vcpkg>
  • Example: install.bat c:vcpkg

(Option 2) Build from source code

If you prefer, you can build Khiva step by step. First, go to the source directory.

  • Run choco install cmake.install -NoNewWindow -Wait Note: Add the installation path to the environment variable path and before than chocolately environment variable path.
  • Run choco install doxygen.install -NoNewWindow -Wait.
  • Run choco install graphviz -NoNewWindow -Wait.
  • Run python -m pip install --upgrade pip.
  • Run pip3 install sphinx breathe sphinx_rtd_theme.
  • Run vcpkg install --triplet x64-windows gtest eigen3 benchmark boost.
  • Create a build folder in the root path of the project.
  • Browse inside the build folder.
  • Run cmake .. -DCMAKE_TOOLCHAIN_FILE="<PATH_TO_VPKG>/scripts/buildsystems/vcpkg.cmake" -DKHIVA_USE_CONAN=OFF -G "Visual Studio 15 2017 Win64" (Note: Replace <PATH_TO_VPKG> with your vcpkg installation path and do not forget to clean the build directory every time before running this command).
  • Run cmake --build . --config Release -- /m to compile.

Install Khiva library

To install Khiva just execute the following command:

  • Run cmake -DBUILD_TYPE=Release -P cmake_install.cmake.

Generating the Khiva installer

We use Cpack and NSIS to generate the installer.

Notes: Before generating the installer, the project must be built by following the steps in the previous Build from source code section. The generated package is stored in the build folder.

  • Run choco install nsis -NoNewWindow -Wait.
  • The installer can be generated running the command cpack -G NSIS.

Note: We use the cpack command from cmake, be aware chocolatey has another cpack command. If you cannot run the proper command, check out the path from cmake is placed before the path from chocolatey in the environment variable path.

Generating documentation

  • Run pip install sphinx to install Sphinx.
  • Browse to the root path of the project.
  • Run sphinx-build.exe -b html doc/sphinx/source/ build/doc/html/.

Linux

We use Ubuntu 16.04 LTS as our linux distribution example.

Prerequisites

  • Install Python-64bits or run apt-get install python3 python3-pip, 32-bits version won’t work.
  • Download ArrayFire 3.6.2.
  • Create destination folder sudo mkdir -p /opt/arrayfire
  • Install ArrayFire sudo bash arrayfire/ArrayFire-v3.6.2_Linux_x86_64.sh --prefix=/opt/arrayfire --skip-license

Once we have installed all Khiva dependencies, we are ready to install Khiva from source code or by using the installers.

Build from source code

First, go to the source directory.

conan remote add conan-mpusz https://api.bintray.com/conan/mpusz/conan-mpusz
mkdir build
cd build
conan install .. --build missing
cmake ..
make -j8
make install

It installs the library in /usr/local/lib and /usr/local/include folders.

In case ArrayFire is not installed in the default directory, it is required to add the Arrayfire lib folder to the LD_LIBRARY_PATH environment variable.

export LD_LIBRARY_PATH="/pathToArrayfire/arrayfire/lib:$LD_LIBRARY_PATH"

Install Khiva library from source code

  • Run make install.

Generating the khiva installer

We use CPack to generate the installers from source code.

Notes: Before generating the installer the project should be built following the process explained in the previous Build from source code section. The generated package will be stored in the build folder.

For linux, either a deb or a rpm installer package can be generated. This could be done by running the command cpack -G DEB or cpack -G RPM respectively inside the build folder.

Generating documentation

We use sphinx + doxygen to generate our documentation. You need to install the following packages:

  • Sphinx: brew install sphinx.
  • Doxygen: brew install doxygen.
  • Read the Docs Theme: pip install sphinx_rtd_theme.
  • Breathe: pip install breathe.

To generate the khiva documentation run the following command.

  • Run make documentation.

Mac OS

Prerequisites

  • Install Python-64bits or just run brew install python3, 32-bits version won’t work.
  • Install ArrayFire 3.6.2 and then execute the following lines to move the ArrayFire files from the default installation directory to the system path for libraries:
sudo mv /opt/arrayfire/include/* /usr/local/include
sudo mv /opt/arrayfire/lib/* /usr/local/lib
sudo mv /opt/arrayfire/share/* /usr/local/share
sudo rm -rf /opt/arrayfire

Once we have installed all Khiva dependencies, we are ready to build and install Khiva, either by using the installers of from source code.

Build from source code

First, go to the directory where the source code is stored:

conan remote add conan-mpusz https://api.bintray.com/conan/mpusz/conan-mpusz
mkdir build
cd build
conan install .. --build missing
cmake ..
make -j8
make install

It installs the library in /usr/local/lib and /usr/local/include folders.

Install Khiva library from source code

  • Run make install.

Generating the khiva installer

For Mac OS, the installer can be generated by running the command cpack -G productbuild inside the build folder. Note that, before generating the installer you have to follow the previous Build from source code section.

Generating documentation

We use sphinx + doxygen to generate our documentation. You will need to install the following packages:

  • Sphinx: brew install sphinx.
  • Doxygen: brew install doxygen.
  • Read the Docs Theme: pip install sphinx_rtd_theme.
  • Breathe: pip install breathe.

To generate the khiva documentation run the following command.

  • make documentation.