From c1a15afec71eb0a8722ae52bd300d63a587c0561 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Thu, 21 Apr 2022 11:30:32 +0200 Subject: [PATCH 01/28] CI Experimental [nogil] build of scikit-learn --- azure-pipelines.yml | 33 +++++++++++++++++++++++++++++++++ build_tools/azure/install.sh | 18 +++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2a44674ef8610..47523702fedc5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -71,6 +71,39 @@ jobs: # Here we make sure, that they are still run on a regular basis. SKLEARN_SKIP_NETWORK_TESTS: '0' +- template: build_tools/azure/posix.yml + # Experimental CPython branch without the Global Interpreter Lock: + # https://github.com/colesbury/nogil/ + # + # The nogil build relies on a dedicated PyPI-style index to install patched + # versions of NumPy, SciPy and Cython maintained by @colesbury and that + # include specifc fixes to make them run correctly without relying on the GIL. + # + # The goal of this CI entry is to make sure that we do not introduce any + # dependency on the GIL in scikit-learn itself. An auxiliary goal is to early + # detect any regression in the patched build dependencies to report them + # upstream. The long-term goal is to be able to stop having to maintain + # multiprocessing based workaround / hacks in joblib / loky to make multi-CPU + # computing in scikit-learn efficient by default using regular threads. + # + # If this experimental entry becomes too unstable, feel free to disable it. + parameters: + name: Linux_nogil + vmImage: ubuntu-20.04 + dependsOn: [git_commit, linting] + condition: | + and( + succeeded(), + not(contains(dependencies['git_commit']['outputs']['commit.message'], '[ci skip]')), + or(eq(variables['Build.Reason'], 'Schedule'), + contains(dependencies['git_commit']['outputs']['commit.message'], '[nogil]' + ) + ) + ) + matrix: + pylatest_pip_scipy_dev: + DISTRIB: 'pip-nogil' + # Check compilation with intel C++ compiler (ICC) - template: build_tools/azure/posix.yml parameters: diff --git a/build_tools/azure/install.sh b/build_tools/azure/install.sh index ff89358c0c1f6..eec12f7268d18 100755 --- a/build_tools/azure/install.sh +++ b/build_tools/azure/install.sh @@ -56,6 +56,9 @@ pre_python_environment_install() { sudo apt-get update sudo apt-get install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic source /opt/intel/oneapi/setvars.sh + elif [[ "$DISTRIB" == "pip-nogil" ]]; then + apt-get update + apt-get build-dep python3 python3-dev fi } @@ -120,6 +123,19 @@ python_environment_install() { pip install https://github.com/joblib/joblib/archive/master.zip echo "Installing pillow master" pip install https://github.com/python-pillow/Pillow/archive/main.zip + elif [[ "$DISTRIB" == "pip-nogil" ]]; then + ORIGINAL_FOLDER=`pwd` + cd .. + git clone https://github.com/colesbury/nogil + cd nogil + ./configure && make -j 2 + ./python.exe -m venv $VIRTUALENV + cd $ORIGINAL_FOLDER + source $VIRTUALENV/bin/activate + + python -m pip install -U pip + echo "Installing build dependepencies with pip from the nogil repository" + pip install numpy scipy cython joblib threadpoolctl fi python -m pip install $(get_dep threadpoolctl $THREADPOOLCTL_VERSION) \ @@ -140,7 +156,6 @@ python_environment_install() { } scikit_learn_install() { - setup_ccache show_installed_libraries # Set parallelism to 3 to overlap IO bound tasks with CPU bound tasks on CI @@ -183,6 +198,7 @@ scikit_learn_install() { main() { pre_python_environment_install + setup_ccache python_environment_install scikit_learn_install } From b93f035a4f9d82dd3acf2df36bd6701be849e626 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Thu, 21 Apr 2022 11:48:20 +0200 Subject: [PATCH 02/28] fix typos [nogil] --- azure-pipelines.yml | 2 +- build_tools/azure/install.sh | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 47523702fedc5..350942b53eae6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -101,7 +101,7 @@ jobs: ) ) matrix: - pylatest_pip_scipy_dev: + pylatest_pip_nogil: DISTRIB: 'pip-nogil' # Check compilation with intel C++ compiler (ICC) diff --git a/build_tools/azure/install.sh b/build_tools/azure/install.sh index eec12f7268d18..780777871f040 100755 --- a/build_tools/azure/install.sh +++ b/build_tools/azure/install.sh @@ -57,8 +57,9 @@ pre_python_environment_install() { sudo apt-get install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic source /opt/intel/oneapi/setvars.sh elif [[ "$DISTRIB" == "pip-nogil" ]]; then - apt-get update - apt-get build-dep python3 python3-dev + apt-get -yq update + apt-get install -yq ccache + apt-get build-dep -yq python3 python3-dev fi } From 787b286d15fba44a6d7161350772303aa8ef97ac Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Thu, 21 Apr 2022 11:57:40 +0200 Subject: [PATCH 03/28] Skip ccache setup if not installed [nogil] --- build_tools/azure/install.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/build_tools/azure/install.sh b/build_tools/azure/install.sh index 780777871f040..b2f692962c60c 100755 --- a/build_tools/azure/install.sh +++ b/build_tools/azure/install.sh @@ -20,14 +20,19 @@ make_conda() { } setup_ccache() { - echo "Setting up ccache with CCACHE_DIR=${CCACHE_DIR}" - mkdir /tmp/ccache/ - which ccache - for name in gcc g++ cc c++ clang clang++ i686-linux-gnu-gcc i686-linux-gnu-c++ x86_64-linux-gnu-gcc x86_64-linux-gnu-c++ x86_64-apple-darwin13.4.0-clang x86_64-apple-darwin13.4.0-clang++; do - ln -s $(which ccache) "/tmp/ccache/${name}" - done - export PATH="/tmp/ccache/:${PATH}" - ccache -M 256M + CCACHE_BIN=`which ccache || echo ""` + if [[ "${CCACHE_BIN}" != "" ]]; then + echo "Setting up ccache with CCACHE_DIR=${CCACHE_DIR}" + mkdir /tmp/ccache/ + which ccache + for name in gcc g++ cc c++ clang clang++ i686-linux-gnu-gcc i686-linux-gnu-c++ x86_64-linux-gnu-gcc x86_64-linux-gnu-c++ x86_64-apple-darwin13.4.0-clang x86_64-apple-darwin13.4.0-clang++; do + ln -s ${CCACHE_BIN} "/tmp/ccache/${name}" + done + export PATH="/tmp/ccache/:${PATH}" + ccache -M 256M + else + echo "ccache not found, skipping..." + fi } pre_python_environment_install() { From 9ec5962a72559b53b2bb3fd25599f730b934f6a0 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Thu, 21 Apr 2022 12:01:17 +0200 Subject: [PATCH 04/28] Move ccache setup back to itself original position [nogil] --- build_tools/azure/install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build_tools/azure/install.sh b/build_tools/azure/install.sh index b2f692962c60c..8c63a353934e7 100755 --- a/build_tools/azure/install.sh +++ b/build_tools/azure/install.sh @@ -130,6 +130,7 @@ python_environment_install() { echo "Installing pillow master" pip install https://github.com/python-pillow/Pillow/archive/main.zip elif [[ "$DISTRIB" == "pip-nogil" ]]; then + setup_ccache # speed-up the build of CPython it-self ORIGINAL_FOLDER=`pwd` cd .. git clone https://github.com/colesbury/nogil @@ -162,6 +163,7 @@ python_environment_install() { } scikit_learn_install() { + setup_ccache show_installed_libraries # Set parallelism to 3 to overlap IO bound tasks with CPU bound tasks on CI @@ -204,7 +206,6 @@ scikit_learn_install() { main() { pre_python_environment_install - setup_ccache python_environment_install scikit_learn_install } From adcaf82483bf4f7b176e523364790cc7dfac4493 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Thu, 21 Apr 2022 12:48:27 +0200 Subject: [PATCH 05/28] missing sudo [nogil] --- build_tools/azure/install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build_tools/azure/install.sh b/build_tools/azure/install.sh index 8c63a353934e7..f1bfca4522aa0 100755 --- a/build_tools/azure/install.sh +++ b/build_tools/azure/install.sh @@ -62,9 +62,9 @@ pre_python_environment_install() { sudo apt-get install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic source /opt/intel/oneapi/setvars.sh elif [[ "$DISTRIB" == "pip-nogil" ]]; then - apt-get -yq update - apt-get install -yq ccache - apt-get build-dep -yq python3 python3-dev + sudo apt-get -yq update + sudo apt-get install -yq ccache + sudo apt-get build-dep -yq python3 python3-dev fi } From c64638c51d17765caf8492a88879eeb56e2fe235 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Thu, 21 Apr 2022 13:07:03 +0200 Subject: [PATCH 06/28] Add the APT package sources [nogil] --- build_tools/azure/install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build_tools/azure/install.sh b/build_tools/azure/install.sh index f1bfca4522aa0..9e138505184c9 100755 --- a/build_tools/azure/install.sh +++ b/build_tools/azure/install.sh @@ -62,6 +62,7 @@ pre_python_environment_install() { sudo apt-get install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic source /opt/intel/oneapi/setvars.sh elif [[ "$DISTRIB" == "pip-nogil" ]]; then + echo "deb-src http://archive.ubuntu.com/ubuntu/ focal main" || sudo tee /etc/apt/sources.list sudo apt-get -yq update sudo apt-get install -yq ccache sudo apt-get build-dep -yq python3 python3-dev From 64a09a72edd41e7b2df638b21871a604e0d4ede8 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Thu, 21 Apr 2022 13:15:48 +0200 Subject: [PATCH 07/28] typo [nogil] --- build_tools/azure/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tools/azure/install.sh b/build_tools/azure/install.sh index 9e138505184c9..ee374a965623a 100755 --- a/build_tools/azure/install.sh +++ b/build_tools/azure/install.sh @@ -62,7 +62,7 @@ pre_python_environment_install() { sudo apt-get install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic source /opt/intel/oneapi/setvars.sh elif [[ "$DISTRIB" == "pip-nogil" ]]; then - echo "deb-src http://archive.ubuntu.com/ubuntu/ focal main" || sudo tee /etc/apt/sources.list + echo "deb-src http://archive.ubuntu.com/ubuntu/ focal main" | sudo tee /etc/apt/sources.list sudo apt-get -yq update sudo apt-get install -yq ccache sudo apt-get build-dep -yq python3 python3-dev From 16c7a245fccd570bb1a7c2a8fe9586598731d3e7 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Thu, 21 Apr 2022 13:22:51 +0200 Subject: [PATCH 08/28] tee -a instead of tee [nogil] --- build_tools/azure/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tools/azure/install.sh b/build_tools/azure/install.sh index ee374a965623a..20dff87612338 100755 --- a/build_tools/azure/install.sh +++ b/build_tools/azure/install.sh @@ -62,7 +62,7 @@ pre_python_environment_install() { sudo apt-get install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic source /opt/intel/oneapi/setvars.sh elif [[ "$DISTRIB" == "pip-nogil" ]]; then - echo "deb-src http://archive.ubuntu.com/ubuntu/ focal main" | sudo tee /etc/apt/sources.list + echo "deb-src http://archive.ubuntu.com/ubuntu/ focal main" | sudo tee -a /etc/apt/sources.list sudo apt-get -yq update sudo apt-get install -yq ccache sudo apt-get build-dep -yq python3 python3-dev From 2966abaf8bdf8f47d175cc2f61f9755a1409c585 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Thu, 21 Apr 2022 13:38:30 +0200 Subject: [PATCH 09/28] python.exe => python [nogil] --- build_tools/azure/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tools/azure/install.sh b/build_tools/azure/install.sh index 20dff87612338..dc1929dde9313 100755 --- a/build_tools/azure/install.sh +++ b/build_tools/azure/install.sh @@ -137,7 +137,7 @@ python_environment_install() { git clone https://github.com/colesbury/nogil cd nogil ./configure && make -j 2 - ./python.exe -m venv $VIRTUALENV + ./python -m venv $VIRTUALENV cd $ORIGINAL_FOLDER source $VIRTUALENV/bin/activate From 34b2a5bee418a4dcbeb962ab0900a7a9276808ba Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Thu, 21 Apr 2022 13:52:39 +0200 Subject: [PATCH 10/28] VIRTUALENV is just a name, not a path [nogil] --- build_tools/azure/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tools/azure/install.sh b/build_tools/azure/install.sh index dc1929dde9313..a914cd1cb05ac 100755 --- a/build_tools/azure/install.sh +++ b/build_tools/azure/install.sh @@ -137,7 +137,7 @@ python_environment_install() { git clone https://github.com/colesbury/nogil cd nogil ./configure && make -j 2 - ./python -m venv $VIRTUALENV + ./python -m venv $ORIGINAL_FOLDER/$VIRTUALENV cd $ORIGINAL_FOLDER source $VIRTUALENV/bin/activate From e09e2efcd7e7e4b238acba67b4efd5a633e4e5f4 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Thu, 21 Apr 2022 13:59:24 +0200 Subject: [PATCH 11/28] git clone --depth 1 [nogil] --- build_tools/azure/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tools/azure/install.sh b/build_tools/azure/install.sh index a914cd1cb05ac..3111cb71f8a55 100755 --- a/build_tools/azure/install.sh +++ b/build_tools/azure/install.sh @@ -134,7 +134,7 @@ python_environment_install() { setup_ccache # speed-up the build of CPython it-self ORIGINAL_FOLDER=`pwd` cd .. - git clone https://github.com/colesbury/nogil + git clone --depth 1 https://github.com/colesbury/nogil cd nogil ./configure && make -j 2 ./python -m venv $ORIGINAL_FOLDER/$VIRTUALENV From d6f62189d813cd8acfdac2ad9c9b248ee14bd170 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Thu, 21 Apr 2022 15:45:20 +0200 Subject: [PATCH 12/28] Make setup_ccache idempotent --- build_tools/azure/install.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build_tools/azure/install.sh b/build_tools/azure/install.sh index 3111cb71f8a55..bff27e00ce7f3 100755 --- a/build_tools/azure/install.sh +++ b/build_tools/azure/install.sh @@ -8,6 +8,9 @@ source build_tools/shared.sh UNAMESTR=`uname` +CCACHE_LINKS_DIR="/tmp/ccache" + + make_conda() { TO_INSTALL="$@" if [[ "$DISTRIB" == *"mamba"* ]]; then @@ -21,14 +24,14 @@ make_conda() { setup_ccache() { CCACHE_BIN=`which ccache || echo ""` - if [[ "${CCACHE_BIN}" != "" ]]; then + if [[ "${CCACHE_BIN}" != "" ]] && [[ ! -d "${CCACHE_LINKS_DIR}" ]]; then echo "Setting up ccache with CCACHE_DIR=${CCACHE_DIR}" - mkdir /tmp/ccache/ + mkdir ${CCACHE_LINKS_DIR} which ccache for name in gcc g++ cc c++ clang clang++ i686-linux-gnu-gcc i686-linux-gnu-c++ x86_64-linux-gnu-gcc x86_64-linux-gnu-c++ x86_64-apple-darwin13.4.0-clang x86_64-apple-darwin13.4.0-clang++; do - ln -s ${CCACHE_BIN} "/tmp/ccache/${name}" + ln -s ${CCACHE_BIN} "${CCACHE_LINKS_DIR}/${name}" done - export PATH="/tmp/ccache/:${PATH}" + export PATH="${CCACHE_LINKS_DIR}:${PATH}" ccache -M 256M else echo "ccache not found, skipping..." From f5afcdc5fe6f4cb288b98a619c005ca3ad190c61 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Thu, 21 Apr 2022 15:52:45 +0200 Subject: [PATCH 13/28] Better output messages in setup_ccache [nogil] --- build_tools/azure/install.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build_tools/azure/install.sh b/build_tools/azure/install.sh index bff27e00ce7f3..c60ad4fcd6e6d 100755 --- a/build_tools/azure/install.sh +++ b/build_tools/azure/install.sh @@ -24,7 +24,11 @@ make_conda() { setup_ccache() { CCACHE_BIN=`which ccache || echo ""` - if [[ "${CCACHE_BIN}" != "" ]] && [[ ! -d "${CCACHE_LINKS_DIR}" ]]; then + if [[ "${CCACHE_BIN}" == "" ]]; then + echo "ccache not found, skipping..." + elif [[ -d "${CCACHE_LINKS_DIR}" ]]; then + echo "ccache already configured, skipping..." + else echo "Setting up ccache with CCACHE_DIR=${CCACHE_DIR}" mkdir ${CCACHE_LINKS_DIR} which ccache @@ -33,8 +37,6 @@ setup_ccache() { done export PATH="${CCACHE_LINKS_DIR}:${PATH}" ccache -M 256M - else - echo "ccache not found, skipping..." fi } From f94cfb84724e9def59f43893a8398e84b6ab328c Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Thu, 21 Apr 2022 16:42:32 +0200 Subject: [PATCH 14/28] activate venv in tests [nogil] --- build_tools/azure/test_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tools/azure/test_script.sh b/build_tools/azure/test_script.sh index 46f6dc7d43943..152ad8a9f5743 100755 --- a/build_tools/azure/test_script.sh +++ b/build_tools/azure/test_script.sh @@ -7,7 +7,7 @@ source build_tools/shared.sh if [[ "$DISTRIB" =~ ^conda.* ]]; then source activate $VIRTUALENV -elif [[ "$DISTRIB" == "ubuntu" ]] || [[ "$DISTRIB" == "debian-32" ]]; then +elif [[ "$DISTRIB" == "ubuntu" ]] || [[ "$DISTRIB" == "debian-32" ]] || [[ "$DISTRIB" == "pip-nogil" ]]; then source $VIRTUALENV/bin/activate fi From 17967d766c8cc8ce7660e3a3f3895a3916374ebd Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Thu, 21 Apr 2022 19:49:22 +0200 Subject: [PATCH 15/28] Try to disable xdist [nogil] Co-authored-by: Thomas J. Fan --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 350942b53eae6..f428f47be410d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -103,6 +103,7 @@ jobs: matrix: pylatest_pip_nogil: DISTRIB: 'pip-nogil' + PYTEST_XDIST_VERSION: 'none' # Check compilation with intel C++ compiler (ICC) - template: build_tools/azure/posix.yml From 4aa94677de4eb5fba65262a3238e3f4bcc81ae46 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Wed, 27 Apr 2022 11:46:17 +0200 Subject: [PATCH 16/28] Trigger [nogil] build From 715546dea61d7ced0691f3a6486685dc262c5bbe Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Wed, 27 Apr 2022 14:32:44 +0200 Subject: [PATCH 17/28] enable nogil venv for doctests --- build_tools/azure/test_docs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tools/azure/test_docs.sh b/build_tools/azure/test_docs.sh index 18b3ccb148b5e..ac9002747c50e 100755 --- a/build_tools/azure/test_docs.sh +++ b/build_tools/azure/test_docs.sh @@ -4,7 +4,7 @@ set -e if [[ "$DISTRIB" =~ ^conda.* ]]; then source activate $VIRTUALENV -elif [[ "$DISTRIB" == "ubuntu" ]]; then +elif [[ "$DISTRIB" == "ubuntu" ]] || [[ "$DISTRIB" == "pip-nogil"; then source $VIRTUALENV/bin/activate fi From 3a9ebd244dbed320070fa207f28ca66437293168 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Wed, 27 Apr 2022 14:33:26 +0200 Subject: [PATCH 18/28] Trigger [nogil] From 7767753eab74293e3dd4f38b6e093d455ad00ca8 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Wed, 27 Apr 2022 14:47:28 +0200 Subject: [PATCH 19/28] Fixed a typo [nogil] --- build_tools/azure/test_docs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tools/azure/test_docs.sh b/build_tools/azure/test_docs.sh index ac9002747c50e..d40d2c55eae32 100755 --- a/build_tools/azure/test_docs.sh +++ b/build_tools/azure/test_docs.sh @@ -4,7 +4,7 @@ set -e if [[ "$DISTRIB" =~ ^conda.* ]]; then source activate $VIRTUALENV -elif [[ "$DISTRIB" == "ubuntu" ]] || [[ "$DISTRIB" == "pip-nogil"; then +elif [[ "$DISTRIB" == "ubuntu" ]] || [[ "$DISTRIB" == "pip-nogil" ]]; then source $VIRTUALENV/bin/activate fi From 8173b1cc0cb04ee26fa358187d44727b73a3aaea Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Thu, 28 Apr 2022 11:33:13 +0200 Subject: [PATCH 20/28] disable coverage for [nogil] --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f428f47be410d..0292b966f4465 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -104,6 +104,7 @@ jobs: pylatest_pip_nogil: DISTRIB: 'pip-nogil' PYTEST_XDIST_VERSION: 'none' + COVERAGE: 'false' # Check compilation with intel C++ compiler (ICC) - template: build_tools/azure/posix.yml From baa4d4cb73846b35527412504c79e67bb6427a95 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Thu, 28 Apr 2022 11:58:40 +0200 Subject: [PATCH 21/28] Re-enable pytext-xdist for [nogil] --- azure-pipelines.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0292b966f4465..020d007acc651 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -103,7 +103,6 @@ jobs: matrix: pylatest_pip_nogil: DISTRIB: 'pip-nogil' - PYTEST_XDIST_VERSION: 'none' COVERAGE: 'false' # Check compilation with intel C++ compiler (ICC) From c872deaa7b4e60651ea005af06b291a2a0a30135 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Fri, 29 Apr 2022 09:52:33 +0200 Subject: [PATCH 22/28] Document the [nogil] commit flag --- doc/developers/contributing.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/developers/contributing.rst b/doc/developers/contributing.rst index 445a9d2211733..a8ab323daefb3 100644 --- a/doc/developers/contributing.rst +++ b/doc/developers/contributing.rst @@ -552,6 +552,7 @@ message, the following actions are taken. [cd build gh] CD is run only for GitHub Actions [lint skip] Azure pipeline skips linting [scipy-dev] Build & test with our dependencies (numpy, scipy, etc ...) development builds + [nogil] Build & test with the nogil experimental branches of CPython, Cython, NumPy, SciPy... [icc-build] Build & test with the Intel C compiler (ICC) [pypy] Build & test with PyPy [doc skip] Docs are not built From b7a84e98a34b2a476b6ec5ca6819a76d10c2a4fe Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Fri, 29 Apr 2022 09:53:21 +0200 Subject: [PATCH 23/28] Apply suggestions from code review [nogil] Co-authored-by: Thomas J. Fan --- build_tools/azure/test_docs.sh | 2 +- build_tools/azure/test_script.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build_tools/azure/test_docs.sh b/build_tools/azure/test_docs.sh index d40d2c55eae32..1d28f64a036cd 100755 --- a/build_tools/azure/test_docs.sh +++ b/build_tools/azure/test_docs.sh @@ -4,7 +4,7 @@ set -e if [[ "$DISTRIB" =~ ^conda.* ]]; then source activate $VIRTUALENV -elif [[ "$DISTRIB" == "ubuntu" ]] || [[ "$DISTRIB" == "pip-nogil" ]]; then +elif [[ "$DISTRIB" == "ubuntu" || "$DISTRIB" == "pip-nogil" ]]; then source $VIRTUALENV/bin/activate fi diff --git a/build_tools/azure/test_script.sh b/build_tools/azure/test_script.sh index 4f99a1fc3c9a5..3d74a0d98b374 100755 --- a/build_tools/azure/test_script.sh +++ b/build_tools/azure/test_script.sh @@ -7,7 +7,7 @@ source build_tools/shared.sh if [[ "$DISTRIB" =~ ^conda.* ]]; then source activate $VIRTUALENV -elif [[ "$DISTRIB" == "ubuntu" ]] || [[ "$DISTRIB" == "debian-32" ]] || [[ "$DISTRIB" == "pip-nogil" ]]; then +elif [[ "$DISTRIB" == "ubuntu" || "$DISTRIB" == "debian-32" || "$DISTRIB" == "pip-nogil" ]]; then source $VIRTUALENV/bin/activate fi From bb79bb425b1df9f6f025394be5aecaaeba7d8eaf Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Fri, 29 Apr 2022 09:57:46 +0200 Subject: [PATCH 24/28] More explicit comment on the [nogil] specific index --- build_tools/azure/install.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build_tools/azure/install.sh b/build_tools/azure/install.sh index c60ad4fcd6e6d..8404c036b665f 100755 --- a/build_tools/azure/install.sh +++ b/build_tools/azure/install.sh @@ -147,7 +147,11 @@ python_environment_install() { source $VIRTUALENV/bin/activate python -m pip install -U pip - echo "Installing build dependepencies with pip from the nogil repository" + # The pip version that comes with the nogil branch of CPython + # automatically uses the custom nogil index as its highest priority + # index to fetch patched versions of libraries with native code that + # would otherwise depend on the GIL. + echo "Installing build dependepencies with pip from the nogil repository: https://d1yxz45j0ypngg.cloudfront.net/" pip install numpy scipy cython joblib threadpoolctl fi From 465a18316a47e90747cee9fc9a054e5da80e8a4d Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Fri, 29 Apr 2022 10:41:25 +0200 Subject: [PATCH 25/28] Typo [ci skip] --- build_tools/azure/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tools/azure/install.sh b/build_tools/azure/install.sh index 8404c036b665f..ac160105ab085 100755 --- a/build_tools/azure/install.sh +++ b/build_tools/azure/install.sh @@ -151,7 +151,7 @@ python_environment_install() { # automatically uses the custom nogil index as its highest priority # index to fetch patched versions of libraries with native code that # would otherwise depend on the GIL. - echo "Installing build dependepencies with pip from the nogil repository: https://d1yxz45j0ypngg.cloudfront.net/" + echo "Installing build dependencies with pip from the nogil repository: https://d1yxz45j0ypngg.cloudfront.net/" pip install numpy scipy cython joblib threadpoolctl fi From 6729e0b4b695f03d75ad6333d262aaa1bc240ca3 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Fri, 29 Apr 2022 10:45:22 +0200 Subject: [PATCH 26/28] Trigger [nogil] From 4b478ad72e90779d52cefbd0923c7979ec3d3f95 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Mon, 2 May 2022 12:19:37 +0200 Subject: [PATCH 27/28] reorg install script for [nogil] --- build_tools/azure/install.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/build_tools/azure/install.sh b/build_tools/azure/install.sh index ac160105ab085..244a61defc37a 100755 --- a/build_tools/azure/install.sh +++ b/build_tools/azure/install.sh @@ -124,17 +124,6 @@ python_environment_install() { # do not install dependencies for lightgbm since it requires scikit-learn. python -m pip install "lightgbm>=3.0.0" --no-deps - elif [[ "$DISTRIB" == "conda-pip-scipy-dev" ]]; then - make_conda "ccache python=$PYTHON_VERSION" - python -m pip install -U pip - echo "Installing numpy and scipy master wheels" - dev_anaconda_url=https://pypi.anaconda.org/scipy-wheels-nightly/simple - pip install --pre --upgrade --timeout=60 --extra-index $dev_anaconda_url numpy pandas scipy - pip install --pre cython - echo "Installing joblib master" - pip install https://github.com/joblib/joblib/archive/master.zip - echo "Installing pillow master" - pip install https://github.com/python-pillow/Pillow/archive/main.zip elif [[ "$DISTRIB" == "pip-nogil" ]]; then setup_ccache # speed-up the build of CPython it-self ORIGINAL_FOLDER=`pwd` @@ -153,6 +142,19 @@ python_environment_install() { # would otherwise depend on the GIL. echo "Installing build dependencies with pip from the nogil repository: https://d1yxz45j0ypngg.cloudfront.net/" pip install numpy scipy cython joblib threadpoolctl + + elif [[ "$DISTRIB" == "conda-pip-scipy-dev" ]]; then + make_conda "ccache python=$PYTHON_VERSION" + python -m pip install -U pip + echo "Installing numpy and scipy master wheels" + dev_anaconda_url=https://pypi.anaconda.org/scipy-wheels-nightly/simple + pip install --pre --upgrade --timeout=60 --extra-index $dev_anaconda_url numpy pandas scipy + pip install --pre cython + echo "Installing joblib master" + pip install https://github.com/joblib/joblib/archive/master.zip + echo "Installing pillow master" + pip install https://github.com/python-pillow/Pillow/archive/main.zip + fi python -m pip install $(get_dep threadpoolctl $THREADPOOLCTL_VERSION) \ From 3598eb67d9d1b502bdc3273768a00316e10c3432 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Mon, 2 May 2022 12:21:34 +0200 Subject: [PATCH 28/28] reorg install script for [nogil] --- build_tools/azure/install.sh | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/build_tools/azure/install.sh b/build_tools/azure/install.sh index 244a61defc37a..cfc563a4f9f65 100755 --- a/build_tools/azure/install.sh +++ b/build_tools/azure/install.sh @@ -58,6 +58,12 @@ pre_python_environment_install() { apt-get -yq update apt-get -yq install build-essential + elif [[ "$DISTRIB" == "pip-nogil" ]]; then + echo "deb-src http://archive.ubuntu.com/ubuntu/ focal main" | sudo tee -a /etc/apt/sources.list + sudo apt-get -yq update + sudo apt-get install -yq ccache + sudo apt-get build-dep -yq python3 python3-dev + elif [[ "$BUILD_WITH_ICC" == "true" ]]; then wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB @@ -66,11 +72,7 @@ pre_python_environment_install() { sudo apt-get update sudo apt-get install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic source /opt/intel/oneapi/setvars.sh - elif [[ "$DISTRIB" == "pip-nogil" ]]; then - echo "deb-src http://archive.ubuntu.com/ubuntu/ focal main" | sudo tee -a /etc/apt/sources.list - sudo apt-get -yq update - sudo apt-get install -yq ccache - sudo apt-get build-dep -yq python3 python3-dev + fi } @@ -124,6 +126,18 @@ python_environment_install() { # do not install dependencies for lightgbm since it requires scikit-learn. python -m pip install "lightgbm>=3.0.0" --no-deps + elif [[ "$DISTRIB" == "conda-pip-scipy-dev" ]]; then + make_conda "ccache python=$PYTHON_VERSION" + python -m pip install -U pip + echo "Installing numpy and scipy master wheels" + dev_anaconda_url=https://pypi.anaconda.org/scipy-wheels-nightly/simple + pip install --pre --upgrade --timeout=60 --extra-index $dev_anaconda_url numpy pandas scipy + pip install --pre cython + echo "Installing joblib master" + pip install https://github.com/joblib/joblib/archive/master.zip + echo "Installing pillow master" + pip install https://github.com/python-pillow/Pillow/archive/main.zip + elif [[ "$DISTRIB" == "pip-nogil" ]]; then setup_ccache # speed-up the build of CPython it-self ORIGINAL_FOLDER=`pwd` @@ -143,18 +157,6 @@ python_environment_install() { echo "Installing build dependencies with pip from the nogil repository: https://d1yxz45j0ypngg.cloudfront.net/" pip install numpy scipy cython joblib threadpoolctl - elif [[ "$DISTRIB" == "conda-pip-scipy-dev" ]]; then - make_conda "ccache python=$PYTHON_VERSION" - python -m pip install -U pip - echo "Installing numpy and scipy master wheels" - dev_anaconda_url=https://pypi.anaconda.org/scipy-wheels-nightly/simple - pip install --pre --upgrade --timeout=60 --extra-index $dev_anaconda_url numpy pandas scipy - pip install --pre cython - echo "Installing joblib master" - pip install https://github.com/joblib/joblib/archive/master.zip - echo "Installing pillow master" - pip install https://github.com/python-pillow/Pillow/archive/main.zip - fi python -m pip install $(get_dep threadpoolctl $THREADPOOLCTL_VERSION) \