| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
exe() { |
| 4 |
stdbuf -o0 -e0 echo "% $@" ; |
| 5 |
eval "$@" ; |
| 6 |
if [ $? -ne 0 ] ; then |
| 7 |
echo "'$@' failed."; |
| 8 |
exit 1; |
| 9 |
fi |
| 10 |
} |
| 11 |
|
| 12 |
sierra_proj=${SIERRA_PROJ:-${PWD}} |
| 13 |
output_dir=${OUTPUT_DIR:-${PWD}/../stk-cmake-testing} |
| 14 |
trilinos_dir=${output_dir}/Trilinos |
| 15 |
cuda_on_or_off=${CUDA:-OFF} |
| 16 |
clear_cache=${CLEAR_CACHE:-ON} |
| 17 |
incremental_build=${INCREMENTAL_BUILD:-OFF} |
| 18 |
build_type=${CMAKE_BUILD_TYPE:-release} |
| 19 |
date_suffix=`date +%F_%H-%M-%S` |
| 20 |
|
| 21 |
|
| 22 |
if [ ! -d ${output_dir} ] ; then |
| 23 |
exe mkdir -p ${output_dir}; |
| 24 |
fi |
| 25 |
|
| 26 |
stk_cmake_testing_source_dir=${sierra_proj}/stk/stk_integration_tests/cmake_install_test |
| 27 |
if [ "${incremental_build}" == "OFF" ] ; then |
| 28 |
${stk_cmake_testing_source_dir}/create_workspace.sh ${trilinos_dir} ${sierra_proj} |
| 29 |
fi |
| 30 |
|
| 31 |
trilinos_install_dir=${output_dir}/trilinos_install_${build_type}_gcc |
| 32 |
exe rm -rf $trilinos_install_dir |
| 33 |
|
| 34 |
stk_build_dir=${output_dir}/stk_build_${build_type}_gcc |
| 35 |
if [ "${incremental_build}" == "OFF" ] ; then |
| 36 |
if [ "${clear_cache}" == "ON" ] ; then |
| 37 |
exe rm -rf $stk_build_dir |
| 38 |
exe mkdir -p $stk_build_dir |
| 39 |
fi |
| 40 |
fi |
| 41 |
|
| 42 |
printf "\nUsing sierra project: ${sierra_proj}\n"; |
| 43 |
printf "Using build-type: ${build_type}\n"; |
| 44 |
printf "CUDA: ${cuda_on_or_off}\n"; |
| 45 |
printf "Putting output and logs here: ${output_dir}\n"; |
| 46 |
|
| 47 |
bake_log=${output_dir}/bake-stk_balance.out.$date_suffix |
| 48 |
stk_config_log=${output_dir}/stk-config.out.$date_suffix |
| 49 |
stk_make_log=${output_dir}/stk-make.out.$date_suffix |
| 50 |
stk_install_log=${output_dir}/stk-install.out.$date_suffix |
| 51 |
stk_ctest_log=${output_dir}/stk-ctest.out.$date_suffix |
| 52 |
stk_app_config_log=${output_dir}/stk-test-app-config.out.$date_suffix |
| 53 |
stk_app_make_log=${output_dir}/stk-test-app-make.out.$date_suffix |
| 54 |
|
| 55 |
exe cp ${stk_cmake_testing_source_dir}/run_cmake_stk ${stk_build_dir} |
| 56 |
exe cd ${stk_build_dir} |
| 57 |
|
| 58 |
exe source ${stk_cmake_testing_source_dir}/load_gcc_modules |
| 59 |
|
| 60 |
if [ "${incremental_build}" == "OFF" ] ; then |
| 61 |
printf "Configuring trilinos/stk (running cmake)...\n"; |
| 62 |
exe "TRILINOS_DIR=${trilinos_dir} \ |
| 63 |
TRILINOS_INSTALL_DIR=${trilinos_install_dir} \ |
| 64 |
CMAKE_BUILD_TYPE=${build_type} \ |
| 65 |
CUDA=${cuda_on_or_off} \ |
| 66 |
CLEAR_CACHE=${clear_cache} \ |
| 67 |
./run_cmake_stk >& ${stk_config_log}" |
| 68 |
if [ $? -ne 0 ] ; then |
| 69 |
echo "!! error in stk/trilinos config, check output in ${stk_config_log} !!"; |
| 70 |
exit 1; |
| 71 |
fi |
| 72 |
fi |
| 73 |
|
| 74 |
printf "Now building trilinos/stk using make...\n"; |
| 75 |
exe "make VERBOSE=1 -j16 >& ${stk_make_log}"; |
| 76 |
if [ $? -ne 0 ] ; then |
| 77 |
echo "!! error in make, check output in ${stk_make_log} !!"; |
| 78 |
exit 1; |
| 79 |
fi |
| 80 |
|
| 81 |
exe "ctest -j8 >& ${stk_ctest_log}"; |
| 82 |
if [ $? -ne 0 ] ; then |
| 83 |
printf "!! error running ctest, check output in ${stk_ctest_log}\n"; |
| 84 |
exit 1; |
| 85 |
fi |
| 86 |
|
| 87 |
echo "all done, SUCCESS!"; |
| 88 |
exit 0; |