Skip to content

Implement CONDA based MKL paths #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 40 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,20 +200,54 @@
_omp_rpath = []


_mkl_root = os.environ.get('MKLROOT', None)
if _mkl_root is None:
raise EnvironmentError("Intel NumPy: Please install Intel OneAPI environment. MKLROOT is empty")
_mkl_include = [os.path.join(_mkl_root, 'include')]
"""
Get the math library environemnt
"""
_mkl_include = None
_mkl_libpath = None
# TODO make it as a function in utils
_conda_root = os.environ.get("CONDA_PREFIX", None)
if _mkl_include is None and _mkl_libpath is None and _conda_root is not None:
_mkl_include_find = os.path.join(_conda_root, "include")
_mkl_libpath_find = os.path.join(_conda_root, "lib")
_required_header = os.path.join(_mkl_include_find, "mkl_blas_sycl.hpp")
_required_library = os.path.join(_mkl_libpath_find, "libmkl_sycl.so")

if (os.path.exists(_required_header) and os.path.exists(_required_library)):
print(
f"Intel DPNP: using $CONDA_PREFIX based math library. include={_mkl_include_find}, libpath={_mkl_libpath_find}")
_mkl_include = [_mkl_include_find]
_mkl_libpath = [_mkl_libpath_find]


_mkl_root = os.environ.get("MKLROOT", None)
if _mkl_include is None and _mkl_libpath is None and _mkl_root is not None:
_mkl_include_find = os.path.join(_mkl_root, "include")
_mkl_libpath_find = os.path.join(_mkl_root, "lib", "intel64")
_required_header = os.path.join(_mkl_include_find, "mkl_blas_sycl.hpp")
_required_library = os.path.join(_mkl_libpath_find, "libmkl_sycl.so")

if (os.path.exists(_required_header) and os.path.exists(_required_library)):
print(
f"Intel DPNP: using $MKLROOT based math library. include={_mkl_include_find}, libpath={_mkl_libpath_find}")
_mkl_include = [_mkl_include_find]
_mkl_libpath = [_mkl_libpath_find]

if _mkl_include is None and _mkl_libpath is None:
raise EnvironmentError("Intel DPNP: Please install Intel OneAPI environment. MKLROOT is empty")

_project_cmplr_macro += [("MKL_ILP64", "1")] # using 64bit integers in MKL interface (long)
_mkl_libs = ["mkl_rt", "mkl_sycl", "mkl_intel_ilp64", "mkl_sequential",
"mkl_core", "sycl", "OpenCL", "pthread", "m", "dl"]
_project_cmplr_macro += [("MKL_ILP64", "1")] # using 64bit integers in MKL interface (long)

_mkl_libpath = [os.path.join(_mkl_root, 'lib', 'intel64')]
if IS_LIN:
_mkl_rpath = _mkl_libpath
elif IS_WIN:
_mkl_libs = ["mkl_sycl", "mkl_intel_ilp64", "mkl_tbb_thread", "mkl_core", "sycl", "OpenCL", "tbb"]

"""
Get the compiler environemnt
"""
_cmplr_root = os.environ.get('ONEAPI_ROOT', None)
if _cmplr_root is None:
raise EnvironmentError("Please install Intel OneAPI environment. ONEAPI_ROOT is empty")
Expand Down