4
4
set -x
5
5
6
6
UNAMESTR=` uname`
7
+ N_CORES=` nproc --all`
8
+
7
9
8
10
setup_ccache () {
9
11
echo " Setting up ccache"
@@ -12,49 +14,75 @@ setup_ccache() {
12
14
for name in gcc g++ cc c++ x86_64-linux-gnu-gcc x86_64-linux-gnu-c++; do
13
15
ln -s $( which ccache) " /tmp/ccache/${name} "
14
16
done
15
- export PATH=" /tmp/ccache/:${PATH} "
16
- ccache -M 256M
17
+ export PATH=" /tmp/ccache:${PATH} "
18
+ # Unset ccache limits
19
+ ccache -F 0
20
+ ccache -M 0
17
21
}
18
22
19
23
# imports get_dep
20
24
source build_tools/shared.sh
21
25
22
26
sudo add-apt-repository --remove ppa:ubuntu-toolchain-r/test
23
27
sudo apt-get update
24
- sudo apt-get install python3-virtualenv ccache
25
- python3 -m virtualenv --system-site-packages --python=python3 testenv
26
- source testenv/bin/activate
27
- pip install --upgrade pip
28
+
29
+ # Setup conda environment
30
+ MINICONDA_URL=" https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-aarch64.sh"
31
+
32
+ # Install Mambaforge
33
+ wget $MINICONDA_URL -O mambaforge.sh
34
+ MINICONDA_PATH=$HOME /miniconda
35
+ chmod +x mambaforge.sh && ./mambaforge.sh -b -p $MINICONDA_PATH
36
+ export PATH=$MINICONDA_PATH /bin:$PATH
37
+ mamba init --all --verbose
38
+ mamba update --yes conda
39
+
40
+ # Create environment and install dependencies
41
+ mamba create -n testenv --yes $( get_dep python $PYTHON_VERSION )
42
+ source activate testenv
43
+
44
+ # Use the latest by default
45
+ mamba install --verbose -y ccache \
46
+ pip \
47
+ $( get_dep numpy $NUMPY_VERSION ) \
48
+ $( get_dep scipy $SCIPY_VERSION ) \
49
+ $( get_dep cython $CYTHON_VERSION ) \
50
+ $( get_dep joblib $JOBLIB_VERSION ) \
51
+ $( get_dep threadpoolctl $THREADPOOLCTL_VERSION ) \
52
+ $( get_dep pytest $PYTEST_VERSION ) \
53
+ $( get_dep pytest-xdist $PYTEST_XDIST_VERSION )
28
54
setup_ccache
29
- python -m pip install $( get_dep cython $CYTHON_VERSION ) \
30
- $( get_dep joblib $JOBLIB_VERSION )
31
- python -m pip install $( get_dep threadpoolctl $THREADPOOLCTL_VERSION ) \
32
- $( get_dep pytest $PYTEST_VERSION ) \
33
- $( get_dep pytest-xdist $PYTEST_XDIST_VERSION )
34
55
35
56
if [[ " $COVERAGE " == " true" ]]; then
36
- python -m pip install codecov pytest-cov
37
- fi
38
-
39
- if [[ " $PYTEST_XDIST_VERSION " != " none" ]]; then
40
- python -m pip install pytest-xdist
57
+ mamba install --verbose -y codecov pytest-cov
41
58
fi
42
59
43
60
if [[ " $TEST_DOCSTRINGS " == " true" ]]; then
44
61
# numpydoc requires sphinx
45
- python -m pip install sphinx
46
- python -m pip install numpydoc
62
+ mamba install --verbose -y sphinx
63
+ mamba install --verbose -y numpydoc
47
64
fi
48
65
49
66
python --version
50
67
51
- # Set parallelism to 3 to overlap IO bound tasks with CPU bound tasks on CI
52
- # workers with 2 cores when building the compiled extensions of scikit-learn.
53
- export SKLEARN_BUILD_PARALLEL=3
68
+ # Set parallelism to $N_CORES + 1 to overlap IO bound tasks with CPU bound tasks on CI
69
+ # workers with $N_CORES cores when building the compiled extensions of scikit-learn.
70
+ export SKLEARN_BUILD_PARALLEL=$(( $N_CORES + 1 ))
71
+
72
+ # Disable the build isolation and build in the tree so that the same folder can be
73
+ # cached between CI runs.
74
+ # TODO: remove the '--use-feature' flag when made obsolete in pip 21.3.
75
+ pip install --verbose --no-build-isolation --use-feature=in-tree-build .
76
+
77
+ # Report cache usage
78
+ ccache -s --verbose
79
+
80
+ mamba list
54
81
55
- python -m pip list
56
- pip install --verbose --editable .
57
- ccache -s
82
+ # Changing directory not to have module resolution use scikit-learn source
83
+ # directory but to the installed package .
84
+ cd /tmp
58
85
python -c " import sklearn; sklearn.show_versions()"
59
86
python -m threadpoolctl --import sklearn
60
- python -m pytest sklearn
87
+ # Test using as many workers as available cores
88
+ pytest --pyargs -n $N_CORES sklearn
0 commit comments