Get ONNX Runtime Build Information using C++

Get ONNX Runtime Build Information using C++

Obtaining the ONNX Runtime build information can be useful for several reasons. It provides developers with essential insights into the configuration, and capabilities of the ONNX Runtime library. This information is valuable for debugging, compatibility checks, and ensuring optimal performance. This tutorial demonstrates how to get ONNX Runtime build information using C++.

In the following code, we retrieve the build information of the ONNX Runtime as a string. The returned string contains details such as Git branch, Git commit ID, build type (e.g. Debug, Release) and CMake C++ compiler flags. The build information is printed to the console.

#include <iostream>
#include <onnxruntime_cxx_api.h>

int main()
{
    std::string info = Ort::GetBuildInfoString();
    std::cout << info << std::endl;

    return 0;
}

The output of the provided code would typically look something like this:

ORT Build Info: git-branch=, git-commit-id=, build type=Release, cmake cxx flags: -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection -fcf-protection -O3 -Wl,--strip-all -ffunction-sections -fdata-sections -DCPUINFO_SUPPORTED

Leave a Comment

Cancel reply

Your email address will not be published.