Skip to content

Commit 8aef61c

Browse files
Bump up version to 2.4.1
Moved tests into mkl layout, added github actions
1 parent 2e0aa0c commit 8aef61c

File tree

6 files changed

+323
-17
lines changed

6 files changed

+323
-17
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Build mkl-service with clang
2+
on:
3+
pull_request:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
build-with-clang:
9+
name: Build project with IntelLLVM clang compiler
10+
runs-on: ubuntu-latest
11+
12+
env:
13+
ONEAPI_ROOT: /opt/intel/oneapi
14+
15+
steps:
16+
- name: Cancel Previous Runs
17+
uses: styfle/cancel-workflow-action@0.11.0
18+
with:
19+
access_token: ${{ github.token }}
20+
21+
- name: Add Intel repository
22+
run: |
23+
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
24+
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
25+
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
26+
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
27+
sudo apt-get update
28+
29+
- name: Install Intel OneAPI
30+
run: |
31+
sudo apt-get install intel-oneapi-compiler-dpcpp-cpp
32+
sudo apt-get install intel-oneapi-tbb
33+
sudo apt-get install intel-oneapi-mkl-devel
34+
35+
- name: Setup Python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: '3.12'
39+
architecture: x64
40+
41+
- name: Checkout repo
42+
uses: actions/checkout@v4
43+
with:
44+
fetch-depth: 0
45+
46+
- name: Install mkl-service dependencies
47+
shell: bash -l {0}
48+
run: |
49+
pip install numpy cython setuptools pytest pytest-cov
50+
51+
- name: List oneAPI folder content
52+
shell: bash -l {0}
53+
run: ls /opt/intel/oneapi/compiler
54+
55+
- name: Build mkl_random
56+
shell: bash -l {0}
57+
run: |
58+
source /opt/intel/oneapi/setvars.sh
59+
echo $CMPLR_ROOT
60+
export CC=$CMPLR_ROOT/bin/compiler/clang
61+
export CXX=$CMPLR_ROOT/bin/compiler/clang++
62+
export CFLAGS="${CFLAGS} -fno-fast-math"
63+
echo "CC = ${CC} CXX=${CXX}"
64+
ls -l ${CC} ${CXX}
65+
python setup.py develop
66+
67+
- name: Run mkl_random tests
68+
shell: bash -l {0}
69+
run: |
70+
source /opt/intel/oneapi/setvars.sh
71+
pytest -s -v --pyargs mkl

.github/workflows/conda-package.yml

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
name: Conda package
2+
3+
on: push
4+
5+
env:
6+
PACKAGE_NAME: mkl-service
7+
MODULE_NAME: mkl
8+
TEST_ENV_NAME: test_mkl_service
9+
VER_SCRIPT1: "import json; f = open('ver.json', 'r'); j = json.load(f); f.close(); "
10+
VER_SCRIPT2: "d = j['mkl-service'][0]; print('='.join((d[s] for s in ('version', 'build'))))"
11+
12+
jobs:
13+
build_linux:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python: ["3.9", "3.10", "3.11", "3.12"]
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Set pkgs_dirs
24+
run: |
25+
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
26+
- name: Cache conda packages
27+
uses: actions/cache@v4
28+
env:
29+
CACHE_NUMBER: 0 # Increase to reset cache
30+
with:
31+
path: ~/.conda/pkgs
32+
key:
33+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
34+
restore-keys: |
35+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
36+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
37+
38+
- name: Add conda to system path
39+
run: echo $CONDA/bin >> $GITHUB_PATH
40+
- name: Install conda-build
41+
run: conda install conda-build
42+
- name: Build conda package
43+
run: |
44+
CHANNELS="-c conda-forge -c intel --override-channels"
45+
VERSIONS="--python ${{ matrix.python }}"
46+
TEST="--no-test"
47+
48+
conda build \
49+
$TEST \
50+
$VERSIONS \
51+
$CHANNELS \
52+
conda-recipe
53+
- name: Upload artifact
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
57+
path: /usr/share/miniconda/conda-bld/linux-64/${{ env.PACKAGE_NAME }}-*.tar.bz2
58+
59+
build_windows:
60+
runs-on: windows-latest
61+
62+
strategy:
63+
matrix:
64+
python: ['3.9', '3.10', '3.11', '3.12']
65+
env:
66+
conda-bld: C:\Miniconda\conda-bld\win-64\
67+
steps:
68+
- uses: actions/checkout@v4
69+
with:
70+
fetch-depth: 0
71+
- uses: conda-incubator/setup-miniconda@v3
72+
with:
73+
auto-activate-base: true
74+
activate-environment: ""
75+
76+
- name: Cache conda packages
77+
uses: actions/cache@v4
78+
env:
79+
CACHE_NUMBER: 3 # Increase to reset cache
80+
with:
81+
path: /home/runner/conda_pkgs_dir
82+
key:
83+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
84+
restore-keys: |
85+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
86+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
87+
- name: Install conda-build
88+
run: conda install conda-build
89+
- name: Build conda package
90+
run: conda build --no-test --python ${{ matrix.python }} -c intel -c conda-forge --override-channels conda-recipe
91+
- name: Upload artifact
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
95+
path: ${{ env.conda-bld }}${{ env.PACKAGE_NAME }}-*.tar.bz2
96+
97+
test_linux:
98+
needs: build_linux
99+
runs-on: ${{ matrix.runner }}
100+
101+
strategy:
102+
matrix:
103+
python: ['3.9', '3.10', '3.11', '3.12']
104+
experimental: [false]
105+
runner: [ubuntu-latest]
106+
continue-on-error: ${{ matrix.experimental }}
107+
env:
108+
CHANNELS: -c conda-forge -c intel --override-channels
109+
110+
steps:
111+
- name: Download artifact
112+
uses: actions/download-artifact@v4
113+
with:
114+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
115+
- name: Add conda to system path
116+
run: echo $CONDA/bin >> $GITHUB_PATH
117+
- name: Install conda-build
118+
run: conda install conda-build
119+
- name: Create conda channel
120+
run: |
121+
mkdir -p $GITHUB_WORKSPACE/channel/linux-64
122+
conda index $GITHUB_WORKSPACE/channel || exit 1
123+
mv ${PACKAGE_NAME}-*.tar.bz2 $GITHUB_WORKSPACE/channel/linux-64 || exit 1
124+
conda index $GITHUB_WORKSPACE/channel || exit 1
125+
# Test channel
126+
conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels --info --json > $GITHUB_WORKSPACE/ver.json
127+
cat ver.json
128+
- name: Collect dependencies
129+
run: |
130+
. $CONDA/etc/profile.d/conda.sh
131+
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
132+
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
133+
conda create -n ${{ env.TEST_ENV_NAME }} $PACKAGE_NAME=${PACKAGE_VERSION} python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
134+
cat lockfile
135+
- name: Set pkgs_dirs
136+
run: |
137+
echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc
138+
- name: Cache conda packages
139+
uses: actions/cache@v4
140+
env:
141+
CACHE_NUMBER: 0 # Increase to reset cache
142+
with:
143+
path: ~/.conda/pkgs
144+
key:
145+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
146+
restore-keys: |
147+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
148+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
149+
150+
- name: Install mkl-service
151+
run: |
152+
. $CONDA/etc/profile.d/conda.sh
153+
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
154+
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
155+
conda create -n ${{ env.TEST_ENV_NAME }} $PACKAGE_NAME=${PACKAGE_VERSION} pytest python=${{ matrix.python }} $CHANNELS
156+
# Test installed packages
157+
conda list
158+
- name: Run tests
159+
run: |
160+
. $CONDA/etc/profile.d/conda.sh
161+
conda activate ${{ env.TEST_ENV_NAME }}
162+
pytest -vv --pyargs ${{ env.MODULE_NAME }}
163+
164+
test_windows:
165+
needs: build_windows
166+
runs-on: ${{ matrix.runner }}
167+
168+
strategy:
169+
matrix:
170+
python: ['3.9', '3.10', '3.11', '3.12']
171+
experimental: [false]
172+
runner: [windows-latest]
173+
continue-on-error: ${{ matrix.experimental }}
174+
env:
175+
CHANNELS: -c conda-forge -c intel --override-channels
176+
177+
steps:
178+
- name: Download artifact
179+
uses: actions/download-artifact@v4
180+
with:
181+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
182+
- uses: conda-incubator/setup-miniconda@v3
183+
with:
184+
auto-activate-base: true
185+
activate-environment: ""
186+
- name: Install conda-build
187+
# Needed to be able to run conda index
188+
run: conda install conda-build
189+
- name: Create conda channel
190+
run: |
191+
mkdir ${{ env.GITHUB_WORKSPACE }}\channel\win-64
192+
move ${{ env.PACKAGE_NAME }}-*.tar.bz2 ${{ env.GITHUB_WORKSPACE }}\channel\win-64
193+
conda index ${{ env.GITHUB_WORKSPACE }}/channel
194+
# Test channel
195+
conda search ${{ env.PACKAGE_NAME }} -c ${{ env.GITHUB_WORKSPACE }}/channel --override-channels --info --json > ${{ env.GITHUB_WORKSPACE }}\ver.json
196+
more ${{ env.GITHUB_WORKSPACE }}\ver.json
197+
- name: Collect dependencies
198+
shell: cmd
199+
run: |
200+
@ECHO ON
201+
copy /Y ${{ env.GITHUB_WORKSPACE }}\ver.json .
202+
set "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%"
203+
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
204+
SET PACKAGE_VERSION=%%F
205+
)
206+
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
207+
more lockfile
208+
- name: Cache conda packages
209+
uses: actions/cache@v4
210+
env:
211+
CACHE_NUMBER: 3 # Increase to reset cache
212+
with:
213+
path: /home/runner/conda_pkgs_dir
214+
key:
215+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }}
216+
restore-keys: |
217+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
218+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
219+
- name: Install mkl-service
220+
shell: cmd
221+
run: |
222+
@ECHO ON
223+
copy /Y ${{ env.GITHUB_WORKSPACE }}\ver.json .
224+
set "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%"
225+
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
226+
SET PACKAGE_VERSION=%%F
227+
)
228+
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% pytest python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }}
229+
# Test installed packages
230+
conda list
231+
- name: Run tests
232+
run: |
233+
conda activate -n ${{ env.TEST_ENV_NAME }}
234+
pytest -v --pyargs ${{ env.MODULE_NAME }}

conda-recipe/meta.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% set version = "2.4.0" %}
2-
{% set buildnumber = 2 %}
1+
{% set version = "2.4.1" %}
2+
{% set buildnumber = 0 %}
33

44
package:
55
name: mkl-service
@@ -25,17 +25,14 @@ requirements:
2525
run:
2626
- python
2727
- mkl >=2019.3
28-
- six
2928

3029
test:
3130
requires:
3231
- pytest
3332
imports:
3433
- mkl
3534
commands:
36-
- pytest tests/test_mkl_service.py
37-
source_files:
38-
- tests
35+
- pytest -vv --pyargs mkl
3936

4037
about:
4138
home: http://github.com/IntelPython/mkl-service

mkl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ def __exit__(self, *args):
5454
from ._py_mkl_service import *
5555

5656

57-
__version__ = '2.4.0'
57+
__version__ = '2.4.1'

tests/test_mkl_service.py renamed to mkl/tests/test_mkl_service.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626

2727
import pytest
28-
import six
2928
import mkl
3029

3130

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

4039
def test_get_version_string():
4140
v = mkl.get_version_string()
42-
assert isinstance(v, six.string_types)
41+
assert isinstance(v, str)
4342
assert 'Math Kernel Library' in v
4443

4544

setup.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,10 @@
4646
License :: OSI Approved
4747
Programming Language :: C
4848
Programming Language :: Python
49-
Programming Language :: Python :: 2
50-
Programming Language :: Python :: 2.7
51-
Programming Language :: Python :: 3
52-
Programming Language :: Python :: 3.5
53-
Programming Language :: Python :: 3.6
54-
Programming Language :: Python :: 3.7
49+
Programming Language :: Python :: 3.9
50+
Programming Language :: Python :: 3.10
51+
Programming Language :: Python :: 3.11
52+
Programming Language :: Python :: 3.12
5553
Programming Language :: Python :: Implementation :: CPython
5654
Topic :: Software Development
5755
Topic :: Utilities
@@ -143,10 +141,17 @@ def setup_package():
143141
license='BSD',
144142
classifiers=[_f for _f in CLASSIFIERS.split('\n') if _f],
145143
platforms=["Windows", "Linux", "Mac OS-X"],
146-
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
144+
python_requires='>=3.9',
147145
setup_requires=['setuptools', 'cython'],
148146
install_requires=[],
149-
packages=setuptools.find_packages(),
147+
packages=[
148+
"mkl",
149+
],
150+
package_data={
151+
"mkl" : [
152+
"tests/*.*",
153+
]
154+
},
150155
ext_modules=get_extensions()
151156
)
152157
setup(**metadata)

0 commit comments

Comments
 (0)