Skip to content

Commit a271ead

Browse files
FIX: Fix logic to check for existence of different oneDAL libraries (#2577)
* fix logic to detect present onedal libs * missing import * check that path exists * pass variable instead of redefining * missing arg * remove unused import
1 parent 5c99508 commit a271ead

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

scripts/version.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# limitations under the License.
1616
# ===============================================================================
1717

18+
import os
1819
import re
1920
from ctypes.util import find_library
2021
from os.path import isfile
@@ -70,7 +71,19 @@ def get_onedal_version(dal_root, version_type="release"):
7071
return version
7172

7273

73-
def get_onedal_shared_libs(dal_root):
74+
def find_library_custom_paths(alias: str, dal_root: str, is_win: bool) -> bool:
75+
if find_library(alias):
76+
return True
77+
path_from_dal_root = (
78+
jp(dal_root, "Library", "bin") if is_win else jp(dal_root, "lib", "intel64")
79+
)
80+
if os.path.exists(path_from_dal_root):
81+
return alias in os.listdir(path_from_dal_root)
82+
else:
83+
return False
84+
85+
86+
def get_onedal_shared_libs(dal_root: str, is_win: bool) -> list[str]:
7487
"""Function to find which oneDAL shared libraries are available in the system"""
7588
lib_names = [
7689
"onedal",
@@ -88,6 +101,9 @@ def get_onedal_shared_libs(dal_root):
88101
f"lib{lib_name}.{major_bin_version}.dylib",
89102
f"{lib_name}.{major_bin_version}.dll",
90103
]
91-
if any(find_library(alias) for alias in possible_aliases):
104+
if any(
105+
find_library_custom_paths(alias, dal_root, is_win)
106+
for alias in possible_aliases
107+
):
92108
found_libraries.append(lib_name)
93109
return found_libraries

setup.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@
104104
" Use 'NO_DIST=1' to build without distributed mode."
105105
)
106106
dpcpp = (
107-
shutil.which("icpx") is not None
108-
and "onedal_dpc" in get_onedal_shared_libs(dal_root)
107+
shutil.which("icpx" if not IS_WIN else "icx") is not None
108+
and "onedal_dpc" in get_onedal_shared_libs(dal_root, IS_WIN)
109109
and not no_dpc
110110
and not (IS_WIN and debug_build)
111111
)
112112

113113
use_parameters_lib = (not IS_WIN) and (ONEDAL_VERSION >= 20240000)
114114

115-
build_distribute = dpcpp and not no_dist and IS_LIN
115+
build_distributed = dpcpp and not no_dist and IS_LIN
116116

117117
daal_lib_dir = lib_dir if (IS_MAC or os.path.isdir(lib_dir)) else os.path.dirname(lib_dir)
118118
ONEDAL_LIBDIRS = [daal_lib_dir]
@@ -418,12 +418,12 @@ def gen_pyx(odir):
418418
def get_onedal_py_libs():
419419
ext_suffix = get_config_vars("EXT_SUFFIX")[0]
420420
libs = [f"_onedal_py_host{ext_suffix}", f"_onedal_py_dpc{ext_suffix}"]
421-
if build_distribute:
421+
if build_distributed:
422422
libs += [f"_onedal_py_spmd_dpc{ext_suffix}"]
423423
if IS_WIN:
424424
ext_suffix_lib = ext_suffix.replace(".dll", ".lib")
425425
libs += [f"_onedal_py_host{ext_suffix_lib}", f"_onedal_py_dpc{ext_suffix_lib}"]
426-
if build_distribute:
426+
if build_distributed:
427427
libs += [f"_onedal_py_spmd_dpc{ext_suffix_lib}"]
428428
return libs
429429

@@ -476,7 +476,7 @@ def onedal_run(self):
476476
build_onedal("host")
477477
if dpcpp:
478478
build_onedal("dpc")
479-
if build_distribute:
479+
if build_distributed:
480480
build_onedal("spmd_dpc")
481481

482482
def onedal_post_build(self):
@@ -569,7 +569,7 @@ class build(onedal_build, orig_build.build):
569569
if ONEDAL_VERSION >= 20230200:
570570
packages_with_tests += ["onedal.cluster"]
571571

572-
if build_distribute:
572+
if build_distributed:
573573
packages_with_tests += [
574574
"onedal.spmd",
575575
"onedal.spmd.covariance",

0 commit comments

Comments
 (0)