Skip to content

Commit dd79fea

Browse files
committed
Add DPNP_ONEMKL_INTERFACES_DIR option
1 parent e21ed25 commit dd79fea

File tree

3 files changed

+122
-9
lines changed

3 files changed

+122
-9
lines changed

.github/workflows/check-mkl-interfaces.yaml

Lines changed: 95 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ permissions: read-all
1010

1111
env:
1212
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'
1314
BUILD_DEP_PKGS: >-
1415
mkl-devel-dpcpp
1516
tbb-devel
@@ -24,8 +25,8 @@ env:
2425
scikit-build
2526
2627
jobs:
27-
build_and_test:
28-
name: Run on ['${{ matrix.os }}', python='${{ matrix.python }}']
28+
test_by_tag:
29+
name: Run on ['${{ matrix.os }}', python='${{ matrix.python }}'] with oneMKL tag
2930

3031
strategy:
3132
matrix:
@@ -42,7 +43,7 @@ jobs:
4243
run:
4344
shell: ${{ matrix.os == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }}
4445

45-
continue-on-error: true
46+
continue-on-error: false
4647

4748
steps:
4849
- name: Cancel Previous Runs
@@ -63,7 +64,7 @@ jobs:
6364
channels: conda-forge
6465
conda-remove-defaults: 'true'
6566
python-version: ${{ matrix.python }}
66-
activate-environment: 'test_onemkl_interfaces'
67+
activate-environment: ${{ env.TEST_ENV_NAME }}
6768

6869
# Sometimes `mamba install ...` fails due to slow download speed rate, so disable the check in mamba
6970
- name: Disable speed limit check in mamba
@@ -98,3 +99,93 @@ jobs:
9899
python -m pytest -ra --pyargs dpnp.tests
99100
env:
100101
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-path: '${{ 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-path }}
143+
fetch-depth: 0
144+
145+
- name: ls info
146+
run: |
147+
ls -la ${{ env.onemkl-source-path }}
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="" --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 8f4312ef966420b9b8b4b82b9d5c22e2c91a1fe7 # v0.6
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+
ddefault=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)