Skip to content

Commit cf91f09

Browse files
committed
Merge branch 'master' of https://github.com/IntelPython/dpnp into feature/1arg_2types
2 parents 6d22eee + 1f8a5ed commit cf91f09

29 files changed

+975
-1260
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: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% set version = "0.2" %}
1+
{% set version = "0.3.0" %}
22
{% set buildnumber = 0 %}
33

44
package:
@@ -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/backend_fptr.hpp

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
//*****************************************************************************
2+
// Copyright (c) 2016-2020, Intel Corporation
3+
// All rights reserved.
4+
//
5+
// Redistribution and use in source and binary forms, with or without
6+
// modification, are permitted provided that the following conditions are met:
7+
// - Redistributions of source code must retain the above copyright notice,
8+
// this list of conditions and the following disclaimer.
9+
// - Redistributions in binary form must reproduce the above copyright notice,
10+
// this list of conditions and the following disclaimer in the documentation
11+
// and/or other materials provided with the distribution.
12+
//
13+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
17+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23+
// THE POSSIBILITY OF SUCH DAMAGE.
24+
//*****************************************************************************
25+
26+
/*
27+
* This header file contains internal function declarations related to FPTR interface.
28+
* It should not contains public declarations
29+
*/
30+
31+
#pragma once
32+
#ifndef BACKEND_FPTR_H // Cython compatibility
33+
#define BACKEND_FPTR_H
34+
35+
#include <map>
36+
37+
#include <backend_iface_fptr.hpp>
38+
39+
/**
40+
* Data storage type of the FPTR interface
41+
*
42+
* map[FunctionName][InputType2][InputType2]
43+
*
44+
* Function name is enum DPNPFuncName
45+
* InputTypes are presented as enum DPNPFuncType
46+
*
47+
* contains structure with kernel information
48+
*
49+
* if the kernel requires only one input type - use same type for both parameters
50+
*
51+
*/
52+
typedef std::map<DPNPFuncType, DPNPFuncData_t> map_2p_t;
53+
typedef std::map<DPNPFuncType, map_2p_t> map_1p_t;
54+
typedef std::map<DPNPFuncName, map_1p_t> func_map_t;
55+
56+
/**
57+
* Internal shortcuts for Data type enum values
58+
*/
59+
const DPNPFuncType eft_INT = DPNPFuncType::DPNP_FT_INT;
60+
const DPNPFuncType eft_LNG = DPNPFuncType::DPNP_FT_LONG;
61+
const DPNPFuncType eft_FLT = DPNPFuncType::DPNP_FT_FLOAT;
62+
const DPNPFuncType eft_DBL = DPNPFuncType::DPNP_FT_DOUBLE;
63+
64+
/**
65+
* FPTR interface initialization functions
66+
*/
67+
void func_map_init_elemwise(func_map_t& fmap);
68+
void func_map_init_linalg(func_map_t& fmap);
69+
void func_map_init_manipulation(func_map_t& fmap);
70+
void func_map_init_reduction(func_map_t& fmap);
71+
void func_map_init_searching(func_map_t& fmap);
72+
void func_map_init_sorting(func_map_t& fmap);
73+
void func_map_init_statistics(func_map_t& fmap);
74+
75+
#endif // BACKEND_FPTR_H

dpnp/backend/backend_iface.hpp

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void dpnp_memory_memcpy_c(void* dst, const void* src, size_t size_in_bytes);
110110
*/
111111
template <typename _DataType>
112112
INP_DLLEXPORT void
113-
custom_blas_gemm_c(void* array1, void* array2, void* result1, size_t size_m, size_t size_n, size_t size_k);
113+
dpnp_matmul_c(void* array1, void* array2, void* result1, size_t size_m, size_t size_n, size_t size_k);
114114

115115
/**
116116
* @ingroup BACKEND_API
@@ -143,7 +143,7 @@ INP_DLLEXPORT void
143143
*
144144
*/
145145
template <typename _DataType>
146-
INP_DLLEXPORT void custom_blas_dot_c(void* array1, void* array2, void* result1, size_t size);
146+
INP_DLLEXPORT void dpnp_dot_c(void* array1, void* array2, void* result1, size_t size);
147147

148148
/**
149149
* @ingroup BACKEND_API
@@ -173,17 +173,19 @@ INP_DLLEXPORT void custom_prod_c(void* array, void* result, size_t size);
173173

174174
/**
175175
* @ingroup BACKEND_API
176-
* @brief math library implementation of eig function
176+
* @brief Compute the eigenvalues and right eigenvectors of a square array.
177177
*
178-
* @param [in] array1 Input array.
178+
* @param [in] array_in Input array[size][size]
179179
*
180-
* @param [out] result1 Output array.
180+
* @param [out] result1 The eigenvalues, each repeated according to its multiplicity
181181
*
182-
* @param [in] size Number of elements in input arrays.
182+
* @param [out] result2 The normalized (unit “length”) eigenvectors
183+
*
184+
* @param [in] size One dimension of square [size][size] array
183185
*
184186
*/
185-
template <typename _DataType>
186-
INP_DLLEXPORT void mkl_lapack_syevd_c(void* array1, void* result1, size_t size);
187+
template <typename _DataType, typename _ResultType>
188+
INP_DLLEXPORT void dpnp_eig_c(const void* array_in, void* result1, void* result2, size_t size);
187189

188190
/**
189191
* @ingroup BACKEND_API
@@ -396,21 +398,22 @@ INP_DLLEXPORT void custom_var_c(
396398
* @param [in] size Number of elements in the input array.
397399
*
398400
*/
399-
#define MACRO_CUSTOM_1ARG_2TYPES_OP(__name__, __operation1__, __operation2__) \
400-
template <typename _DataType_input, typename _DataType_output> \
401-
INP_DLLEXPORT void custom_elemwise_##__name__##_c(void* array1, void* result1, size_t size);
402-
403-
#include <custom_1arg_2type_tbl.hpp>
404401

405402
#define MACRO_CUSTOM_1ARG_1TYPE_OP(__name__, __operation__) \
406403
template <typename _DataType> \
407-
INP_DLLEXPORT void custom_elemwise_##__name__##_c(void* array1, void* result1, size_t size);
404+
INP_DLLEXPORT void __name__(void* array1, void* result1, size_t size);
408405

409406
#include <custom_1arg_1type_tbl.hpp>
410407

411-
#define MACRO_CUSTOM_2ARG_3TYPES_OP(__name__, __operation__) \
408+
#define MACRO_CUSTOM_1ARG_2TYPES_OP(__name__, __operation1__, __operation2__) \
409+
template <typename _DataType_input, typename _DataType_output> \
410+
INP_DLLEXPORT void __name__(void* array1, void* result1, size_t size);
411+
412+
#include <custom_1arg_2type_tbl.hpp>
413+
414+
#define MACRO_CUSTOM_2ARG_3TYPES_OP(__name__, __operation1__, __operation2__) \
412415
template <typename _DataType_input1, typename _DataType_input2, typename _DataType_output> \
413-
INP_DLLEXPORT void custom_elemwise_##__name__##_c(void* array1, void* array2, void* result1, size_t size);
416+
INP_DLLEXPORT void __name__(void* array1, void* array2, void* result1, size_t size);
414417

415418
#include <custom_2arg_3type_tbl.hpp>
416419

0 commit comments

Comments
 (0)