Skip to content

Commit f010e78

Browse files
authored
Merge branch 'master' into wa_sg_store_load
2 parents 2ecf788 + 9b450f0 commit f010e78

File tree

237 files changed

+9014
-3533
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

237 files changed

+9014
-3533
lines changed

.github/workflows/conda-package.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ env:
3030
test_umath.py
3131
test_usm_type.py
3232
third_party/cupy/core_tests
33+
third_party/cupy/linalg_tests/test_decomposition.py
34+
third_party/cupy/linalg_tests/test_norms.py
3335
third_party/cupy/linalg_tests/test_product.py
3436
third_party/cupy/linalg_tests/test_solve.py
3537
third_party/cupy/logic_tests/test_comparison.py

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016-2023, Intel Corporation
1+
Copyright (c) 2016-2024, Intel Corporation
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without

benchmarks/pytest_benchmark/test_random.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# cython: language_level=3
22
# -*- coding: utf-8 -*-
33
# *****************************************************************************
4-
# Copyright (c) 2016-2023, Intel Corporation
4+
# Copyright (c) 2016-2024, Intel Corporation
55
# All rights reserved.
66
#
77
# Redistribution and use in source and binary forms, with or without

conda-recipe/meta.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ test:
4949
- tests
5050
- setup.cfg
5151
commands:
52-
- python -c "import dpnp"
52+
- python -c "import dpnp; print(dpnp.__version__)"
53+
- python -m dpctl -f
5354
- pytest -s
5455

5556
about:

doc/conf.py

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

3030
project = "Data Parallel Extension for NumPy"
31-
copyright = "2020-2023, Intel Corporation"
31+
copyright = "2020-2024, Intel Corporation"
3232
author = "Intel"
3333

3434
version = dpnp.__version__.strip(".dirty")

doc/docstring_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# cython: language_level=3
22
# -*- coding: utf-8 -*-
33
# *****************************************************************************
4-
# Copyright (c) 2016-2023, Intel Corporation
4+
# Copyright (c) 2016-2024, Intel Corporation
55
# All rights reserved.
66
#
77
# Redistribution and use in source and binary forms, with or without

doc/reference/math.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Trigonometric functions
2323
dpnp.unwrap
2424
dpnp.deg2rad
2525
dpnp.rad2deg
26+
dpnp.reduce_hypot
2627

2728

2829
Hyperbolic functions
@@ -94,6 +95,7 @@ Exponents and logarithms
9495
dpnp.log1p
9596
dpnp.logaddexp
9697
dpnp.logaddexp2
98+
dpnp.logsumexp
9799

98100

99101
Other special functions
@@ -203,6 +205,7 @@ Miscellaneous
203205
dpnp.sqrt
204206
dpnp.cbrt
205207
dpnp.square
208+
dpnp.rsqrt
206209
dpnp.abs
207210
dpnp.absolute
208211
dpnp.fabs

doc/reference/ufunc.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ Math operations
4444
dpnp.log1p
4545
dpnp.proj
4646
dpnp.sqrt
47+
dpnp.cbrt
4748
dpnp.square
4849
dpnp.reciprocal
50+
dpnp.rsqrt
4951
dpnp.gcd
5052
dpnp.lcm
5153

dpnp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ endfunction()
5656

5757
build_dpnp_cython_ext_with_backend(dparray ${CMAKE_CURRENT_SOURCE_DIR}/dparray.pyx dpnp)
5858
add_subdirectory(backend)
59+
add_subdirectory(backend/extensions/blas)
5960
add_subdirectory(backend/extensions/lapack)
6061
add_subdirectory(backend/extensions/vm)
6162
add_subdirectory(backend/extensions/sycl_ext)

dpnp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
# *****************************************************************************
3-
# Copyright (c) 2016-2023, Intel Corporation
3+
# Copyright (c) 2016-2024, Intel Corporation
44
# All rights reserved.
55
#
66
# Redistribution and use in source and binary forms, with or without

dpnp/backend/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# *****************************************************************************
2-
# Copyright (c) 2016-2023, Intel Corporation
2+
# Copyright (c) 2016-2024, Intel Corporation
33
# All rights reserved.
44
#
55
# Redistribution and use in source and binary forms, with or without

dpnp/backend/cmake/Modules/MKLConfig.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#===============================================================================
2-
# Copyright 2021-2022 Intel Corporation.
2+
# Copyright (c) 2021-2024 Intel Corporation.
33
#
44
# This software and the related documents are Intel copyrighted materials, and
55
# your use of them is governed by the express license under which they were

dpnp/backend/cmake/Modules/TBBConfig.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2017-2023 Intel Corporation
1+
# Copyright (c) 2017-2024 Intel Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

dpnp/backend/examples/example10.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2023, Intel Corporation
2+
// Copyright (c) 2016-2024, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/examples/example11.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2023, Intel Corporation
2+
// Copyright (c) 2016-2024, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/examples/example3.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2023, Intel Corporation
2+
// Copyright (c) 2016-2024, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/examples/example5.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2023, Intel Corporation
2+
// Copyright (c) 2016-2024, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/examples/example7.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2023, Intel Corporation
2+
// Copyright (c) 2016-2024, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/examples/example8.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2023, Intel Corporation
2+
// Copyright (c) 2016-2024, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/examples/example9.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2023, Intel Corporation
2+
// Copyright (c) 2016-2024, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/examples/example_bs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2023, Intel Corporation
2+
// Copyright (c) 2016-2024, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/examples/example_experimental_iface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2023, Intel Corporation
2+
// Copyright (c) 2016-2024, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# *****************************************************************************
2+
# Copyright (c) 2016-2023, 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+
set(python_module_name _blas_impl)
28+
set(_module_src
29+
${CMAKE_CURRENT_SOURCE_DIR}/blas_py.cpp
30+
${CMAKE_CURRENT_SOURCE_DIR}/gemm.cpp
31+
${CMAKE_CURRENT_SOURCE_DIR}/gemm_batch.cpp
32+
)
33+
34+
pybind11_add_module(${python_module_name} MODULE ${_module_src})
35+
add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_module_src})
36+
37+
if (WIN32)
38+
if (${CMAKE_VERSION} VERSION_LESS "3.27")
39+
# this is a work-around for target_link_options inserting option after -link option, cause
40+
# linker to ignore it.
41+
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel")
42+
endif()
43+
endif()
44+
45+
set_target_properties(${python_module_name} PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON)
46+
47+
target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../include)
48+
target_include_directories(${python_module_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../src)
49+
50+
target_include_directories(${python_module_name} PUBLIC ${Dpctl_INCLUDE_DIRS})
51+
target_include_directories(${python_module_name} PUBLIC ${Dpctl_TENSOR_INCLUDE_DIR})
52+
53+
if (WIN32)
54+
target_compile_options(${python_module_name} PRIVATE
55+
/clang:-fno-approx-func
56+
/clang:-fno-finite-math-only
57+
)
58+
else()
59+
target_compile_options(${python_module_name} PRIVATE
60+
-fno-approx-func
61+
-fno-finite-math-only
62+
)
63+
endif()
64+
65+
target_link_options(${python_module_name} PUBLIC -fsycl-device-code-split=per_kernel)
66+
if (UNIX)
67+
# this option is support on Linux only
68+
target_link_options(${python_module_name} PUBLIC -fsycl-link-huge-device-code)
69+
endif()
70+
71+
if (DPNP_GENERATE_COVERAGE)
72+
target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping)
73+
endif()
74+
75+
if (MKL_VERSION_2024)
76+
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::BLAS)
77+
else()
78+
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_DPCPP)
79+
endif()
80+
81+
install(TARGETS ${python_module_name}
82+
DESTINATION "dpnp/backend/extensions/blas"
83+
)
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
//*****************************************************************************
2+
// Copyright (c) 2023, 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+
// This file defines functions of dpnp.backend._lapack_impl extensions
27+
//
28+
//*****************************************************************************
29+
30+
#include <pybind11/pybind11.h>
31+
#include <pybind11/stl.h>
32+
33+
#include "gemm.hpp"
34+
35+
namespace blas_ext = dpnp::backend::ext::blas;
36+
namespace py = pybind11;
37+
38+
// populate dispatch tables
39+
void init_dispatch_tables(void)
40+
{
41+
blas_ext::init_gemm_batch_dispatch_table();
42+
blas_ext::init_gemm_dispatch_table();
43+
}
44+
45+
PYBIND11_MODULE(_blas_impl, m)
46+
{
47+
init_dispatch_tables();
48+
49+
{
50+
m.def("_gemm", &blas_ext::gemm,
51+
"Call `gemm` from OneMKL LAPACK library to return "
52+
"the matrix-matrix product with 2-D matrices.",
53+
py::arg("sycl_queue"), py::arg("matrixA"), py::arg("matrixB"),
54+
py::arg("result"), py::arg("depends") = py::list());
55+
}
56+
57+
{
58+
m.def("_gemm_batch", &blas_ext::gemm_batch,
59+
"Call `gemm_batch` from OneMKL LAPACK library to return "
60+
"the matrix-matrix product for a batch of 2-D matrices.",
61+
py::arg("sycl_queue"), py::arg("matrixA"), py::arg("matrixB"),
62+
py::arg("result"), py::arg("batch_size"), py::arg("stridea"),
63+
py::arg("strideb"), py::arg("stridec"),
64+
py::arg("depends") = py::list());
65+
}
66+
}

0 commit comments

Comments
 (0)