Skip to main content

Build Dakota from Source

·435 words·3 mins
Jin Li
Author
Jin Li
Fate lies within the lightcone.

Build Dakota
#

Prerequisites
#

Dakota relies on some other tools and libraries. Please refer to the Dakota’s official website. Most of the tools (such as CMake, Python) are already installed. The ones that need to take care of are:

  • Linear Algebra libraries: BLAS and LAPACK
  • Boost

System information of my case:

Install Prerequisites
#

  1. The linear algebra libraries BLAS and LAPACK are already in the moose conda environment. Please refer to “Build SAM from Source” for how to install moose conda environment using Mambaforge.

  2. Install Boost 1.69.0. I also tried Boost 1.80, but it didn’t work.

    1. Download Boost 1.69.0 source code from https://boostorg.jfrog.io/artifactory/main/release/1.69.0/source/boost_1_69_0.tar.gz. Or use following command:
      1
      
      wget https://boostorg.jfrog.io/artifactory/main/release/1.69.0/source/boost_1_69_0.tar.gz
    2. Extract the source code:
      1
      
      tar xzf boost_1_69_0.tar.gz
    3. Configure and install. --prefix option specifies the installation location:
      1
      2
      3
      
      cd boost_1_69_0
      ./bootstrap.sh --prefix=${HOME}/local/boost/1.69
      ./b2 -j4 install

Setup Dakota compiling environment
#

  1. Activate moose conda environment:

    1
    
    mamba activate moose
  2. Add Boost dynamic linked library to the LD_LIBRARY_PATH:

    1
    
    export LD_LIBRARY_PATH=${HOME}/local/boost/1.69:$LD_LIBRARY_PATH

    Or if you use Environment Modules to manage your libraries, you can make a module file for Boost and load the Boost module. Please refer to “Use Environment Module to Manage Software Packages and Environment Variables in Linux” for how to use Environment Modules.

Build Dakota from Source
#

Build Dakota
#

  1. Download Dakota source code. I downloaded the Dakota version 1.16.0, Source (Unix/OS X) from https://dakota.sandia.gov/sites/default/files/distributions/public/dakota-6.16.0-public-src-cli.tar.gz. Or you can download it via command:

    1
    
    wget https://dakota.sandia.gov/sites/default/files/distributions/public/dakota-6.16.0-public-src-cli.tar.gz
  2. Extract the source code:

    1
    
    tar xzf dakota-6.16.0-public-src-cli.tar.gz
  3. Make a build directory. Usually we can make the build directory inside the source code directory:

    1
    2
    
    cd dakota-6.16.0-public-src-cli
    mkdir build
  4. Configure in the build directory:

    1
    2
    
    cd build
    cmake -DCMAKE_INSTALL_PREFIX=${HOME}/local/dakota/6.16.0 ..

    Here we specify ${HOME}/local/dakota/6.16.0 as the Dakota installation directory.

  5. Build Dakota:

    1
    
    make -j 4 

    It may take a while.

Test Dakota
#

Test the Dakota build:

1
2
cd test 
ctest -j 4 -L Accept

If all the tests are passed, it shows the Dakota build was successful.

Install Dakota
#

Finally you can install Dakota:

1
2
cd ..
make install

The installation location is ${HOME}/local/dakota/6.16.0. You should add the Dakota binary executable to the system PATH:

1
export PATH=${HOME}/local/dakota/6.16.0/bin:$PATH

so that the system can find it. Or you can make a symbolic link for it to link it to you executable directory. For example, I have all my user’s exectable or tools in $HOME/bin, so I linked Dakota binary executable to this directory:

1
ln -s ${HOME}/local/dakota/6.16.0/bin/dakota $HOME/bin

You can check whether Dakota is recongnized by the system using:

1
dakota -v