Skip to content

Use oneMKL LAPACK gesv for dpnp.linalg.solve() #304

Use oneMKL LAPACK gesv for dpnp.linalg.solve()

Use oneMKL LAPACK gesv for dpnp.linalg.solve() #304

name: Test oneAPI Math Library (oneMath)
on:
push:
branches:
- master
pull_request:
permissions: read-all
env:
environment-file: 'environments/environment.yml'
environment-file-name: 'environment.yml'
environment-file-loc: '${{ github.workspace }}/environments'
build-with-oneapi-env: 'environments/build_with_oneapi.yml'
dpctl-pkg-env: 'environments/dpctl_pkg.yml'
oneapi-pkgs-env: 'environments/oneapi_pkgs.yml'
test-env-name: 'test_onemath'
rerun-tests-on-failure: 'true'
rerun-tests-max-attempts: 2
rerun-tests-timeout: 20
jobs:
build_env_file:
name: Build conda env file
permissions:
# Needed to cancel any previous runs that are not completed for a given workflow
actions: write
runs-on: 'ubuntu-latest'
timeout-minutes: 5
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: Install conda-merge tool
uses: BSFishy/pip-action@8f2d471d809dc20b6ada98c91910b6ae6243f318 # v1
with:
packages: conda-merge
- name: Merge conda env files
run: |
conda-merge ${{ env.dpctl-pkg-env }} ${{ env.oneapi-pkgs-env }} ${{ env.build-with-oneapi-env }} > ${{ env.environment-file }}
cat ${{ env.environment-file }}
- name: Upload artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ env.environment-file-name }}
path: ${{ env.environment-file }}
test_by_tag:
name: Run tests with OneMath tag
needs: build_env_file
strategy:
fail-fast: false
matrix:
python: ['3.13']
os: [ubuntu-22.04] # windows-2022 - no DFT support for Windows in oneMKL
runs-on: ${{ matrix.os }}
timeout-minutes: 60
defaults:
run:
shell: ${{ matrix.os == 'windows-2022' && 'cmd /C CALL {0}' || 'bash -el {0}' }}
steps:
- name: Checkout DPNP repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Download artifact
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: ${{ env.environment-file-name }}
path: ${{ env.environment-file-loc }}
- name: Setup miniconda
id: setup_miniconda
continue-on-error: true
uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0
with:
miniforge-version: latest
use-mamba: 'true'
conda-remove-defaults: 'true'
environment-file: ${{ env.environment-file }}
activate-environment: ${{ env.test-env-name }}
- name: ReSetup miniconda
if: steps.setup_miniconda.outcome == 'failure'
uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0
with:
miniforge-version: latest
use-mamba: 'true'
conda-remove-defaults: 'true'
environment-file: ${{ env.environment-file }}
activate-environment: ${{ env.test-env-name }}
- name: Conda info
run: |
mamba info
mamba list
- name: Build and install DPNP package
run: |
python scripts/build_locally.py --onemath --verbose
- name: Smoke test
run: |
python -m dpctl -f
python -c "import dpnp; print(dpnp.__version__)"
- name: Run tests
if: env.rerun-tests-on-failure != 'true'
run: |
python -m pytest -ra --pyargs dpnp.tests
env:
SYCL_CACHE_PERSISTENT: 1
- name: ReRun tests on Linux
if: env.rerun-tests-on-failure == 'true'
id: run_tests
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
with:
timeout_minutes: ${{ env.rerun-tests-timeout }}
max_attempts: ${{ env.rerun-tests-max-attempts }}
retry_on: any
command: |
. $CONDA/etc/profile.d/conda.sh
. $CONDA/etc/profile.d/mamba.sh
mamba activate ${{ env.test-env-name }}
python -m pytest -ra --pyargs dpnp.tests
env:
SYCL_CACHE_PERSISTENT: 1
test_by_branch:
name: Run tests with oneMath develop branch
needs: build_env_file
strategy:
fail-fast: false
matrix:
python: ['3.13']
os: [ubuntu-22.04] # windows-2022 - no DFT support for Windows in oneMKL
runs-on: ${{ matrix.os }}
timeout-minutes: 60
defaults:
run:
shell: ${{ matrix.os == 'windows-2022' && 'cmd /C CALL {0}' || 'bash -el {0}' }}
env:
onemkl-source-dir: '${{ github.workspace }}/onemkl/'
steps:
- name: Checkout DPNP repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Download artifact
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: ${{ env.environment-file-name }}
path: ${{ env.environment-file-loc }}
- name: Checkout oneMKL repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: 'oneapi-src/oneMKL'
ref: 'develop'
path: ${{ env.onemkl-source-dir }}
fetch-depth: 0
- name: oneMKL ls info
run: |
ls -la ${{ env.onemkl-source-dir }}
- name: Setup miniconda
id: setup_miniconda
continue-on-error: true
uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0
with:
miniforge-version: latest
use-mamba: 'true'
conda-remove-defaults: 'true'
environment-file: ${{ env.environment-file }}
activate-environment: ${{ env.test-env-name }}
- name: ReSetup miniconda
if: steps.setup_miniconda.outcome == 'failure'
uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3.2.0
with:
miniforge-version: latest
use-mamba: 'true'
conda-remove-defaults: 'true'
environment-file: ${{ env.environment-file }}
activate-environment: ${{ env.test-env-name }}
- name: Conda info
run: |
mamba info
mamba list
- name: Build and install DPNP package
run: |
python scripts/build_locally.py --onemath --onemath-dir=${{ env.onemkl-source-dir }} --verbose
- name: Smoke test
run: |
python -m dpctl -f
python -c "import dpnp; print(dpnp.__version__)"
- name: Run tests
if: env.rerun-tests-on-failure != 'true'
run: |
python -m pytest -ra --pyargs dpnp.tests
env:
SYCL_CACHE_PERSISTENT: 1
- name: ReRun tests on Linux
if: env.rerun-tests-on-failure == 'true'
id: run_tests
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
with:
timeout_minutes: ${{ env.rerun-tests-timeout }}
max_attempts: ${{ env.rerun-tests-max-attempts }}
retry_on: any
command: |
. $CONDA/etc/profile.d/conda.sh
. $CONDA/etc/profile.d/mamba.sh
mamba activate ${{ env.test-env-name }}
python -m pytest -ra --pyargs dpnp.tests
env:
SYCL_CACHE_PERSISTENT: 1