|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Travis clone "scikit-learn/scikit-learn" repository into |
| 4 | +# a local repository. We use a cached directory with three |
| 5 | +# scikit-learn repositories (one for each matrix entry for |
| 6 | +# non continuous deployment jobs) from which we pull local |
| 7 | +# Travis repository. This allows us to keep build artifact |
| 8 | +# for GCC + Cython, and gain time. |
| 9 | + |
| 10 | +set -e |
| 11 | + |
| 12 | +echo "CPU Arch: $TRAVIS_CPU_ARCH." |
| 13 | + |
| 14 | +# Import "get_dep" |
| 15 | +source build_tools/shared.sh |
| 16 | + |
| 17 | +echo "List files from cached directories." |
| 18 | +echo "pip:" |
| 19 | +ls $HOME/.cache/pip |
| 20 | + |
| 21 | +export CC=/usr/lib/ccache/gcc |
| 22 | +export CXX=/usr/lib/ccache/g++ |
| 23 | + |
| 24 | +# Useful for debugging how ccache is used |
| 25 | +# export CCACHE_LOGFILE=/tmp/ccache.log |
| 26 | + |
| 27 | +# 60MB are (more or less) used by .ccache, when |
| 28 | +# compiling from scratch at the time of writing |
| 29 | +ccache --max-size 100M --show-stats |
| 30 | + |
| 31 | +# Deactivate the default virtual environment |
| 32 | +# to setup a conda-based environment instead |
| 33 | +deactivate |
| 34 | + |
| 35 | +if [[ $TRAVIS_CPU_ARCH == arm64 ]]; then |
| 36 | + # Different Miniconda URL for ARM64 architectures |
| 37 | + MINICONDA_URL="https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-aarch64.sh" |
| 38 | +else |
| 39 | + MINICONDA_URL="https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh" |
| 40 | +fi |
| 41 | + |
| 42 | +# Install Miniconda |
| 43 | +wget $MINICONDA_URL -O miniconda.sh |
| 44 | +MINICONDA_PATH=$HOME/miniconda |
| 45 | +chmod +x miniconda.sh && ./miniconda.sh -b -p $MINICONDA_PATH |
| 46 | +export PATH=$MINICONDA_PATH/bin:$PATH |
| 47 | +conda update --yes conda |
| 48 | + |
| 49 | +# Create environment and install dependencies |
| 50 | +conda create -n testenv --yes python=3.7 |
| 51 | + |
| 52 | +source activate testenv |
| 53 | + |
| 54 | +if [[ $TRAVIS_CPU_ARCH == amd64 ]]; then |
| 55 | + echo "Upgrading pip and setuptools." |
| 56 | + pip install --upgrade pip setuptools |
| 57 | + echo "Installing numpy, scipy and pandas master wheels." |
| 58 | + dev_anaconda_url=https://pypi.anaconda.org/scipy-wheels-nightly/simple |
| 59 | + pip install --pre --upgrade --timeout=60 --extra-index $dev_anaconda_url numpy scipy pandas |
| 60 | + echo "Installing cython pre-release wheels." |
| 61 | + pip install --pre cython |
| 62 | + echo "Installing joblib master." |
| 63 | + pip install https://github.com/joblib/joblib/archive/master.zip |
| 64 | + echo "Installing pillow master." |
| 65 | + pip install https://github.com/python-pillow/Pillow/archive/master.zip |
| 66 | +else |
| 67 | + conda install -y scipy numpy pandas cython |
| 68 | + pip install joblib threadpoolctl |
| 69 | +fi |
| 70 | + |
| 71 | +pip install $(get_dep pytest $PYTEST_VERSION) pytest-xdist |
| 72 | + |
| 73 | +# Build scikit-learn in this script to collapse the |
| 74 | +# verbose build output in the Travis output when it |
| 75 | +# succeeds |
| 76 | +python --version |
| 77 | +python -c "import numpy; print(f'numpy {numpy.__version__}')" |
| 78 | +python -c "import scipy; print(f'scipy {scipy.__version__}')" |
| 79 | + |
| 80 | +if [[ $BUILD_WITH_ICC == true ]]; then |
| 81 | + wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB |
| 82 | + sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB |
| 83 | + rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB |
| 84 | + sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main" |
| 85 | + sudo apt-get update |
| 86 | + sudo apt-get install intel-oneapi-icc |
| 87 | + source /opt/intel/oneapi/setvars.sh |
| 88 | + |
| 89 | + # The "build_clib" command is implicitly used to build "libsvm-skl". |
| 90 | + # To compile with a different compiler, we also need to specify the |
| 91 | + # compiler for this command |
| 92 | + python setup.py build_ext --compiler=intelem -i build_clib --compiler=intelem |
| 93 | +else |
| 94 | + pip install -e . |
| 95 | +fi |
| 96 | + |
| 97 | +python setup.py develop |
| 98 | + |
| 99 | +ccache --show-stats |
| 100 | + |
| 101 | +# Useful for debugging how ccache is used |
| 102 | +# cat $CCACHE_LOGFILE |
0 commit comments