Skip to content

Commit cd310d1

Browse files
Beta10 build (#128)
* change build process for using libs from packages * MKL header changes * section description in meta.yaml * legal notice in description in meta.yaml * refactoring * BSD license
1 parent 2903875 commit cd310d1

File tree

6 files changed

+84
-32
lines changed

6 files changed

+84
-32
lines changed

0.env.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ export ONEAPI_ROOT=/opt/intel/oneapi
99
. ${ONEAPI_ROOT}/compiler/latest/env/vars.sh
1010
. ${ONEAPI_ROOT}/tbb/latest/env/vars.sh
1111

12+
export DPCPPROOT=${ONEAPI_ROOT}/compiler/latest
13+
1214
export PYTHONPATH=$PYTHONPATH:${THEDIR}

conda-recipe/build.sh

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
11
#!/bin/bash
22

3-
#. $RECIPE_DIR/activate_env.sh
3+
# if ONEAPI_ROOT is specified (use all from it)
4+
if [ -n "${ONEAPI_ROOT}" ]; then
5+
export DPCPPROOT=${ONEAPI_ROOT}/compiler/latest
6+
# TODO uncomment when CI will be changed
7+
# export MKLROOT=${ONEAPI_ROOT}/mkl/latest
8+
export TBBROOT=${ONEAPI_ROOT}/tbb/latest
9+
fi
10+
11+
# if DPCPPROOT is specified (work with custom DPCPP)
12+
if [ -n "${DPCPPROOT}" ]; then
13+
. ${DPCPPROOT}/env/vars.sh
14+
fi
15+
16+
# if MKLROOT is specified (work with custom math library)
17+
if [ -n "${MKLROOT}" ]; then
18+
. ${MKLROOT}/env/vars.sh
19+
conda remove mkl --force -y || true
20+
fi
421

5-
if [ ! -z "${ONEAPI_ROOT}" ]; then
6-
. ${ONEAPI_ROOT}/mkl/latest/env/vars.sh
7-
. ${ONEAPI_ROOT}/compiler/2021.1-beta09/env/vars.sh
8-
. ${ONEAPI_ROOT}/tbb/latest/env/vars.sh
22+
# have to activate while SYCL CPU device/driver needs paths
23+
# if TBBROOT is specified
24+
if [ -n "${TBBROOT}" ]; then
25+
. ${TBBROOT}/env/vars.sh
926
fi
1027

1128
$PYTHON setup.py build_clib
12-
#cp $SRC_DIR/dpnp/libdpnp_backend_c.so $SP_DIR/libdpnp_backend_c.so
1329
$PYTHON setup.py build_ext install

conda-recipe/meta.yaml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,27 @@ requirements:
1414
- setuptools
1515
- numpy-devel >=1.18
1616
- cython
17-
- dpctl =0.3.3
17+
- dpctl >=0.3.7
18+
- mkl-devel >=2021.1b10
1819
run:
1920
- python
21+
- dpctl >=0.3.7
22+
- dpcpp_cpp_rt =2021.1b10
23+
- mkl >=2021.1b10
2024

2125
build:
2226
number: {{buildnumber}}
2327
include_recipe: False
2428
script_env:
2529
- ONEAPI_ROOT
30+
- DPCPPROOT
31+
- MKLROOT
32+
- TBBROOT
2633

2734
test:
2835
requires:
2936
- pytest
3037
- setuptools
31-
- dpctl =0.3.3
3238
source_files:
3339
- examples
3440
- tests
@@ -37,6 +43,15 @@ test:
3743
- pytest
3844

3945
about:
40-
license: ISSL
46+
home: https://github.com/IntelPython/dpnp
47+
license: BSD-2-Clause
4148
license_file: LICENSE.txt
42-
summary: NumPy-like API accelerated with SYCL
49+
description: |
50+
<strong>LEGAL NOTICE: Use of this software package is subject to the
51+
software license agreement (as set forth above, in the license section of
52+
the installed Conda package and/or the README file) and all notices,
53+
disclaimers or license terms for third party or open source software
54+
included in or with the software.</strong>
55+
<br/><br/>
56+
EULA: <a href="https://opensource.org/licenses/BSD-2-Clause" target="_blank">BSD-2-Clause</a>
57+
<br/><br/>

conda-recipe/run_test.sh

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
#!/bin/bash
22

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

5-
if [ ! -z "${ONEAPI_ROOT}" ]; then
6-
. ${ONEAPI_ROOT}/mkl/latest/env/vars.sh
7-
. ${ONEAPI_ROOT}/compiler/2021.1-beta09/env/vars.sh
8-
. ${ONEAPI_ROOT}/tbb/latest/env/vars.sh
11+
# if DPCPPROOT is specified (work with custom DPCPP)
12+
if [ -n "${DPCPPROOT}" ]; then
13+
. ${DPCPPROOT}/env/vars.sh
914
fi
1015

11-
# if MKLROOT is specified (build with custom MKL)
12-
if [ ! -z "${MKLROOT}" ]; then
16+
# if MKLROOT is specified (work with custom math library)
17+
if [ -n "${MKLROOT}" ]; then
18+
. ${MKLROOT}/env/vars.sh
1319
conda remove mkl --force -y || true
1420
fi
21+
22+
# have to activate while SYCL CPU device/driver needs paths
23+
# if TBBROOT is specified
24+
if [ -n "${TBBROOT}" ]; then
25+
. ${TBBROOT}/env/vars.sh
26+
fi

dpnp/backend/queue_sycl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#define QUEUE_SYCL_H
2929

3030
#include <CL/sycl.hpp>
31-
#include <mkl_sycl.hpp>
31+
#include <oneapi/mkl.hpp>
3232

3333
#if !defined(DPNP_LOCAL_QUEUE)
3434
#include <dppl_sycl_queue_manager.h>

setup.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@
9595
Operating System :: MacOS
9696
"""
9797

98+
IS_CONDA_BUILD = True if os.environ.get("CONDA_BUILD", None) == "1" else False
99+
98100
IS_WIN = False
99101
IS_MAC = False
100102
IS_LIN = False
@@ -205,12 +207,16 @@
205207
"""
206208
_mkl_include = None
207209
_mkl_libpath = None
208-
# TODO make it as a function in utils
209-
_conda_root = os.environ.get("CONDA_PREFIX", None)
210-
if _mkl_include is None and _mkl_libpath is None and _conda_root is not None:
210+
211+
# try to find math library in environment
212+
if IS_CONDA_BUILD:
213+
_conda_root = os.environ.get("PREFIX", None)
214+
else:
215+
_conda_root = os.environ.get("CONDA_PREFIX", None)
216+
if _conda_root is not None:
211217
_mkl_include_find = os.path.join(_conda_root, "include")
212218
_mkl_libpath_find = os.path.join(_conda_root, "lib")
213-
_required_header = os.path.join(_mkl_include_find, "mkl_blas_sycl.hpp")
219+
_required_header = os.path.join(_mkl_include_find, "oneapi", "mkl.hpp")
214220
_required_library = os.path.join(_mkl_libpath_find, "libmkl_sycl.so")
215221

216222
if (os.path.exists(_required_header) and os.path.exists(_required_library)):
@@ -219,9 +225,10 @@
219225
_mkl_include = [_mkl_include_find]
220226
_mkl_libpath = [_mkl_libpath_find]
221227

222-
223228
_mkl_root = os.environ.get("MKLROOT", None)
224-
if _mkl_include is None and _mkl_libpath is None and _mkl_root is not None:
229+
if ((_mkl_include is None or _mkl_libpath is None) and (_mkl_root is not None)): # if MKLROOT was specified then use it
230+
# TODO change paths and file names for new version
231+
# paths and file names are aligned to beta09 at this moment
225232
_mkl_include_find = os.path.join(_mkl_root, "include")
226233
_mkl_libpath_find = os.path.join(_mkl_root, "lib", "intel64")
227234
_required_header = os.path.join(_mkl_include_find, "mkl_blas_sycl.hpp")
@@ -233,8 +240,8 @@
233240
_mkl_include = [_mkl_include_find]
234241
_mkl_libpath = [_mkl_libpath_find]
235242

236-
if _mkl_include is None and _mkl_libpath is None:
237-
raise EnvironmentError("Intel DPNP: Please install Intel OneAPI environment. MKLROOT is empty")
243+
if _mkl_include is None or _mkl_libpath is None:
244+
raise EnvironmentError("Intel DPNP: Unable to find math library")
238245

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

255262
if IS_LIN:
256-
_cmplr_libpath = [os.path.join(_cmplr_root, 'compiler', 'latest', 'linux', 'lib')]
257-
_omp_libpath = [os.path.join(_cmplr_root, 'compiler', 'latest', 'linux', 'compiler', 'lib', 'intel64')]
263+
_cmplr_libpath = [os.path.join(_cmplr_root, 'linux', 'lib')]
264+
_omp_libpath = [os.path.join(_cmplr_root, 'linux', 'compiler', 'lib', 'intel64')]
258265
_cmplr_rpath = _cmplr_libpath
259266
_omp_rpath = _omp_libpath
260267
elif IS_WIN:
261-
_cmplr_libpath = [os.path.join(_cmplr_root, 'compiler', 'latest', 'windows', 'lib')]
262-
_omp_libpath = [os.path.join(_cmplr_root, 'compiler', 'latest', 'windows', 'compiler', 'lib', 'intel64_win')]
268+
_cmplr_libpath = [os.path.join(_cmplr_root, 'windows', 'lib')]
269+
_omp_libpath = [os.path.join(_cmplr_root, 'windows', 'compiler', 'lib', 'intel64_win')]
263270

264271

265272
"""

0 commit comments

Comments
 (0)