Click or drag to resize

Build and test

This topic shows how to setup a build environment and execute unit tests.

Introduction

After cloning the analytics repository, you can build different kinds of projects from the source code:

You can also execute unit tests.

Build .NET 6 projects
Build native dependencies

Novacta.Analytics relies on native dynamic-link libraries obtained via the Intel® oneAPI Math Kernel Library customDLL builder, version 2022.1. Such platform-specific dependencies have in turn a dependency on a threaded runtime, as reported in the following table:

Platform

Dependency

Runtime

win-x64

libna.dll

libiomp5md.dll

linux-x64

libna.so

libiomp5.so

osx-x64

libna.dylib

libiomp5.dylib

To prepare the native dependencies specific to a given platform, proceed as follows.

  • win-x64

    • On a Windows machine where you cloned the repo, download the Intel® oneAPI Base Toolkit, version 2022.1.2.154, and install the oneAPI Math Kernel Library.

      Caution note Caution

      The projects assume that the Windows Intel® oneAPI BaseKit has been installed in its default directory. Otherwise, paths referred to in project properties should be modified according to the location of the currently installed version.

    • Make sure the environmental variable ONEAPI_ROOT is properly set to target the folder where the Intel® oneAPI Base Toolkit is installed on your machine.

    • Install Visual Studio 2022 and customize the installation by adding the Desktop development with C++ workload.

    • Use Visual Studio 2022 to build the .vcxproj projects included in the repository sub-folder native/platforms/win-x64.

  • linux-x64

    • On a Linux machine where you cloned the repo, download the Intel® oneAPI Base Toolkit, version 2022.1.2.146, and install the oneAPI Math Kernel Library.

      Caution note Caution

      The following instructions assume that the Linux Intel® oneAPI BaseKit has been installed in its default directory. Otherwise, paths should be modified according to the location of the currently installed version.

    • Set variable LIBNAROOT to the directory where the repo has been cloned on your Linux machine. If, for example, the repo has been cloned under the path /Users/user/Source/Repos, execute the following command:

      Set LIBNAROOT
      export LIBNAROOT=/Users/user/Source/Repos/analytics
    • Build the libna.so native dependency:

      Build libna.so
      sudo make intel64 -C /opt/intel/oneapi/mkl/2022.0.2/tools/builder export=$LIBNAROOT/native/exports/mkl_exports_linux.txt name=$LIBNAROOT/src/Novacta.Analytics/runtimes/linux-x64/native/libna
    • Copy the required redistributable libiomp5.so:

      Copy libiomp5.so
      cp /opt/intel/oneapi/compiler/2022.0.2/linux/compiler/lib/intel64/libiomp5.so $LIBNAROOT/src/Novacta.Analytics/runtimes/linux-x64/native
  • osx-x64

    • On a macOS machine where you cloned the repo, download the Intel® oneAPI Base Toolkit, version 2022.1.0.92, and install the oneAPI Math Kernel Library.

      Caution note Caution

      The following instructions assume that the macOS Intel® oneAPI BaseKit has been installed in its default directory. Otherwise, paths should be modified according to the location of the currently installed version.

    • Set variable LIBNAROOT to the directory where the repo has been cloned on your macOS machine. If, for example, the repo has been cloned under the path /Users/user/Source/Repos, execute the following command:

      Set LIBNAROOT
      export LIBNAROOT=/Users/user/Source/Repos/analytics
    • Build the libna.dylib native dependency:

      Build libna.dylib
      sudo make intel64 -C /opt/intel/oneapi/mkl/2022.0.0/tools/builder export=$LIBNAROOT/native/exports/mkl_exports_osx.txt name=$LIBNAROOT/src/Novacta.Analytics/runtimes/osx-x64/native/libna
    • Copy the required redistributable libiomp5.dylib:

      Copy libiomp5.dylib
      cp /opt/intel/oneapi/compiler/2022.0.0/mac/compiler/lib/libiomp5.dylib $LIBNAROOT/src/Novacta.Analytics/runtimes/osx-x64/native
Build the documentation
  • Download and install on a Windows machine the latest version of Sandcastle Help File Builder.

  • Inspect the properties of the SHFB project available in folder Novacta.Analytics.Documentation.

    Notice that the project relies on the Novacta.Shfb.LatexTools package, which needs to be properly configured in order to manage the LaTeX content required to compile reference and conceptual files. See here how to get started with the tools.

  • From the Components tab, select the Novacta.Shfb.LatexComponent in the Build Components in this project list.

  • Push the Configure button to set options LaTeX bin folder and DviSvgm bin folder, in order to target the LaTeX distribution installed on your machine.

  • Build the project from the SHFB standalone GUI, or via the SHFB Visual Studio package for Visual Studio 2022.

Unit tests
  • From a shell of your choice, change the current directory to folder Novacta.Analytics.Tests.

    Native dependencies are automatically placed in the test directory. However, to resolve the dependencies on a Linux or macOS target machine at runtime, the following commands need to be executed.

    If you are on a Linux machine:

    Preparing Linux environments for tests
    export LD_LIBRARY_PATH=.

    or, if you are on a macOS machine:

    Preparing macOS environments for tests
    export DYLD_LIBRARY_PATH=.
  • To run unit tests, execute the dotnet test command.