#! /bin/bash # This is an automated installation script to install Dakota automatically in $HOME/Dakota. # Execute this code as an user in your $HOME directory # Read and try to understand what this script does before using it. # # This script should work for Ubuntu. For CENTOS 7, you may have to modify certain details of how to install the mandatory required packages and the compiler mpicxx, and also on the path setting in the file $DAK_SRC/cmake/BuildDakotaCustom.cmake # 1. # Execute this script by issuing the command in a terminal: ## chmod +x sh inst_dakota_genetic.txt; ./inst_dakota_genetic.txt # # 2. Mandatory requirements 1: (i) CMake 3.10, (ii) unzip, (iii) g++, (iv) boost. # You must also ensure that CMake3 is in your PATH (check this by typing 'which cmake3' in a terminal. # For Ubuntu, these packages can be installed by typing in the terminal release=$(cat /etc/*-release | grep Ubuntu) if [ ! -z "$release" ] then sudo apt install -y cmake sudo apt install -y unzip sudo apt install -y g++ sudo apt install -y liblapack libblas libboost-all-dev fi # # For CENTOS 7, issue the command as su release=$(cat /etc/*-release | grep CentOS) ### for Centos 7. if [ ! -z "$release" ] then yum install -y cmake camke3 yum install -y unzip yum install -y g++ yum install -y libboost-all-dev fi # # If this does not work, google to trouble shoot. # # 3. Mandatory requirements 2: (i) libblas, (ii) liblapack libraries, (iii) mpicxx compiler must exist in your LINUX. # In Ubuntu, these are sitting in the following PATH # # i. /usr/lib/libblas.so # ii. /usr/lib/liblapack.so # iii. /usr/bin/mpicxx # # For Centos 7, these are sitting in the following PATH # i. /usr/lib64/libblas.a # ii. /usr/lib64/liblapack.a # iii. /usr/lib64/openmpi/bin/mpicxx # Check the existence of these libraries and compiler by issuing the commands in a terminal: ls -la /usr/lib/libblas.so ls -la /usr/lib/liblapack.so ls -la /usr/bin/mpicxx # or ls -la /usr/lib64/libblas.a ls -la /usr/lib64/liblapack.a ls -la /usr/lib64/openmpi/bin/mpicxx # If the responses are positive, that means these libraries and mpicxx exist and are sitting in the indicated path. # If these libraries are not installed, you have to install them by using release=$(cat /etc/*-release | grep CentOS) ### for Centos 7. if [ ! -z "$release" ] then yum install -y openmpi.x86_64 openmpi-devel.x86_64 liblapack blas-devel.x86_64 lapack-devel.x86_64 fi release=$(cat /etc/*-release | grep Ubuntu) if [ ! -z "$release" ] then sudo apt install liblapack libblas liblapack-dev libopenmpi-dev libblas-dev fi # 4. Download and install dakota automatically from the internet cd $HOME mkdir dakota-download dd=$HOME/dakota-download cd $dd ## wget https://dakota.sandia.gov/sites/default/files/distributions/public/dakota-6.10.0-release-public-src-UI.zip unzip dakota-6.10.0-release-public-src-UI.zip cd dakota-6.10.0-release-public-src-UI DAK_SRC=$(echo $PWD) mkdir -p $HOME/dakota-build DAK_BUILD=$HOME/dakota-build export DAK_SRC=$DAK_SRC export DAK_BUILD=$DAK_BUILD cp $DAK_SRC/cmake/BuildDakotaTemplate.cmake \ $DAK_SRC/cmake/BuildDakotaCustom.cmake #5. Edit $DAK_SRC/cmake/BuildDakotaCustom.cmake file to reflect your platform configuration. # Specifically, for Ubuntu, you have to correctly specify the path to the liblapack.so, libblas.so libraries, and also that for the executable mpicxx in the following portion in $DAK_SRC/cmake/BuildDakotaCustom.cmake, i.e., # set( DAKOTA_HAVE_MPI ON # CACHE BOOL "Build with MPI enabled" FORCE) # "/usr/lib/libblas.so" # "/usr/lib/liblapack.so" # "/usr/bin/mpicxx" # CACHE FILEPATH "Use MPI compiler wrapper" FORCE) # # # Download $DAK_SRC/cmake/BuildDakotaCustom.cmake for Ubuntu release=$(cat /etc/*-release | grep Ubuntu) if [ ! -z "$release" ] then mv $DAK_SRC/cmake/BuildDakotaCustom.cmake $DAK_SRC/cmake/BuildDakotaCustom.cmake.orig #wget http://comsics.usm.my/tlyoon/configrepo/howto/customise_centos/dakota/BuildDakotaCustom.cmake.Ubuntu wget https://www.dropbox.com/s/lq4ujhtzwu0358u/BuildDakotaCustom.cmake.Ubuntu?dl=0 -O BuildDakotaCustom.cmake.Ubuntu cp BuildDakotaCustom.cmake.Ubuntu $DAK_SRC/cmake/BuildDakotaCustom.cmake fi # 6. If your libblas, liblapack and mpicxx are sitting in a different path other than that specified in $DAK_SRC/cmake/BuildDakotaCustom.cmake, modify these lines in DAK_SRC/cmake/BuildDakotaCustom.cmake so that the paths are pointed to the corresponding path in your LINUX. # # release=$(cat /etc/*-release | grep CentOS) ### for Centos 7. if [ ! -z "$release" ] # 7. In CENTOS 7, lapack and blas are sitting in /usr/lib64/. Type release=$(cat /etc/*-release | grep CentOS) ### for Centos 7. then ls -la /usr/lib64/liblapack.a ls -la /usr/lib64/libblas.a # to check their existence. For mpicxx, it sits in /usr/lib64/openmpi/bin/ for CENTOS 7. Type ls -la /usr/lib64/openmpi/bin/mpicxx # to check for its existence. # fi # 8. For centos 7, the portion in the file $DAK_SRC/cmake/BuildDakotaCustom.cmake has to be modified to read # # set( DAKOTA_HAVE_MPI ON # CACHE BOOL "Build with MPI enabled" FORCE) # "/usr/lib64/libblas.a" # "/usr/lib64/liblapack.a" # "/usr/lib64/openmpi/bin/mpicxx" # CACHE FILEPATH "Use MPI compiler wrapper" FORCE) # # Download $DAK_SRC/cmake/BuildDakotaCustom.cmake for CentOS release=$(cat /etc/*-release | grep CentOS) if [ ! -z "$release" ] then mv $DAK_SRC/cmake/BuildDakotaCustom.cmake $DAK_SRC/cmake/BuildDakotaCustom.cmake.orig #wget http://comsics.usm.my/tlyoon/configrepo/howto/customise_centos/dakota/BuildDakotaCustom.cmake.CentOS wget https://www.dropbox.com/s/5i5s8g2l6e7csjb/BuildDakotaCustom.cmake.CentOS?dl=0 -O BuildDakotaCustom.cmake.CentOS cp BuildDakotaCustom.cmake.CentOS $DAK_SRC/cmake/BuildDakotaCustom.cmake fi # 9. Begin compilation. The dakota executable is known as dakota. If it gets compiled correctly, it should be found in $HOME/Dakota/bin or $DAK_BUILD/bin or $DAK_SRC/bin cd $DAK_BUILD cmake -C $DAK_SRC/cmake/BuildDakotaCustom.cmake $DAK_SRC make -j2 make install echo export PATH="$DAK_INSTALL"/bin:"$DAK_INSTALL"/share/dakota/test:$PATH echo export PYTHONPATH=$DAK_INSTALL/share/dakota/Python:$PYTHONPATH echo 'export PATH="$DAK_INSTALL"/bin:"$DAK_INSTALL"/share/dakota/test:$PATH' >> ~/.bashrc echo 'export PYTHONPATH=$DAK_INSTALL/share/dakota/Python:$PYTHONPATH' >> ~/.bashrc # 9. Check whether dakota has been properly installed which dakota