From 7a32a0a425b00679b4a0b13d2e36f112e981858a Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 8 Dec 2023 11:02:11 +0000 Subject: [PATCH] Update oneAPI dependencies (#1581) (#1605) --- .ci/pipeline/build-and-test-lnx.yml | 6 ++-- .ci/pipeline/build-and-test-win.yml | 2 +- .ci/scripts/install_dpcpp.sh | 3 +- gen.py | 51 ----------------------------- generator/gen_daal4py.py | 12 ++++++- scripts/CMakeLists.txt | 7 ++++ scripts/version.py | 14 ++++++-- setup.py | 9 ++++- 8 files changed, 43 insertions(+), 61 deletions(-) delete mode 100644 gen.py diff --git a/.ci/pipeline/build-and-test-lnx.yml b/.ci/pipeline/build-and-test-lnx.yml index f62c827c9e..0b015c4678 100644 --- a/.ci/pipeline/build-and-test-lnx.yml +++ b/.ci/pipeline/build-and-test-lnx.yml @@ -24,8 +24,8 @@ steps: displayName: "System info" - script: | conda update -y -q conda - if [ $(echo $(PYTHON_VERSION) | grep '3.8\|3.9\|3.10') ]; then export DPCPP_PACKAGE="dpctl>=0.14 "; else export DPCPP_PACKAGE=""; fi - conda create -q -y -n CB -c conda-forge -c intel python=$(PYTHON_VERSION) dal-devel mpich pyyaml $DPCPP_PACKAGE dpcpp-cpp-rt>=2023.2.0 + if [ $(echo $(PYTHON_VERSION) | grep '3.9\|3.10') ]; then export DPCPP_PACKAGE="dpctl>=0.15 "; else export DPCPP_PACKAGE=""; fi + conda create -q -y -n CB -c conda-forge -c intel python=$(PYTHON_VERSION) intel::dal-devel mpich pyyaml $DPCPP_PACKAGE "dpcpp-cpp-rt>=2024.0.0" displayName: "Conda create" - script: | . /usr/share/miniconda/etc/profile.d/conda.sh @@ -47,7 +47,7 @@ steps: bash .ci/scripts/setup_sklearn.sh $(SKLEARN_VERSION) pip install --upgrade -r requirements-test.txt pip install $(python .ci/scripts/get_compatible_scipy_version.py) - if [ $(echo $(PYTHON_VERSION) | grep '3.8\|3.9\|3.10') ]; then conda install -q -y -c intel dpnp; fi + if [ $(echo $(PYTHON_VERSION) | grep '3.9\|3.10') ]; then conda install -q -y -c intel dpnp; fi pip list displayName: "Install testing requirements" - script: | diff --git a/.ci/pipeline/build-and-test-win.yml b/.ci/pipeline/build-and-test-win.yml index 2875513cb3..07dd3a5d6f 100644 --- a/.ci/pipeline/build-and-test-win.yml +++ b/.ci/pipeline/build-and-test-win.yml @@ -16,7 +16,7 @@ steps: - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" displayName: Add conda to PATH - - script: conda create -q -y -n CB -c conda-forge -c intel python=$(PYTHON_VERSION) dal-devel impi-devel clang-format pyyaml + - script: conda create -q -y -n CB -c conda-forge -c intel python=$(PYTHON_VERSION) intel::dal-devel impi-devel clang-format pyyaml displayName: 'Create Anaconda environment' - script: | call activate CB diff --git a/.ci/scripts/install_dpcpp.sh b/.ci/scripts/install_dpcpp.sh index 7df36449d9..86432e17ca 100755 --- a/.ci/scripts/install_dpcpp.sh +++ b/.ci/scripts/install_dpcpp.sh @@ -21,6 +21,5 @@ rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list sudo add-apt-repository -y "deb https://apt.repos.intel.com/oneapi all main" sudo apt-get update -sudo apt-get install -y intel-dpcpp-cpp-compiler-2023.2.1 +sudo apt-get install -y intel-dpcpp-cpp-compiler-2024.0 sudo bash -c 'echo libintelocl.so > /etc/OpenCL/vendors/intel-cpu.icd' -sudo mv -f /opt/intel/oneapi/compiler/latest/linux/lib/oclfpga /opt/intel/oneapi/compiler/latest/linux/lib/oclfpga_ diff --git a/gen.py b/gen.py deleted file mode 100644 index 57be876e5d..0000000000 --- a/gen.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python -# ============================================================================== -# Copyright 2020 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== - -from generator.gen_daal4py import gen_daal4py - -if __name__ == "__main__": - import argparse - - global no_warn - - description = """ - A tool to create cython interface files for HLAPI of oneDAL (aka daal4py). - Extracting necessary data and creating internal data structures. - See parse.py for details about C++ parsing. - See wrappers.py for necessary configuration that can not be auto-extracted. - See wrapper_gen.py for code generation (cython and C++). - """ - - argParser = argparse.ArgumentParser( - prog="gen_daal4py.py", - description=description, - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - ) - argParser.add_argument( - "--dalroot", - required=True, - help="DAAL root directory (reads include dir in there)", - ) - argParser.add_argument( - "--outdir", default="build", help="Output directory to store wrapper files to" - ) - argParser.add_argument( - "--wall", default=False, action="store_true", help="Emit all warnings" - ) - - args = argParser.parse_args() - gen_daal4py(args.dalroot, args.outdir, "v_develop", args.wall) diff --git a/generator/gen_daal4py.py b/generator/gen_daal4py.py index c808aa25c8..997d4d8805 100755 --- a/generator/gen_daal4py.py +++ b/generator/gen_daal4py.py @@ -27,9 +27,11 @@ import re import shutil from collections import OrderedDict, defaultdict +from os.path import isdir from os.path import join as jp from shutil import copytree, rmtree from subprocess import call +from sys import platform from .format import mk_var from .parse import parse_header, parse_version @@ -1196,7 +1198,15 @@ def gen_daal4py(dalroot, outdir, version, warn_all=False, no_dist=False, no_stre global no_warn if warn_all: no_warn = {} - orig_path = jp(dalroot, "include") + orig_path_candidates = [ + jp(dalroot, "include", "dal"), + jp(dalroot, "Library", "include", "dal"), + jp(dalroot, "include"), + ] + for candidate in orig_path_candidates: + if isdir(candidate): + orig_path = candidate + break assert os.path.isfile(jp(orig_path, "algorithms", "algorithm.h")) and os.path.isfile( jp(orig_path, "algorithms", "model.h") ), ( diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index d458ee045e..92d42bb927 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -171,6 +171,13 @@ set(EXTERNAL_INCLUDE_DIRECTORIES ${NUMPY_INCLUDE_DIRS} ) +# TODO: remove this workaround when oneDAL CMake config is fixed +if(WIN32) +list(APPEND EXTERNAL_INCLUDE_DIRECTORIES $ENV{DALROOT}/Library/include/dal $ENV{DALROOT}/include/dal) +else() +list(APPEND EXTERNAL_INCLUDE_DIRECTORIES ${oneDAL_INCLUDE_DIRS}/dal) +endif() + set(EXTERNAL_LINK_DIRECTORIES ${PYTHON_LIBRARY_DIR} ${oneDAL_LIBRARY_DIR}) set(EXTERNAL_LINK_LIBRARIES ${ONEDAL_LIBRARIES}) diff --git a/scripts/version.py b/scripts/version.py index 68dcf0ffdb..eafb512800 100755 --- a/scripts/version.py +++ b/scripts/version.py @@ -16,7 +16,9 @@ # =============================================================================== import re +from os.path import isfile from os.path import join as jp +from sys import platform def find_defines(defines: list, file_obj): @@ -36,9 +38,17 @@ def get_onedal_version(dal_root, version_type="release"): if version_type not in ["release", "binary"]: raise ValueError(f'Incorrect version type "{version_type}"') - header_version = jp(dal_root, "include", "services", "library_version_info.h") - version = "" + header_candidates = [ + jp(dal_root, "include", "dal", "services", "library_version_info.h"), + jp(dal_root, "Library", "include", "dal", "services", "library_version_info.h"), + jp(dal_root, "include", "services", "library_version_info.h"), + ] + for candidate in header_candidates: + if isfile(candidate): + header_version = candidate + break + version = "" with open(header_version, "r") as header: if version_type == "release": version = find_defines( diff --git a/setup.py b/setup.py index 7fa70df492..4a0a12f127 100644 --- a/setup.py +++ b/setup.py @@ -249,8 +249,15 @@ def get_build_options(): include_dir_plat = [ os.path.abspath("./src"), os.path.abspath("."), - dal_root + "/include", ] + include_dir_candidates = [ + jp(dal_root, "include"), + jp(dal_root, "include", "dal"), + jp(dal_root, "Library", "include", "dal"), + ] + for candidate in include_dir_candidates: + if os.path.isdir(candidate): + include_dir_plat.append(candidate) # FIXME it is a wrong place for this dependency if not no_dist: include_dir_plat.append(mpi_root + "/include")