From a5c67a6d552b8c23bff70a40a9caf6364f39e8e4 Mon Sep 17 00:00:00 2001 From: Tim Head Date: Fri, 21 Mar 2025 14:09:25 +0100 Subject: [PATCH 1/3] Update array API common checks docs Mention that you can run (most of the) checks without having a GPU by using array-api-strict. --- doc/modules/array_api.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/modules/array_api.rst b/doc/modules/array_api.rst index b1d1272e3b173..f1b5e379057af 100644 --- a/doc/modules/array_api.rst +++ b/doc/modules/array_api.rst @@ -200,16 +200,17 @@ common tests to verify that the estimators' results are the same when using vanilla NumPy and Array API inputs. To run these checks you need to install -`array_api_compat `_ in your -test environment. To run the full set of checks you need to install both -`PyTorch `_ and `CuPy `_ and have +`array-api-strict `_ in your +test environment. This allows you to run checks without having a +GPU. To run the full set of checks you also need to install +`PyTorch `_, `CuPy `_ and have a GPU. Checks that can not be executed or have missing dependencies will be automatically skipped. Therefore it's important to run the tests with the `-v` flag to see which checks are skipped: .. prompt:: bash $ - pip install array-api-compat # and other libraries as needed + pip install array-api-strict # and other libraries as needed pytest -k "array_api" -v .. _mps_support: From 25de158a229b114e664af69e6d24fffac5d619bb Mon Sep 17 00:00:00 2001 From: Tim Head Date: Mon, 12 May 2025 10:38:17 +0200 Subject: [PATCH 2/3] Update doc/modules/array_api.rst Co-authored-by: Olivier Grisel --- doc/modules/array_api.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/modules/array_api.rst b/doc/modules/array_api.rst index f1b5e379057af..9514e563a4bc8 100644 --- a/doc/modules/array_api.rst +++ b/doc/modules/array_api.rst @@ -213,6 +213,17 @@ automatically skipped. Therefore it's important to run the tests with the pip install array-api-strict # and other libraries as needed pytest -k "array_api" -v +Running the scikit-learn tests against `array-api-strict` should help reveal +most code problems related to handling multiple device inputs via the use of +simulated non-CPU devices. This allows for fast iterative development and debugging of +array API related code. + +However, to ensure full handling of PyTorch or CuPy inputs allocated on actual GPU +devices, it is necessary to run the tests against those libraries and hardware. +This can either be achieved by using +`Google Colab `_ +or leveraging our CI infrastructure on pull requests (manually triggered by maintainers +for cost reasons). .. _mps_support: Note on MPS device support From 512390860e65fd120db60d36d266d7a04687587b Mon Sep 17 00:00:00 2001 From: Tim Head Date: Mon, 12 May 2025 10:44:08 +0200 Subject: [PATCH 3/3] Add newline --- doc/modules/array_api.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/modules/array_api.rst b/doc/modules/array_api.rst index 9514e563a4bc8..f0c7d334a895c 100644 --- a/doc/modules/array_api.rst +++ b/doc/modules/array_api.rst @@ -224,6 +224,7 @@ This can either be achieved by using `Google Colab `_ or leveraging our CI infrastructure on pull requests (manually triggered by maintainers for cost reasons). + .. _mps_support: Note on MPS device support