Skip to content

Commit c77b04b

Browse files
committed
update clang workflow
add workflow using standard clang
1 parent c885ddd commit c77b04b

4 files changed

Lines changed: 77 additions & 9 deletions

File tree

.github/workflows/build-with-clang.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
permissions: read-all
99

1010
jobs:
11-
build-with-clang:
11+
build-with-intel-clang:
1212
runs-on: ubuntu-latest
1313

1414
strategy:
@@ -56,7 +56,7 @@ jobs:
5656

5757
- name: Install mkl_umath dependencies
5858
run: |
59-
pip install scikit-build cmake ninja cython setuptools">=77"
59+
pip install meson-python ninja cython mkl-service
6060
pip install ${{ matrix.numpy_version }}
6161
6262
- name: List oneAPI folder content
@@ -67,7 +67,6 @@ jobs:
6767
source ${{ env.ONEAPI_ROOT }}/setvars.sh
6868
echo $CMPLR_ROOT
6969
export CC=$CMPLR_ROOT/bin/icx
70-
export CFLAGS="${CFLAGS} -fno-fast-math -O2"
7170
pip install . --no-build-isolation --no-deps --verbose
7271
7372
- name: Run mkl_umath tests
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Build project with standard clang compiler
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
permissions: read-all
9+
10+
jobs:
11+
build-with-standard-clang:
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
17+
numpy_version: ["numpy'>=2'"]
18+
19+
env:
20+
COMPILER_ROOT: /usr/bin
21+
22+
defaults:
23+
run:
24+
shell: bash -el {0}
25+
26+
steps:
27+
- name: Cancel Previous Runs
28+
uses: styfle/cancel-workflow-action@3155a141048f8f89c06b4cdae32e7853e97536bc # 0.13.0
29+
with:
30+
access_token: ${{ github.token }}
31+
32+
- name: Install Dependencies
33+
run: |
34+
sudo apt-get update && sudo apt-get install -y clang
35+
36+
- name: Setup Python
37+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
38+
with:
39+
python-version: ${{ matrix.python }}
40+
architecture: x64
41+
42+
- name: Checkout repo
43+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
44+
with:
45+
fetch-depth: 0
46+
47+
- name: Install mkl_umath dependencies
48+
run: |
49+
pip install meson-python ninja cython mkl-service
50+
pip install mkl-devel tbb-devel
51+
pip install ${{ matrix.numpy_version }}
52+
53+
- name: Build mkl_umath
54+
run: |
55+
export CC=${{ env.COMPILER_ROOT }}/clang
56+
pip install . --no-build-isolation --no-deps --verbose
57+
58+
- name: Run mkl_umath tests
59+
run: |
60+
pip install pytest
61+
# mkl_umath cannot be installed in editable mode, we need
62+
# to change directory before importing it and running tests
63+
cd ..
64+
python -m pytest -sv --pyargs mkl_umath/mkl_umath/tests

meson.build

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
project(
22
'mkl_umath',
3-
['c', 'cython'],
3+
['c', 'cpp', 'cython'],
44
version: run_command(
55
'python', '-c',
66
'import os; exec(open("mkl_umath/_version.py").read()); print(__version__)',
@@ -42,22 +42,27 @@ endif
4242

4343
if cc.get_argument_syntax() == 'msvc'
4444
c_args += [
45-
'/Ox', '/GS', '/DynamicBase',
46-
'/fp:precise', 'Qimf-precision=high', '/Qprotect-parens'
45+
'/Ox', '/GS', '/DynamicBase', '/fp:precise'
4746
]
4847
link_args = ['/NXCompat', '/DynamicBase']
48+
49+
if cc.get_id().startswith('intel')
50+
c_args += ['Qimf-precision=high', '/Qprotect-parens']
51+
endif
4952
elif cc.get_argument_syntax() == 'gcc'
5053
c_args += [
5154
'-O3', '-Wall', '-Wextra', '-Winit-self', '-Wunused-function',
5255
'-Wuninitialized', '-Wmissing-declarations', '-Wstrict-prototypes',
5356
'-Wno-unused-parameter', '-fdiagnostics-color=auto',
5457
'-fstack-protector', '-fstack-protector-all', '-fpic', '-fPIC',
5558
'-D_FORTIFY_SOURCE=2', '-Wformat', '-Wformat-security',
56-
'-fno-delete-null-pointer-checks', '-fwrapv',
57-
'-fprotect-parens', '-fimf-precision=high', '-fno-fast-math',
59+
'-fno-delete-null-pointer-checks', '-fwrapv', '-fno-fast-math',
5860
'-Wno-incompatible-function-pointer-types'
5961
]
6062
link_args += ['-Wl,-z,noexecstack', '-Wl,-z,relro', '-Wl,-z,now']
63+
if cc.get_id().startswith('intel')
64+
c_args += ['-fimf-precision=high', '-fprotect-parens']
65+
endif
6166
else
6267
error('Unsupported system.')
6368
endif

mkl_umath/src/mkl_umath_loops.c.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static inline npy_double spacing(npy_double x) {
151151
}
152152

153153
static inline npy_float spacingf(npy_float x) {
154-
if (isinff(x))
154+
if (isinf(x))
155155
return ((npy_float) NAN);
156156

157157
return copysignf(nextafterf(fabsf(x), INFINITY), x) - x;

0 commit comments

Comments
 (0)