Skip to content

Build Guide

Michael Gardner edited this page Apr 17, 2019 · 1 revision

Build Guide

smelt can be built on different platforms using cmake version 3.0 or greater. The necessary configuration files to find external dependencies and build the library are included in the GitHub repository. Currently, smelt has been tested on the following system configurations:

  • Ubuntu 18.04 with GCC 7.3.0
  • Ubuntu 16.04
    • GCC 7.4.0
    • Clang 7.0.0
  • MacOS 10.14 with Xcode 10.2
  • MacOS 10.13 with GCC 7.4.0
  • Windows 10 with Visual Studio 19
  • Windows Server 2016 with Visual Studio 17

External Dependencies

smelt has several header-only dependencies which are all contained in the external folder of the master branch. These include:

  • Boost: For random number generation, statistical distributions and functions
  • Eigen: For linear algebra and matrix operations
  • Catch2: For unit testing
  • JSON for Modern C++: For reading and writing JSON

In addition to header-only dependencies, smelt also requires the following packages:

Mac and Windows users can install them through conda while Ubuntu users can install them using apt. Otherwise, these packages can alse be downloaded directly from Intel and installed manually.

The cmake build has been configured to discover these libraries through environment variables that need to be set prior to configuring the build. When installing the libraries manually or using apt, these environment variables can be set using scripts provided by Intel, which will be located in the installation directories for MKL and IPP. For MKL, run the script on Linux and MacOS to set the required environment variables. On Windows, this is achieved by running the mklvars.bat script. The process is the same for IPP, where the script is named (Linux and MacOS) or ippvars.bat (Windows). After these scripts have been executed, the build process can be started.

When using conda to install the dependencies, the header files and binaries are installed separately. Run the following commands to install the MKL and IPP dependencies:

  conda install -c intel mkl --yes
  conda install -c intel mkl-include --yes
  conda install -c intel ipp --yes
  conda install -c intel ipp-include --yes

Once installation has been completed, the MKLROOT and IPPROOT environment variables need to be set. Additionally, the libraries need to be added the path. This is done by running the following:

  • MacOS
  export MKLROOT=/path/to/miniconda
  export IPPROOT=/path/to/miniconda
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/miniconda/lib
  • Windows
  set MKLROOT=\path\to\miniconda
  set IPPROOT=\path\to\miniconda
  set PATH=%PATH%;%MKLROOT%\Library\bin
  set PATH=%PATH%;%IPPROOT%\Library\bin
  set PATH=%PATH%;%MKLROOT%\Library\lib
  set PATH=%PATH%;%IPPROOT%\Library\lib

Building and Testing

Once the required dependencies have been installed and environment variables set, smelt is ready to be built. To configure and start the build, run the following commands:

  • Linux and MacOS
  mkdir build
  cd build
  cmake .. -DCMAKE_BUILD_TYPE=Release
  • Windows
  mkdir build
  cd build
  cmake --build . --target ALL_BUILD --config Release

When the build has completed, run the suite of unit tests to make sure smelt functions correctly on your system:

  • Linux and MacOS
  ctest --verbose
  • Windows
  ctest -C Release --verbose

If all tests pass, smelt has been built successfully and is ready for use.

Clone this wiki locally
You can’t perform that action at this time.