Skip to content

Commit

Permalink
Merge 403f13d into eaf343a
Browse files Browse the repository at this point in the history
  • Loading branch information
antonwolfy authored Dec 5, 2024
2 parents eaf343a + 403f13d commit 2cb9ca4
Show file tree
Hide file tree
Showing 4 changed files with 220 additions and 5 deletions.
191 changes: 191 additions & 0 deletions .github/workflows/check-mkl-interfaces.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
name: Test oneMKL interfaces

on:
push:
branches:
- master
pull_request:

permissions: read-all

env:
CHANNELS: '-c dppy/label/dev -c https://software.repos.intel.com/python/conda/ -c conda-forge --override-channels'
TEST_ENV_NAME: 'test_onemkl_interfaces'
BUILD_DEP_PKGS: >-
mkl-devel-dpcpp
tbb-devel
dpctl
onedpl-devel
setuptools
python
numpy">=2.0"
cython
cmake
ninja
scikit-build
jobs:
test_default:
name: Run on ['${{ matrix.os }}', python='${{ matrix.python }}']

strategy:
matrix:
python: ['3.12']
os: [ubuntu-22.04] # windows-2019 - no DFT support for Windows in oneMKL

permissions:
# Needed to cancel any previous runs that are not completed for a given workflow
actions: write

runs-on: ${{ matrix.os }}

defaults:
run:
shell: ${{ matrix.os == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }}

continue-on-error: false

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
with:
access_token: ${{ github.token }}

- name: Checkout DPNP repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Setup miniconda
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
channels: conda-forge
conda-remove-defaults: 'true'
python-version: ${{ matrix.python }}
activate-environment: ${{ env.TEST_ENV_NAME }}

# Sometimes `mamba install ...` fails due to slow download speed rate, so disable the check in mamba
- name: Disable speed limit check in mamba
run: echo "MAMBA_NO_LOW_SPEED_LIMIT=1" >> $GITHUB_ENV

- name: Install dpnp build dependencies
run: |
mamba install ${{ env.DPCPP_PKG }} ${{ env.BUILD_DEP_PKGS }} ${{ env.CHANNELS }}
env:
DPCPP_PKG: ${{ matrix.os == 'windows-2019' && 'dpcpp_win-64 vs_win-64=2017.9' || 'dpcpp_linux-64' }}

- name: Conda info
run: |
mamba info
mamba list
- name: Build and install DPNP package
run: |
python scripts/build_locally.py --onemkl-interfaces --verbose
- name: Smoke test
run: |
python -m dpctl -f
python -c "import dpnp; print(dpnp.__version__)"
- name: Install pytest
run: |
mamba install pytest ${{ env.CHANNELS }}
- name: Run tests
run: |
python -m pytest -ra --pyargs dpnp.tests
env:
SYCL_CACHE_PERSISTENT: 1

test_build_option:
name: Run on ['${{ matrix.os }}', python='${{ matrix.python }}'] though build option

strategy:
matrix:
python: ['3.12']
os: [ubuntu-22.04] # windows-2019 - no DFT support for Windows in oneMKL

permissions:
# Needed to cancel any previous runs that are not completed for a given workflow
actions: write

runs-on: ${{ matrix.os }}

defaults:
run:
shell: ${{ matrix.os == 'windows-2019' && 'cmd /C CALL {0}' || 'bash -el {0}' }}

continue-on-error: true

env:
onemkl-source-dir: '${{ github.workspace }}/onemkl/'

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1
with:
access_token: ${{ github.token }}

- name: Checkout DPNP repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Checkout oneMKL repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: 'oneapi-src/oneMKL'
ref: 'v0.6' # the same as handcoded by default
path: ${{ env.onemkl-source-dir }}
fetch-depth: 0

- name: oneMKL ls info
run: |
ls -la ${{ env.onemkl-source-dir }}
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
channels: conda-forge
conda-remove-defaults: 'true'
python-version: ${{ matrix.python }}
activate-environment: ${{ env.TEST_ENV_NAME }}

# Sometimes `mamba install ...` fails due to slow download speed rate, so disable the check in mamba
- name: Disable speed limit check in mamba
run: echo "MAMBA_NO_LOW_SPEED_LIMIT=1" >> $GITHUB_ENV

- name: Install dpnp build dependencies
run: |
mamba install ${{ env.DPCPP_PKG }} ${{ env.BUILD_DEP_PKGS }} ${{ env.CHANNELS }}
env:
DPCPP_PKG: ${{ matrix.os == 'windows-2019' && 'dpcpp_win-64 vs_win-64=2017.9' || 'dpcpp_linux-64' }}

- name: Conda info
run: |
mamba info
mamba list
- name: Build and install DPNP package
run: |
python scripts/build_locally.py --onemkl-interfaces --onemkl-interfaces-dir=${{ env.onemkl-source-dir }} --verbose
- name: Smoke test
run: |
python -m dpctl -f
python -c "import dpnp; print(dpnp.__version__)"
- name: Install pytest
run: |
mamba install pytest ${{ env.CHANNELS }}
- name: Run tests
run: |
python -m pytest -ra --pyargs dpnp.tests
env:
SYCL_CACHE_PERSISTENT: 1
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This is a bug-fix release.
* Changed to use `Miniforge` installer in GutHub actions [#2057](https://github.com/IntelPython/dpnp/pull/2057)
* Updated `README.md` to reflect current installation requirements and available options [#2166](https://github.com/IntelPython/dpnp/pull/2166)
* Corrected a list of owners and code maintainers [#2185](https://github.com/IntelPython/dpnp/pull/2185)
* Bumped a version of `oneMKL` interface used in dpnp build by default to align it with `2025.0` oneAPI release [#2193](https://github.com/IntelPython/dpnp/pull/2193)

### Fixed

Expand All @@ -21,6 +22,7 @@ This is a bug-fix release.
* Fixed incorrect result produced by `dpnp.fft.fft` function when input array has negative strides [#2202](https://github.com/IntelPython/dpnp/pull/2202)
* Resolved a compilation error when building with DPC++ 2025.1 compiler [#2211](https://github.com/IntelPython/dpnp/pull/2211)


## [0.16.0] - 10/14/2024

This release reaches an important milestone by making offloading fully asynchronous. Calls to `dpnp` submit tasks for execution to DPC++ runtime and return without waiting for execution of these tasks to finish. The sequential semantics a user comes to expect from execution of Python script is preserved though.
Expand Down
16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,17 @@ if(_use_onemkl_interfaces)
set(ENABLE_MKLGPU_BACKEND False)
set(ENABLE_MKLCPU_BACKEND False)
endif()
FetchContent_Declare(
onemkl_interfaces_library
GIT_REPOSITORY https://github.com/oneapi-src/oneMKL.git
GIT_TAG f2d2dcb4213a435bb60fbb88320c5f24892423ce
)

if(DPNP_ONEMKL_INTERFACES_DIR)
FetchContent_Declare(onemkl_interfaces_library SOURCE_DIR "${DPNP_ONEMKL_INTERFACES_DIR}")
else()
FetchContent_Declare(
onemkl_interfaces_library
GIT_REPOSITORY https://github.com/oneapi-src/oneMKL.git
GIT_TAG 8f4312ef966420b9b8b4b82b9d5c22e2c91a1fe7 # v0.6
)
endif()

FetchContent_MakeAvailable(onemkl_interfaces_library)
set(CMAKE_INSTALL_RPATH "${CMAKE_BINARY_DIR}/lib")
endif()
Expand Down
16 changes: 16 additions & 0 deletions scripts/build_locally.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def run(
cmake_opts="",
target="intel",
onemkl_interfaces=False,
onemkl_interfaces_dir=None,
):
build_system = None

Expand Down Expand Up @@ -108,6 +109,13 @@ def run(
"-DDPNP_USE_ONEMKL_INTERFACES=ON",
]

if onemkl_interfaces_dir:
cmake_args += [
f"-DDPNP_ONEMKL_INTERFACES_DIR={onemkl_interfaces_dir}",
]
elif onemkl_interfaces_dir:
RuntimeError("--onemkl-interfaces-dir option is not supported")

subprocess.check_call(
cmake_args, shell=False, cwd=setup_dir, env=os.environ
)
Expand Down Expand Up @@ -175,6 +183,13 @@ def run(
dest="onemkl_interfaces",
action="store_true",
)
driver.add_argument(
"--onemkl-interfaces-dir",
help="Local directory with source of oneMKL Interfaces",
dest="onemkl_interfaces_dir",
default=None,
type=str,
)
args = parser.parse_args()

args_to_validate = [
Expand Down Expand Up @@ -230,4 +245,5 @@ def run(
cmake_opts=args.cmake_opts,
target=args.target,
onemkl_interfaces=args.onemkl_interfaces,
onemkl_interfaces_dir=args.onemkl_interfaces_dir,
)

0 comments on commit 2cb9ca4

Please sign in to comment.