From f5d4c9f5cdab9ea3d946bba50f4abf55abf3baef Mon Sep 17 00:00:00 2001 From: Kirill Date: Fri, 6 Nov 2020 00:49:38 +0300 Subject: [PATCH] Library for Win fix (#377) Library for Win fix --- setup.py | 50 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/setup.py b/setup.py index 38050e93ea..9f11433208 100755 --- a/setup.py +++ b/setup.py @@ -35,19 +35,47 @@ except ImportError: from ctypes.util import find_library +IS_WIN = False +IS_MAC = False +IS_LIN = False + +daal_root = os.environ['DAALROOT'] + +if 'linux' in sys.platform: + IS_LIN = True + lib_dir = jp(daal_root, 'lib', 'intel64') +elif sys.platform == 'darwin': + IS_MAC = True + lib_dir = jp(daal_root, 'lib') +elif sys.platform in ['win32', 'cygwin']: + IS_WIN = True + lib_dir = jp(daal_root, 'lib', 'intel64') +else: + assert False, sys.platform + ' not supported' + def get_lib_suffix(): + def walk_ld_library_path(): - ld_library_path = os.environ.get('LD_LIBRARY_PATH', None) + if IS_WIN: + ld_library_path = f"{os.environ.get('CONDA_PREFIX')}/Library/lib" + else: + ld_library_path = os.environ.get('LD_LIBRARY_PATH', None) + if ld_library_path is None: return None + libs = [] - ld_library_path = ld_library_path.split(':') + if IS_WIN: + ld_library_path = ld_library_path.split(';') + else: + ld_library_path = ld_library_path.split(':') while '' in ld_library_path: ld_library_path.remove('') for lib_path in ld_library_path: for _, _, new_files in os.walk(lib_path): libs += new_files + for lib in libs: if 'onedal_core' in lib: return 'onedal' @@ -96,7 +124,6 @@ def get_win_major_version(): print('distributed mode not supported for python version < 3.6\n') no_dist = True no_stream = True if 'NO_STREAM' in os.environ and os.environ['NO_STREAM'] in trues else False -daal_root = os.environ['DAALROOT'] mpi_root = None if no_dist else os.environ['MPIROOT'] dpcpp = True if 'DPCPPROOT' in os.environ else False dpcpp_root = None if not dpcpp else os.environ['DPCPPROOT'] @@ -104,24 +131,11 @@ def get_win_major_version(): dpctl_root = None if not dpctl else os.environ['DPCTLROOT'] #itac_root = os.environ['VT_ROOT'] -IS_WIN = False -IS_MAC = False -IS_LIN = False - -if 'linux' in sys.platform: - IS_LIN = True - lib_dir = jp(daal_root, 'lib', 'intel64') -elif sys.platform == 'darwin': - IS_MAC = True - lib_dir = jp(daal_root, 'lib') -elif sys.platform in ['win32', 'cygwin']: - IS_WIN = True - lib_dir = jp(daal_root, 'lib', 'intel64') -else: - assert False, sys.platform + ' not supported' daal_lib_dir = lib_dir if (IS_MAC or os.path.isdir(lib_dir)) else os.path.dirname(lib_dir) DAAL_LIBDIRS = [daal_lib_dir] +if IS_WIN: + DAAL_LIBDIRS.append(f"{os.environ.get('CONDA_PREFIX')}/Library/lib") if no_stream : print('\nDisabling support for streaming mode\n')