Building OpenNN

OpenNN has been written in ANSI C++. This means that the library can be built on any system with little effort. OpenNN includes project files for Qt Creator. When working with another compiler is needed, a project for it must be created. In this tutorial, you'll learn how to do that.

Contents:

Visual Studio

In order to use OpenNN with Visual Studio a solution for it must be created. This is easily done using Cmake. In a terminal, go to your OpenNN folder and run the following command.

				mkdir build
cd build
cmake ..

The necessary files for a Visual Studio solution will be created in the build directory.

Please mind the following dependencies:
  • The folder opennn contains the OpenNN source libray.
  • The folder eigen contains the Eigen template library, which is used by OpenNN.
  • The folder examples contains several applications which use OpenNN.
  • The folder tests contains another application which use OpenNN.

Execute the file opennn.sln, and compile the Visual Studio project opennn. Select Release as the build type. Once the solution has been created, you can run the example applications, each located in its respective folder and the .exe file in a Release directory. A MS-DOS console should appear with the results of the corresponding example. To develop your own neural networks application, use the blank example.

Make

The process for building OpenNN using Make is really simple. Got to your OpenNN folder and run the following code to generate the necessary MakeFiles:

				mkdir build
cd build
cmake -DCMAKE_TYPE_BUILD=Release ..

OpenNN includes CMake files compatibles with MPI and OpenMP compilations. You just have to use "-D__OPENNN_MPI__=1" for the MPI compilation (requires mpi compiler), or "-D__OPENNN_OMP__=1" for the OpenMP compilation.

Now Simply run

				make

All necessary files will be built and OpenNN will be ready to use. If you want to make only certain parts of the whole OpenNN repository you can do so by passing some argument to the above command (E.g: make opennn, make tests, ...). Please mind the following dependencies:

  • The OpenNN source library depends on the Eigen library.
  • All the examples depend on OpenNN.
  • The tests also depend on OpenNN.

Once all the makefiles has been created, you can run the example applications and create your own neural networks program. Take note that the executable files must be moved to a folder inside its current directory (E.g: path_to_example_folder/example_file must be moved to path_to_example_folder/Release/example_file).

Qt Creator


Qt Creator is a cross-platform IDE (integrated development environment). That means that it can be used in Windows, Linux and MacOS. Note that OpenNN does not use the Qt library. In order to run OpenNN with Qt creator, follow the next steps:
  1. Download Qt.
  2. Download OpenNN.
  3. Run an example.
  4. Create your application.

(i) Download Qt

The first step is to download Qt, it can be done from here.

(ii) Download OpenNN

The second step is also to download OpenNN from Sourceforge or GitHub. OpenNN includes project files for Qt Creator. Nevertheless, the OpenNN library does not make use of the Qt Library.

(iii) Run an example

The opennn.pro project file for Qt Creator can be found in the opennn folder. To open the OpenNN project just double click on that file.

Many example subprojects are also included in the OpenNN distribution. From the opennn project select some example, for instance the simple_function_regression subproject. Then run that example by clicking on the play button or pressing Ctrl+R. Read the application code to see what the simple function regression example does. The next figure shows the iris plant example.

Iris plant example.

(iv) Create your application

Now you can create a new project in a blank example, in order to use the tasks of OpenNN that better suit your needs.

Blank project.

Bibliography