Skip to content

Beta10 build #128

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 6 commits into from
Oct 8, 2020
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions 0.env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ export ONEAPI_ROOT=/opt/intel/oneapi
. ${ONEAPI_ROOT}/compiler/latest/env/vars.sh
. ${ONEAPI_ROOT}/tbb/latest/env/vars.sh

export DPCPPROOT=${ONEAPI_ROOT}/compiler/latest

export PYTHONPATH=$PYTHONPATH:${THEDIR}
28 changes: 22 additions & 6 deletions conda-recipe/build.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
#!/bin/bash

#. $RECIPE_DIR/activate_env.sh
# if ONEAPI_ROOT is specified (use all from it)
if [ -n "${ONEAPI_ROOT}" ]; then
export DPCPPROOT=${ONEAPI_ROOT}/compiler/latest
# TODO uncomment when CI will be changed
# export MKLROOT=${ONEAPI_ROOT}/mkl/latest
export TBBROOT=${ONEAPI_ROOT}/tbb/latest
fi

# if DPCPPROOT is specified (work with custom DPCPP)
if [ -n "${DPCPPROOT}" ]; then
. ${DPCPPROOT}/env/vars.sh
fi

# if MKLROOT is specified (work with custom math library)
if [ -n "${MKLROOT}" ]; then
. ${MKLROOT}/env/vars.sh
conda remove mkl --force -y || true
fi

if [ ! -z "${ONEAPI_ROOT}" ]; then
. ${ONEAPI_ROOT}/mkl/latest/env/vars.sh
. ${ONEAPI_ROOT}/compiler/2021.1-beta09/env/vars.sh
. ${ONEAPI_ROOT}/tbb/latest/env/vars.sh
# have to activate while SYCL CPU device/driver needs paths
# if TBBROOT is specified
if [ -n "${TBBROOT}" ]; then
. ${TBBROOT}/env/vars.sh
fi

$PYTHON setup.py build_clib
#cp $SRC_DIR/dpnp/libdpnp_backend_c.so $SP_DIR/libdpnp_backend_c.so
$PYTHON setup.py build_ext install
23 changes: 19 additions & 4 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,27 @@ requirements:
- setuptools
- numpy-devel >=1.18
- cython
- dpctl =0.3.3
- dpctl >=0.3.7
- mkl-devel >=2021.1b10
run:
- python
- dpctl >=0.3.7
- dpcpp_cpp_rt =2021.1b10
- mkl >=2021.1b10

build:
number: {{buildnumber}}
include_recipe: False
script_env:
- ONEAPI_ROOT
- DPCPPROOT
- MKLROOT
- TBBROOT

test:
requires:
- pytest
- setuptools
- dpctl =0.3.3
source_files:
- examples
- tests
Expand All @@ -37,6 +43,15 @@ test:
- pytest

about:
license: ISSL
home: https://github.com/IntelPython/dpnp
license: BSD-2-Clause
license_file: LICENSE.txt
summary: NumPy-like API accelerated with SYCL
description: |
<strong>LEGAL NOTICE: Use of this software package is subject to the
software license agreement (as set forth above, in the license section of
the installed Conda package and/or the README file) and all notices,
disclaimers or license terms for third party or open source software
included in or with the software.</strong>
<br/><br/>
EULA: <a href="https://opensource.org/licenses/BSD-2-Clause" target="_blank">BSD-2-Clause</a>
<br/><br/>
26 changes: 19 additions & 7 deletions conda-recipe/run_test.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
#!/bin/bash

#. $RECIPE_DIR/activate_env.sh
# if ONEAPI_ROOT is specified (use all from it)
if [ -n "${ONEAPI_ROOT}" ]; then
export DPCPPROOT=${ONEAPI_ROOT}/compiler/latest
# TODO uncomment when CI will be changed
# export MKLROOT=${ONEAPI_ROOT}/mkl/latest
export TBBROOT=${ONEAPI_ROOT}/tbb/latest
fi

if [ ! -z "${ONEAPI_ROOT}" ]; then
. ${ONEAPI_ROOT}/mkl/latest/env/vars.sh
. ${ONEAPI_ROOT}/compiler/2021.1-beta09/env/vars.sh
. ${ONEAPI_ROOT}/tbb/latest/env/vars.sh
# if DPCPPROOT is specified (work with custom DPCPP)
if [ -n "${DPCPPROOT}" ]; then
. ${DPCPPROOT}/env/vars.sh
fi

# if MKLROOT is specified (build with custom MKL)
if [ ! -z "${MKLROOT}" ]; then
# if MKLROOT is specified (work with custom math library)
if [ -n "${MKLROOT}" ]; then
. ${MKLROOT}/env/vars.sh
conda remove mkl --force -y || true
fi

# have to activate while SYCL CPU device/driver needs paths
# if TBBROOT is specified
if [ -n "${TBBROOT}" ]; then
. ${TBBROOT}/env/vars.sh
fi
2 changes: 1 addition & 1 deletion dpnp/backend/queue_sycl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define QUEUE_SYCL_H

#include <CL/sycl.hpp>
#include <mkl_sycl.hpp>
#include <oneapi/mkl.hpp>

#if !defined(DPNP_LOCAL_QUEUE)
#include <dppl_sycl_queue_manager.h>
Expand Down
35 changes: 21 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@
Operating System :: MacOS
"""

IS_CONDA_BUILD = True if os.environ.get("CONDA_BUILD", None) == "1" else False

IS_WIN = False
IS_MAC = False
IS_LIN = False
Expand Down Expand Up @@ -205,12 +207,16 @@
"""
_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:

# try to find math library in environment
if IS_CONDA_BUILD:
_conda_root = os.environ.get("PREFIX", None)
else:
_conda_root = os.environ.get("CONDA_PREFIX", None)
if _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_header = os.path.join(_mkl_include_find, "oneapi", "mkl.hpp")
_required_library = os.path.join(_mkl_libpath_find, "libmkl_sycl.so")

if (os.path.exists(_required_header) and os.path.exists(_required_library)):
Expand All @@ -219,9 +225,10 @@
_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:
if ((_mkl_include is None or _mkl_libpath is None) and (_mkl_root is not None)): # if MKLROOT was specified then use it
# TODO change paths and file names for new version
# paths and file names are aligned to beta09 at this moment
_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")
Expand All @@ -233,8 +240,8 @@
_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")
if _mkl_include is None or _mkl_libpath is None:
raise EnvironmentError("Intel DPNP: Unable to find math library")

_project_cmplr_macro += [("MKL_ILP64", "1")] # using 64bit integers in MKL interface (long)
_mkl_libs = ["mkl_rt", "mkl_sycl", "mkl_intel_ilp64", "mkl_sequential",
Expand All @@ -248,18 +255,18 @@
"""
Get the compiler environemnt
"""
_cmplr_root = os.environ.get('ONEAPI_ROOT', None)
_cmplr_root = os.environ.get('DPCPPROOT', None)
if _cmplr_root is None:
raise EnvironmentError("Please install Intel OneAPI environment. ONEAPI_ROOT is empty")
raise EnvironmentError("Please install Intel OneAPI environment. DPCPPROOT is empty")

if IS_LIN:
_cmplr_libpath = [os.path.join(_cmplr_root, 'compiler', 'latest', 'linux', 'lib')]
_omp_libpath = [os.path.join(_cmplr_root, 'compiler', 'latest', 'linux', 'compiler', 'lib', 'intel64')]
_cmplr_libpath = [os.path.join(_cmplr_root, 'linux', 'lib')]
_omp_libpath = [os.path.join(_cmplr_root, 'linux', 'compiler', 'lib', 'intel64')]
_cmplr_rpath = _cmplr_libpath
_omp_rpath = _omp_libpath
elif IS_WIN:
_cmplr_libpath = [os.path.join(_cmplr_root, 'compiler', 'latest', 'windows', 'lib')]
_omp_libpath = [os.path.join(_cmplr_root, 'compiler', 'latest', 'windows', 'compiler', 'lib', 'intel64_win')]
_cmplr_libpath = [os.path.join(_cmplr_root, 'windows', 'lib')]
_omp_libpath = [os.path.join(_cmplr_root, 'windows', 'compiler', 'lib', 'intel64_win')]


"""
Expand Down