Debian Codegraph @

packages/stk/stk_integration_tests/cmake_install_test/build_stk_user_facing

raw
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 clear_cache=${CLEAR_CACHE:-ON}
16 build_type=${CMAKE_BUILD_TYPE:-release}
17 date_suffix=`date +%F_%H-%M-%S`
18
19 if [ ! -d ${output_dir} ] ; then
20 exe mkdir -p ${output_dir};
21 fi
22
23 if [ ! -d ${trilinos_dir} ] ; then
24 exe git clone -b develop https://github.com/trilinos/Trilinos.git ${trilinos_dir}
25 else
26 exe cd ${trilinos_dir}
27 exe git checkout develop
28 exe git reset --hard origin/develop
29 exe git pull
30 fi
31
32 trilinos_install_dir=${output_dir}/trilinos_install_${build_type}_gcc
33 exe rm -rf $trilinos_install_dir
34
35 stk_build_dir=${output_dir}/stk_build_user_facing_${build_type}_gcc
36 if [ "${clear_cache}" == "ON" ] ; then
37 exe rm -rf $stk_build_dir
38 exe mkdir -p $stk_build_dir
39 fi
40
41 stk_cmake_testing_source_dir=${sierra_proj}/stk/stk_integration_tests/cmake_install_test
42
43 stk_app_build_dir=${output_dir}/stk_test_app_build
44 exe rm -rf ${stk_app_build_dir}
45 exe mkdir -p ${stk_app_build_dir}
46
47 printf "\nUsing sierra project: ${sierra_proj}\n";
48 printf "Using build-type: ${build_type}\n";
49 printf "Using SIERRA_COMPILER: ${SIERRA_COMPILER}\n";
50 printf "Putting output and logs here: ${output_dir}\n";
51
52 exe cd $sierra_proj
53
54 stk_config_log=${output_dir}/stk-user-facing-config.out.$date_suffix
55 stk_make_log=${output_dir}/stk-user-facing-make.out.$date_suffix
56 stk_install_log=${output_dir}/stk-user-facing-install.out.$date_suffix
57 stk_ctest_log=${output_dir}/stk-user-facing-ctest.out.$date_suffix
58 stk_app_config_log=${output_dir}/stk-test-app-user-facing-config.out.$date_suffix
59 stk_app_make_log=${output_dir}/stk-test-app-user-facing-make.out.$date_suffix
60 stk_app_run_log=${output_dir}/stk-test-app-user-facing-run.out.$date_suffix
61
62 if [ -d ${trilinos_dir}/packages/stk ] ; then
63 exe rm -rf ${trilinos_dir}/packages/stk;
64 fi
65 if [ ! -L ${trilinos_dir}/packages/stk ] ; then
66 exe ln -s ${sierra_proj}/stk ${trilinos_dir}/packages
67 fi
68
69 exe cp ${stk_cmake_testing_source_dir}/run_cmake_stk_user_facing ${stk_build_dir}
70 exe cd ${stk_build_dir}
71
72 exe source ${stk_cmake_testing_source_dir}/load_gcc_modules
73
74 printf "Configuring trilinos/stk (running cmake)...\n";
75 exe "TRILINOS_DIR=${trilinos_dir} \
76 TRILINOS_INSTALL_DIR=${trilinos_install_dir} \
77 CMAKE_BUILD_TYPE=${build_type} \
78 CLEAR_CACHE=${clear_cache} \
79 ./run_cmake_stk_user_facing >& ${stk_config_log}"
80
81 if [ $? -ne 0 ] ; then
82 echo "!! error in stk/trilinos config, check output in ${stk_config_log} !!";
83 exit 1;
84 fi
85
86 printf "Now building trilinos/stk using make...\n";
87 exe "make VERBOSE=1 -j8 >& ${stk_make_log}";
88 if [ $? -ne 0 ] ; then
89 echo "!! error in make, check output in ${stk_make_log} !!";
90 exit 1;
91 fi
92
93 exe "ctest >& ${stk_ctest_log}";
94 if [ $? -ne 0 ] ; then
95 echo "!! error in ctest, check output in ${stk_ctest_log} !!";
96 exit 1;
97 fi
98
99 exe "make install >& ${stk_install_log}";
100 if [ $? -ne 0 ] ; then
101 echo "!! error in make install, check output in ${stk_install_log} !!";
102 exit 1;
103 fi
104
105 printf "\nNow building stk test-app...\n";
106
107 exe rm -rf ${stk_app_build_dir}
108 exe mkdir ${stk_app_build_dir}
109 exe cp ${stk_cmake_testing_source_dir}/stk_test_app/run_cmake_stk_test_app ${stk_app_build_dir}
110 exe cd ${stk_app_build_dir};
111
112 exe "./run_cmake_stk_test_app ${trilinos_install_dir} ${stk_cmake_testing_source_dir}/stk_test_app >& ${stk_app_config_log}";
113 if [ $? -ne 0 ] ; then
114 printf "!! error running cmake for stk test-app, check output in ${stk_app_config_log}\n";
115 exit 1;
116 fi
117
118 exe "make VERBOSE=1 >& ${stk_app_make_log}";
119 if [ $? -ne 0 ] ; then
120 printf "!! error building stk-test-app, check output in ${stk_app_make_log}\n";
121 exit 1;
122 fi
123
124 if [ ! -x ${trilinos_install_dir}/bin/stk_balance.exe ] ; then
125 print "!! error, stk_balance executable not installed.\n";
126 exit 1;
127 fi
128
129 printf "\nRunning the stk test-app...\n";
130
131 exe "mpirun --np 1 ${output_dir}/stk_test_app_build/test_stk_app >& ${stk_app_run_log}";
132 if [ $? -ne 0 ] ; then
133 printf "!! error running the stk test-app, check output in ${stk_app_run_log}\n";
134 exit 1;
135 fi
136
137 echo "all done, SUCCESS!";
138 exit 0;
139