Skip to content

Commit

Permalink
Library for Win fix (#377)
Browse files Browse the repository at this point in the history
Library for Win fix
  • Loading branch information
PetrovKP authored Nov 5, 2020
1 parent d36454e commit f5d4c9f
Showing 1 changed file with 32 additions and 18 deletions.
50 changes: 32 additions & 18 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -96,32 +124,18 @@ 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']
dpctl = True if dpcpp and 'DPCTLROOT' in os.environ else False
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')
Expand Down

0 comments on commit f5d4c9f

Please sign in to comment.