Skip to content

Commit

Permalink
Unify daal4py and sklearnex building (uxlfoundation#1955)
Browse files Browse the repository at this point in the history
* Unify daal4py and sklearnex setup scripts

* Update public CI scripts and INSTALL.md

* Linting

* Return wrongly deleted setup line

* Update installation docs

* Change d4p_version define in setup.py

* Remove extra variables setting

* Revert "Remove extra variables setting"

This reverts commit 3b61622.

* Remove extra DALROOT setting

* Update INSTALL.md

Co-authored-by: Ben Moore <[email protected]>

---------

Co-authored-by: Ben Moore <[email protected]>
  • Loading branch information
Alexsandruss and bdmoore1 authored Jul 30, 2024
1 parent 53159f9 commit 38e42e3
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 305 deletions.
1 change: 0 additions & 1 deletion .ci/pipeline/build-and-test-lnx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ steps:
conda activate CB
export DALROOT=$CONDA_PREFIX
./conda-recipe/build.sh
python setup_sklearnex.py install --single-version-externally-managed --record=record_sklearnex.txt
displayName: "Build daal4py/sklearnex"
- script: |
. /usr/share/miniconda/etc/profile.d/conda.sh
Expand Down
1 change: 0 additions & 1 deletion .ci/pipeline/build-and-test-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ steps:
source activate CB
export DALROOT=$CONDA_PREFIX
./conda-recipe/build.sh
python setup_sklearnex.py install --single-version-externally-managed --record=record_sklearnex.txt
displayName: Conda build
- script: |
source activate CB
Expand Down
2 changes: 0 additions & 2 deletions .ci/pipeline/build-and-test-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ steps:
set PYTHON=python
call conda-recipe\bld.bat
IF %ERRORLEVEL% neq 0 EXIT /b %ERRORLEVEL%
set DALROOT=%CONDA_PREFIX%
python setup_sklearnex.py install --single-version-externally-managed --record=record_sklearnex.txt
displayName: 'Build daal4py/sklearnex'
- script: |
set PATH=C:\msys64\usr\bin;%PATH%
Expand Down
1 change: 0 additions & 1 deletion .ci/pipeline/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ jobs:
export PREFIX=$(dirname $(dirname $(which python)))
export DALROOT=$PREFIX
./conda-recipe/build.sh
python setup_sklearnex.py install --single-version-externally-managed --record=record_sklearnex.txt
displayName: 'Build daal4py/sklearnex'
- script: |
export LD_LIBRARY_PATH=$(dirname $(dirname $(which python)))/lib:$LD_LIBRARY_PATH
Expand Down
1 change: 0 additions & 1 deletion .ci/pipeline/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ jobs:
conda activate CB
export DALROOT=$CONDA_PREFIX
./conda-recipe/build.sh
python setup_sklearnex.py install --single-version-externally-managed --record=record.txt
displayName: 'Build daal4py/sklearnex'
- script: |
. /usr/share/miniconda/etc/profile.d/conda.sh
Expand Down
35 changes: 27 additions & 8 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,41 +139,60 @@ Intel(R) Extension for Scikit-learn* is easily built from the sources with the m

The package is available for Windows* OS, Linux* OS, and macOS*.

Multi-node (distributed) and streaming support can be disabled if needed.

The build-process (using setup.py) happens in 4 stages:
1. Creating C++ and Cython sources from oneDAL C++ headers
2. Building oneDAL Python interfaces via cmake and pybind11
3. Running Cython on generated sources
4. Compiling and linking them

### Prerequisites
* Python version >= 3.8, <= 3.12
* daal4py >= 2024.3

**TIP:** [Build daal4py from sources](https://github.com/intel/scikit-learn-intelex/blob/main/daal4py/INSTALL.md) or get it from [distribution channels](https://intelpython.github.io/daal4py/#getting-daal4py).
* Jinja2
* Cython
* Numpy
* cmake and pybind11
* A C++ compiler with C++11 support
* Clang-Format
* [Intel® oneAPI Data Analytics Library (oneDAL)](https://github.com/oneapi-src/oneDAL) version 2021.1 or later
* You can use the pre-built `dal-devel` conda package from conda-forge channel
* MPI (optional, needed for distributed mode)
* You can use the pre-built `impi-devel` conda package from conda-forge channel
* A DPC++ compiler (optional, needed for DPC++ interfaces)

### Configure the Build with Environment Variables
* ``SKLEARNEX_VERSION``: sets the package version
* ``DALROOT``: sets the oneAPI Data Analytics Library path
* ``NO_DIST``: set to '1', 'yes' or alike to build without support for distributed mode
* ``NO_STREAM``: set to '1', 'yes' or alike to build without support for streaming mode
* ``OFF_ONEDAL_IFACE``: set to '1' to build without the support of oneDAL interfaces

### Build Intel(R) Extension for Scikit-learn

- To install the package:

```bash
cd <checkout-dir>
python setup_sklearnex.py install
python setup.py install
```

- To install the package in the development mode:

```bash
cd <checkout-dir>
python setup_sklearnex.py develop
python setup.py develop
```

- To install scikit-learn-intelex without downloading daal4py:
- To install scikit-learn-intelex without checking for dependencies:

```bash
cd <checkout-dir>
python setup_sklearnex.py install --single-version-externally-managed --record=record.txt
python setup.py install --single-version-externally-managed --record=record.txt
```
```bash
cd <checkout-dir>
python setup_sklearnex.py develop --no-deps
python setup.py develop --no-deps
```

Where:
Expand Down
128 changes: 0 additions & 128 deletions daal4py/INSTALL.md

This file was deleted.

2 changes: 1 addition & 1 deletion daal4py/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ conda install impi_rt -c intel

</details>

You can [build daal4py from sources](https://github.com/intel/scikit-learn-intelex/blob/main/daal4py/INSTALL.md) as well.
You can [build daal4py from sources](https://github.com/intel/scikit-learn-intelex/blob/main/INSTALL.md) as well.


# ⚠️ Scikit-learn patching
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
license_files =
LICENSE
doc/daal4py/third-party-programs.txt
doc/third-party-programs-sklearnex.txt

[flake8]
ignore = E265, E722, E402, F401, F403, W503
Expand Down
46 changes: 37 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@
os.environ.get("OFF_ONEDAL_IFACE", "0") == "0" and ONEDAL_VERSION >= ONEDAL_2021_3
)

d4p_version = (
os.environ["DAAL4PY_VERSION"]
if "DAAL4PY_VERSION" in os.environ
sklearnex_version = (
os.environ["SKLEARNEX_VERSION"]
if "SKLEARNEX_VERSION" in os.environ
else time.strftime("%Y%m%d.%H%M%S")
)

Expand Down Expand Up @@ -261,7 +261,7 @@ def get_build_options():
]
eca = [
"-DPY_ARRAY_UNIQUE_SYMBOL=daal4py_array_API",
'-DD4P_VERSION="' + d4p_version + '"',
'-DD4P_VERSION="' + sklearnex_version + '"',
"-DNPY_ALLOW_THREADS=1",
]
ela = []
Expand Down Expand Up @@ -398,7 +398,7 @@ def gen_pyx(odir):
odir = os.path.abspath(odir)
if not os.path.isdir(odir):
os.mkdir(odir)
gen_daal4py(dal_root, odir, d4p_version, no_dist=no_dist, no_stream=no_stream)
gen_daal4py(dal_root, odir, sklearnex_version, no_dist=no_dist, no_stream=no_stream)


gen_pyx(os.path.abspath("./build"))
Expand Down Expand Up @@ -555,6 +555,25 @@ def run(self):
"onedal.primitives",
"onedal.svm",
"onedal.utils",
"sklearnex",
"sklearnex.basic_statistics",
"sklearnex.cluster",
"sklearnex.covariance",
"sklearnex.decomposition",
"sklearnex.ensemble",
"sklearnex.glob",
"sklearnex.linear_model",
"sklearnex.manifold",
"sklearnex.metrics",
"sklearnex.model_selection",
"sklearnex.neighbors",
"sklearnex.preview",
"sklearnex.preview.covariance",
"sklearnex.preview.cluster",
"sklearnex.preview.decomposition",
"sklearnex.preview.linear_model",
"sklearnex.svm",
"sklearnex.utils",
]

if ONEDAL_VERSION >= 20230100:
Expand All @@ -569,24 +588,32 @@ def run(self):
"onedal.spmd.covariance",
"onedal.spmd.decomposition",
"onedal.spmd.ensemble",
"sklearnex.spmd",
"sklearnex.spmd.covariance",
"sklearnex.spmd.decomposition",
"sklearnex.spmd.ensemble",
]
if ONEDAL_VERSION >= 20230100:
packages_with_tests += [
"onedal.spmd.basic_statistics",
"onedal.spmd.linear_model",
"onedal.spmd.neighbors",
"sklearnex.spmd.basic_statistics",
"sklearnex.spmd.linear_model",
"sklearnex.spmd.neighbors",
]
if ONEDAL_VERSION >= 20230200:
packages_with_tests += ["onedal.spmd.cluster"]
packages_with_tests += ["onedal.spmd.cluster", "sklearnex.spmd.cluster"]

setup(
name="daal4py",
description="A convenient Python API to Intel(R) oneAPI Data Analytics Library",
name="scikit-learn-intelex",
description="Intel(R) Extension for Scikit-learn is a "
"seamless way to speed up your Scikit-learn application.",
long_description=long_description,
long_description_content_type="text/markdown",
license="Apache-2.0",
author="Intel Corporation",
version=d4p_version,
version=sklearnex_version,
url="https://github.com/intel/scikit-learn-intelex",
author_email="[email protected]",
maintainer_email="[email protected]",
Expand All @@ -606,6 +633,7 @@ def run(self):
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
"Topic :: System",
"Topic :: Software Development",
Expand Down
4 changes: 0 additions & 4 deletions setup_sklearnex.cfg

This file was deleted.

Loading

0 comments on commit 38e42e3

Please sign in to comment.