Building Dakota on Ubuntu 12.04 LTS

From CSDMS

The developers of Dakota at Sandia National Laboratories provide binary distributions for Mac OS X and the CentOS (RHEL-based) Linux distribution. They don't, however, provide a binary for the Ubuntu (Debian-based) Linux distribution, requesting that users compile Dakota from source. This is a long and moderately difficult task which may be out of reach for many Dakota users on Linux who prefer to use Ubuntu. CSDMS can help these users by providing a binary distribution of Dakota built in Ubuntu Linux. Additionally, the Travis CI web service that the CSDMS IF uses for integration testing runs Ubuntu 12.04 LTS, so for us to test our software with Dakota, it would be convenient to have a pre-built binary that can be easily accessed by Travis. These are a set of notes for building Dakota from source on Ubuntu 12.04 LTS.


Instructions from the Dakota developers

The Dakota developers provide helpful hints for building Dakota from source. In particular, I followed their instructions

although, as always, the details are important, so I'll try to be careful in explaining what I did. I chose not to build optional features such as OpenMPI, X Windows, and Python.


Set up an Ubuntu VM

We don't have an Ubuntu test machine at CSDMS, so I installed Ubuntu 12.04 LTS as a VM on my iMac using VirtualBox.

Be sure to provide at least:

  • 20 GB of hard disk space
  • 2 GB of system memory

I couldn't compile the Boost library until I bumped up the base system memory. Graphics memory and acceleration aren't needed.


Install Dependencies

The following Ubuntu packages are both required and are available through the package manager (i.e., they don't need to be built from source):

  • libblas-dev (no need to symlink libblas.so -> libblas.so.3)
  • liblapack-dev (no need to symlink liblapack.so -> liblapack.so.3)
  • g++
  • gfortran
  • fort77
  • libtrilinos-dev (although this lib optional, it will be built by Dakota unless it's installed)

Install these packages with sudo apt-get install {package name} before doing anything else.


Build CMake

The version (2.8.7) of CMake provided with the Ubuntu distro is older than the version (2.8.9) recommended by the Dakota developers. Their instructions for obtaining, compiling, and installing CMake worked.


Build Boost

The version (1.48) of Boost provided with the Ubuntu distro is older than the version (1.49) recommended by the Dakota developers. Their instructions for obtaining, compiling, and installing Boost worked, but it took several attempts. I chose to install Boost along with Dakota, so my actions, which differed slightly from those in the instructions, were:

tar xzf boost_1_49_0.tar.gz
cd boost_1_49_0
./bootstrap.sh --prefix=${HOME}/dakota-6.4.0.Linux-Ubuntu.x86_64
./b2 install


Build Dakota from source

Download the Dakota source and unpack it:

wget https://dakota.sandia.gov/sites/default/files/distributions/public/dakota-6.4-public.src.tar.gz
tar zxf dakota-6.4-public.src.tar.gz

Make a build directory:

cd dakota-6.4-public.src
mkdir build && cd build

Copy the Dakota CMake script into the build directory:

cp ../cmake/BuildDakotaTemplate.cmake BuildDakota.cmake

I made two changes to the script. I set the Boost path:

set( BOOST_ROOT "home/mpiper/dakota-6.4.0.Linux-Ubuntu.x86_64" CACHE PATH "Use non-standard Boost install" FORCE )
set( Boost_NO_SYSTEM_PATHS TRUE CACHE BOOL "Supress search paths other than BOOST_ROOT" FORCE )

and I set the install location:

set( CMAKE_INSTALL_PREFIX "home/mpiper/dakota-6.4.0.Linux-Ubuntu.x86_64" CACHE PATH "Path to Dakota installation" )

Additional information on the Dakota CMake script can be found here.

Run CMake to configure the build:

cmake -C BuildDakota.cmake /home/mpiper/dakota-6.4-public.src

Compile:

make

Test the build (this takes awhile, and only 71% of the tests succeeded for my build):

cd test && make test

Install:

cd ..
make install


Run an example

Follow the instructions for setting the environment, especially for setting the PATH and LD_LIBRARY_PATH variables.

Make sure Dakota runs:

dakota --version

Create a working directory and copy in the rosen_multidim.in example from the Dakota distribution:

mkdir example && cd example
cp /path/to/Dakota/examples/users/rosen_multidim.in .

Call Dakota with:

dakota -i rosen_multidim.in -o dakota.out &> run.log

View the output in dakota.out.


Distribution

I created a tarball from the build I developed in writing this article. I placed it at

https://csdms.colorado.edu/pub/tools/dakota/dakota-6.4.0.Linux-Ubuntu.x86_64.tar.gz

This is intended to be an Ubuntu 12.04 LTS version of the Linux binary distribution produced by the Dakota team and hosted at https://dakota.sandia.gov/download.html. If you use it and find problems, please let me know. Enjoy!