Building DAKOTA

From ASCEND
Jump to: navigation, search

DAKOTA (Design Analysis Kit for Optimisation and Terascale Applications) is an optimisation toolkit that we are evaluating as a wrapper for ASCEND as well as other simulations (eg Solstice), to optimise complex systems. Note that Dakota is in no way a dependency or requirement for running ASCEND.

Since the documentation of Dakota is not updated to Ubuntu 18.04, we have prepared the following concise instructions for getting it up and running on that distro:

Dakota 6.10 on Ubuntu 18.04

# install prerequisites
sudo apt-get install gcc g++ gfortran cmake libboost-dev libboost-all-dev libblas-dev liblapack-dev libopenmpi-dev openmpi-bin openmpi-doc xorg-dev libmotif-dev gsl-bin libgsl0-dev subversion flex bison default-jdk doxygen texlive-latex-base
# download and unpack the source code (version 6.10)
cd ~/src
wget https://dakota.sandia.gov/sites/default/files/distributions/public/dakota-6.10-release-public.src.tar.gz
tar zxf dakota-6.10*.gz
cd dakota-6.10.0.src
# build
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/home/john/.local ..
#  you can use 'make -j8' to go faster, if you have more CPUs than my laptop...
make -j4
cd test && ctest -j 4 -L Accept

These steps result in all tests passing.

Note that you have to explicitly write out your installation path in the cmake line, hence -DCMAKE_INSTALL_PREFIX=/home/john/.local. If you write -DCMAKE_INSTALL_PREFIX=$HOME/.local or -DCMAKE_INSTALL_PREFIX=~/.local, it doesn't work. This seems like a bug. Assuming you've done this, you can then install dakota using

make install
export PATH=~/.local:$PATH LD_LIBRARY_PATH=~/.local/lib:$LD_LIBRARYPATH
dakota --help

You can add the 'export' line to your ~/.profile if you want it to be available automatically in future login sessions.

If you want to be able to run optimisations of Python-based codes, you can use the 'black box' option (system call), or you can turn on the Python 'analysis driver', by adding the following to your cmake command line:

-DDAKOTA_PYTHON=ON

It is possible to use Dakota in a 'sandwich' configuration, eg your program calls Dakota, which makes multiple evaluation calls back to a subroutine in your program again. We are working to figure out an example of how to do that firstly in Python.

Dakota 6.9 on Ubuntu 18.04

Dakota 6.9 built using the same steps as above (for 6.10 on Ubuntu 18.04) results in the following error. The error is resolved by updating to Dakota version 6.10, or else reportedly by adding #include <cmath> at the top of the file packages/external/JEGA/Utilities/include<JEGAConfig.hpp.

/home/john/src/dakota-6.9.0.src/packages/external/JEGA/Utilities/src/DiscreteDesignVariableNature.cpp: In function ‘double JEGA::Utilities::relative_difference(double, double)’:
/home/john/src/dakota-6.9.0.src/packages/external/JEGA/Utilities/src/DiscreteDesignVariableNature.cpp:106:13: error: ‘isnan’ is not a member of ‘std’
     if(std::isnan(arg_a) || std::isnan(arg_b)) return max_val;
             ^~~~~
/home/john/src/dakota-6.9.0.src/packages/external/JEGA/Utilities/src/DiscreteDesignVariableNature.cpp:106:34: error: ‘isnan’ is not a member of ‘std’
     if(std::isnan(arg_a) || std::isnan(arg_b)) return max_val;
                                  ^~~~~
/home/john/src/dakota-6.9.0.src/packages/external/JEGA/Utilities/src/DiscreteDesignVariableNature.cpp:109:8: error: ‘fabs’ was not declared in this scope
     if(fabs(arg_b) > max_val)
        ^~~~
/home/john/src/dakota-6.9.0.src/packages/external/JEGA/Utilities/src/DiscreteDesignVariableNature.cpp:109:8: note: suggested alternative: ‘labs’
     if(fabs(arg_b) > max_val)
        ^~~~
        labs
Scanning dependencies of target sandia_cubature_prb
/home/john/src/dakota-6.9.0.src/packages/external/JEGA/Utilities/src/DiscreteDesignVariableNature.cpp:123:13: error: ‘fabs’ was not declared in this scope
     arg_a = fabs(arg_a);
             ^~~~
[ 40%] Building CXX object packages/external/VPISparseGrid/test/CMakeFiles/sandia_rules2_prb.dir/sandia_rules2_prb.cpp.o
/home/john/src/dakota-6.9.0.src/packages/external/JEGA/Utilities/src/DiscreteDesignVariableNature.cpp:123:13: note: suggested alternative: ‘labs’
     arg_a = fabs(arg_a);
             ^~~~
             labs