Skip to content

Commit

Permalink
Merge pull request #33 from IntelPython/prepare-for-release-2.4.1
Browse files Browse the repository at this point in the history
Prepare for release 2.4.1
  • Loading branch information
oleksandr-pavlyk authored Feb 12, 2024
2 parents 2e0aa0c + a1b4fc9 commit 1bc00fa
Show file tree
Hide file tree
Showing 6 changed files with 327 additions and 17 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/build-with-clang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build mkl-service with clang
on:
pull_request:
push:
branches: [master]

permissions: read-all

jobs:
build-with-clang:
name: Build project with IntelLLVM clang compiler
runs-on: ubuntu-latest

env:
ONEAPI_ROOT: /opt/intel/oneapi

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

- name: Add Intel repository
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
sudo apt-get update
- name: Install Intel OneAPI
run: |
sudo apt-get install intel-oneapi-compiler-dpcpp-cpp
sudo apt-get install intel-oneapi-tbb
sudo apt-get install intel-oneapi-mkl-devel
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
architecture: x64

- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install mkl-service dependencies
shell: bash -l {0}
run: |
pip install numpy cython setuptools pytest pytest-cov
- name: List oneAPI folder content
shell: bash -l {0}
run: ls /opt/intel/oneapi/compiler

- name: Build mkl_random
shell: bash -l {0}
run: |
source /opt/intel/oneapi/setvars.sh
echo $CMPLR_ROOT
export CC=$CMPLR_ROOT/bin/compiler/clang
export CXX=$CMPLR_ROOT/bin/compiler/clang++
export CFLAGS="${CFLAGS} -fno-fast-math"
echo "CC = ${CC} CXX=${CXX}"
ls -l ${CC} ${CXX}
python setup.py develop
- name: Run mkl_random tests
shell: bash -l {0}
run: |
source /opt/intel/oneapi/setvars.sh
pytest -s -v --pyargs mkl
236 changes: 236 additions & 0 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
name: Conda package

on: push

permissions: read-all

env:
PACKAGE_NAME: mkl-service
MODULE_NAME: mkl
TEST_ENV_NAME: test_mkl_service
VER_SCRIPT1: "import json; f = open('ver.json', 'r'); j = json.load(f); f.close(); "
VER_SCRIPT2: "d = j['mkl-service'][0]; print('='.join((d[s] for s in ('version', 'build'))))"

jobs:
build_linux:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set pkgs_dirs
run: |
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
- name: Cache conda packages
uses: actions/cache@v4
env:
CACHE_NUMBER: 0 # Increase to reset cache
with:
path: ~/.conda/pkgs
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: Add conda to system path
run: echo $CONDA/bin >> $GITHUB_PATH
- name: Install conda-build
run: conda install conda-build
- name: Build conda package
run: |
CHANNELS="-c conda-forge -c intel --override-channels"
VERSIONS="--python ${{ matrix.python }}"
TEST="--no-test"
conda build \
$TEST \
$VERSIONS \
$CHANNELS \
conda-recipe
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.tar.bz2

build_windows:
runs-on: windows-latest

strategy:
matrix:
python: ['3.9', '3.10', '3.11', '3.12']
env:
conda-bld: C:\Miniconda\conda-bld\win-64\
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: true
activate-environment: ""

- name: Cache conda packages
uses: actions/cache@v4
env:
CACHE_NUMBER: 3 # Increase to reset cache
with:
path: /home/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
run: conda install conda-build
- name: Build conda package
run: conda build --no-test --python ${{ matrix.python }} -c intel -c conda-forge --override-channels conda-recipe
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2

test_linux:
needs: build_linux
runs-on: ${{ matrix.runner }}

strategy:
matrix:
python: ['3.9', '3.10', '3.11', '3.12']
experimental: [false]
runner: [ubuntu-latest]
continue-on-error: ${{ matrix.experimental }}
env:
CHANNELS: -c conda-forge -c intel --override-channels

steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
- name: Add conda to system path
run: echo $CONDA/bin >> $GITHUB_PATH
- name: Install conda-build
run: conda install conda-build
- name: Create conda channel
run: |
mkdir -p $GITHUB_WORKSPACE/channel/linux-64
conda index $GITHUB_WORKSPACE/channel || exit 1
mv ${PACKAGE_NAME}-*.tar.bz2 $GITHUB_WORKSPACE/channel/linux-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
run: |
. $CONDA/etc/profile.d/conda.sh
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
conda create -n ${{ env.TEST_ENV_NAME }} $PACKAGE_NAME=${PACKAGE_VERSION} python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
cat lockfile
- name: Set pkgs_dirs
run: |
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
- name: Cache conda packages
uses: actions/cache@v4
env:
CACHE_NUMBER: 0 # Increase to reset cache
with:
path: ~/.conda/pkgs
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
run: |
. $CONDA/etc/profile.d/conda.sh
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
conda create -n ${{ env.TEST_ENV_NAME }} $PACKAGE_NAME=${PACKAGE_VERSION} pytest python=${{ matrix.python }} $CHANNELS
# Test installed packages
conda list
- name: Run tests
run: |
. $CONDA/etc/profile.d/conda.sh
conda activate ${{ env.TEST_ENV_NAME }}
pytest -vv --pyargs ${{ env.MODULE_NAME }}
test_windows:
needs: build_windows
runs-on: ${{ matrix.runner }}

strategy:
matrix:
python: ['3.9', '3.10', '3.11', '3.12']
experimental: [false]
runner: [windows-latest]
continue-on-error: ${{ matrix.experimental }}
env:
CHANNELS: -c conda-forge -c intel --override-channels

steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
- uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: true
activate-environment: ""
- name: Install conda-build
# Needed to be able to run conda index
run: conda install conda-build
- name: Create conda channel
run: |
mkdir ${{ env.GITHUB_WORKSPACE }}\channel\win-64
move ${{ env.PACKAGE_NAME }}-*.tar.bz2 ${{ env.GITHUB_WORKSPACE }}\channel\win-64
conda index ${{ env.GITHUB_WORKSPACE }}/channel
# Test channel
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.GITHUB_WORKSPACE }}/channel --override-channels --info --json > ${{ env.GITHUB_WORKSPACE }}\ver.json
more ${{ env.GITHUB_WORKSPACE }}\ver.json
- name: Collect dependencies
shell: cmd
run: |
@ECHO ON
copy /Y ${{ env.GITHUB_WORKSPACE }}\ver.json .
set "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%"
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
SET PACKAGE_VERSION=%%F
)
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
more lockfile
- name: Cache conda packages
uses: actions/cache@v4
env:
CACHE_NUMBER: 3 # Increase to reset cache
with:
path: /home/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: cmd
run: |
@ECHO ON
copy /Y ${{ env.GITHUB_WORKSPACE }}\ver.json .
set "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%"
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
SET PACKAGE_VERSION=%%F
)
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% pytest python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }}
# Test installed packages
conda list
- name: Run tests
run: |
conda activate -n ${{ env.TEST_ENV_NAME }}
pytest -v --pyargs ${{ env.MODULE_NAME }}
9 changes: 3 additions & 6 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set version = "2.4.0" %}
{% set buildnumber = 2 %}
{% set version = "2.4.1" %}
{% set buildnumber = 0 %}

package:
name: mkl-service
Expand All @@ -25,17 +25,14 @@ requirements:
run:
- python
- mkl >=2019.3
- six

test:
requires:
- pytest
imports:
- mkl
commands:
- pytest tests/test_mkl_service.py
source_files:
- tests
- pytest -vv --pyargs mkl

about:
home: http://github.com/IntelPython/mkl-service
Expand Down
2 changes: 1 addition & 1 deletion mkl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ def __exit__(self, *args):
from ._py_mkl_service import *


__version__ = '2.4.0'
__version__ = '2.4.1'
3 changes: 1 addition & 2 deletions tests/test_mkl_service.py → mkl/tests/test_mkl_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@


import pytest
import six
import mkl


Expand All @@ -39,7 +38,7 @@ def test_get_version():

def test_get_version_string():
v = mkl.get_version_string()
assert isinstance(v, six.string_types)
assert isinstance(v, str)
assert 'Math Kernel Library' in v


Expand Down
21 changes: 13 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@
License :: OSI Approved
Programming Language :: C
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: Implementation :: CPython
Topic :: Software Development
Topic :: Utilities
Expand Down Expand Up @@ -143,10 +141,17 @@ def setup_package():
license='BSD',
classifiers=[_f for _f in CLASSIFIERS.split('\n') if _f],
platforms=["Windows", "Linux", "Mac OS-X"],
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
python_requires='>=3.9',
setup_requires=['setuptools', 'cython'],
install_requires=[],
packages=setuptools.find_packages(),
packages=[
"mkl",
],
package_data={
"mkl" : [
"tests/*.*",
]
},
ext_modules=get_extensions()
)
setup(**metadata)
Expand Down

0 comments on commit 1bc00fa

Please sign in to comment.