doc: factor ifnottex/iftex examples
[bison.git] / build-aux / install-icc.sh
blob75d4e2836b45ea96611338b60787b94963096099
1 #!/bin/sh
3 # Install Intel Parallel Studio on Travis CI
4 # https://github.com/nemequ/icc-travis
6 # Originally written for Squash <https://github.com/quixdb/squash> by
7 # Evan Nemerson. For documentation, bug reports, support requests,
8 # etc. please use <https://github.com/nemequ/icc-travis>.
10 # To the extent possible under law, the author(s) of this script have
11 # waived all copyright and related or neighboring rights to this work.
12 # See <https://creativecommons.org/publicdomain/zero/1.0/> for
13 # details.
15 # Tools - Not very useful in non-interactive mode.
16 COMPONENTS_VTUNE="intel-vtune-amplifier-xe-2016-cli__x86_64;intel-vtune-amplifier-xe-2016-common__noarch;intel-vtune-amplifier-xe-2016-cli-common__noarch;intel-vtune-amplifier-xe-2016-collector-64linux__x86_64;intel-vtune-amplifier-xe-2016-sep__noarch;intel-vtune-amplifier-xe-2016-gui-common__noarch;intel-vtune-amplifier-xe-2016-gui__x86_64;intel-vtune-amplifier-xe-2016-common-pset__noarch"
17 COMPONENTS_INSPECTOR="intel-inspector-xe-2016-cli__x86_64;intel-inspector-xe-2016-cli-common__noarch;intel-inspector-xe-2016-gui-common__noarch;intel-inspector-xe-2016-gui__x86_64;intel-inspector-xe-2016-cli-pset__noarch"
18 COMPONENTS_ADVISOR="intel-advisor-xe-2016-cli__x86_64;intel-advisor-xe-2016-cli-common__noarch;intel-advisor-xe-2016-gui-common__noarch;intel-advisor-xe-2016-gui__x86_64;intel-advisor-xe-2016-cli-pset__noarch"
19 COMPONENTS_GDB="intel-gdb-gt__x86_64;intel-gdb-gt-src__noarch;intel-gdb-gt-libelfdwarf__x86_64;intel-gdb-gt-devel__x86_64;intel-gdb-gt-common__noarch;intel-gdb-ps-cdt__x86_64;intel-gdb-ps-cdt-source__x86_64;intel-gdb-ps-mic__x86_64;intel-gdb-ps-mpm__x86_64;intel-gdb__x86_64;intel-gdb-source__noarch;intel-gdb-python-source__noarch;intel-gdb-common__noarch;intel-gdb-ps-common__noarch"
21 # Parallel libraries
22 COMPONENTS_MPI="intel-mpi-rt-core__x86_64;intel-mpi-rt-mic__x86_64;intel-mpi-sdk-core__x86_64;intel-mpi-sdk-mic__x86_64;intel-mpi-psxe__x86_64;intel-mpi-rt-psxe__x86_64"
23 COMPONENTS_TBB="intel-tbb-libs__noarch;intel-mkl-ps-tbb__x86_64;intel-mkl-ps-tbb-devel__x86_64;intel-mkl-ps-tbb-mic__x86_64;intel-mkl-ps-tbb-mic-devel__x86_64;intel-tbb-source__noarch;intel-tbb-devel__noarch;intel-tbb-common__noarch;intel-tbb-ps-common__noarch;intel-tbb-psxe__noarch"
24 COMPONENTS_MKL="intel-mkl__x86_64;intel-mkl-ps__x86_64;intel-mkl-common__noarch;intel-mkl-ps-common__noarch;intel-mkl-devel__x86_64;intel-mkl-ps-mic-devel__x86_64;intel-mkl-ps-f95-devel__x86_64;intel-mkl-gnu-devel__x86_64;intel-mkl-ps-gnu-devel__x86_64;intel-mkl-ps-pgi-devel__x86_64;intel-mkl-sp2dp-devel__x86_64;intel-mkl-ps-cluster-devel__x86_64;intel-mkl-ps-cluster-common__noarch;intel-mkl-ps-f95-common__noarch;intel-mkl-ps-cluster__x86_64;intel-mkl-gnu__x86_64;intel-mkl-ps-gnu__x86_64;intel-mkl-ps-pgi__x86_64;intel-mkl-sp2dp__x86_64;intel-mkl-ps-mic__x86_64;intel-mkl-ps-tbb__x86_64;intel-mkl-ps-tbb-devel__x86_64;intel-mkl-ps-tbb-mic__x86_64;intel-mkl-ps-tbb-mic-devel__x86_64;intel-mkl-psxe__noarch"
25 COMPONENTS_IPP="intel-ipp-l-common__noarch;intel-ipp-l-ps-common__noarch;intel-ipp-l-st__x86_64;intel-ipp-l-mt__x86_64;intel-ipp-l-st-devel__x86_64;intel-ipp-l-ps-st-devel__x86_64;intel-ipp-l-mt-devel__x86_64;intel-ipp-psxe__noarch"
26 COMPONENTS_IPP_CRYPTO="intel-crypto-ipp-st-devel__x86_64;intel-crypto-ipp-ps-st-devel__x86_64;intel-crypto-ipp-st__x86_64;intel-crypto-ipp-mt-devel__x86_64;intel-crypto-ipp-mt__x86_64;intel-crypto-ipp-ss-st-devel__x86_64;intel-crypto-ipp-common__noarch"
27 COMPONENTS_DAAL="intel-daal__x86_64;intel-daal-common__noarch"
29 # Compilers
30 COMPONENTS_OPENMP="intel-openmp-l-all__x86_64;intel-openmp-l-ps-mic__x86_64;intel-openmp-l-ps__x86_64;intel-openmp-l-ps-ss__x86_64;intel-openmp-l-all-devel__x86_64;intel-openmp-l-ps-mic-devel__x86_64;intel-openmp-l-ps-devel__x86_64;intel-openmp-l-ps-ss-devel__x86_64"
31 COMPONENTS_COMPILER_COMMON="intel-comp-l-all-vars__noarch;intel-comp-l-all-common;intel-comp-l-ps-common;intel-comp-l-all-devel;intel-comp-l-ps-ss-devel;intel-comp-l-ps-ss-wrapper;intel-comp-l-all-devel;intel-comp-l-ps-devel__x86_64;intel-comp-l-ps-ss-devel__x86_64;intel-psf-intel__x86_64;intel-icsxe-pset;intel-ipsf__noarch;intel-ccompxe__noarch;${COMPONENTS_OPENMP}"
32 COMPONENTS_IFORT="intel-ifort-l-ps__x86_64;intel-ifort-l-ps-vars__noarch;intel-ifort-l-ps-common__noarch;intel-ifort-l-ps-devel__x86_64;${COMPONENTS_COMPILER_COMMON}"
33 COMPONENTS_ICC="intel-icc-l-all__x86_64;intel-icc-l-ps-ss__x86_64;intel-icc-l-all-vars__noarch;intel-icc-l-all-common__noarch;intel-icc-l-ps-common__noarch;intel-icc-l-all-devel__x86_64;intel-icc-l-ps-devel__x86_64;intel-icc-l-ps-ss-devel__x86_64;${COMPONENTS_COMPILER_COMMON}"
35 DESTINATION="${HOME}/intel"
36 TEMPORARY_FILES="/tmp"
37 PHONE_INTEL="no"
38 COMPONENTS=""
40 add_components() {
41 if [ ! -z "${COMPONENTS}" ]; then
42 COMPONENTS="${COMPONENTS};$1"
43 else
44 COMPONENTS="$1"
48 while [ $# != 0 ]; do
49 case "$1" in
50 "--dest")
51 DESTINATION="$(realpath "$2")"; shift
53 "--tmpdir")
54 TEMPORARY_FILES="$2"; shift
56 "--components")
57 shift
58 OLD_IFS="${IFS}"
59 IFS=","
60 for component in $1; do
61 case "$component" in
62 "icc")
63 add_components "${COMPONENTS_ICC}"
65 "mpi")
66 add_components "${COMPONENTS_MPI}"
68 "vtune")
69 add_components "${COMPONENTS_VTUNE}"
71 "inspector")
72 add_components "${COMPONENTS_INSPECTOR}"
74 "advisor")
75 add_components "${COMPONENTS_ADVISOR}"
77 "tbb")
78 add_components "${COMPONENTS_TBB}"
80 "ifort")
81 add_components "${COMPONENTS_IFORT}"
83 "mkl")
84 add_components "${COMPONENTS_MKL}"
86 "openmp")
87 # Noop, here for compatability. OpenMP is installed with icc and ifort now.
89 "ipp")
90 add_components "${COMPONENTS_IPP}"
92 "ipp-crypto")
93 add_components "${COMPONENTS_IPP_CRYPTO}"
95 "gdb")
96 add_components "${COMPONENTS_GDB}"
98 "daal")
99 add_components "${COMPONENTS_DAAL}"
102 echo "Unknown component '$component'"
103 exit 1
105 esac
106 done
107 IFS="${OLD_IFS}"
110 echo "Unrecognized argument '$1'"
111 exit 1
113 esac
114 shift
115 done
117 if [ -z "${COMPONENTS}" ]; then
118 COMPONENTS="${COMPONENTS_ICC}"
121 INSTALLER_SCRIPT="parallel_studio_xe_2016_update3_online.sh"
122 INSTALLER="${TEMPORARY_FILES}/${INSTALLER_SCRIPT}"
123 INSTALLER_URL="http://registrationcenter-download.intel.com/akdlm/irc_nas/9061/${INSTALLER_SCRIPT}"
124 SILENT_CFG="${TEMPORARY_FILES}/silent.cfg"
125 SUCCESS_INDICATOR="${TEMPORARY_FILES}/icc-travis-success"
127 if [ ! -e "${TEMPORARY_FILES}" ]; then
128 echo "${TEMPORARY_FILES} does not exist, creating..."
129 mkdir -p "${TEMPORARY_FILES}" || (sudo mkdir -p "${TEMPORARY_FILES}" && sudo chown -R "${USER}:${USER}" "${TEMPORARY_FILES}")
132 if [ ! -e "${DESTINATION}" ]; then
133 echo "${DESTINATION} does not exist, creating..."
134 mkdir -p "${DESTINATION}" || (sudo mkdir -p "${DESTINATION}" && sudo chown -R "${USER}:${USER}" "${DESTINATION}")
137 if [ ! -e "${INSTALLER}" ]; then
138 wget -O "${INSTALLER}" "${INSTALLER_URL}" || exit 1
140 chmod u+x "${INSTALLER}"
142 # See https://software.intel.com/en-us/articles/intel-composer-xe-2015-silent-installation-guide
143 echo "# Generated silent configuration file" > "${SILENT_CFG}"
144 echo "ACCEPT_EULA=accept" >> "${SILENT_CFG}"
145 echo "INSTALL_MODE=NONRPM" >> "${SILENT_CFG}"
146 echo "CONTINUE_WITH_OPTIONAL_ERROR=yes" >> "${SILENT_CFG}"
147 echo "PSET_INSTALL_DIR=${DESTINATION}" >> "${SILENT_CFG}"
148 echo "CONTINUE_WITH_INSTALLDIR_OVERWRITE=yes" >> "${SILENT_CFG}"
149 echo "COMPONENTS=${COMPONENTS}" >> "${SILENT_CFG}"
150 echo "PSET_MODE=install" >> "${SILENT_CFG}"
151 echo "PHONEHOME_SEND_USAGE_DATA=${PHONE_INTEL}" >> "${SILENT_CFG}"
152 if [ "x" != "x${INTEL_SERIAL_NUMBER}" ]; then
153 echo "ACTIVATION_SERIAL_NUMBER=${INTEL_SERIAL_NUMBER}" >> "${SILENT_CFG}"
154 echo "ACTIVATION_TYPE=serial_number" >> "${SILENT_CFG}"
155 else
156 echo "ACTIVATION_TYPE=trial_lic" >> "${SILENT_CFG}"
159 attempt=1;
160 while [ $attempt -le 3 ]; do
161 if [ ! -e "${TEMPORARY_FILES}/parallel-studio-install-data" ]; then
162 mkdir -p "${TEMPORARY_FILES}/parallel-studio-install-data" || (sudo mkdir -p "${TEMPORARY_FILES}/parallel-studio-install-data" && sudo chown -R "${USER}:${USER}" "${TEMPORARY_FILES}")
165 ("${INSTALLER}" \
166 -t "${TEMPORARY_FILES}/parallel-studio-install-data" \
167 -s "${SILENT_CFG}" \
168 --cli-mode \
169 --user-mode && \
170 touch "${SUCCESS_INDICATOR}") &
172 # So Travis doesn't die in case of a long download/installation.
174 # NOTE: a watched script never terminates.
175 elapsed=0;
176 while kill -0 $! 2>/dev/null; do
177 sleep 1
178 elapsed=$(expr $elapsed + 1)
179 if [ $(expr $elapsed % 60) -eq 0 ]; then
180 mins_elapsed=$(expr $elapsed / 60)
181 if [ $mins_elapsed = 1 ]; then
182 minute_string="minute"
183 else
184 minute_string="minutes"
186 echo "Still running... (about $(expr $elapsed / 60) ${minute_string} so far)."
188 done
190 if [ ! -e "${SUCCESS_INDICATOR}" ]; then
191 echo "Installation failed."
192 exit 1
195 if [ ! -e "${DESTINATION}/bin/compilervars.sh" ]; then
196 # Sometimes the installer returns successfully without actually
197 # installing anything. Let's try again…
198 echo "Installation attempt #${attempt} completed, but unable to find compilervars.sh."
199 find "${DESTINATION}"
200 else
201 break
204 rm -vrf "${TEMPORARY_FILES}/parallel-studio-install-data"
205 echo "Trying again..."
207 attempt=$(expr $attempt + 1)
208 done
210 if [ ! -e "${DESTINATION}/bin/compilervars.sh" ]; then
211 echo "Installation failed."
212 exit 1
215 # Apparently the installer drops the license file in a location it
216 # doesn't know to check.
217 ln -s "${DESTINATION}"/licenses ~/Licenses
219 # Add configuration information to ~/.bashrc. Unfortunately this will
220 # not be picked up automatically by Travis, so you'll still need to
221 # source ~/.bashrc in your .travis.yml
223 # Container-based builds include a `[ -z "$PS1" ] && return` near the
224 # beginning of the file, so appending won't work, we'll need to
225 # prepend.
226 echo "export INTEL_INSTALL_PATH=\"${DESTINATION}\"" >> ~/.bashrc-intel
227 echo ". \"\${INTEL_INSTALL_PATH}/bin/compilervars.sh\" intel64" >> ~/.bashrc-intel
228 echo "export LD_LIBRARY_PATH=\"\${INTEL_INSTALL_PATH}/ism/bin/intel64:\${INTEL_INSTALL_PATH}/lib/intel64_lin:\$LD_LIBRARY_PATH\"" >> ~/.bashrc-intel
229 echo "export PATH=\"\${INTEL_INSTALL_PATH}/bin:\$PATH\"" >> ~/.bashrc-intel
230 echo "function uninstall_intel_software {" >> ~/.bashrc-intel
231 echo " find \"\${INTEL_INSTALL_PATH}\" -name 'uninstall.sh' -not -path '*/ism/uninstall.sh' -exec {} -s \;" >> ~/.bashrc-intel
232 echo "}" >> ~/.bashrc-intel
233 cat ~/.bashrc >> ~/.bashrc-intel
234 mv ~/.bashrc-intel ~/.bashrc