| #!/bin/bash | |
| # SPDX-FileCopyrightText: The Eigen Authors | |
| # SPDX-License-Identifier: MPL-2.0 | |
| set -x | |
| echo "Running ${CI_JOB_NAME}" | |
| echo "Host machine configuration:" | |
| uname -a | |
| cat /etc/os-release || true | |
| lscpu || true | |
| free -h || true | |
| df -h . || true | |
| # GPU builds can run on hosts without a GPU or its diagnostic tools. | |
| for gpu_info in nvidia-smi rocm-smi; do | |
| if command -v "${gpu_info}" > /dev/null 2>&1; then | |
| "${gpu_info}" || echo "${gpu_info} failed; GPU diagnostics unavailable." | |
| fi | |
| done | |
| # Get architecture and display CI configuration. | |
| export ARCH=`uname -m` | |
| export NPROC=`nproc` | |
| echo "arch=$ARCH, target=${EIGEN_CI_TARGET_ARCH}" | |
| echo "Processors: ${NPROC}" | |
| echo "CI Variables:" | |
| export | grep EIGEN | grep -v "CACHE_TOKEN" | |
| # Set noninteractive, otherwise tzdata may be installed and prompt for a | |
| # geographical region. | |
| export DEBIAN_FRONTEND=noninteractive | |
| if [[ "${EIGEN_CI_SKIP_APT}" != "true" ]]; then | |
| apt-get update -y > /dev/null | |
| # python3 drives both the test pass cache and the sccache GCS credential server; | |
| # curl and ca-certificates support downloading sccache and probing the credential server. | |
| packages="ninja-build cmake git xsltproc ccache curl ca-certificates python3" | |
| apt-get install -y --no-install-recommends ${packages} > /dev/null | |
| fi | |
| # Install required dependencies and set up compilers. | |
| # These are required even for testing to ensure that dynamic runtime libraries | |
| # are available. | |
| if [[ "$ARCH" == "${EIGEN_CI_TARGET_ARCH}" || "${EIGEN_CI_TARGET_ARCH}" == "any" ]]; then | |
| if [[ "${EIGEN_CI_SKIP_APT}" != "true" ]]; then | |
| apt-get install -y --no-install-recommends ${EIGEN_CI_INSTALL} > /dev/null; | |
| fi | |
| export EIGEN_CI_CXX_IMPLICIT_INCLUDE_DIRECTORIES=""; | |
| export EIGEN_CI_CXX_COMPILER_TARGET=""; | |
| else | |
| if [[ "${EIGEN_CI_SKIP_APT}" != "true" ]]; then | |
| apt-get install -y --no-install-recommends ${EIGEN_CI_CROSS_INSTALL} > /dev/null; | |
| fi | |
| export EIGEN_CI_C_COMPILER=${EIGEN_CI_CROSS_C_COMPILER}; | |
| export EIGEN_CI_CXX_COMPILER=${EIGEN_CI_CROSS_CXX_COMPILER}; | |
| export EIGEN_CI_CXX_COMPILER_TARGET=${EIGEN_CI_CROSS_TARGET_TRIPLE}; | |
| # Tell the compiler where to find headers and libraries if using clang. | |
| # NOTE: this breaks GCC since it messes with include path order | |
| # (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129) | |
| if [[ "${EIGEN_CI_CROSS_CXX_COMPILER}" == *"clang"* ]]; then | |
| export CPLUS_INCLUDE_PATH="/usr/${EIGEN_CI_CROSS_TARGET_TRIPLE}/include"; | |
| export LIBRARY_PATH="/usr/${EIGEN_CI_CROSS_TARGET_TRIPLE}/lib64"; | |
| fi | |
| fi | |
| echo "Compilers: ${EIGEN_CI_C_COMPILER} ${EIGEN_CI_CXX_COMPILER}" | |
| if [ -n "$EIGEN_CI_BEFORE_SCRIPT" ]; then eval "$EIGEN_CI_BEFORE_SCRIPT"; fi | |
| set +x |