[24649] | 1 | #!/bin/bash
|
---|
| 2 | set -eu
|
---|
| 3 |
|
---|
| 4 |
|
---|
| 5 | # Constants
|
---|
| 6 | #
|
---|
| 7 | DAK_ROOT=${ISSM_DIR}/externalpackages/dakota
|
---|
| 8 | VER="6.2"
|
---|
| 9 |
|
---|
| 10 | ## Environment
|
---|
| 11 | #
|
---|
| 12 | export BLAS_LIBS="-L${ISSM_DIR}/externalpackages/petsc/install/lib -lfblas -L/usr/local/gfortran/lib -lgfortran" # Need to export BLAS_LIBS *and* pass it as an option to CMake to ensure that external packages also find it
|
---|
| 13 | export BOOST_ROOT=${ISSM_DIR}/externalpackages/boost/install
|
---|
| 14 | export CXXFLAGS='-std=c++98' # Setting CXXFLAGS to deal with C++11 incompatibility with Matlab's Boost (absolutely necessary for this version)
|
---|
| 15 | export DAK_BUILD=${DAK_ROOT}/build
|
---|
| 16 | export DAK_INSTALL=${DAK_ROOT}/install
|
---|
| 17 | export DAK_SRC=${DAK_ROOT}/src
|
---|
| 18 | export LAPACK_LIBS="-L${ISSM_DIR}/externalpackages/petsc/install/lib -lflapack -L/usr/local/gfortran/lib -lgfortran" # Need to export LAPACK_LIBS *and* pass it as an option to CMake to ensure that external packages also find it
|
---|
| 19 |
|
---|
| 20 | # Cleanup
|
---|
| 21 | rm -rf build install src
|
---|
| 22 | mkdir build install src
|
---|
| 23 |
|
---|
| 24 | # Download source
|
---|
| 25 | ${ISSM_DIR}/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/dakota-${VER}-public.src.tar.gz" "dakota-${VER}-public-src.tar.gz"
|
---|
| 26 |
|
---|
| 27 | # Unpack source
|
---|
| 28 | tar -zxvf dakota-${VER}-public-src.tar.gz
|
---|
| 29 |
|
---|
| 30 | # Move source to 'src' directory
|
---|
| 31 | mv dakota-${VER}.0.src/* src
|
---|
| 32 | rm -rf dakota-${VER}.0.src
|
---|
| 33 |
|
---|
| 34 | # Copy customized source and configuration files to 'src' directory
|
---|
| 35 | cp configs/${VER}/packages/DDACE/src/Analyzer/MainEffectsExcelOutput.cpp ${DAK_SRC}/packages/DDACE/src/Analyzer
|
---|
| 36 | cp configs/${VER}/packages/surfpack/src/surfaces/nkm/NKM_KrigingModel.cpp ${DAK_SRC}/packages/surfpack/src/surfaces/nkm
|
---|
| 37 | cp configs/${VER}/src/DakotaInterface.cpp ${DAK_SRC}/src
|
---|
| 38 | cp configs/${VER}/src/NonDLocalReliability.cpp ${DAK_SRC}/src
|
---|
| 39 | cp configs/${VER}/src/NonDSampling.cpp ${DAK_SRC}/src
|
---|
| 40 |
|
---|
| 41 | # Copy customized source and configuration files specific to Mac to 'src' directory
|
---|
| 42 | cp configs/${VER}/mac/cmake/BuildDakotaCustom.cmake ${DAK_SRC}/cmake
|
---|
| 43 | cp configs/${VER}/mac/cmake/DakotaDev.cmake ${DAK_SRC}/cmake
|
---|
| 44 | cp configs/${VER}/mac/packages/VPISparseGrid/src/sandia_rules.cpp ${DAK_SRC}/packages/VPISparseGrid/src
|
---|
| 45 |
|
---|
| 46 | # Configure
|
---|
| 47 | cd ${DAK_BUILD}
|
---|
| 48 | cmake \
|
---|
| 49 | -DBUILD_SHARED_LIBS=ON \
|
---|
| 50 | -DBUILD_STATIC_LIBS=OFF \
|
---|
| 51 | -DCMAKE_C_COMPILER=${MPI_HOME}/bin/mpicc \
|
---|
| 52 | -DCMAKE_CXX_COMPILER=${MPI_HOME}/bin/mpicxx \
|
---|
| 53 | -DCMAKE_Fortran_COMPILER=${MPI_HOME}/bin/mpif77 \
|
---|
| 54 | -DCMAKE_CXX_FLAGS="-fdelayed-template-parsing" \
|
---|
| 55 | -DHAVE_ACRO=OFF \
|
---|
| 56 | -DHAVE_JEGA=OFF \
|
---|
| 57 | -C${DAK_SRC}/cmake/BuildDakotaCustom.cmake \
|
---|
| 58 | -C${DAK_SRC}/cmake/DakotaDev.cmake \
|
---|
| 59 | ${DAK_SRC}
|
---|
| 60 |
|
---|
| 61 | # Compile and install
|
---|
| 62 | if [ $# -eq 0 ]; then
|
---|
| 63 | make
|
---|
| 64 | make install
|
---|
| 65 | else
|
---|
| 66 | make -j $1
|
---|
| 67 | make -j $1 install
|
---|
| 68 | fi
|
---|
| 69 |
|
---|
| 70 | cd ${DAK_INSTALL}
|
---|
| 71 |
|
---|
| 72 | # Comment out definition of HAVE_MPI in Teuchos config header file in order to
|
---|
| 73 | # avoid conflict with our definition
|
---|
| 74 | sed -i -e "s/#define HAVE_MPI/\/* #define HAVE_MPI *\//g" include/Teuchos_config.h
|
---|