Skip to content

Commit 747222e

Browse files
committed
Merge branch 'master' into merge_to_gold
2 parents b002153 + b69ab1e commit 747222e

File tree

125 files changed

+4977
-3322
lines changed

Some content is hidden

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

125 files changed

+4977
-3322
lines changed

.coveragerc

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
- [ ] Have you added a test, reproducer or referred to issue with a reproducer?
33
- [ ] Have you tested your changes locally for CPU and GPU devices?
44
- [ ] Have you made sure that new changes do not introduce compiler warnings?
5+
- [ ] Have you checked performance impact of proposed changes?
56
- [ ] If this PR is a work in progress, are you filing the PR as a draft?
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2+
# file Copyright.txt or https://cmake.org/licensing for details.
3+
4+
5+
# This module is shared by multiple languages; use include blocker.
6+
if(__WINDOWS_INTEL)
7+
return()
8+
endif()
9+
set(__WINDOWS_INTEL 1)
10+
11+
include(Platform/Windows-MSVC)
12+
macro(__windows_compiler_intel lang)
13+
__windows_compiler_msvc(${lang})
14+
15+
set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} <CMAKE_${lang}_LINK_FLAGS> <OBJECTS> ${CMAKE_START_TEMP_FILE} -link -out:<TARGET> -implib:<TARGET_IMPLIB> -pdb:<TARGET_PDB> -version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
16+
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY "<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} <CMAKE_${lang}_LINK_FLAGS> <OBJECTS> ${CMAKE_START_TEMP_FILE} -LD -link -out:<TARGET> -implib:<TARGET_IMPLIB> -pdb:<TARGET_PDB> -version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
17+
set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY})
18+
if (NOT "${lang}" STREQUAL "Fortran") # Fortran driver does not support -fuse-ld, yet
19+
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} <CMAKE_${lang}_LINK_FLAGS> <OBJECTS> ${CMAKE_START_TEMP_FILE} -fuse-ld=llvm-lib -o <TARGET> -link <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
20+
endif()
21+
set(CMAKE_DEPFILE_FLAGS_${lang} "-QMMD -QMT <DEP_TARGET> -QMF <DEP_FILE>")
22+
set(CMAKE_${lang}_DEPFILE_FORMAT gcc)
23+
24+
endmacro()
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2+
# file Copyright.txt or https://cmake.org/licensing for details.
3+
4+
5+
# This module is shared by multiple languages; use include blocker.
6+
if(__WINDOWS_INTEL_LLVM)
7+
return()
8+
endif()
9+
set(__WINDOWS_INTEL_LLVM 1)
10+
11+
# Platform/Windows-MSVC adds some linking options icx/ifx do not understand,
12+
# but that need to be passed to the linker. Wrap all the linking options from
13+
# Platform/Windows-MSVC so that the compiler will hand them off to the linker
14+
# without interpreting them.
15+
16+
# Save original CMAKE_${t}_LINKER_FLAGS_INIT
17+
foreach(t EXE SHARED MODULE STATIC)
18+
set(_saved_cmake_${t}_linker_flags_init ${CMAKE_${t}_LINKER_FLAGS_INIT})
19+
set(CMAKE_${t}_LINKER_FLAGS_INIT "")
20+
endforeach()
21+
include(Platform/Windows-MSVC)
22+
# Wrap linker flags from Windows-MSVC
23+
set(_IntelLLVM_LINKER_WRAPPER_FLAG "/Qoption,link,")
24+
set(_IntelLLVM_LINKER_WRAPPER_FLAG_SEP ",")
25+
foreach(t EXE SHARED MODULE STATIC)
26+
set(_wrapped_linker_flags "")
27+
foreach(flag ${CMAKE_${t}_LINKER_FLAGS_INIT})
28+
string(STRIP ${flag} flag)
29+
list(APPEND _wrapped_linker_flags "${_IntelLLVM_LINKER_WRAPPER_FLAG}${flag}")
30+
endforeach()
31+
set(CMAKE_${t}_LINKER_FLAGS_INIT "")
32+
list(APPEND CMAKE_${t}_LINKER_FLAGS_INIT
33+
${_saved_cmake_${t}_linker_flags_init} ${_wrapped_linker_flags})
34+
endforeach()
35+
36+
macro(__windows_compiler_intel lang)
37+
__windows_compiler_msvc(${lang})
38+
39+
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "${_IntelLLVM_LINKER_WRAPPER_FLAG}")
40+
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP "${_IntelLLVM_LINKER_WRAPPER_FLAG_SEP}")
41+
set(CMAKE_${lang}_CREATE_WIN32_EXE "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/subsystem:windows")
42+
set(CMAKE_${lang}_CREATE_CONSOLE_EXE "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/subsystem:console")
43+
set(CMAKE_LINK_DEF_FILE_FLAG "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/DEF:")
44+
set(CMAKE_LIBRARY_PATH_FLAG "${CMAKE_${lang}_LINKER_WRAPPER_FLAG}/LIBPATH:")
45+
46+
# Features for LINK_LIBRARY generator expression
47+
if(MSVC_VERSION GREATER "1900")
48+
## WHOLE_ARCHIVE: Force loading all members of an archive
49+
set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:/WHOLEARCHIVE:<LIBRARY>")
50+
set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE)
51+
endif()
52+
53+
set(CMAKE_${lang}_LINK_EXECUTABLE
54+
"${_CMAKE_VS_LINK_EXE}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} <CMAKE_${lang}_LINK_FLAGS> <OBJECTS> ${CMAKE_START_TEMP_FILE} <LINK_FLAGS> <LINK_LIBRARIES> /link /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}")
55+
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
56+
"${_CMAKE_VS_LINK_DLL}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} <CMAKE_${lang}_LINK_FLAGS> <OBJECTS> ${CMAKE_START_TEMP_FILE} -LD <LINK_FLAGS> <LINK_LIBRARIES> -link /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}")
57+
set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY})
58+
if (NOT "${lang}" STREQUAL "Fortran" OR CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 2022.1)
59+
# The Fortran driver does not support -fuse-ld=llvm-lib before compiler version 2022.1
60+
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY
61+
"<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} <CMAKE_${lang}_LINK_FLAGS> <OBJECTS> ${CMAKE_START_TEMP_FILE} -fuse-ld=llvm-lib -o <TARGET> <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
62+
endif()
63+
64+
set(CMAKE_DEPFILE_FLAGS_${lang} "-QMD -QMT <DEP_TARGET> -QMF <DEP_FILE>")
65+
set(CMAKE_${lang}_DEPFILE_FORMAT gcc)
66+
endmacro()

.github/workflows/build-sphinx.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717

1818
env:
1919
python-ver: '3.9'
20+
CHANNELS: '-c dppy/label/dev -c intel -c conda-forge --override-channels'
2021

2122
steps:
2223
- name: Cancel Previous Runs
@@ -74,21 +75,20 @@ jobs:
7475
- name: Install dpnp dependencies
7576
run: |
7677
conda install dpctl mkl-devel-dpcpp onedpl-devel tbb-devel dpcpp_linux-64 \
77-
cmake cython pytest -c dppy/label/dev -c intel -c conda-forge
78+
cmake cython pytest ninja scikit-build sysroot_linux-64">=2.28" ${{ env.CHANNELS }}
7879
7980
- name: Install cuPy dependencies
80-
run: conda install -c conda-forge cupy cudatoolkit=10.0
81+
run: conda install cupy cudatoolkit=10.0
8182

8283
- name: Conda info
83-
run: |
84-
conda info
85-
conda list
84+
run: conda info
85+
86+
- name: Conda list
87+
run: conda list
8688

8789
- name: Build library
8890
run: |
89-
python setup.py build_clib
90-
CC=icpx python setup.py build_ext --inplace
91-
python setup.py develop
91+
CC=icx CXX=icpx python setup.py develop -G Ninja -- -DDPCTL_MODULE_PATH=$(python -m dpctl --cmakedir)
9292
9393
- name: Build docs
9494
run: make html

.github/workflows/conda-package.yml

Lines changed: 10 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
env:
1010
PACKAGE_NAME: dpnp
1111
MODULE_NAME: dpnp
12-
CHANNELS: '-c dppy/label/dev -c intel -c main --override-channels'
12+
CHANNELS: '-c dppy/label/dev -c intel -c conda-forge --override-channels'
1313
TEST_SCOPE: >-
1414
test_arraycreation.py
1515
test_dot.py
@@ -18,8 +18,10 @@ env:
1818
test_linalg.py
1919
test_mathematical.py
2020
test_random_state.py
21+
test_sort.py
2122
test_special.py
2223
test_usm_type.py
24+
third_party/cupy/sorting_tests/test_sort.py
2325
VER_JSON_NAME: 'version.json'
2426
VER_SCRIPT1: "import json; f = open('version.json', 'r'); j = json.load(f); f.close(); "
2527
VER_SCRIPT2: "d = j['dpnp'][0]; print('='.join((d[s] for s in ('version', 'build'))))"
@@ -59,7 +61,6 @@ jobs:
5961
python-version: ${{ matrix.python }}
6062
miniconda-version: 'latest'
6163
activate-environment: 'build'
62-
use-only-tar-bz2: true
6364

6465
- if: matrix.os == 'ubuntu-20.04'
6566
name: Store conda paths as envs on Linux
@@ -170,7 +171,7 @@ jobs:
170171
- name: Cache conda packages
171172
uses: actions/cache@v3.2.6
172173
env:
173-
CACHE_NUMBER: 1 # Increase to reset cache
174+
CACHE_NUMBER: 1 # Increase to reset cache
174175
with:
175176
path: ${{ env.conda-pkgs }}
176177
key:
@@ -189,15 +190,11 @@ jobs:
189190

190191
- name: Smoke test
191192
run: python -c "import dpnp, dpctl; dpctl.lsplatform()"
192-
env:
193-
OCL_ICD_FILENAMES: 'libintelocl.so'
194193

195194
# TODO: run the whole scope once the issues on CPU are resolved
196195
- name: Run tests
197196
run: |
198197
python -m pytest -q -ra --disable-warnings -vv ${{ env.TEST_SCOPE }}
199-
env:
200-
OCL_ICD_FILENAMES: 'libintelocl.so'
201198
working-directory: ${{ env.tests-path }}
202199

203200
test_windows:
@@ -319,52 +316,14 @@ jobs:
319316
- name: List installed packages
320317
run: conda list
321318

322-
- name: Add library
319+
- name: Activate OCL CPU RT
323320
shell: pwsh
324321
run: |
325-
# Make sure the below libraries exist
326-
Get-Item -Path "$env:CONDA_LIB_BIN_PATH\OpenCL.dll"
327-
Get-Item -Path "$env:CONDA_LIB_PATH\intelocl64.dll"
328-
329-
echo "OCL_ICD_FILENAMES = $env:CONDA_LIB_PATH\intelocl64.dll" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
330-
try {$list = Get-Item -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors | Select-Object -ExpandProperty Property } catch {$list=@()}
331-
332-
if ($list.count -eq 0) {
333-
if (-not (Test-Path -Path HKLM:\SOFTWARE\Khronos)) {
334-
New-Item -Path HKLM:\SOFTWARE\Khronos
335-
}
336-
337-
if (-not (Test-Path -Path HKLM:\SOFTWARE\Khronos\OpenCL)) {
338-
New-Item -Path HKLM:\SOFTWARE\Khronos\OpenCL
339-
}
340-
341-
if (-not (Test-Path -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors)) {
342-
New-Item -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors
343-
}
344-
345-
New-ItemProperty -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors -Name "$env:CONDA_LIB_PATH\intelocl64.dll" -Value 0
346-
try {$list = Get-Item -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors | Select-Object -ExpandProperty Property } catch {$list=@()}
347-
Write-Output $(Get-Item -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors)
348-
349-
# Now copy OpenCL.dll into system folder
350-
$system_ocl_icd_loader="C:\Windows\System32\OpenCL.dll"
351-
$python_ocl_icd_loader="$env:CONDA_LIB_BIN_PATH\OpenCL.dll"
352-
Copy-Item -Path $python_ocl_icd_loader -Destination $system_ocl_icd_loader
353-
354-
if (Test-Path -Path $system_ocl_icd_loader) {
355-
Write-Output "$system_ocl_icd_loader has been copied"
356-
$acl = Get-Acl $system_ocl_icd_loader
357-
Write-Output $acl
358-
} else {
359-
Write-Output "OCL-ICD-Loader was not copied"
360-
}
361-
362-
# Configuration variable assisting OpenCL CPU driver to find TBB DLLs which are not located where it expects them by default
363-
$cl_cfg="$env:CONDA_LIB_PATH\cl.cfg"
364-
Write-Output "`n>>> Dump content of $cl_cfg`n" (Get-Content $cl_cfg) "`n<<< end of dump`n"
365-
(Get-Content $cl_cfg) -replace '^CL_CONFIG_TBB_DLL_PATH =.*', "CL_CONFIG_TBB_DLL_PATH = $env:CONDA_LIB_BIN_PATH" | Set-Content $cl_cfg
366-
Write-Output "`n>>> Dump content of modified $cl_cfg`n" (Get-Content $cl_cfg) "`n<<< end of dump`n"
367-
}
322+
$script_path="$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1"
323+
&$script_path
324+
# Check the variable assisting OpenCL CPU driver to find TBB DLLs which are not located where it expects them by default
325+
$cl_cfg="$env:CONDA_PREFIX\Library\lib\cl.cfg"
326+
Get-Content -Tail 5 -Path $cl_cfg
368327
369328
- name: Smoke test
370329
run: python -c "import dpnp, dpctl; dpctl.lsplatform()"
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Generate coverage data for dpnp
2+
on:
3+
pull_request:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
generate-coverage:
9+
name: Generate coverage and push to Coveralls.io
10+
runs-on: ubuntu-20.04
11+
12+
defaults:
13+
run:
14+
shell: bash -l {0}
15+
16+
env:
17+
python-ver: '3.10'
18+
CHANNELS: '-c dppy/label/dev -c intel -c conda-forge --override-channels'
19+
20+
steps:
21+
- name: Cancel Previous Runs
22+
uses: styfle/cancel-workflow-action@0.11.0
23+
with:
24+
access_token: ${{ github.token }}
25+
26+
- name: Checkout repo
27+
uses: actions/checkout@v3
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Setup miniconda
32+
uses: conda-incubator/setup-miniconda@v2.2.0
33+
with:
34+
auto-update-conda: true
35+
python-version: ${{ env.python-ver }}
36+
miniconda-version: 'latest'
37+
activate-environment: 'coverage'
38+
39+
- name: Install Lcov
40+
run: |
41+
sudo apt-get install lcov
42+
- name: Install dpnp dependencies
43+
run: |
44+
conda install cython llvm cmake scikit-build ninja pytest pytest-cov coverage[toml] \
45+
dpctl dpcpp_linux-64 sysroot_linux-64">=2.28" mkl-devel-dpcpp tbb-devel onedpl-devel ${{ env.CHANNELS }}
46+
- name: Conda info
47+
run: |
48+
conda info
49+
conda list
50+
- name: Build dpnp with coverage
51+
run: |
52+
python scripts/gen_coverage.py --pytest-opts="--ignore tests/test_random.py \
53+
--ignore tests/test_strides.py"
54+
- name: Install coverall dependencies
55+
run: |
56+
sudo gem install coveralls-lcov
57+
pip install coveralls==3.2.0
58+
- name: Upload coverage data to coveralls.io
59+
run: |
60+
echo "Processing pytest-coverage"
61+
export DPNP_PYTEST_LCOV=$(find . -name dpnp_pytest.lcov)
62+
coveralls-lcov -v -n $DPNP_PYTEST_LCOV > pytest-dpnp-c-api-coverage.json
63+
# merge file with coverage data and upload
64+
echo "Merging files with coverage data"
65+
coveralls --service=github --merge=pytest-dpnp-c-api-coverage.json
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
COVERALLS_PARALLEL: true
69+
70+
coveralls:
71+
name: Indicate completion to coveralls.io
72+
needs: generate-coverage
73+
runs-on: ubuntu-latest
74+
container: python:3-slim
75+
steps:
76+
- name: Finished
77+
run: |
78+
pip3 install --upgrade coveralls
79+
coveralls --finish
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# CMake build and local install directory
2-
build
2+
_skbuild
33
build_cython
44
dpnp.egg-info
55

0 commit comments

Comments
 (0)