AO

artelnics/opennn

Developer tools
1,2 тыс. stars Качество 40 Тренд 60

OpenNN - Open Neural Networks Library

Обзор

OpenNN is a C++20 library for building, training and running neural networks. It supports tabular data, images, time series and text, with CPU and optional CUDA execution. Models can be embedded in C++ applications or exported as standalone source code for supported architectures. You need Git, CMake 3.24+, and a C++20 compiler with std::format and OpenMP: GCC 13+, Clang 17+, or Visual Studio 2022 C++ tools. On macOS, install the OpenMP runtime (libomp). CMake retrieves missing dependencies during the first configuration, so that step needs internet access. Clone the repository and configure a CPU build: Run the blank example on Linux/macOS or with a single-configuration generator: Next, follow the Iris example to train a classifier, evaluate it and export predictions as C or Python code. Install a C++20-compatible CUDA toolkit and cuDNN 9+.

README

OpenNN

OpenNN is a C++20 library for building, training and running neural networks. It supports tabular data, images, time series and text, with CPU and optional CUDA execution. Models can be embedded in C++ applications or exported as standalone source code for supported architectures.

I want to… Start here
Build and run my first network Quick start
Choose CPU/CUDA backends and build options Build options
Use OpenNN in my C++ application Install and link
Train, evaluate or export a model Examples
Update an 8.x application or model Migration
Understand the source folders Repository contents
Run or review performance comparisons Benchmarks
Contribute or run the tests Contributing
Use OpenNN under the AGPL or a commercial licence License

Tutorials are available on opennn.net.

Quick start

You need Git, CMake 3.24+, and a C++20 compiler with std::format and OpenMP: GCC 13+, Clang 17+, or Visual Studio 2022 C++ tools. On macOS, install the OpenMP runtime (libomp). CMake retrieves missing dependencies during the first configuration, so that step needs internet access.

Clone the repository and configure a CPU build:

git clone https://github.com/Artelnics/opennn.git
cd opennn
cmake -S . -B ../opennn-build -DCMAKE_BUILD_TYPE=Release -DOpenNN_DISABLE_CUDA=ON -DOpenNN_BUILD_TESTS=OFF -DOpenNN_BUILD_EXAMPLES=ON
cmake --build ../opennn-build --config Release --target blank --parallel

Run the blank example on Linux/macOS or with a single-configuration generator:

../opennn-build/bin/blank

With Visual Studio on Windows:

../opennn-build/bin/Release/blank.exe

Next, follow the Iris example to train a classifier, evaluate it and export predictions as C or Python code.

CUDA builds

Install a C++20-compatible CUDA toolkit and cuDNN 9+. Use a separate build directory so the CPU and CUDA configurations do not overwrite each other:

cmake -S . -B ../opennn-build/cuda -DCMAKE_BUILD_TYPE=Release -DOpenNN_REQUIRE_CUDA=ON -DOpenNN_BUILD_TESTS=OFF -DOpenNN_BUILD_EXAMPLES=OFF
cmake --build ../opennn-build/cuda --config Release --target opennn --parallel

Require CUDA explicitly to make missing GPU build dependencies an error.

Use OpenNN in your application

Install a completed build to a separate prefix:

cmake --install ../opennn-build --config Release --prefix ../opennn-install

In your application’s CMakeLists.txt, consume the installed target:

cmake_minimum_required(VERSION 3.24)
project(MyApplication LANGUAGES CXX)
find_package(OpenNN 26.0 CONFIG REQUIRED)
add_executable(my_application main.cpp)
target_link_libraries(my_application PRIVATE OpenNN::opennn)
target_compile_features(my_application PRIVATE cxx_std_20)

Configure the application with -DCMAKE_PREFIX_PATH=/absolute/path/to/opennn-install. The exported target supplies OpenNN’s include paths and dependency linkage, and the package still works after moving the install prefix. The package consumer is a complete working example.

Fetched Eigen and zlib are installed with the library. OpenMP, oneTBB, oneDNN, MKL and NVIDIA runtimes are not copied into the installation; supply those selected by the build. Use a compiler compatible with the one that built the package. Installation packages exclude example datasets and models.

Include the public module headers directly, for example #include "opennn/network/network.h". Do not include the private precompiled header opennn/core/pch.h in an application.

Repository contents

Folder What it contains
opennn/ The library: public headers, implementations, models and CPU/CUDA backends. See the module map.
examples/ Runnable applications and bundled data.
tests/ C++ unit tests of the library.
benchmarks/ OpenNN versus PyTorch comparisons and their measurement rules.
tools/ Verification scripts, code checkers, fuzzing, package checks and agent skills; see AGENTS.md.
.github/workflows/ Continuous integration.

Contributing and support

Base contributions on dev, include the validation you ran, and describe the resulting behavior in the pull request. A pull request can be merged only after its author has accepted the Contributor License Agreement; see CONTRIBUTING.md. AGENTS.md holds the engineering rules, verification commands and release procedure. For a bug report, include the OpenNN commit, operating system, compiler, CPU/CUDA configuration, reproduction command and error, and file it in GitHub Issues.

License

OpenNN is Copyright © 2026 Artificial Intelligence Techniques, S.L. (Artelnics) and Roberto López González, and is dual-licensed:

  • Open source: the GNU Affero General Public License, version 3 only (LICENSE.txt), with additional permissions for linking with NVIDIA CUDA, cuDNN and Intel oneMKL and for the code and model files that OpenNN generates.
  • Commercial: a licence from Artelnics for closed-source products and hosted services that cannot meet the AGPL’s terms. Write to [email protected].

LICENSING.md gives the details. OpenNN 8.x and earlier, and the development snapshots published before this change, were distributed under the GNU Lesser General Public License, version 2.1 or later, and copies of them keep those terms. Dependencies and downloadable pre-trained weights keep their own terms, listed in THIRD_PARTY_NOTICES.txt. Example data keeps its publishers’ terms, recorded in the SOURCE.md notice of each data folder.

View this README on GitHub

Рекомендуемые инструменты

Попробуйте другой запрос или уберите фильтр.

Установка

npx skillfish add artelnics/opennn