[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 | #
|
---|
[24967] | 12 | LIBGFORTRAN=$(mdfind -onlyin /usr -name libgfortran.* | grep -n libgfortran.a | grep -v i386 | sed "s/[0-9]*://g")
|
---|
[24961] | 13 | LIBGFORTRAN_ROOT=${LIBGFORTRAN%/*}
|
---|
| 14 |
|
---|
| 15 | export BLAS_LIBS="-L${ISSM_DIR}/externalpackages/petsc/install/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
|
---|
[24649] | 16 | export BOOST_ROOT=${ISSM_DIR}/externalpackages/boost/install
|
---|
| 17 | export DAK_BUILD=${DAK_ROOT}/build
|
---|
| 18 | export DAK_INSTALL=${DAK_ROOT}/install
|
---|
| 19 | export DAK_SRC=${DAK_ROOT}/src
|
---|
[24824] | 20 | export GSL_HOME=${ISSM_DIR}/externalpackages/gsl/install
|
---|
[24961] | 21 | export LAPACK_LIBS="-L${ISSM_DIR}/externalpackages/petsc/install/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
|
---|
[24649] | 22 |
|
---|
| 23 | # Cleanup
|
---|
| 24 | rm -rf build install src
|
---|
| 25 | mkdir build install src
|
---|
| 26 |
|
---|
| 27 | # Download source
|
---|
| 28 | ${ISSM_DIR}/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/dakota-${VER}-public.src.tar.gz" "dakota-${VER}-public-src.tar.gz"
|
---|
| 29 |
|
---|
| 30 | # Unpack source
|
---|
| 31 | tar -zxvf dakota-${VER}-public-src.tar.gz
|
---|
| 32 |
|
---|
| 33 | # Move source to 'src' directory
|
---|
| 34 | mv dakota-${VER}.0.src/* src
|
---|
| 35 | rm -rf dakota-${VER}.0.src
|
---|
| 36 |
|
---|
| 37 | # Copy customized source and configuration files to 'src' directory
|
---|
| 38 | cp configs/${VER}/packages/DDACE/src/Analyzer/MainEffectsExcelOutput.cpp ${DAK_SRC}/packages/DDACE/src/Analyzer
|
---|
| 39 | cp configs/${VER}/packages/surfpack/src/surfaces/nkm/NKM_KrigingModel.cpp ${DAK_SRC}/packages/surfpack/src/surfaces/nkm
|
---|
| 40 | cp configs/${VER}/src/DakotaInterface.cpp ${DAK_SRC}/src
|
---|
| 41 | cp configs/${VER}/src/NonDLocalReliability.cpp ${DAK_SRC}/src
|
---|
| 42 | cp configs/${VER}/src/NonDSampling.cpp ${DAK_SRC}/src
|
---|
| 43 |
|
---|
| 44 | # Copy customized source and configuration files specific to Mac to 'src' directory
|
---|
| 45 | cp configs/${VER}/mac/cmake/BuildDakotaCustom.cmake ${DAK_SRC}/cmake
|
---|
| 46 | cp configs/${VER}/mac/cmake/DakotaDev.cmake ${DAK_SRC}/cmake
|
---|
[24653] | 47 | cp configs/${VER}/mac/cmake/InstallDarwinDylibs.cmake ${DAK_SRC}/cmake
|
---|
[24649] | 48 | cp configs/${VER}/mac/packages/VPISparseGrid/src/sandia_rules.cpp ${DAK_SRC}/packages/VPISparseGrid/src
|
---|
| 49 |
|
---|
| 50 | # Configure
|
---|
| 51 | cd ${DAK_BUILD}
|
---|
| 52 | cmake \
|
---|
| 53 | -DBUILD_SHARED_LIBS=ON \
|
---|
| 54 | -DBUILD_STATIC_LIBS=OFF \
|
---|
| 55 | -DCMAKE_C_COMPILER=${MPI_HOME}/bin/mpicc \
|
---|
| 56 | -DCMAKE_CXX_COMPILER=${MPI_HOME}/bin/mpicxx \
|
---|
| 57 | -DCMAKE_Fortran_COMPILER=${MPI_HOME}/bin/mpif77 \
|
---|
| 58 | -DCMAKE_CXX_FLAGS="-fdelayed-template-parsing" \
|
---|
[24663] | 59 | -DBoost_NO_BOOST_CMAKE=TRUE \
|
---|
[24649] | 60 | -DHAVE_ACRO=OFF \
|
---|
| 61 | -DHAVE_JEGA=OFF \
|
---|
[24824] | 62 | -DHAVE_QUESO=ON \
|
---|
| 63 | -DDAKOTA_HAVE_GSL=ON \
|
---|
[24649] | 64 | -C${DAK_SRC}/cmake/BuildDakotaCustom.cmake \
|
---|
| 65 | -C${DAK_SRC}/cmake/DakotaDev.cmake \
|
---|
| 66 | ${DAK_SRC}
|
---|
| 67 |
|
---|
| 68 | # Compile and install
|
---|
| 69 | if [ $# -eq 0 ]; then
|
---|
| 70 | make
|
---|
| 71 | make install
|
---|
| 72 | else
|
---|
| 73 | make -j $1
|
---|
| 74 | make -j $1 install
|
---|
| 75 | fi
|
---|
| 76 |
|
---|
| 77 | cd ${DAK_INSTALL}
|
---|
| 78 |
|
---|
| 79 | # Comment out definition of HAVE_MPI in Teuchos config header file in order to
|
---|
| 80 | # avoid conflict with our definition
|
---|
| 81 | sed -i -e "s/#define HAVE_MPI/\/* #define HAVE_MPI *\//g" include/Teuchos_config.h
|
---|
[24653] | 82 |
|
---|
[24654] | 83 | # Set install_name for all shared libraries
|
---|
| 84 | cd ${DAK_INSTALL}/lib
|
---|
| 85 | for name in *.dylib; do
|
---|
| 86 | install_name_tool -id ${DAK_INSTALL}/lib/${name} ${name}
|
---|
| 87 | done
|
---|
| 88 |
|
---|
[24653] | 89 | ## Patch install names for certain libraries
|
---|
| 90 | #
|
---|
| 91 | # TODO: Figure out how to reconfigure source to apply these install names at compile time
|
---|
| 92 | #
|
---|
[24654] | 93 | install_name_tool -change libdakota_src_fortran.dylib ${DAK_INSTALL}/lib/libdakota_src_fortran.dylib libdakota_src.dylib
|
---|
| 94 | install_name_tool -change liblhs_mod.dylib ${DAK_INSTALL}/lib/liblhs_mod.dylib liblhs.dylib
|
---|
| 95 | install_name_tool -change liblhs_mods.dylib ${DAK_INSTALL}/lib/liblhs_mods.dylib liblhs.dylib
|
---|
| 96 | install_name_tool -change liblhs_mod.dylib ${DAK_INSTALL}/lib/liblhs_mod.dylib liblhs_mods.dylib
|
---|
| 97 | install_name_tool -change libteuchos.dylib ${DAK_INSTALL}/lib/libteuchos.dylib liboptpp.dylib
|
---|
| 98 | install_name_tool -change libdfftpack.dylib ${DAK_INSTALL}/lib/libdfftpack.dylib libpecos.dylib
|
---|
| 99 | install_name_tool -change liblhs.dylib ${DAK_INSTALL}/lib/liblhs.dylib libpecos.dylib
|
---|
| 100 | install_name_tool -change liblhs_mod.dylib ${DAK_INSTALL}/lib/liblhs_mod.dylib libpecos.dylib
|
---|
| 101 | install_name_tool -change liblhs_mods.dylib ${DAK_INSTALL}/lib/liblhs_mods.dylib libpecos.dylib
|
---|
| 102 | install_name_tool -change libpecos_src.dylib ${DAK_INSTALL}/lib/libpecos_src.dylib libpecos.dylib
|
---|
| 103 | install_name_tool -change libteuchos.dylib ${DAK_INSTALL}/lib/libteuchos.dylib libpecos.dylib
|
---|
| 104 | install_name_tool -change libdfftpack.dylib ${DAK_INSTALL}/lib/libdfftpack.dylib libpecos_src.dylib
|
---|
| 105 | install_name_tool -change liblhs.dylib ${DAK_INSTALL}/lib/liblhs.dylib libpecos_src.dylib
|
---|
| 106 | install_name_tool -change liblhs_mod.dylib ${DAK_INSTALL}/lib/liblhs_mod.dylib libpecos_src.dylib
|
---|
| 107 | install_name_tool -change liblhs_mods.dylib ${DAK_INSTALL}/lib/liblhs_mods.dylib libpecos_src.dylib
|
---|
| 108 | install_name_tool -change libteuchos.dylib ${DAK_INSTALL}/lib/libteuchos.dylib libpecos_src.dylib
|
---|
| 109 | install_name_tool -change libsurfpack_fortran.dylib ${DAK_INSTALL}/lib/libsurfpack_fortran.dylib libsurfpack.dylib
|
---|