commit:     1f7cd8213b81e9a36492cbd94dd463f9e2c49eed
Author:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 25 13:13:53 2023 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Sat Feb 25 13:13:53 2023 +0000
URL:        https://gitweb.gentoo.org/proj/sci.git/commit/?id=1f7cd821

sci-libs/daal4py: add 2023.0.2

Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>

 sci-libs/daal4py/daal4py-2023.0.2.ebuild           |  64 +++++++++++++
 .../daal4py-2023.0.2-dont-use-entire-include.patch | 104 +++++++++++++++++++++
 2 files changed, 168 insertions(+)

diff --git a/sci-libs/daal4py/daal4py-2023.0.2.ebuild 
b/sci-libs/daal4py/daal4py-2023.0.2.ebuild
new file mode 100644
index 000000000..09fc690fd
--- /dev/null
+++ b/sci-libs/daal4py/daal4py-2023.0.2.ebuild
@@ -0,0 +1,64 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..11} )
+DISTUTILS_USE_PEP517=setuptools
+inherit distutils-r1
+
+DESCRIPTION="Python API to the oneAPI Data Analytics Library"
+HOMEPAGE="https://github.com/intel/scikit-learn-intelex";
+SRC_URI="https://github.com/intel/scikit-learn-intelex/archive/${PV}.tar.gz -> 
${P}.tar.gz"
+S="${WORKDIR}/scikit-learn-intelex-${PV}"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64"
+
+BDEPEND="
+       dev-python/cython[${PYTHON_USEDEP}]
+       dev-python/pybind11[${PYTHON_USEDEP}]
+       dev-util/cmake
+       sys-devel/DPC++
+       test? (
+               sci-libs/scikit-learn[${PYTHON_USEDEP}]
+               sci-libs/scikit-learn-intelx[${PYTHON_USEDEP}]
+               dev-python/pandas[${PYTHON_USEDEP}]
+       )
+"
+
+DEPEND="
+       dev-python/jinja[${PYTHON_USEDEP}]
+       dev-python/numpy[${PYTHON_USEDEP}]
+       dev-python/dpctl[${PYTHON_USEDEP}]
+       sci-libs/oneDAL
+       virtual/mpi
+"
+RDEPEND="${DEPEND}"
+
+distutils_enable_tests pytest
+
+PATCHES=(
+       "${FILESDIR}/${PN}-2023.0.2-dont-use-entire-include.patch"
+)
+
+python_prepare_all() {
+       # DPC++ compiler required for full functionality
+       export CC="${ESYSROOT}/usr/lib/llvm/intel/bin/clang"
+       export CXX="${ESYSROOT}/usr/lib/llvm/intel/bin/clang++"
+       export DPCPPROOT="${ESYSROOT}/usr/lib/llvm/intel"
+       export 
CPLUS_INCLUDE_PATH="${ESYSROOT}/usr/lib/llvm/intel/include:${ESYSROOT}/usr/lib/llvm/intel/include/sycl:${ESYSROOT}/usr/lib/llvm/intel/include/sycl/CL/sycl"
+       export MPIROOT="${ESYSROOT}/usr"
+       export DALROOT="${ESYSROOT}/usr"
+       # Parallel build is broken
+       export MAKEOPTS="-j1"
+
+       distutils-r1_python_prepare_all
+}
+
+python_test() {
+       export 
PYTHONPATH="${BUILD_DIR}/install/usr/lib/${EPYTHON}/site-packages"
+       # We don't use epytest because it overwrites our PYTHONPATH
+       pytest -vv || die
+}

diff --git 
a/sci-libs/daal4py/files/daal4py-2023.0.2-dont-use-entire-include.patch 
b/sci-libs/daal4py/files/daal4py-2023.0.2-dont-use-entire-include.patch
new file mode 100644
index 000000000..d26414105
--- /dev/null
+++ b/sci-libs/daal4py/files/daal4py-2023.0.2-dont-use-entire-include.patch
@@ -0,0 +1,104 @@
+diff --git a/generator/gen_daal4py.py b/generator/gen_daal4py.py
+index 203c870..7fdac1e 100755
+--- a/generator/gen_daal4py.py
++++ b/generator/gen_daal4py.py
+@@ -34,7 +34,7 @@ from .wrappers import (required, ignore, defaults, has_dist, 
ifaces,
+                        enum_maps, enum_params, wrap_algo, result_to_compute)
+ from .wrapper_gen import wrapper_gen
+ from .format import mk_var
+-from shutil import copytree, rmtree
++from shutil import copytree, copyfile, rmtree
+ from subprocess import call
+ 
+ try:
+@@ -1045,7 +1045,13 @@ def gen_daal4py(daalroot, outdir, version, 
warn_all=False,
+     head_path = jp("build", "include")
+     algo_path = jp(head_path, "algorithms")
+     rmtree(head_path, ignore_errors=True)
+-    copytree(orig_path, head_path)
++    copytree(jp(orig_path, 'services'), jp(head_path, 'services'))
++    copytree(jp(orig_path, 'oneapi', 'dal'), jp(head_path, 'oneapi', 'dal'))
++    copytree(jp(orig_path, 'data_management'), jp(head_path, 
'data_management'))
++    copytree(jp(orig_path, 'algorithms'), jp(head_path, 'algorithms'))
++    copyfile(jp(orig_path, 'daal.h'), jp(head_path, 'daal.h'))
++    copyfile(jp(orig_path, 'daal_sycl.h'), jp(head_path, 'daal_sycl.h'))
++    copyfile(jp(orig_path, 'oneapi', 'dal.hpp'), jp(head_path, 'oneapi', 
'dal.hpp'))
+     for (dirpath, dirnames, filenames) in os.walk(algo_path):
+         for filename in filenames:
+             call([shutil.which("clang-format"), "-i", jp(dirpath, filename)])
+diff --git a/scripts/build_backend.py b/scripts/build_backend.py
+index dd314e4..ec1ec2c 100755
+--- a/scripts/build_backend.py
++++ b/scripts/build_backend.py
+@@ -118,20 +118,12 @@ def custom_build_cmake_clib(iface, cxx=None, 
onedal_major_binary_version=1):
+     python_library_dir = win_python_path_lib if IS_WIN else 
get_config_var('LIBDIR')
+     numpy_include = np.get_include()
+ 
+-    if iface == 'dpc':
+-        if IS_WIN:
+-            cxx = 'icx'
+-        else:
+-            cxx = 'icpx'
+-    elif cxx is None:
+-        raise RuntimeError('CXX compiler shall be specified')
+-
+     cmake_args = [
+         "cmake",
+         cmake_generator,
+         "-S" + builder_directory,
+         "-B" + abs_build_temp_path,
+-        "-DCMAKE_CXX_COMPILER=" + cxx,
++        "-DCMAKE_CXX_COMPILER=" + os.environ.get('CXX'),
+         "-DCMAKE_INSTALL_PREFIX=" + install_directory,
+         "-DCMAKE_PREFIX_PATH=" + install_directory,
+         "-DIFACE=" + iface,
+@@ -140,7 +132,7 @@ def custom_build_cmake_clib(iface, cxx=None, 
onedal_major_binary_version=1):
+         "-DNUMPY_INCLUDE_DIRS=" + numpy_include,
+         "-DPYTHON_LIBRARY_DIR=" + python_library_dir,
+         "-DoneDAL_INCLUDE_DIRS=" + jp(os.environ['DALROOT'], 'include'),
+-        "-DoneDAL_LIBRARY_DIR=" + jp(os.environ['DALROOT'], 'lib', 'intel64'),
++        "-DoneDAL_LIBRARY_DIR=" + jp(os.environ['DALROOT'], 'lib', 'lib64'),
+         "-Dpybind11_DIR=" + pybind11.get_cmake_dir(),
+     ]
+ 
+diff --git a/setup.py b/setup.py
+index 8f56b48..36260ea 100644
+--- a/setup.py
++++ b/setup.py
+@@ -48,13 +48,13 @@ if dal_root is None:
+ 
+ if 'linux' in sys.platform:
+     IS_LIN = True
+-    lib_dir = jp(dal_root, 'lib', 'intel64')
++    lib_dir = jp(dal_root, 'lib', 'lib64')
+ elif sys.platform == 'darwin':
+     IS_MAC = True
+     lib_dir = jp(dal_root, 'lib')
+ elif sys.platform in ['win32', 'cygwin']:
+     IS_WIN = True
+-    lib_dir = jp(dal_root, 'lib', 'intel64')
++    lib_dir = jp(dal_root, 'lib', 'lib64')
+ else:
+     assert False, sys.platform + ' not supported'
+ 
+@@ -178,7 +178,8 @@ def get_build_options():
+         'icc', 'icpc', 'icl', 'dpcpp', 'icx', 'icpx']
+     eca = ['-DPY_ARRAY_UNIQUE_SYMBOL=daal4py_array_API',
+            '-DD4P_VERSION="' + d4p_version + '"', '-DNPY_ALLOW_THREADS=1']
+-    ela = []
++    ela = os.environ.get('LDFLAGS').split(" ")
++    eca += os.environ.get('CFLAGS').split(" ")
+ 
+     if using_intel and IS_WIN:
+         include_dir_plat.append(
+@@ -311,8 +312,8 @@ def build_oneapi_backend():
+     ela = ['-fsycl'] + ['-fsycl-device-code-split=per_kernel'] + ela
+ 
+     return build_backend.build_cpp(
+-        cc=cc,
+-        cxx=cxx,
++        cc=os.environ.get('CC'),
++        cxx=os.environ.get('CXX'),
+         sources=['src/oneapi/oneapi_backend.cpp'],
+         targetname='oneapi_backend',
+         targetprefix='' if IS_WIN else 'lib',

Reply via email to