You can build onnc source with either CMake or Automake building system.
There are 2 modes, Release mode and debug mode, provided in CMake building system.
Recommended for common use.
Release mode will build onnc with basic optimizations, and skip debug informations.
Notice: Release mode will NOT build unit tests.
$ mkdir -p build && cd build
$ cmake -DCMAKE_BUILD_TYPE=Release ..
It will create build
directory, get into it and configure with Release
build type.
$ make -j4
It will compile sources with 4 threads concurrently. You can modify -j4
option to meet your needs.
$ sudo make install
It will install essential files to /usr/local
.
Recommended for development use.
Debug mode will build onnc with debug settings, unit tests and some debug informations.
$ mkdir -p build && cd build
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
It will create build
directory, get into it and configure with Debug
build type.
$ make -j4
It will compile sources with 4 threads concurrently. You can modify -j4
option to meet your needs.
$ ctest
It will trigger all unit tests by CTest.
If you want to execute single unit test, you can find it in build/tools/unittests
directory.
$ sudo make install
It will install essential files to /usr/local
.
You can override default configurations by simply add -DENTRY=VALUE
�options to the configure command. The ENTRY
and VALUE
can be replaced according to the following table:
"Path string" of value means you have to provide a string of a directory path, and "File path string" means you have to provide a string of a file path.
Entry | Available values | Default | Description |
---|---|---|---|
CMAKE_INSTALL_PREFIX | Path string | /usr/local |
Path to install onnc into |
CMAKE_BUILD_TYPE | Debug ,Release |
Release |
Build mode |
LLVM_CONFIG | File path string | System default path | Path of llvm-config |
ONNX_INCLUDE_DIR | Path string | System default path | Path to include directory of onnx |
ONNX_LIBRARIES | File path string list | System default paths | Path of onnx and onnx_proto libraries |
ONNX_LIBRARIE_onnx | File path string | System default path | Path of onnx library |
ONNX_LIBRARIE_onnx_proto | File path string | System default path | Path of onnx_proto library |
ONNX_NAMESPACE | string | onnx |
Namespace of onnx |
SKYPAT_INCLUDE_DIR | Path string | /usr/local/include |
Path to include directory of SkyPat |
SKYPAT_LIBRARIES | File path string | System default path | Path of SkyPat library |
TARGET_ALL | ON ,OFF |
ON |
Whether to build all targets |
TARGET_SOPHON | ON ,OFF |
ON |
Whether to build Sophon targets |
TARGET_X86 | ON ,OFF |
ON |
Whether to build X86 targets |
USE_LLVM | ON ,OFF |
ON |
Whether to use LLVM |
ENABLE_CLOCK_GETTIME | ON ,OFF |
OFF |
Whether to enable clock_gettime function |
ENABLE_GETTIMEOFDAY | ON ,OFF |
ON |
Whether to enable gettimeofday function |
ENABLE_PTHREAD | ON ,OFF |
ON |
Whether to enable pthread |
ENABLE_UNITTEST | ON ,OFF |
ON |
Whether to build unit test |
ENABLE_WERROR | ON ,OFF |
OFF |
Whether to use -Werror flag |
USE_MKLDNN | ON ,OFF |
ON |
Whether to use MKLDNN for libonnc-rt |
MKLDNN_ROOT | File path string | System default path | Path of MKLDNN libraries |
Use cmake -L ..
inside build
directory to get more detailed options.