Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 163 additions & 2 deletions .github/workflows/conda-package-cf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ jobs:
channels: conda-forge
python-version: ${{ matrix.python }}

- name: Update conda
run: |
conda update -n base --all

- name: Install conda build
run: |
conda install -n base -y conda-build

- name: Cache conda packages
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
env:
Expand All @@ -126,9 +134,12 @@ jobs:
echo "CONDA_BLD=$CONDA\\conda-bld\\win-64\\" >> "$GITHUB_ENV"
echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE\\" >> "$GITHUB_ENV"

- name: Install conda build
- name: Show Conda info
run: |
conda info --all

- name: List base environment packages
run: |
conda install -n base -y conda-build
conda list -n base

- name: Build conda package
Expand Down Expand Up @@ -301,3 +312,153 @@ jobs:
run: |
conda activate ${{ env.TEST_ENV_NAME }}
pytest -v --pyargs ${{ env.MODULE_NAME }}

build_osx:
runs-on: macos-26-intel

strategy:
matrix:
python: ['3.10', '3.11', '3.12', '3.13', '3.14']

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

- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0

- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
with:
miniforge-version: latest
activate-environment: build
channels: conda-forge
python-version: ${{ matrix.python }}

- name: Cache conda packages
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
env:
CACHE_NUMBER: 0 # Increase to reset cache
with:
path: /Users/runner/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
restore-keys: |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-

- name: Install conda-build
shell: bash -el {0}
run: |
conda install -n base -y conda-build
conda list -n base

- name: Store conda paths as envs
shell: bash -el {0}
run: |
echo "CONDA_BLD=$CONDA/conda-bld/osx-64/" >> "$GITHUB_ENV"
echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE/" >> "$GITHUB_ENV"

- name: Build conda package
shell: bash -el {0}
run: |
CHANNELS=(-c conda-forge -c conda-forge/label/python_rc --override-channels)
VERSIONS=(--python "${{ matrix.python }}")
TEST=(--no-test)

conda build \
"${TEST[@]}" \
"${VERSIONS[@]}" \
"${CHANNELS[@]}" \
conda-recipe-cf

- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.conda

- name: Upload wheels artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
path: ${{ env.WHEELS_OUTPUT_FOLDER }}mkl_service-*.whl

test_osx:
needs: build_osx
runs-on: ${{ matrix.runner }}

strategy:
matrix:
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
experimental: [false]
runner: [macos-26-intel]
continue-on-error: ${{ matrix.experimental }}
env:
CHANNELS: -c conda-forge -c conda-forge/label/python_rc --override-channels

steps:
- name: Download artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}

- uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 # v4.0.1
with:
miniforge-version: latest
channels: conda-forge
activate-environment: base

- name: Install conda-index
shell: bash -el {0}
run: conda install -n base -y conda-index

- name: Create conda channel
shell: bash -el {0}
run: |
mkdir -p "$GITHUB_WORKSPACE/channel/osx-64"
conda index "$GITHUB_WORKSPACE/channel" || exit 1
mv "${PACKAGE_NAME}"-*.conda "$GITHUB_WORKSPACE/channel/osx-64" || exit 1
conda index "$GITHUB_WORKSPACE/channel" || exit 1
# Test channel
conda search "$PACKAGE_NAME" -c "$GITHUB_WORKSPACE/channel" --override-channels --info --json > "$GITHUB_WORKSPACE/ver.json"
cat ver.json

- name: Collect dependencies
shell: bash -el {0}
run: |
CHANNELS=(-c "$GITHUB_WORKSPACE/channel" -c conda-forge -c conda-forge/label/python_rc --override-channels)
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
export PACKAGE_VERSION
conda create -n "${{ env.TEST_ENV_NAME }}" "$PACKAGE_NAME=$PACKAGE_VERSION" "python=${{ matrix.python }}" "${CHANNELS[@]}" --only-deps --dry-run > lockfile
cat lockfile

- name: Cache conda packages
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
env:
CACHE_NUMBER: 0 # Increase to reset cache
with:
path: /Users/runner/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
restore-keys: |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-

- name: Install mkl-service
shell: bash -el {0}
run: |
CHANNELS=(-c "$GITHUB_WORKSPACE/channel" -c conda-forge -c conda-forge/label/python_rc --override-channels)
PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")"
export PACKAGE_VERSION
conda create -n "${{ env.TEST_ENV_NAME }}" "$PACKAGE_NAME=$PACKAGE_VERSION" pytest "python=${{ matrix.python }}" "${CHANNELS[@]}"
# Test installed packages
conda list -n "${{ env.TEST_ENV_NAME }}"

- name: Run tests
shell: bash -el {0}
run: |
conda activate ${{ env.TEST_ENV_NAME }}
pytest -vv --pyargs ${{ env.MODULE_NAME }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

### Changed
* Make `mkl-service` backward compatibility from MKL 2026.0 down to at least 2023.2 [gh-193](https://github.com/IntelPython/mkl-service/pull/193)

### Fixed
* Changed insecure HTTP URLs to HTTPS in `pyproject.toml` and conda recipe files for improved security
Expand Down
10 changes: 4 additions & 6 deletions conda-recipe-cf/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
c_compiler: # [linux]
- gcc # [linux]
cxx_compiler: # [linux]
- gxx # [linux]
cxx_compiler_version: # [linux]
- '14' # [linux]
c_stdlib: # [linux]
- sysroot # [linux]
c_stdlib_version: # [linux]
- '2.28' # [linux]
c_compiler: # [osx]
- clang # [osx]
c_stdlib: # [osx]
- macosx_deployment_target # [osx]
c_stdlib: # [win]
- vs # [win]
cxx_compiler: # [win]
- vs2022 # [win]
c_compiler: # [win]
- vs2022 # [win]
4 changes: 3 additions & 1 deletion conda-recipe-cf/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ source:

build:
number: {{ GIT_DESCRIBE_NUMBER }}
skip: true # [osx and arm64]
script_env:
- WHEELS_OUTPUT_FOLDER
ignore_run_exports:
Expand All @@ -22,7 +23,8 @@ requirements:
- python-gil # [py>=314]
- pip >=25.0
- setuptools >=77
- mkl-devel
- mkl-devel # [not osx]
- mkl-devel <2024 # [osx]
- cython
- wheel >=0.45.1
- python-build >=1.2.2
Expand Down
26 changes: 10 additions & 16 deletions conda-recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
c_compiler: # [linux]
- gcc # [linux]
cxx_compiler: # [linux]
- gxx # [linux]
cxx_compiler_version: # [linux]
- '14' # [linux]
c_stdlib: # [linux]
- sysroot # [linux]
c_stdlib_version: # [linux]
- '2.28' # [linux]
c_stdlib: # [win]
- vs # [win]
cxx_compiler: # [win]
- vs2022 # [win]
c_compiler: # [win]
- vs2022 # [win]
c_compiler: # [linux]
- gcc # [linux]
c_stdlib: # [linux]
- sysroot # [linux]
c_stdlib_version: # [linux]
- '2.28' # [linux]
c_stdlib: # [win]
- vs # [win]
c_compiler: # [win]
- vs2022 # [win]
62 changes: 59 additions & 3 deletions mkl/_mkl_service.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ cdef extern from "mkl.h":
int MKL_CBWR_AVX2
int MKL_CBWR_AVX512
int MKL_CBWR_AVX512_E1
int MKL_CBWR_AVX10

int MKL_CBWR_SUCCESS
int MKL_CBWR_ERR_INVALID_SETTINGS
Expand All @@ -74,12 +73,10 @@ cdef extern from "mkl.h":
int MKL_ENABLE_AVX512_E3
int MKL_ENABLE_AVX512_E4
int MKL_ENABLE_AVX512_E1
int MKL_ENABLE_AVX512_E5
int MKL_ENABLE_AVX512
int MKL_ENABLE_AVX2
int MKL_ENABLE_AVX2_E1
int MKL_ENABLE_SSE4_2
int MKL_ENABLE_AVX10

# MPI Implementation Constants
int MKL_BLACS_CUSTOM
Expand Down Expand Up @@ -169,3 +166,62 @@ cdef extern from "mkl.h":
int vmlSetErrStatus(const MKL_INT status)
int vmlGetErrStatus()
int vmlClearErrStatus()

# version-compat shim
cdef extern from *:
"""
#include <mkl.h>

/* define constants removed in 2026.0 if undefined */
#ifndef MKL_CBWR_SSSE3
#define MKL_CBWR_SSSE3 -1
#endif
#ifndef MKL_CBWR_SSE4_1
#define MKL_CBWR_SSE4_1 -1
#endif
#ifndef MKL_CBWR_AVX
#define MKL_CBWR_AVX -1
#endif
#ifndef MKL_CBWR_AVX512_MIC
#define MKL_CBWR_AVX512_MIC -1
#endif
#ifndef MKL_CBWR_AVX512_MIC_E1
#define MKL_CBWR_AVX512_MIC_E1 -1
#endif

#ifndef MKL_ENABLE_AVX512_MIC_E1
#define MKL_ENABLE_AVX512_MIC_E1 -1
#endif
#ifndef MKL_ENABLE_AVX512_MIC
#define MKL_ENABLE_AVX512_MIC -1
#endif
#ifndef MKL_ENABLE_AVX
#define MKL_ENABLE_AVX -1
#endif

/* define constants from 2026.0 if undefined */
#ifndef MKL_CBWR_AVX10
#define MKL_CBWR_AVX10 -2
#endif

#ifndef MKL_ENABLE_AVX512_E5
#define MKL_ENABLE_AVX512_E5 -2
#endif
#ifndef MKL_ENABLE_AVX10
#define MKL_ENABLE_AVX10 -2
#endif
"""
int MKL_CBWR_SSSE3
int MKL_CBWR_SSE4_1
int MKL_CBWR_AVX
int MKL_CBWR_AVX512_MIC
int MKL_CBWR_AVX512_MIC_E1

int MKL_ENABLE_AVX512_MIC_E1
int MKL_ENABLE_AVX512_MIC
int MKL_ENABLE_AVX

int MKL_CBWR_AVX10

int MKL_ENABLE_AVX512_E5
int MKL_ENABLE_AVX10
Loading
Loading