[24649] | 1 | #!/bin/bash
|
---|
| 2 | set -eu
|
---|
| 3 |
|
---|
| 4 |
|
---|
[25860] | 5 | ## Constants
|
---|
[24649] | 6 | #
|
---|
| 7 | VER="6.2"
|
---|
| 8 |
|
---|
[27188] | 9 | PREFIX="${ISSM_DIR}/externalpackages/dakota/install" # Set to location where external package should be installed
|
---|
[25860] | 10 |
|
---|
[25243] | 11 | # Find libgfortran so that we do not have to hardcode it.
|
---|
[25226] | 12 | #
|
---|
[25860] | 13 | # TODO:
|
---|
| 14 | # - Move this to etc/environment.sh
|
---|
| 15 | #
|
---|
[27406] | 16 | echo "Finding libgfortran..."
|
---|
[27541] | 17 | LIBGFORTRAN=$(find /usr /opt -name libgfortran* 2>/dev/null | egrep -n libgfortran.a | egrep -v i386 | sed "s/[0-9]*://g" | head -1)
|
---|
[24961] | 18 | LIBGFORTRAN_ROOT=${LIBGFORTRAN%/*}
|
---|
| 19 |
|
---|
[27191] | 20 | ## Environment
|
---|
| 21 | #
|
---|
[25860] | 22 | export BLAS_LIBS="-L${BLAS_ROOT}/lib -lfblas -L${LIBGFORTRAN_ROOT} -lgfortran" # Need to export BLAS_LIBS *and* pass it as an option to CMake to ensure that external packages also find it
|
---|
| 23 | export DAK_BUILD=${ISSM_DIR}/externalpackages/dakota/build # DO NOT CHANGE THIS
|
---|
| 24 | export DAK_INSTALL=${PREFIX} # DO NOT CHANGE THIS
|
---|
| 25 | export DAK_SRC=${ISSM_DIR}/externalpackages/dakota/src # DO NOT CHANGE THIS
|
---|
[27705] | 26 | export GSL_CONFIG=${GSL_HOME}/bin/gsl-config
|
---|
[25860] | 27 | export LAPACK_LIBS="-L${LAPACK_ROOT}/lib -lflapack -L${LIBGFORTRAN_ROOT} -lgfortran" # Need to export LAPACK_LIBS *and* pass it as an option to CMake to ensure that external packages also find it
|
---|
[27565] | 28 | export LDFLAGS="-framework CoreFoundation"
|
---|
[24649] | 29 |
|
---|
| 30 | # Cleanup
|
---|
[25860] | 31 | rm -rf ${DAK_BUILD} ${DAK_INSTALL} ${DAK_SRC}
|
---|
| 32 | mkdir -p ${DAK_BUILD} ${DAK_INSTALL} ${DAK_SRC}
|
---|
[24649] | 33 |
|
---|
| 34 | # Download source
|
---|
| 35 | ${ISSM_DIR}/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/dakota-${VER}-public.src.tar.gz" "dakota-${VER}-public-src.tar.gz"
|
---|
| 36 |
|
---|
| 37 | # Unpack source
|
---|
| 38 | tar -zxvf dakota-${VER}-public-src.tar.gz
|
---|
| 39 |
|
---|
| 40 | # Move source to 'src' directory
|
---|
[25860] | 41 | mv dakota-${VER}.0.src/* ${DAK_SRC}
|
---|
[24649] | 42 | rm -rf dakota-${VER}.0.src
|
---|
| 43 |
|
---|
| 44 | # Copy customized source and configuration files to 'src' directory
|
---|
| 45 | cp configs/${VER}/packages/DDACE/src/Analyzer/MainEffectsExcelOutput.cpp ${DAK_SRC}/packages/DDACE/src/Analyzer
|
---|
[26246] | 46 | cp configs/${VER}/packages/queso/src/misc/src/1DQuadrature.C ${DAK_SRC}/packages/queso/src/misc/src
|
---|
[24649] | 47 | cp configs/${VER}/packages/surfpack/src/surfaces/nkm/NKM_KrigingModel.cpp ${DAK_SRC}/packages/surfpack/src/surfaces/nkm
|
---|
[26240] | 48 | cp configs/${VER}/packages/VPISparseGrid/src/sandia_rules.cpp ${DAK_SRC}/packages/VPISparseGrid/src
|
---|
[24649] | 49 | cp configs/${VER}/src/DakotaInterface.cpp ${DAK_SRC}/src
|
---|
| 50 | cp configs/${VER}/src/NonDLocalReliability.cpp ${DAK_SRC}/src
|
---|
| 51 | cp configs/${VER}/src/NonDSampling.cpp ${DAK_SRC}/src
|
---|
| 52 |
|
---|
| 53 | # Copy customized source and configuration files specific to Mac to 'src' directory
|
---|
| 54 | cp configs/${VER}/mac/cmake/BuildDakotaCustom.cmake ${DAK_SRC}/cmake
|
---|
| 55 | cp configs/${VER}/mac/cmake/DakotaDev.cmake ${DAK_SRC}/cmake
|
---|
[24653] | 56 | cp configs/${VER}/mac/cmake/InstallDarwinDylibs.cmake ${DAK_SRC}/cmake
|
---|
[24649] | 57 |
|
---|
[27187] | 58 | # Disable requirement of Python 2 for TriBITS
|
---|
| 59 | sed -i'' -e 's|SET(PythonInterp_FIND_VERSION|#SET(PythonInterp_FIND_VERSION|' ${DAK_SRC}/packages/teuchos/cmake/tribits/package_arch/TribitsFindPythonInterp.cmake
|
---|
| 60 |
|
---|
[24649] | 61 | # Configure
|
---|
[27563] | 62 | #
|
---|
| 63 | # NOTE:
|
---|
| 64 | # - The -w option has been added to CMAKE_C_FLAGS, CMAKE_CXX_FLAGS, and
|
---|
| 65 | # CMAKE_Fortran_FLAGS. This should be removed for more recent versions of
|
---|
| 66 | # Dakota.
|
---|
| 67 | #
|
---|
[24649] | 68 | cd ${DAK_BUILD}
|
---|
| 69 | cmake \
|
---|
| 70 | -DBUILD_SHARED_LIBS=ON \
|
---|
| 71 | -DBUILD_STATIC_LIBS=OFF \
|
---|
| 72 | -DCMAKE_C_COMPILER=${MPI_HOME}/bin/mpicc \
|
---|
[27563] | 73 | -DCMAKE_C_FLAGS="-w" \
|
---|
[24649] | 74 | -DCMAKE_CXX_COMPILER=${MPI_HOME}/bin/mpicxx \
|
---|
[27563] | 75 | -DCMAKE_CXX_FLAGS="-fdelayed-template-parsing -w" \
|
---|
[27187] | 76 | -DCMAKE_CXX_STANDARD="11" \
|
---|
[24649] | 77 | -DCMAKE_Fortran_COMPILER=${MPI_HOME}/bin/mpif77 \
|
---|
[24663] | 78 | -DBoost_NO_BOOST_CMAKE=TRUE \
|
---|
[24649] | 79 | -DHAVE_ACRO=OFF \
|
---|
| 80 | -DHAVE_JEGA=OFF \
|
---|
[24824] | 81 | -DHAVE_QUESO=ON \
|
---|
| 82 | -DDAKOTA_HAVE_GSL=ON \
|
---|
[24649] | 83 | -C${DAK_SRC}/cmake/BuildDakotaCustom.cmake \
|
---|
| 84 | -C${DAK_SRC}/cmake/DakotaDev.cmake \
|
---|
| 85 | ${DAK_SRC}
|
---|
| 86 |
|
---|
| 87 | # Compile and install
|
---|
| 88 | if [ $# -eq 0 ]; then
|
---|
| 89 | make
|
---|
| 90 | make install
|
---|
| 91 | else
|
---|
| 92 | make -j $1
|
---|
| 93 | make -j $1 install
|
---|
| 94 | fi
|
---|
| 95 |
|
---|
| 96 | cd ${DAK_INSTALL}
|
---|
| 97 |
|
---|
| 98 | # Comment out definition of HAVE_MPI in Teuchos config header file in order to
|
---|
| 99 | # avoid conflict with our definition
|
---|
| 100 | sed -i -e "s/#define HAVE_MPI/\/* #define HAVE_MPI *\//g" include/Teuchos_config.h
|
---|
[24653] | 101 |
|
---|
[24654] | 102 | # Set install_name for all shared libraries
|
---|
| 103 | cd ${DAK_INSTALL}/lib
|
---|
| 104 | for name in *.dylib; do
|
---|
| 105 | install_name_tool -id ${DAK_INSTALL}/lib/${name} ${name}
|
---|
| 106 | done
|
---|
| 107 |
|
---|
[24653] | 108 | ## Patch install names for certain libraries
|
---|
| 109 | #
|
---|
| 110 | # TODO: Figure out how to reconfigure source to apply these install names at compile time
|
---|
| 111 | #
|
---|
[24654] | 112 | install_name_tool -change libdakota_src_fortran.dylib ${DAK_INSTALL}/lib/libdakota_src_fortran.dylib libdakota_src.dylib
|
---|
| 113 | install_name_tool -change liblhs_mod.dylib ${DAK_INSTALL}/lib/liblhs_mod.dylib liblhs.dylib
|
---|
| 114 | install_name_tool -change liblhs_mods.dylib ${DAK_INSTALL}/lib/liblhs_mods.dylib liblhs.dylib
|
---|
| 115 | install_name_tool -change liblhs_mod.dylib ${DAK_INSTALL}/lib/liblhs_mod.dylib liblhs_mods.dylib
|
---|
| 116 | install_name_tool -change libteuchos.dylib ${DAK_INSTALL}/lib/libteuchos.dylib liboptpp.dylib
|
---|
| 117 | install_name_tool -change libdfftpack.dylib ${DAK_INSTALL}/lib/libdfftpack.dylib libpecos.dylib
|
---|
| 118 | install_name_tool -change liblhs.dylib ${DAK_INSTALL}/lib/liblhs.dylib libpecos.dylib
|
---|
| 119 | install_name_tool -change liblhs_mod.dylib ${DAK_INSTALL}/lib/liblhs_mod.dylib libpecos.dylib
|
---|
| 120 | install_name_tool -change liblhs_mods.dylib ${DAK_INSTALL}/lib/liblhs_mods.dylib libpecos.dylib
|
---|
| 121 | install_name_tool -change libpecos_src.dylib ${DAK_INSTALL}/lib/libpecos_src.dylib libpecos.dylib
|
---|
| 122 | install_name_tool -change libteuchos.dylib ${DAK_INSTALL}/lib/libteuchos.dylib libpecos.dylib
|
---|
| 123 | install_name_tool -change libdfftpack.dylib ${DAK_INSTALL}/lib/libdfftpack.dylib libpecos_src.dylib
|
---|
| 124 | install_name_tool -change liblhs.dylib ${DAK_INSTALL}/lib/liblhs.dylib libpecos_src.dylib
|
---|
| 125 | install_name_tool -change liblhs_mod.dylib ${DAK_INSTALL}/lib/liblhs_mod.dylib libpecos_src.dylib
|
---|
| 126 | install_name_tool -change liblhs_mods.dylib ${DAK_INSTALL}/lib/liblhs_mods.dylib libpecos_src.dylib
|
---|
| 127 | install_name_tool -change libteuchos.dylib ${DAK_INSTALL}/lib/libteuchos.dylib libpecos_src.dylib
|
---|
| 128 | install_name_tool -change libsurfpack_fortran.dylib ${DAK_INSTALL}/lib/libsurfpack_fortran.dylib libsurfpack.dylib
|
---|