Building Dakota on Ubuntu 12.04 LTS: Difference between revisions

From CSDMS
No edit summary
m Final touch-ups before release
Line 1: Line 1:
The developers of Dakota provide [https://dakota.sandia.gov/content/install-dakota-0 binary distributions] for Mac OS X and the CentOS (RHEL-compatible) Linux distribution.
The developers of Dakota at Sandia National Laboratory provide [https://dakota.sandia.gov/content/install-dakota-0 binary distributions] for Mac OS X and the CentOS (RHEL-based) Linux distribution.
They don't, however, provide a binary for the Ubuntu (Debian-compatible) Linux distribution,
They don't, however, provide a binary for the Ubuntu (Debian-based) Linux distribution,
requesting that users compile Dakota from source.
requesting that users compile Dakota from source.
This is a [https://dakota.sandia.gov/content/build-compile-source-code long and moderately difficult task],
This is a [https://dakota.sandia.gov/content/build-compile-source-code long and moderately difficult task]
so it may be out of reach for many Dakota users who prefer to use Ubuntu.
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,
Additionally,
the [https://travis-ci.org Travis CI] web service that CSDMS uses for integration testing
the [https://travis-ci.org Travis CI] web service that the CSDMS IF uses for integration testing
runs Ubuntu 12.04 LTS,
runs Ubuntu 12.04 LTS,
so for us to test our software with Dakota,
so for us to test our software with Dakota,
Line 14: Line 15:
== Instructions from the Dakota developers ==
== Instructions from the Dakota developers ==


The Dakota developers provide help for building Dakota from source.
The Dakota developers provide helpful hints for building Dakota from source.
In particular,
In particular,
I followed their instructions
I followed their instructions
Line 39: Line 40:
== Install Dependencies ==
== Install Dependencies ==


Here are the Ubuntu packages that are both required
The following Ubuntu packages are both required
and are available through the package manager
and are available through the package manager
(i.e., they don't need to be built from source):
(i.e., they don't need to be built from source):
Line 68: Line 69:
  cd boost_1_49_0
  cd boost_1_49_0
  ./bootstrap.sh --prefix=${HOME}/dakota-6.4.0.Linux-Ubuntu.x86_64
  ./bootstrap.sh --prefix=${HOME}/dakota-6.4.0.Linux-Ubuntu.x86_64
  ./b2 -j4 install
  ./b2 install




Line 102: Line 103:
Additional information on the Dakota CMake script can be found [https://dakota.sandia.gov/content/using-builddakotatemplatecmake-script here].
Additional information on the Dakota CMake script can be found [https://dakota.sandia.gov/content/using-builddakotatemplatecmake-script here].


Configure the build:
Run CMake to configure the build:


  cmake -C BuildDakota.cmake /home/mpiper/dakota-6.4-public.src
  cmake -C BuildDakota.cmake /home/mpiper/dakota-6.4-public.src
Line 110: Line 111:
  make
  make


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


  cd test && make test
  cd test && make test
Line 149: Line 150:
</blockquote>
</blockquote>


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

Revision as of 17:08, 22 August 2016

The developers of Dakota at Sandia National Laboratory 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
  • libteuchos-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

http://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!