Skip to content

Commit 475c531

Browse files
authored
Bump oneMKL version to 0.6 and add new --onemkl-interfaces-dir option (#2193)
* Bump oneMKL version to 0.6 * Add GH action to check build with oneMKL interfaces * Add DPNP_ONEMKL_INTERFACES_DIR option
1 parent 5cf4883 commit 475c531

File tree

3 files changed

+218
-5
lines changed

3 files changed

+218
-5
lines changed
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
name: Test oneMKL interfaces
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
permissions: read-all
10+
11+
env:
12+
CHANNELS: '-c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels'
13+
TEST_ENV_NAME: 'test_onemkl_interfaces'
14+
BUILD_DEP_PKGS: >-
15+
mkl-devel-dpcpp
16+
tbb-devel
17+
dpctl
18+
onedpl-devel
19+
setuptools
20+
python
21+
numpy">=2.0"
22+
cython
23+
cmake
24+
ninja
25+
scikit-build
26+
27+
jobs:
28+
test_by_tag:
29+
name: Run on ['${{ matrix.os }}', python='${{ matrix.python }}'] with oneMKL tag
30+
31+
strategy:
32+
matrix:
33+
python: ['3.12']
34+
os: [ubuntu-22.04] # windows-2019 - no DFT support for Windows in oneMKL
35+
36+
permissions:
37+
# Needed to cancel any previous runs that are not completed for a given workflow
38+
actions: write
39+
40+
runs-on: ${{ matrix.os }}
41+
42+
defaults:
43+
run:
44+
shell: ${{ matrix.os == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }}
45+
46+
continue-on-error: false
47+
48+
steps:
49+
- name: Cancel Previous Runs
50+
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
51+
with:
52+
access_token: ${{ github.token }}
53+
54+
- name: Checkout DPNP repo
55+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
56+
with:
57+
fetch-depth: 0
58+
59+
- name: Setup miniconda
60+
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
61+
with:
62+
miniforge-version: latest
63+
use-mamba: 'true'
64+
channels: conda-forge
65+
conda-remove-defaults: 'true'
66+
python-version: ${{ matrix.python }}
67+
activate-environment: ${{ env.TEST_ENV_NAME }}
68+
69+
# Sometimes `mamba install ...` fails due to slow download speed rate, so disable the check in mamba
70+
- name: Disable speed limit check in mamba
71+
run: echo "MAMBA_NO_LOW_SPEED_LIMIT=1" >> $GITHUB_ENV
72+
73+
- name: Install dpnp build dependencies
74+
run: |
75+
mamba install ${{ env.DPCPP_PKG }} ${{ env.BUILD_DEP_PKGS }} ${{ env.CHANNELS }}
76+
env:
77+
DPCPP_PKG: ${{ matrix.os == 'windows-2019' && 'dpcpp_win-64 vs_win-64=2017.9' || 'dpcpp_linux-64' }}
78+
79+
- name: Conda info
80+
run: |
81+
mamba info
82+
mamba list
83+
84+
- name: Build and install DPNP package
85+
run: |
86+
python scripts/build_locally.py --onemkl-interfaces --verbose
87+
88+
- name: Smoke test
89+
run: |
90+
python -m dpctl -f
91+
python -c "import dpnp; print(dpnp.__version__)"
92+
93+
- name: Install pytest
94+
run: |
95+
mamba install pytest ${{ env.CHANNELS }}
96+
97+
- name: Run tests
98+
run: |
99+
python -m pytest -ra --pyargs dpnp.tests
100+
env:
101+
SYCL_CACHE_PERSISTENT: 1
102+
103+
test_by_branch:
104+
name: Run on ['${{ matrix.os }}', python='${{ matrix.python }}'] with oneMKL develop branch
105+
106+
strategy:
107+
matrix:
108+
python: ['3.12']
109+
os: [ubuntu-22.04] # windows-2019 - no DFT support for Windows in oneMKL
110+
111+
permissions:
112+
# Needed to cancel any previous runs that are not completed for a given workflow
113+
actions: write
114+
115+
runs-on: ${{ matrix.os }}
116+
117+
defaults:
118+
run:
119+
shell: ${{ matrix.os == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }}
120+
121+
continue-on-error: true
122+
123+
env:
124+
onemkl-source-dir: '${{ github.workspace }}/onemkl/'
125+
126+
steps:
127+
- name: Cancel Previous Runs
128+
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
129+
with:
130+
access_token: ${{ github.token }}
131+
132+
- name: Checkout DPNP repo
133+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
134+
with:
135+
fetch-depth: 0
136+
137+
- name: Checkout oneMKL repo
138+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
139+
with:
140+
repository: 'oneapi-src/oneMKL'
141+
ref: 'develop'
142+
path: ${{ env.onemkl-source-dir }}
143+
fetch-depth: 0
144+
145+
- name: oneMKL ls info
146+
run: |
147+
ls -la ${{ env.onemkl-source-dir }}
148+
149+
- name: Setup miniconda
150+
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
151+
with:
152+
miniforge-version: latest
153+
use-mamba: 'true'
154+
channels: conda-forge
155+
conda-remove-defaults: 'true'
156+
python-version: ${{ matrix.python }}
157+
activate-environment: ${{ env.TEST_ENV_NAME }}
158+
159+
# Sometimes `mamba install ...` fails due to slow download speed rate, so disable the check in mamba
160+
- name: Disable speed limit check in mamba
161+
run: echo "MAMBA_NO_LOW_SPEED_LIMIT=1" >> $GITHUB_ENV
162+
163+
- name: Install dpnp build dependencies
164+
run: |
165+
mamba install ${{ env.DPCPP_PKG }} ${{ env.BUILD_DEP_PKGS }} ${{ env.CHANNELS }}
166+
env:
167+
DPCPP_PKG: ${{ matrix.os == 'windows-2019' && 'dpcpp_win-64 vs_win-64=2017.9' || 'dpcpp_linux-64' }}
168+
169+
- name: Conda info
170+
run: |
171+
mamba info
172+
mamba list
173+
174+
- name: Build and install DPNP package
175+
run: |
176+
python scripts/build_locally.py --onemkl-interfaces --onemkl-interfaces-dir=${{ env.onemkl-source-dir }} --verbose
177+
178+
- name: Smoke test
179+
run: |
180+
python -m dpctl -f
181+
python -c "import dpnp; print(dpnp.__version__)"
182+
183+
- name: Install pytest
184+
run: |
185+
mamba install pytest ${{ env.CHANNELS }}
186+
187+
- name: Run tests
188+
run: |
189+
python -m pytest -ra --pyargs dpnp.tests
190+
env:
191+
SYCL_CACHE_PERSISTENT: 1

CMakeLists.txt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,17 @@ if(_use_onemkl_interfaces)
114114
set(ENABLE_MKLGPU_BACKEND False)
115115
set(ENABLE_MKLCPU_BACKEND False)
116116
endif()
117-
FetchContent_Declare(
118-
onemkl_interfaces_library
119-
GIT_REPOSITORY https://github.com/oneapi-src/oneMKL.git
120-
GIT_TAG f2d2dcb4213a435bb60fbb88320c5f24892423ce
121-
)
117+
118+
if(DPNP_ONEMKL_INTERFACES_DIR)
119+
FetchContent_Declare(onemkl_interfaces_library SOURCE_DIR "${DPNP_ONEMKL_INTERFACES_DIR}")
120+
else()
121+
FetchContent_Declare(
122+
onemkl_interfaces_library
123+
GIT_REPOSITORY https://github.com/oneapi-src/oneMKL.git
124+
GIT_TAG 8f4312ef966420b9b8b4b82b9d5c22e2c91a1fe7 # v0.6
125+
)
126+
endif()
127+
122128
FetchContent_MakeAvailable(onemkl_interfaces_library)
123129
set(CMAKE_INSTALL_RPATH "${CMAKE_BINARY_DIR}/lib")
124130
endif()

scripts/build_locally.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def run(
4040
cmake_opts="",
4141
target="intel",
4242
onemkl_interfaces=False,
43+
onemkl_interfaces_dir=None,
4344
):
4445
build_system = None
4546

@@ -108,6 +109,13 @@ def run(
108109
"-DDPNP_USE_ONEMKL_INTERFACES=ON",
109110
]
110111

112+
if onemkl_interfaces_dir:
113+
cmake_args += [
114+
f"-DDPNP_ONEMKL_INTERFACES_DIR={onemkl_interfaces_dir}",
115+
]
116+
elif onemkl_interfaces_dir:
117+
RuntimeError("--onemkl-interfaces-dir option is not supported")
118+
111119
subprocess.check_call(
112120
cmake_args, shell=False, cwd=setup_dir, env=os.environ
113121
)
@@ -175,6 +183,13 @@ def run(
175183
dest="onemkl_interfaces",
176184
action="store_true",
177185
)
186+
driver.add_argument(
187+
"--onemkl-interfaces-dir",
188+
help="Local directory with source of oneMKL Interfaces",
189+
dest="onemkl_interfaces_dir",
190+
default=None,
191+
type=str,
192+
)
178193
args = parser.parse_args()
179194

180195
args_to_validate = [
@@ -230,4 +245,5 @@ def run(
230245
cmake_opts=args.cmake_opts,
231246
target=args.target,
232247
onemkl_interfaces=args.onemkl_interfaces,
248+
onemkl_interfaces_dir=args.onemkl_interfaces_dir,
233249
)

0 commit comments

Comments
 (0)