| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
function execute() { |
| 4 |
stdbuf -o0 -e0 echo "% $@" ; |
| 5 |
if [ $# -gt 0 ] ; then |
| 6 |
if [ $1 == "module" ] ; then |
| 7 |
module "${@:2}" ; |
| 8 |
elif [ $1 == "source" ] ; then |
| 9 |
source "${@:2}" ; |
| 10 |
else |
| 11 |
eval "$@" ; |
| 12 |
fi |
| 13 |
fi |
| 14 |
if [ $? -ne 0 ] ; then |
| 15 |
echo "'$@' failed."; |
| 16 |
exit 1; |
| 17 |
fi |
| 18 |
} |
| 19 |
|
| 20 |
function cd_to_new_dir() |
| 21 |
{ |
| 22 |
execute rm -rf $1 |
| 23 |
execute mkdir $1 |
| 24 |
execute cd $1 |
| 25 |
} |
| 26 |
|
| 27 |
function exit_with_message() |
| 28 |
{ |
| 29 |
echo $1 |
| 30 |
exit 1 |
| 31 |
} |
| 32 |
|
| 33 |
function make_and_install() |
| 34 |
{ |
| 35 |
make -j 16 || exit_with_message "Failed building $1" |
| 36 |
make install || exit_with_message "Failed installing $1" |
| 37 |
} |
| 38 |
|
| 39 |
function build_yaml() |
| 40 |
{ |
| 41 |
productName=yaml |
| 42 |
|
| 43 |
cd_to_new_dir ${output_dir}/${productName} |
| 44 |
execute tar -xzf ${sierra_proj}/TPLs_src/spack/spack_tpls/yaml-cpp/*.tar.gz |
| 45 |
cd_to_new_dir ${productName}_build |
| 46 |
|
| 47 |
execute cmake -DCMAKE_BUILD_TYPE=${build_type^^} -DYAML_CPP_BUILD_TESTS=false -DCMAKE_INSTALL_PREFIX=../${productName}_install ../yaml-cpp |
| 48 |
make_and_install $productName |
| 49 |
} |
| 50 |
|
| 51 |
function setup_trilinos_with_krino() |
| 52 |
{ |
| 53 |
productName=trilinos |
| 54 |
|
| 55 |
trilinos_dir=${output_dir}/${productName} |
| 56 |
if [ ! -d ${trilinos_dir} ] ; then |
| 57 |
execute mkdir ${trilinos_dir} |
| 58 |
fi |
| 59 |
execute cd ${trilinos_dir} |
| 60 |
|
| 61 |
if [ ! -d Trilinos ] ; then |
| 62 |
execute git clone -b develop https://github.com/trilinos/Trilinos.git Trilinos |
| 63 |
else |
| 64 |
execute cd Trilinos |
| 65 |
execute git checkout develop |
| 66 |
execute git clean -fd |
| 67 |
execute git reset --hard |
| 68 |
execute git pull |
| 69 |
execute cd .. |
| 70 |
fi |
| 71 |
|
| 72 |
if [ -d Trilinos/packages/krino ] ; then |
| 73 |
execute rm -rf Trilinos/packages/krino; |
| 74 |
execute rm -rf Trilinos/packages/stk; |
| 75 |
fi |
| 76 |
if [ ! -L Trilinos/packages/krino ] ; then |
| 77 |
execute ln -s ${sierra_proj}/krino Trilinos/packages |
| 78 |
execute ln -s ${sierra_proj}/stk Trilinos/packages |
| 79 |
fi |
| 80 |
} |
| 81 |
|
| 82 |
function build_trilinos_with_krino() |
| 83 |
{ |
| 84 |
productName=trilinos |
| 85 |
|
| 86 |
execute cd ${output_dir}/${productName} |
| 87 |
|
| 88 |
rm -rf ${productName}_install |
| 89 |
cd_to_new_dir ${productName}_build |
| 90 |
|
| 91 |
export TRILINOS_INSTALL_DIR=../${productName}_install |
| 92 |
execute $sierra_proj/krino/cmake_install_test/run_cmake_krino |
| 93 |
make_and_install $productName |
| 94 |
} |
| 95 |
|
| 96 |
function setup_environment() |
| 97 |
{ |
| 98 |
execute source /etc/profile.d/modules.sh |
| 99 |
execute module purge |
| 100 |
|
| 101 |
execute source $sierra_proj/krino/cmake_install_test/load_gcc_modules |
| 102 |
|
| 103 |
execute module list |
| 104 |
execute env |
| 105 |
} |
| 106 |
|
| 107 |
function runTests() |
| 108 |
{ |
| 109 |
cd $1 |
| 110 |
ctest -j 16 || exit_with_message "$2 tests failed" |
| 111 |
cd ../.. |
| 112 |
} |
| 113 |
|
| 114 |
sierra_proj=${SIERRA_PROJ:-${PWD}} |
| 115 |
output_dir=${OUTPUT_DIR:-${PWD}/../krino-cmake-testing} |
| 116 |
|
| 117 |
cuda_on_or_off=${CUDA:-OFF} |
| 118 |
build_type=${CMAKE_BUILD_TYPE:-release} |
| 119 |
date_suffix=`date +%F_%H-%M-%S` |
| 120 |
|
| 121 |
if [ ! -d ${output_dir} ] ; then |
| 122 |
execute mkdir ${output_dir} |
| 123 |
fi |
| 124 |
execute rm -rf ${output_dir}/yaml |
| 125 |
|
| 126 |
setup_trilinos_with_krino |
| 127 |
setup_environment |
| 128 |
|
| 129 |
build_trilinos_with_krino |
| 130 |
build_yaml |
| 131 |
build_trilinos_with_krino |