From 04605feb41c01e36f7547f350cebb4c91c774b9b Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Tue, 7 Apr 2026 18:51:04 -0700 Subject: [PATCH 01/40] Moves the build system from setuptools to meson * removes setup.py and generate_mklrand_c.py * updates pyproject.toml * adds meson.build --- conda-recipe-cf/meta.yaml | 4 +- conda-recipe/meta.yaml | 4 +- meson.build | 94 ++++++++++++++++++++++++ mkl_random/src/generate_mklrand_c.py | 48 ------------ pyproject.toml | 22 ++---- setup.py | 105 --------------------------- 6 files changed, 107 insertions(+), 170 deletions(-) create mode 100644 meson.build delete mode 100644 mkl_random/src/generate_mklrand_c.py delete mode 100644 setup.py diff --git a/conda-recipe-cf/meta.yaml b/conda-recipe-cf/meta.yaml index 4effa580..317805af 100644 --- a/conda-recipe-cf/meta.yaml +++ b/conda-recipe-cf/meta.yaml @@ -18,9 +18,11 @@ requirements: - {{ compiler('cxx') }} - {{ stdlib('c') }} host: + - meson-python >=0.13.0 + - meson + - pkg-config - python - python-gil # [py>=314] - - setuptools >=77 - mkl-devel - cython - numpy diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 4de995a0..eee53bf4 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -18,9 +18,11 @@ requirements: - {{ compiler('cxx') }} - {{ stdlib('c') }} host: + - meson-python >=0.13.0 + - meson + - pkg-config - python - python-gil # [py>=314] - - setuptools >=77 - mkl-devel - cython - numpy diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..727ebde4 --- /dev/null +++ b/meson.build @@ -0,0 +1,94 @@ +project( + 'mkl_random', + ['c', 'cpp', 'cython'], + version: run_command( + 'python', '-c', + 'import os; exec(open("mkl_random/_version.py").read()); print(__version__)', + check: true + ).stdout().strip(), + default_options: [ + 'cpp_std=c++11', + 'buildtype=release', + ] +) + +py = import('python').find_installation(pure: false) +py_dep = py.dependency() + +# numpy includes +np_dir = run_command(py, + ['-c', 'import numpy; print(numpy.get_include())'], + check: true +).stdout().strip() + +inc_np = include_directories(np_dir, 'mkl_random/src') + +# compiler/linker +cpp = meson.get_compiler('cpp') +cpp_args = [ + '-D_FILE_OFFSET_BITS=64', + '-D_LARGEFILE_SOURCE=1', + '-D_LARGEFILE64_SOURCE=1', + '-DPY_ARRAY_UNIQUE_SYMBOL=mkl_random_ext', + '-DNDEBUG' +] +link_args = [] + +if cpp.get_argument_syntax() == 'msvc' + link_args += ['Advapi32.lib'] +else + cpp_args += ['-Wno-unused-but-set-variable', '-Wno-unused-function'] +endif + +mkl_dep = dependency('MKL', method: 'cmake', + modules: ['MKL::MKL'], + cmake_args: [ + '-DMKL_ARCH=intel64', + '-DMKL_LINK=dynamic', + '-DMKL_THREADING=intel_thread', + '-DMKL_INTERFACE=lp64' + ], + required: true +) + +py.extension_module( + 'mklrand', + sources: [ + 'mkl_random/mklrand.pyx', + 'mkl_random/src/mkl_distributions.cpp', + 'mkl_random/src/randomkit.cpp' + ], + include_directories: inc_np, + dependencies: [mkl_dep, py_dep], + cpp_args: cpp_args, + link_args: link_args, + override_options: ['cython_language=cpp'], + install: true, + subdir: 'mkl_random' +) + +# install python sources + +py.install_sources( + [ + 'mkl_random/__init__.py', + 'mkl_random/_init_helper.py', + 'mkl_random/_patch_numpy.py', + 'mkl_random/_version.py', + ], + subdir: 'mkl_random' +) + +py.install_sources( + [ + 'mkl_random/interfaces/__init__.py', + 'mkl_random/interfaces/_numpy_random.py', + 'mkl_random/interfaces/numpy_random.py', + ], + subdir: 'mkl_random/interfaces' +) + +install_subdir( + 'mkl_random/tests', + install_dir: py.get_install_dir() / 'mkl_random' +) diff --git a/mkl_random/src/generate_mklrand_c.py b/mkl_random/src/generate_mklrand_c.py deleted file mode 100644 index 744223ed..00000000 --- a/mkl_random/src/generate_mklrand_c.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python -from __future__ import absolute_import, division, print_function - -import os -import re -import sys - -unused_internal_funcs = [ - "__Pyx_PrintItem", - "__Pyx_PrintNewline", - "__Pyx_ReRaise", - # '__Pyx_GetExcValue', - "__Pyx_ArgTypeTest", - "__Pyx_SetVtable", - "__Pyx_GetVtable", - "__Pyx_CreateClass", -] - -if __name__ == "__main__": - # Use cython here so that long docstrings are broken up. - # This is needed for some VC++ compilers. - os.system("cython mklrand.pyx") - mklrand_c = open("mklrand.c", "r") - processed = open("mklrand_pp.c", "w") - unused_funcs_str = "(" + "|".join(unused_internal_funcs) + ")" - uifpat = re.compile(r"static \w+ \*?" + unused_funcs_str + r".*/\*proto\*/") - linepat = re.compile(r'/\* ".*/mklrand.pyx":') - for linenum, line in enumerate(mklrand_c): - m = re.match( - r"^(\s+arrayObject\w*\s*=\s*[(])[(]PyObject\s*[*][)]", line - ) - if m: - line = "%s(PyArrayObject *)%s" % (m.group(1), line[m.end() :]) - m = uifpat.match(line) - if m: - line = "" - m = re.search(unused_funcs_str, line) - if m: - print( - "%s was declared unused, but is used at line %d" - % (m.group(), linenum + 1), - file=sys.stderr, - ) - line = linepat.sub(r'/* "mklrand.pyx":', line) - processed.write(line) - mklrand_c.close() - processed.close() - os.rename("mklrand_pp.c", "mklrand.c") diff --git a/pyproject.toml b/pyproject.toml index 0476dba7..3e26ce2b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,13 +24,15 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [build-system] -build-backend = "setuptools.build_meta" -requires = ["setuptools>=77", "Cython", "numpy"] +build-backend = "mesonpy" +requires = [ + "meson-python>=0.13.0", + "Cython", + "numpy" +] [project] -authors = [ - {name = "Intel Corporation", email = "scripting@intel.com"} -] +authors = [{name = "Intel Corporation"}] classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Science/Research", @@ -98,13 +100,3 @@ extension-pkg-allow-list = ["numpy", "mkl_random.mklrand"] [tool.pylint.typecheck] generated-members = ["RandomState", "min", "max"] - -[tool.setuptools] -include-package-data = true -packages = ["mkl_random", "mkl_random.interfaces"] - -[tool.setuptools.dynamic] -version = {attr = "mkl_random._version.__version__"} - -[tool.setuptools.package-data] -"mkl_random" = ["tests/**/*.py"] diff --git a/setup.py b/setup.py deleted file mode 100644 index 0b90bf9d..00000000 --- a/setup.py +++ /dev/null @@ -1,105 +0,0 @@ -# Copyright (c) 2017, Intel Corporation -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import os -import sys -from os.path import join - -import Cython.Build -import numpy as np -from setuptools import Extension, setup - - -def extensions(): - mkl_root = os.environ.get("MKLROOT", None) - if mkl_root: - mkl_info = { - "include_dirs": [join(mkl_root, "include")], - "library_dirs": [ - join(mkl_root, "lib"), - join(mkl_root, "lib", "intel64"), - ], - "libraries": ["mkl_rt"], - } - else: - raise ValueError("MKLROOT environment variable not set.") - - mkl_include_dirs = mkl_info.get("include_dirs", []) - mkl_library_dirs = mkl_info.get("library_dirs", []) - mkl_libraries = mkl_info.get("libraries", ["mkl_rt"]) - - libs = mkl_libraries - lib_dirs = mkl_library_dirs - - if sys.platform == "win32": - libs.append("Advapi32") - - Q = ( - "/Q" - if sys.platform.startswith("win") or sys.platform == "cygwin" - else "-" - ) - eca = [Q + "std=c++11"] - if sys.platform == "linux": - eca.extend(["-Wno-unused-but-set-variable", "-Wno-unused-function"]) - - defs = [ - ("_FILE_OFFSET_BITS", "64"), - ("_LARGEFILE_SOURCE", "1"), - ("_LARGEFILE64_SOURCE", "1"), - ("PY_ARRAY_UNIQUE_SYMBOL", "mkl_random_ext"), - ] - - exts = [ - Extension( - "mkl_random.mklrand", - sources=[ - join("mkl_random", "mklrand.pyx"), - join("mkl_random", "src", "mkl_distributions.cpp"), - join("mkl_random", "src", "randomkit.cpp"), - ], - depends=[ - join("mkl_random", "src", "mkl_distributions.hpp"), - join("mkl_random", "src", "randomkit.h"), - join("mkl_random", "src", "numpy_multiiter_workaround.h"), - ], - include_dirs=[join("mkl_random", "src"), np.get_include()] - + mkl_include_dirs, - libraries=libs, - library_dirs=lib_dirs, - extra_compile_args=eca, - define_macros=defs + [("NDEBUG", None)], - language="c++", - ), - ] - - return exts - - -setup( - cmdclass={"build_ext": Cython.Build.build_ext}, - ext_modules=extensions(), - zip_safe=False, -) From a8429b324c2ad9b34a5f72d90edde1eaecf3fbf2 Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Tue, 7 Apr 2026 19:12:17 -0700 Subject: [PATCH 02/40] add cmake to build system dependencies we search for MKL with cmake. Also drop pkg-config from meta.yamls and use cmake --- conda-recipe-cf/meta.yaml | 2 +- conda-recipe/meta.yaml | 2 +- pyproject.toml | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/conda-recipe-cf/meta.yaml b/conda-recipe-cf/meta.yaml index 317805af..012645a5 100644 --- a/conda-recipe-cf/meta.yaml +++ b/conda-recipe-cf/meta.yaml @@ -20,7 +20,7 @@ requirements: host: - meson-python >=0.13.0 - meson - - pkg-config + - cmake - python - python-gil # [py>=314] - mkl-devel diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index eee53bf4..ff55e54d 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -20,7 +20,7 @@ requirements: host: - meson-python >=0.13.0 - meson - - pkg-config + - cmake - python - python-gil # [py>=314] - mkl-devel diff --git a/pyproject.toml b/pyproject.toml index 3e26ce2b..6dddf739 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,8 @@ build-backend = "mesonpy" requires = [ "meson-python>=0.13.0", "Cython", - "numpy" + "numpy", + "cmake" ] [project] From dd8fb6cb18626d4ec9797d3821f7b4d739742246 Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Tue, 7 Apr 2026 20:40:28 -0700 Subject: [PATCH 03/40] use meson-python in builds --- .github/workflows/build-docs.yml | 2 +- .github/workflows/build-with-clang.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 13d07a56..144d11be 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -41,7 +41,7 @@ jobs: if: ${{ !github.event.pull_request || github.event.action != 'closed' }} shell: bash -l {0} run: | - pip install numpy cython setuptools">=77" scikit-build cmake sphinx sphinx_rtd_theme furo pydot graphviz sphinxcontrib-programoutput sphinxcontrib-googleanalytics sphinx_design + pip install meson-python ninja cython cmake numpy cmake sphinx sphinx_rtd_theme furo pydot graphviz sphinxcontrib-programoutput sphinxcontrib-googleanalytics sphinx_design - name: Checkout repo uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: diff --git a/.github/workflows/build-with-clang.yml b/.github/workflows/build-with-clang.yml index 37eeec2a..7cb8d3ad 100644 --- a/.github/workflows/build-with-clang.yml +++ b/.github/workflows/build-with-clang.yml @@ -54,7 +54,7 @@ jobs: - name: Install mkl_random dependencies run: | - pip install cython setuptools">=77" + pip install meson-python ninja cython cmake pip install "${{ matrix.numpy_version }}" - name: List oneAPI folder content From e7b7b563922b0eff02dd307029c40b02548dca34 Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Tue, 7 Apr 2026 20:40:54 -0700 Subject: [PATCH 04/40] add pip build --- .github/workflows/build_pip.yml | 58 +++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/build_pip.yml diff --git a/.github/workflows/build_pip.yml b/.github/workflows/build_pip.yml new file mode 100644 index 00000000..ee02be68 --- /dev/null +++ b/.github/workflows/build_pip.yml @@ -0,0 +1,58 @@ +name: Editable build using pip and pre-release NumPy + +on: + push: + branches: + - master + pull_request: + +permissions: read-all + +env: + PACKAGE_NAME: mkl_random + MODULE_NAME: mkl_random + TEST_ENV_NAME: test_mkl_random + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + shell: bash -el {0} + + strategy: + matrix: + python: ["3.10", "3.11", "3.12", "3.13", "3.14"] + use_pre: ["", "--pre"] + + steps: + - name: Install jq + shell: bash -l {0} + run: | + sudo apt-get install jq + + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + + - uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0 + with: + miniforge-version: latest + channels: conda-forge + activate-environment: test + python-version: ${{ matrix.python }} + + - name: Install MKL + run: | + conda install mkl-devel mkl-service + python -c "import sys; print(sys.executable)" + which python + python -c "import mkl; print(mkl.__file__)" + + - name: Build conda package + run: | + pip install --no-cache-dir meson-python ninja cmake cython + pip install --no-cache-dir numpy ${{ matrix.use_pre }} + pip install -e ".[test]" --no-build-isolation --verbose + pip list + python -m pytest -v mkl_random/tests From 2d1f4a4cee0d70dbb0d48d651a19747d8451e18c Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Tue, 7 Apr 2026 20:56:21 -0700 Subject: [PATCH 05/40] add standard clang workflow remove tbb from build-with-clang workflow --- .github/workflows/build-with-clang.yml | 1 - .../workflows/build-with-standard-clang.yml | 66 +++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-with-standard-clang.yml diff --git a/.github/workflows/build-with-clang.yml b/.github/workflows/build-with-clang.yml index 7cb8d3ad..2594eeae 100644 --- a/.github/workflows/build-with-clang.yml +++ b/.github/workflows/build-with-clang.yml @@ -38,7 +38,6 @@ jobs: - 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 diff --git a/.github/workflows/build-with-standard-clang.yml b/.github/workflows/build-with-standard-clang.yml new file mode 100644 index 00000000..ca6a6a61 --- /dev/null +++ b/.github/workflows/build-with-standard-clang.yml @@ -0,0 +1,66 @@ +name: Build project with standard clang compiler + +on: + pull_request: + push: + branches: [master] + +permissions: read-all + +jobs: + build-with-standard-clang: + runs-on: ubuntu-latest + + strategy: + matrix: + python: ["3.10", "3.11", "3.12", "3.13", "3.14"] + numpy_version: ["numpy'>=2'"] + + env: + COMPILER_ROOT: /usr/bin + + defaults: + run: + shell: bash -el {0} + + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@3155a141048f8f89c06b4cdae32e7853e97536bc # 0.13.0 + with: + access_token: ${{ github.token }} + + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang + + - name: Setup Python + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: ${{ matrix.python }} + architecture: x64 + + - name: Checkout repo + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + + - name: Install mkl_random dependencies + run: | + pip install meson-python ninja cmake cython mkl-service + pip install mkl-devel + pip install ${{ matrix.numpy_version }} + + - name: Build mkl_random + run: | + export CC=${{ env.COMPILER_ROOT }}/clang + export CXX=${{ env.COMPILER_ROOT }}/clang++ + pip install . --no-build-isolation --no-deps --verbose + + - name: Run mkl_random tests + run: | + pip install pytest + # mkl_random cannot be installed in editable mode, we need + # to change directory before importing it and running tests + cd .. + python -m pytest -sv --pyargs mkl_random From 6b6bc71689b4df05493ec9d37db3d0f7dde5ee9e Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Tue, 7 Apr 2026 22:08:25 -0700 Subject: [PATCH 06/40] add ninja to build system and meta.yamls --- conda-recipe-cf/meta.yaml | 1 + conda-recipe/meta.yaml | 1 + pyproject.toml | 1 + 3 files changed, 3 insertions(+) diff --git a/conda-recipe-cf/meta.yaml b/conda-recipe-cf/meta.yaml index 012645a5..3b94d47c 100644 --- a/conda-recipe-cf/meta.yaml +++ b/conda-recipe-cf/meta.yaml @@ -21,6 +21,7 @@ requirements: - meson-python >=0.13.0 - meson - cmake + - ninja - python - python-gil # [py>=314] - mkl-devel diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index ff55e54d..c309a44e 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -21,6 +21,7 @@ requirements: - meson-python >=0.13.0 - meson - cmake + - ninja - python - python-gil # [py>=314] - mkl-devel diff --git a/pyproject.toml b/pyproject.toml index 6dddf739..d17e3204 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,7 @@ build-backend = "mesonpy" requires = [ "meson-python>=0.13.0", + "ninja", "Cython", "numpy", "cmake" From 668fbb5afe248a1a7e5464b41ad3000e3e460d2e Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Tue, 7 Apr 2026 22:08:46 -0700 Subject: [PATCH 07/40] use pip install in build scripts aligns more closely with conda-forge feedstock --- conda-recipe-cf/bld.bat | 17 ++--------------- conda-recipe-cf/build.sh | 17 +---------------- 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/conda-recipe-cf/bld.bat b/conda-recipe-cf/bld.bat index 29a732bd..a08c27bb 100644 --- a/conda-recipe-cf/bld.bat +++ b/conda-recipe-cf/bld.bat @@ -1,15 +1,2 @@ -@rem Remember to source the compiler - -set MKLROOT=%CONDA_PREFIX% - -rem Build wheel package -if NOT "%WHEELS_OUTPUT_FOLDER%"=="" ( - %PYTHON% -m pip wheel --no-build-isolation --no-deps . - if errorlevel 1 exit 1 - copy mkl_random*.whl %WHEELS_OUTPUT_FOLDER% - if errorlevel 1 exit 1 -) ELSE ( - rem Build conda package - %PYTHON% -m pip install --no-build-isolation --no-deps . - if errorlevel 1 exit 1 -) +%PYTHON% -m pip install --no-build-isolation --no-deps . +if errorlevel 1 exit 1 diff --git a/conda-recipe-cf/build.sh b/conda-recipe-cf/build.sh index f513746f..562c55f3 100644 --- a/conda-recipe-cf/build.sh +++ b/conda-recipe-cf/build.sh @@ -1,18 +1,3 @@ #!/bin/bash -x -export CFLAGS="-I$PREFIX/include $CFLAGS" -export LDFLAGS="-Wl,-rpath,\$ORIGIN/../.. -Wl,-rpath,\$ORIGIN/../../.. -L${PREFIX}/lib ${LDFLAGS}" -export MKLROOT=$CONDA_PREFIX - -read -r GLIBC_MAJOR GLIBC_MINOR <<<"$(conda list '^sysroot_linux-64$' \ - | tail -n 1 | awk '{print $2}' | grep -oP '\d+' | head -n 2 | tr '\n' ' ')" - -# Build wheel package -if [ -n "${WHEELS_OUTPUT_FOLDER}" ]; then - $PYTHON -m pip wheel --no-build-isolation --no-deps . - ${PYTHON} -m wheel tags --remove --platform-tag "manylinux_${GLIBC_MAJOR}_${GLIBC_MINOR}_x86_64" mkl_random*.whl - cp mkl_random*.whl "${WHEELS_OUTPUT_FOLDER}" -else - # Build conda package - $PYTHON -m pip install --no-build-isolation --no-deps . -fi +$PYTHON -m pip install --no-build-isolation --no-deps . From 6f8d749a1c8f0a4caec4db7b57342758a347750b Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Tue, 7 Apr 2026 22:12:05 -0700 Subject: [PATCH 08/40] remove MKLROOT --- conda-recipe/bld.bat | 2 -- conda-recipe/build.sh | 1 - 2 files changed, 3 deletions(-) diff --git a/conda-recipe/bld.bat b/conda-recipe/bld.bat index 29a732bd..fed6ce06 100644 --- a/conda-recipe/bld.bat +++ b/conda-recipe/bld.bat @@ -1,7 +1,5 @@ @rem Remember to source the compiler -set MKLROOT=%CONDA_PREFIX% - rem Build wheel package if NOT "%WHEELS_OUTPUT_FOLDER%"=="" ( %PYTHON% -m pip wheel --no-build-isolation --no-deps . diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index f513746f..527f695c 100644 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -2,7 +2,6 @@ export CFLAGS="-I$PREFIX/include $CFLAGS" export LDFLAGS="-Wl,-rpath,\$ORIGIN/../.. -Wl,-rpath,\$ORIGIN/../../.. -L${PREFIX}/lib ${LDFLAGS}" -export MKLROOT=$CONDA_PREFIX read -r GLIBC_MAJOR GLIBC_MINOR <<<"$(conda list '^sysroot_linux-64$' \ | tail -n 1 | awk '{print $2}' | grep -oP '\d+' | head -n 2 | tr '\n' ' ')" From 02efc616962d664874f041b1a13387b4c860d4be Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Tue, 7 Apr 2026 23:16:51 -0700 Subject: [PATCH 09/40] don't install mkl-service in pip and standard clang builds --- .github/workflows/build-with-standard-clang.yml | 3 +-- .github/workflows/build_pip.yml | 10 +--------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-with-standard-clang.yml b/.github/workflows/build-with-standard-clang.yml index ca6a6a61..94e916df 100644 --- a/.github/workflows/build-with-standard-clang.yml +++ b/.github/workflows/build-with-standard-clang.yml @@ -47,8 +47,7 @@ jobs: - name: Install mkl_random dependencies run: | - pip install meson-python ninja cmake cython mkl-service - pip install mkl-devel + pip install meson-python ninja cmake cython mkl-devel mkl pip install ${{ matrix.numpy_version }} - name: Build mkl_random diff --git a/.github/workflows/build_pip.yml b/.github/workflows/build_pip.yml index ee02be68..93740aa8 100644 --- a/.github/workflows/build_pip.yml +++ b/.github/workflows/build_pip.yml @@ -26,11 +26,6 @@ jobs: use_pre: ["", "--pre"] steps: - - name: Install jq - shell: bash -l {0} - run: | - sudo apt-get install jq - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 @@ -44,10 +39,7 @@ jobs: - name: Install MKL run: | - conda install mkl-devel mkl-service - python -c "import sys; print(sys.executable)" - which python - python -c "import mkl; print(mkl.__file__)" + conda install mkl-devel mkl - name: Build conda package run: | From e2c6db2ecc4b14c70b9fffe8caaffbb656b27ecd Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Fri, 15 May 2026 18:25:48 -0700 Subject: [PATCH 10/40] add mkl_threading option --- meson.build | 2 +- meson.options | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 meson.options diff --git a/meson.build b/meson.build index 727ebde4..5da12705 100644 --- a/meson.build +++ b/meson.build @@ -45,7 +45,7 @@ mkl_dep = dependency('MKL', method: 'cmake', cmake_args: [ '-DMKL_ARCH=intel64', '-DMKL_LINK=dynamic', - '-DMKL_THREADING=intel_thread', + '-DMKL_THREADING=' + get_option('mkl_threading'), '-DMKL_INTERFACE=lp64' ], required: true diff --git a/meson.options b/meson.options new file mode 100644 index 00000000..7bd9b387 --- /dev/null +++ b/meson.options @@ -0,0 +1,7 @@ +option( + 'mkl_threading', + type: 'combo', + choices: ['intel_thread', 'tbb_thread', 'sequential', 'gnu_thread'], + value: 'intel_thread', + description: 'MKL threading layer to link to (default: intel_thread)' +) From d6652645bd3d0c7fcf9d9995ca620ae2c8286b49 Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Fri, 15 May 2026 18:26:03 -0700 Subject: [PATCH 11/40] use gnu_thread in Linux conda-forge builds --- conda-recipe-cf/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda-recipe-cf/build.sh b/conda-recipe-cf/build.sh index 562c55f3..2c308764 100644 --- a/conda-recipe-cf/build.sh +++ b/conda-recipe-cf/build.sh @@ -1,3 +1,3 @@ #!/bin/bash -x -$PYTHON -m pip install --no-build-isolation --no-deps . +$PYTHON -m pip install --no-build-isolation --no-deps -Csetup-args="-Dmkl_threading=gnu_thread" . From 03930e6010293b3a424aab1f746493e61f64c28c Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Fri, 15 May 2026 18:27:26 -0700 Subject: [PATCH 12/40] add fix to pip builds --- .github/workflows/build_pip.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_pip.yml b/.github/workflows/build_pip.yml index 93740aa8..0cc4b477 100644 --- a/.github/workflows/build_pip.yml +++ b/.github/workflows/build_pip.yml @@ -45,6 +45,6 @@ jobs: run: | pip install --no-cache-dir meson-python ninja cmake cython pip install --no-cache-dir numpy ${{ matrix.use_pre }} - pip install -e ".[test]" --no-build-isolation --verbose + pip install -e ".[test]" --no-build-isolation --verbose -Csetup-args="-Dmkl_threading=gnu_thread" pip list python -m pytest -v mkl_random/tests From 9bf7d7ee5cbf859d16b7b40a58f41835101030bc Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 23 Jul 2026 04:03:01 -0700 Subject: [PATCH 13/40] Apply remarks from mkl-service PR for meson.build --- meson.build | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 5da12705..724aa163 100644 --- a/meson.build +++ b/meson.build @@ -2,10 +2,11 @@ project( 'mkl_random', ['c', 'cpp', 'cython'], version: run_command( - 'python', '-c', - 'import os; exec(open("mkl_random/_version.py").read()); print(__version__)', + find_program('python3', 'python'), + ['-c', 'exec(open("mkl_random/_version.py").read()); print(__version__)'], check: true ).stdout().strip(), + meson_version: '>=1.8.3', default_options: [ 'cpp_std=c++11', 'buildtype=release', @@ -40,6 +41,17 @@ else cpp_args += ['-Wno-unused-but-set-variable', '-Wno-unused-function'] endif +rpath_link_args = [] +if host_machine.system() != 'windows' + if host_machine.system() == 'darwin' + origin = '@loader_path' + else + origin = '$ORIGIN' + endif + rpath = origin / '../..' + ':' + origin / '../../..' + rpath_link_args = ['-Wl,-rpath,' + rpath] +endif + mkl_dep = dependency('MKL', method: 'cmake', modules: ['MKL::MKL'], cmake_args: [ @@ -61,7 +73,7 @@ py.extension_module( include_directories: inc_np, dependencies: [mkl_dep, py_dep], cpp_args: cpp_args, - link_args: link_args, + link_args: link_args + rpath_link_args, override_options: ['cython_language=cpp'], install: true, subdir: 'mkl_random' @@ -90,5 +102,6 @@ py.install_sources( install_subdir( 'mkl_random/tests', - install_dir: py.get_install_dir() / 'mkl_random' + install_dir: py.get_install_dir() / 'mkl_random', + exclude_files: ['AGENTS.md'] ) From 60adc5f8ccdbfb29171096e11220d90ca2b4d716 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 23 Jul 2026 04:06:05 -0700 Subject: [PATCH 14/40] Apply remarks from mkl-service PR for conda-recipe --- conda-recipe/bld.bat | 27 +++++++++++++++++---------- conda-recipe/build.sh | 35 +++++++++++++++++++++++++---------- conda-recipe/meta.yaml | 2 +- 3 files changed, 43 insertions(+), 21 deletions(-) diff --git a/conda-recipe/bld.bat b/conda-recipe/bld.bat index fed6ce06..38d7c254 100644 --- a/conda-recipe/bld.bat +++ b/conda-recipe/bld.bat @@ -1,13 +1,20 @@ -@rem Remember to source the compiler +:: -wnx flags mean: --wheel --no-isolation --skip-dependency-check +:: -Ccompile-args=-v makes ninja print full compiler commands (verbose build) +%PYTHON% -m build -w -n -x -Ccompile-args=-v +if %ERRORLEVEL% neq 0 exit 1 + +for /f %%f in ('dir /b /S .\dist') do ( + %PYTHON% -m pip install %%f ^ + --no-build-isolation ^ + --no-deps ^ + --only-binary :all: ^ + --no-index ^ + --prefix %PREFIX% ^ + -vv + if %ERRORLEVEL% neq 0 exit 1 +) -rem Build wheel package if NOT "%WHEELS_OUTPUT_FOLDER%"=="" ( - %PYTHON% -m pip wheel --no-build-isolation --no-deps . - if errorlevel 1 exit 1 - copy mkl_random*.whl %WHEELS_OUTPUT_FOLDER% - if errorlevel 1 exit 1 -) ELSE ( - rem Build conda package - %PYTHON% -m pip install --no-build-isolation --no-deps . - if errorlevel 1 exit 1 + copy dist\mkl_random*.whl %WHEELS_OUTPUT_FOLDER% + if %ERRORLEVEL% neq 0 exit 1 ) diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index 527f695c..3dab4732 100644 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -1,17 +1,32 @@ -#!/bin/bash -x +#!/bin/bash -ex + +if [ -d "build" ]; then + rm -rf build +fi export CFLAGS="-I$PREFIX/include $CFLAGS" -export LDFLAGS="-Wl,-rpath,\$ORIGIN/../.. -Wl,-rpath,\$ORIGIN/../../.. -L${PREFIX}/lib ${LDFLAGS}" +export LDFLAGS="-L${PREFIX}/lib ${LDFLAGS}" read -r GLIBC_MAJOR GLIBC_MINOR <<<"$(conda list '^sysroot_linux-64$' \ | tail -n 1 | awk '{print $2}' | grep -oP '\d+' | head -n 2 | tr '\n' ' ')" -# Build wheel package -if [ -n "${WHEELS_OUTPUT_FOLDER}" ]; then - $PYTHON -m pip wheel --no-build-isolation --no-deps . - ${PYTHON} -m wheel tags --remove --platform-tag "manylinux_${GLIBC_MAJOR}_${GLIBC_MINOR}_x86_64" mkl_random*.whl - cp mkl_random*.whl "${WHEELS_OUTPUT_FOLDER}" -else - # Build conda package - $PYTHON -m pip install --no-build-isolation --no-deps . +# -wnx flags mean: --wheel --no-isolation --skip-dependency-check +# -Ccompile-args=-v makes ninja print full compiler commands (verbose build) +${PYTHON} -m build -w -n -x -Ccompile-args=-v + +${PYTHON} -m wheel tags --remove \ + --platform-tag "manylinux_${GLIBC_MAJOR}_${GLIBC_MINOR}_x86_64" \ + dist/mkl_random*.whl + +${PYTHON} -m pip install dist/mkl_random*.whl \ + --no-build-isolation \ + --no-deps \ + --only-binary :all: \ + --no-index \ + --prefix "${PREFIX}" \ + -vv + +# Copy wheel package +if [[ -d "${WHEELS_OUTPUT_FOLDER}" ]]; then + cp dist/mkl_random*.whl "${WHEELS_OUTPUT_FOLDER[@]}" fi diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index c309a44e..1b40a08b 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -19,7 +19,7 @@ requirements: - {{ stdlib('c') }} host: - meson-python >=0.13.0 - - meson + - python-build >=1.2.2 - cmake - ninja - python From 72f9a2d8ba3f3a6049195c23e3dea8212e9f8418 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 23 Jul 2026 04:08:49 -0700 Subject: [PATCH 15/40] Update conda-recipe-cf --- conda-recipe-cf/build.sh | 2 +- conda-recipe-cf/meta.yaml | 2 +- meson.build | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/conda-recipe-cf/build.sh b/conda-recipe-cf/build.sh index 2c308764..d52c78b4 100644 --- a/conda-recipe-cf/build.sh +++ b/conda-recipe-cf/build.sh @@ -1,3 +1,3 @@ -#!/bin/bash -x +#!/bin/bash -ex $PYTHON -m pip install --no-build-isolation --no-deps -Csetup-args="-Dmkl_threading=gnu_thread" . diff --git a/conda-recipe-cf/meta.yaml b/conda-recipe-cf/meta.yaml index 3b94d47c..f8ad89af 100644 --- a/conda-recipe-cf/meta.yaml +++ b/conda-recipe-cf/meta.yaml @@ -31,7 +31,7 @@ requirements: - wheel >=0.41.3 run: - python - - python-gil [py>=314] + - python-gil # [py>=314] - {{ pin_compatible('numpy', min_pin="x.x", max_pin="x") }} - {{ pin_compatible('mkl', min_pin="x.x", max_pin="x") }} diff --git a/meson.build b/meson.build index 724aa163..17a2f69f 100644 --- a/meson.build +++ b/meson.build @@ -102,6 +102,5 @@ py.install_sources( install_subdir( 'mkl_random/tests', - install_dir: py.get_install_dir() / 'mkl_random', - exclude_files: ['AGENTS.md'] + install_dir: py.get_install_dir() / 'mkl_random' ) From 7483cfb9c60f31c53f408ea2b2005c760d95a996 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 23 Jul 2026 04:12:46 -0700 Subject: [PATCH 16/40] Add missing python source file to meson.build --- meson.build | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meson.build b/meson.build index 17a2f69f..8247ffaa 100644 --- a/meson.build +++ b/meson.build @@ -84,9 +84,13 @@ py.extension_module( py.install_sources( [ 'mkl_random/__init__.py', + 'mkl_random/__main__.py', 'mkl_random/_init_helper.py', 'mkl_random/_patch_numpy.py', + 'mkl_random/_patch_startup.py', 'mkl_random/_version.py', + 'mkl_random/patch.py', + 'mkl_random/with_patch.py', ], subdir: 'mkl_random' ) From 74a8ae0ab291bbb61e8d8bef350731f484dd991c Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 23 Jul 2026 04:25:59 -0700 Subject: [PATCH 17/40] Clean up github workflows --- .github/workflows/build-docs.yml | 2 +- .github/workflows/build-with-clang.yml | 2 +- .github/workflows/build-with-standard-clang.yml | 2 +- .github/workflows/build_pip.yml | 2 +- conda-recipe-cf/meta.yaml | 1 - 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 4c1cbde9..474f059b 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -41,7 +41,7 @@ jobs: if: ${{ !github.event.pull_request || github.event.action != 'closed' }} shell: bash -l {0} run: | - pip install meson-python ninja cython cmake numpy cmake sphinx sphinx_rtd_theme furo pydot graphviz sphinxcontrib-programoutput sphinxcontrib-googleanalytics sphinx_design + pip install meson-python ninja cython cmake numpy sphinx sphinx_rtd_theme furo pydot graphviz sphinxcontrib-programoutput sphinxcontrib-googleanalytics sphinx_design - name: Checkout repo uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: diff --git a/.github/workflows/build-with-clang.yml b/.github/workflows/build-with-clang.yml index 61459d8a..2c5ba096 100644 --- a/.github/workflows/build-with-clang.yml +++ b/.github/workflows/build-with-clang.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: python: ["3.10", "3.11", "3.12", "3.13", "3.14"] - numpy_version: ["numpy>=2"] + numpy_version: ["'numpy>=2'"] env: ONEAPI_ROOT: /opt/intel/oneapi diff --git a/.github/workflows/build-with-standard-clang.yml b/.github/workflows/build-with-standard-clang.yml index 94e916df..927e2781 100644 --- a/.github/workflows/build-with-standard-clang.yml +++ b/.github/workflows/build-with-standard-clang.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: python: ["3.10", "3.11", "3.12", "3.13", "3.14"] - numpy_version: ["numpy'>=2'"] + numpy_version: ["'numpy>=2'"] env: COMPILER_ROOT: /usr/bin diff --git a/.github/workflows/build_pip.yml b/.github/workflows/build_pip.yml index 0cc4b477..a5573251 100644 --- a/.github/workflows/build_pip.yml +++ b/.github/workflows/build_pip.yml @@ -41,7 +41,7 @@ jobs: run: | conda install mkl-devel mkl - - name: Build conda package + - name: Build with pip run: | pip install --no-cache-dir meson-python ninja cmake cython pip install --no-cache-dir numpy ${{ matrix.use_pre }} diff --git a/conda-recipe-cf/meta.yaml b/conda-recipe-cf/meta.yaml index f8ad89af..44b75c22 100644 --- a/conda-recipe-cf/meta.yaml +++ b/conda-recipe-cf/meta.yaml @@ -19,7 +19,6 @@ requirements: - {{ stdlib('c') }} host: - meson-python >=0.13.0 - - meson - cmake - ninja - python From 6819973e80818950e31ecb1a0352862a1ae48e41 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 23 Jul 2026 04:34:28 -0700 Subject: [PATCH 18/40] Remove unused env variables from build_pip.yml --- .github/workflows/build_pip.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/build_pip.yml b/.github/workflows/build_pip.yml index a5573251..c7ec10ba 100644 --- a/.github/workflows/build_pip.yml +++ b/.github/workflows/build_pip.yml @@ -8,11 +8,6 @@ on: permissions: read-all -env: - PACKAGE_NAME: mkl_random - MODULE_NAME: mkl_random - TEST_ENV_NAME: test_mkl_random - jobs: build: runs-on: ubuntu-latest From 59da27693013a4cc69a32b98bc03282cc126be05 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 23 Jul 2026 04:38:37 -0700 Subject: [PATCH 19/40] Add Building from source block to README.md --- README.md | 26 ++++++++++++++++++++++---- meson.build | 3 ++- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b58ae37f..cd5e40c8 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,25 @@ with mkl_random.mkl_random(): --- -To build `mkl_random` from sources on Linux: - - install a recent version of MKL, if necessary; - - execute `source /path_to_oneapi/mkl/latest/env/vars.sh`; - - execute `python -m pip install .` +# Building from source + +A C++ compiler, Intel® oneAPI Math Kernel Library (oneMKL), and NumPy are required +to build `mkl_random` from source. + +Executing +```sh +python -m pip install . +``` +will pull in the required build dependencies, including `mkl` and `numpy`, and build `mkl_random`. + +If you already have `mkl` and `numpy` installed (from your system or a conda environment) +and want to reuse them instead of pulling fresh copies into an isolated build, first +install the build dependencies: +```sh +pip install meson-python cmake ninja cython numpy mkl-devel +``` + +then build against the existing installation with: +```sh +python -m pip install --no-build-isolation --no-deps . +``` diff --git a/meson.build b/meson.build index 8247ffaa..4a3737c9 100644 --- a/meson.build +++ b/meson.build @@ -63,6 +63,7 @@ mkl_dep = dependency('MKL', method: 'cmake', required: true ) +# Cython extension py.extension_module( 'mklrand', sources: [ @@ -79,8 +80,8 @@ py.extension_module( subdir: 'mkl_random' ) -# install python sources +# Python sources py.install_sources( [ 'mkl_random/__init__.py', From b98b4db407b3351934998c9ed22b55ac8edb9b58 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 23 Jul 2026 04:41:55 -0700 Subject: [PATCH 20/40] A small clean up --- .github/workflows/build_pip.yml | 2 +- meson.build | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build_pip.yml b/.github/workflows/build_pip.yml index c7ec10ba..2903a39a 100644 --- a/.github/workflows/build_pip.yml +++ b/.github/workflows/build_pip.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest defaults: run: - shell: bash -el {0} + shell: bash -el {0} strategy: matrix: diff --git a/meson.build b/meson.build index 4a3737c9..1141fbaa 100644 --- a/meson.build +++ b/meson.build @@ -80,7 +80,6 @@ py.extension_module( subdir: 'mkl_random' ) - # Python sources py.install_sources( [ From c925f2b85e9ccdcc3a7d2c3b99b91b0a92232b15 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 23 Jul 2026 04:59:51 -0700 Subject: [PATCH 21/40] Remove redundant mkl from build-with-standard-clang dependencies --- .github/workflows/build-with-standard-clang.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-with-standard-clang.yml b/.github/workflows/build-with-standard-clang.yml index 927e2781..e8176e47 100644 --- a/.github/workflows/build-with-standard-clang.yml +++ b/.github/workflows/build-with-standard-clang.yml @@ -47,7 +47,7 @@ jobs: - name: Install mkl_random dependencies run: | - pip install meson-python ninja cmake cython mkl-devel mkl + pip install meson-python ninja cmake cython mkl-devel pip install ${{ matrix.numpy_version }} - name: Build mkl_random From b60d962dfeb438b19a4c643835470245c531dcfc Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 23 Jul 2026 05:09:19 -0700 Subject: [PATCH 22/40] Fix numpy install in GH CI workflows --- .github/workflows/build-with-clang.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-with-clang.yml b/.github/workflows/build-with-clang.yml index 2c5ba096..5e16c4d6 100644 --- a/.github/workflows/build-with-clang.yml +++ b/.github/workflows/build-with-clang.yml @@ -54,7 +54,7 @@ jobs: - name: Install mkl_random dependencies run: | pip install meson-python ninja cython cmake - pip install "${{ matrix.numpy_version }}" + pip install ${{ matrix.numpy_version }} - name: List oneAPI folder content run: ls "${{ env.ONEAPI_ROOT }}/compiler" From a80ff598a24a7c0f2320fc9df9e33c9a02084566 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 23 Jul 2026 05:10:55 -0700 Subject: [PATCH 23/40] add CI badges to README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index cd5e40c8..1e58e898 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ ## `mkl_random` -- a NumPy-based Python interface to Intel® oneAPI Math Kernel Library (OneMKL) Random Number Generation functionality +[![Conda package](https://github.com/IntelPython/mkl_random/actions/workflows/conda-package.yml/badge.svg)](https://github.com/IntelPython/mkl_random/actions/workflows/conda-package.yml) +[![Editable build using pip and pre-release NumPy](https://github.com/IntelPython/mkl_random/actions/workflows/build_pip.yml/badge.svg)](https://github.com/IntelPython/mkl_random/actions/workflows/build_pip.yml) [![Conda package using conda-forge](https://github.com/IntelPython/mkl_random/actions/workflows/conda-package-cf.yml/badge.svg)](https://github.com/IntelPython/mkl_random/actions/workflows/conda-package-cf.yml) `mkl_random` started as a part of Intel® Distribution for Python optimizations to NumPy. From 01d2179f0017591c58c51465b520aca48ab2ef34 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 23 Jul 2026 06:22:53 -0700 Subject: [PATCH 24/40] Fix MKL detection with non-Intel clang++ --- meson.build | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/meson.build b/meson.build index 1141fbaa..61c3430d 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project( 'mkl_random', - ['c', 'cpp', 'cython'], + ['c', 'cython'], version: run_command( find_program('python3', 'python'), ['-c', 'exec(open("mkl_random/_version.py").read()); print(__version__)'], @@ -25,7 +25,6 @@ np_dir = run_command(py, inc_np = include_directories(np_dir, 'mkl_random/src') # compiler/linker -cpp = meson.get_compiler('cpp') cpp_args = [ '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE_SOURCE=1', @@ -35,12 +34,6 @@ cpp_args = [ ] link_args = [] -if cpp.get_argument_syntax() == 'msvc' - link_args += ['Advapi32.lib'] -else - cpp_args += ['-Wno-unused-but-set-variable', '-Wno-unused-function'] -endif - rpath_link_args = [] if host_machine.system() != 'windows' if host_machine.system() == 'darwin' @@ -63,7 +56,18 @@ mkl_dep = dependency('MKL', method: 'cmake', required: true ) -# Cython extension +# cpp must be added after MKL detection: +# MKLConfig.cmake runs check_cxx_compiler_flag when CXX is present +# in the cmake toolchain which fails with non-Intel clang++ +add_languages('cpp', native: false) +cpp = meson.get_compiler('cpp') + +if cpp.get_argument_syntax() == 'msvc' + link_args += ['Advapi32.lib'] +else + cpp_args += ['-Wno-unused-but-set-variable', '-Wno-unused-function'] +endif + py.extension_module( 'mklrand', sources: [ From a90018c874440ce15e0e592efad02dbd14f17928 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 5 Aug 2026 03:30:55 -0700 Subject: [PATCH 25/40] Pass two separate RPATH entry for support macOS --- meson.build | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 61c3430d..2c417041 100644 --- a/meson.build +++ b/meson.build @@ -41,9 +41,11 @@ if host_machine.system() != 'windows' else origin = '$ORIGIN' endif - rpath = origin / '../..' + ':' + origin / '../../..' - rpath_link_args = ['-Wl,-rpath,' + rpath] -endif + + rpath_link_args = [ + '-Wl,-rpath,' + origin / '../..', + '-Wl,-rpath,' + origin / '../../..', + ] mkl_dep = dependency('MKL', method: 'cmake', modules: ['MKL::MKL'], From 569a6e0fb0bedbf4300dfdebcca27eb113b06c0a Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 5 Aug 2026 03:31:50 -0700 Subject: [PATCH 26/40] Require meson-python >=0.16.0 for PEP 639 --- conda-recipe-cf/meta.yaml | 2 +- conda-recipe/meta.yaml | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conda-recipe-cf/meta.yaml b/conda-recipe-cf/meta.yaml index 44b75c22..a7f37cc0 100644 --- a/conda-recipe-cf/meta.yaml +++ b/conda-recipe-cf/meta.yaml @@ -18,7 +18,7 @@ requirements: - {{ compiler('cxx') }} - {{ stdlib('c') }} host: - - meson-python >=0.13.0 + - meson-python >=0.16.0 - cmake - ninja - python diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 1b40a08b..af71b3a5 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -18,7 +18,7 @@ requirements: - {{ compiler('cxx') }} - {{ stdlib('c') }} host: - - meson-python >=0.13.0 + - meson-python >=0.16.0 - python-build >=1.2.2 - cmake - ninja diff --git a/pyproject.toml b/pyproject.toml index d17e3204..8973b3cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ [build-system] build-backend = "mesonpy" requires = [ - "meson-python>=0.13.0", + "meson-python>=0.16.0", "ninja", "Cython", "numpy", From 4184e3adb69427a51b1883cea6828f5243768de7 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 5 Aug 2026 03:34:29 -0700 Subject: [PATCH 27/40] Add gh-113 to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63f0c3d0..96b27dcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed * Removed `numpy-base` dependency and `USE_NUMPY_BASE` environment variable from conda recipe [gh-124](https://github.com/IntelPython/mkl_random/pull/124) +* Migrated the build system from `setuptools` to `meson-python`, removing `setup.py` in favor of `meson.build` [gh-113](https://github.com/IntelPython/mkl_random/pull/113) ### Fixed * Fixed compatibility with NumPy 2.5 by replacing the deprecated in-place array `shape` assignment with `reshape`, and by replacing the deprecated `numpy.testing.suppress_warnings` usage in tests with `pytest.warns` [gh-137](https://github.com/IntelPython/mkl_random/pull/137) From 03c3c7784cf15a901bcb4b8cabddf58200b0a685 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 5 Aug 2026 03:38:27 -0700 Subject: [PATCH 28/40] Add mkl-devel to build-system requires --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 8973b3cb..057ec1e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,7 @@ requires = [ "ninja", "Cython", "numpy", + "mkl-devel", "cmake" ] From f16cab69ed9032f8a55b4dee2a070475bbcca93f Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 5 Aug 2026 03:49:13 -0700 Subject: [PATCH 29/40] Use editable install in build-with-standard-clang --- .github/workflows/build-with-standard-clang.yml | 5 +---- meson.build | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-with-standard-clang.yml b/.github/workflows/build-with-standard-clang.yml index e8176e47..97c1d48b 100644 --- a/.github/workflows/build-with-standard-clang.yml +++ b/.github/workflows/build-with-standard-clang.yml @@ -54,12 +54,9 @@ jobs: run: | export CC=${{ env.COMPILER_ROOT }}/clang export CXX=${{ env.COMPILER_ROOT }}/clang++ - pip install . --no-build-isolation --no-deps --verbose + pip install -e . --no-build-isolation --no-deps --verbose - name: Run mkl_random tests run: | pip install pytest - # mkl_random cannot be installed in editable mode, we need - # to change directory before importing it and running tests - cd .. python -m pytest -sv --pyargs mkl_random diff --git a/meson.build b/meson.build index 2c417041..56900e97 100644 --- a/meson.build +++ b/meson.build @@ -46,6 +46,7 @@ if host_machine.system() != 'windows' '-Wl,-rpath,' + origin / '../..', '-Wl,-rpath,' + origin / '../../..', ] +endif mkl_dep = dependency('MKL', method: 'cmake', modules: ['MKL::MKL'], From 979bfecc05878f86c3ad2d0ecf7e2f16980aa7ca Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 5 Aug 2026 03:58:24 -0700 Subject: [PATCH 30/40] Remove redundant mkl from build_pip dependencies --- .github/workflows/build_pip.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_pip.yml b/.github/workflows/build_pip.yml index 2903a39a..de9ad232 100644 --- a/.github/workflows/build_pip.yml +++ b/.github/workflows/build_pip.yml @@ -34,7 +34,7 @@ jobs: - name: Install MKL run: | - conda install mkl-devel mkl + conda install mkl-devel - name: Build with pip run: | From 3980e9f9aa87f7c3f8bfaf28d31ecdeb31b2a223 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 5 Aug 2026 04:03:25 -0700 Subject: [PATCH 31/40] Remove redundant CFLAGS/LDFLAGS from conda build.sh --- conda-recipe/build.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index 3dab4732..55b00217 100644 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -4,9 +4,6 @@ if [ -d "build" ]; then rm -rf build fi -export CFLAGS="-I$PREFIX/include $CFLAGS" -export LDFLAGS="-L${PREFIX}/lib ${LDFLAGS}" - read -r GLIBC_MAJOR GLIBC_MINOR <<<"$(conda list '^sysroot_linux-64$' \ | tail -n 1 | awk '{print $2}' | grep -oP '\d+' | head -n 2 | tr '\n' ' ')" From 33275d1d6fe0cc03f74653d087d0b7d5b8701962 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 5 Aug 2026 04:14:20 -0700 Subject: [PATCH 32/40] Switch MKL_LINK to sdl and remove meson.options --- .github/workflows/build_pip.yml | 2 +- conda-recipe-cf/build.sh | 2 +- meson.build | 4 +--- meson.options | 7 ------- 4 files changed, 3 insertions(+), 12 deletions(-) delete mode 100644 meson.options diff --git a/.github/workflows/build_pip.yml b/.github/workflows/build_pip.yml index de9ad232..99d4273e 100644 --- a/.github/workflows/build_pip.yml +++ b/.github/workflows/build_pip.yml @@ -40,6 +40,6 @@ jobs: run: | pip install --no-cache-dir meson-python ninja cmake cython pip install --no-cache-dir numpy ${{ matrix.use_pre }} - pip install -e ".[test]" --no-build-isolation --verbose -Csetup-args="-Dmkl_threading=gnu_thread" + pip install -e ".[test]" --no-build-isolation --verbose pip list python -m pytest -v mkl_random/tests diff --git a/conda-recipe-cf/build.sh b/conda-recipe-cf/build.sh index d52c78b4..72e5e4e6 100644 --- a/conda-recipe-cf/build.sh +++ b/conda-recipe-cf/build.sh @@ -1,3 +1,3 @@ #!/bin/bash -ex -$PYTHON -m pip install --no-build-isolation --no-deps -Csetup-args="-Dmkl_threading=gnu_thread" . +$PYTHON -m pip install --no-build-isolation --no-deps . diff --git a/meson.build b/meson.build index 56900e97..2ff5a1c1 100644 --- a/meson.build +++ b/meson.build @@ -52,9 +52,7 @@ mkl_dep = dependency('MKL', method: 'cmake', modules: ['MKL::MKL'], cmake_args: [ '-DMKL_ARCH=intel64', - '-DMKL_LINK=dynamic', - '-DMKL_THREADING=' + get_option('mkl_threading'), - '-DMKL_INTERFACE=lp64' + '-DMKL_LINK=sdl', ], required: true ) diff --git a/meson.options b/meson.options deleted file mode 100644 index 7bd9b387..00000000 --- a/meson.options +++ /dev/null @@ -1,7 +0,0 @@ -option( - 'mkl_threading', - type: 'combo', - choices: ['intel_thread', 'tbb_thread', 'sequential', 'gnu_thread'], - value: 'intel_thread', - description: 'MKL threading layer to link to (default: intel_thread)' -) From 0b68ab442c518d7485396f76910bec4edd981e7e Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 5 Aug 2026 04:19:37 -0700 Subject: [PATCH 33/40] Add --no-deps to build_pip --- .github/workflows/build_pip.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_pip.yml b/.github/workflows/build_pip.yml index 99d4273e..798b1ff7 100644 --- a/.github/workflows/build_pip.yml +++ b/.github/workflows/build_pip.yml @@ -40,6 +40,7 @@ jobs: run: | pip install --no-cache-dir meson-python ninja cmake cython pip install --no-cache-dir numpy ${{ matrix.use_pre }} - pip install -e ".[test]" --no-build-isolation --verbose + pip install -e . --no-build-isolation --no-deps --verbose + pip install --no-cache-dir pytest pip list python -m pytest -v mkl_random/tests From 565d8b4e478a8255defb41b83c4781394f2975a0 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 5 Aug 2026 06:09:05 -0700 Subject: [PATCH 34/40] Clean up .gitignore for meson build --- .gitignore | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 89fa448a..d16f217a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,7 @@ -# CMake build and local install directory +# Meson build and local install directory build/ +.mesonpy-* mkl_random.egg-info/ # Byte-compiled / optimized / DLL files __pycache__/ - -mkl_random/src/mklrand.c -mkl_random/mklrand.cpp -mkl_random/mklrand.cpython*.so From 6970a72931195fd90524d43cfaa2c73100feeb54 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 5 Aug 2026 08:17:02 -0700 Subject: [PATCH 35/40] Update maintenance docs for meson build --- docs/source/maintenance/index.rst | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/source/maintenance/index.rst b/docs/source/maintenance/index.rst index 128b824a..87ea22b6 100644 --- a/docs/source/maintenance/index.rst +++ b/docs/source/maintenance/index.rst @@ -21,17 +21,18 @@ Make sure to install Python packages required to build :mod:`mkl_random`: * :mod:`python` * :mod:`numpy` * :mod:`cython` -* :mod:`setuptools` +* :mod:`meson-python` +* :mod:`ninja` +* :mod:`cmake` +* :mod:`mkl-devel` -You would also need Intel(R) MKL library and its headers. Set :code:`MKLROOT` environment -variable so that :code:`${MKLROOT}/include/mkl.h` and :code:`${MKLROOT}/lib/libmkl_rt.so` -can be found. +The Intel(R) MKL library and its headers are provided by the :mod:`mkl-devel` +package and located through CMake, so no environment variable needs to be set. .. code-block:: bash :caption: Building mkl_random - $ export MKLROOT= - python -m pip install . + python -m pip install . --no-build-isolation --no-deps To run test suite, install :mod:`pytest`, and run From e000f3aea866a75c7337970ab802d40ef31f4a0d Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 5 Aug 2026 08:17:45 -0700 Subject: [PATCH 36/40] Remove unused WHEELS_OUTPUT_FOLDER from conda-recipe-cf --- conda-recipe-cf/meta.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/conda-recipe-cf/meta.yaml b/conda-recipe-cf/meta.yaml index a7f37cc0..e0a05927 100644 --- a/conda-recipe-cf/meta.yaml +++ b/conda-recipe-cf/meta.yaml @@ -7,8 +7,6 @@ source: build: number: {{ GIT_DESCRIBE_NUMBER }} - script_env: - - WHEELS_OUTPUT_FOLDER ignore_run_exports: - blas From bb303b334dd63b5cf0f9e97aec31cbd4984b1835 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 5 Aug 2026 08:21:59 -0700 Subject: [PATCH 37/40] Add numpy to ignore_run_exports in conda recipes --- conda-recipe-cf/meta.yaml | 1 + conda-recipe/meta.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/conda-recipe-cf/meta.yaml b/conda-recipe-cf/meta.yaml index e0a05927..c1dcd498 100644 --- a/conda-recipe-cf/meta.yaml +++ b/conda-recipe-cf/meta.yaml @@ -9,6 +9,7 @@ build: number: {{ GIT_DESCRIBE_NUMBER }} ignore_run_exports: - blas + - numpy requirements: build: diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index af71b3a5..dbdedbbe 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -11,6 +11,7 @@ build: - WHEELS_OUTPUT_FOLDER ignore_run_exports: - blas + - numpy requirements: build: From 952c1333bad45fe1ae509abf0c49d905d1efc21d Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 5 Aug 2026 09:33:18 -0700 Subject: [PATCH 38/40] Add OSX builds to conda-forge package workflow --- .github/workflows/conda-package-cf.yml | 154 +++++++++++++++++++++++++ 1 file changed, 154 insertions(+) diff --git a/.github/workflows/conda-package-cf.yml b/.github/workflows/conda-package-cf.yml index 1760991b..0fb666eb 100644 --- a/.github/workflows/conda-package-cf.yml +++ b/.github/workflows/conda-package-cf.yml @@ -323,3 +323,157 @@ jobs: run: | conda activate ${{ env.TEST_ENV_NAME }} pytest -v --pyargs ${{ env.MODULE_NAME }} + + build_osx: + runs-on: macos-26-intel + strategy: + matrix: + include: + - python: "3.10" + numpy: "2.2" + - python: "3.11" + numpy: "2.3" + - python: "3.12" + numpy: "2.3" + - python: "3.13" + numpy: "2.3" + - python: "3.14" + numpy: "2.3" + + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # v0.13.1 + with: + access_token: ${{ github.token }} + + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + 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@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + 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" + + - name: Build conda package + shell: bash -el {0} + run: | + CHANNELS=(-c conda-forge --override-channels) + VERSIONS=(--python "${{ matrix.python }}" --numpy "${{ matrix.numpy }}") + 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 + + test_osx: + needs: build_osx + runs-on: macos-26-intel + strategy: + matrix: + include: + - python: "3.10" + numpy: "2.2" + - python: "3.11" + numpy: "2.3" + - python: "3.12" + numpy: "2.3" + - python: "3.13" + numpy: "2.3" + - python: "3.14" + numpy: "2.3" + + 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: | + 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 }}" "numpy=${{ matrix.numpy }}" -c "$GITHUB_WORKSPACE/channel" -c conda-forge --override-channels --only-deps --dry-run > lockfile + cat lockfile + + - name: Cache conda packages + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + 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_random + shell: bash -el {0} + run: | + 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 }}" "numpy=${{ matrix.numpy }}" -c "$GITHUB_WORKSPACE/channel" -c conda-forge --override-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 }} From 60d4a45cb76124994229df4d81c74ab8314223ae Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Wed, 5 Aug 2026 09:53:44 -0700 Subject: [PATCH 39/40] Add osx compilers to conda-forge build config --- conda-recipe-cf/conda_build_config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/conda-recipe-cf/conda_build_config.yaml b/conda-recipe-cf/conda_build_config.yaml index 822fd77b..a830d0aa 100644 --- a/conda-recipe-cf/conda_build_config.yaml +++ b/conda-recipe-cf/conda_build_config.yaml @@ -8,6 +8,12 @@ c_stdlib: # [linux] - sysroot # [linux] c_stdlib_version: # [linux] - '2.28' # [linux] +c_compiler: # [osx] + - clang # [osx] +cxx_compiler: # [osx] + - clangxx # [osx] +c_stdlib: # [osx] + - macosx_deployment_target # [osx] c_stdlib: # [win] - vs # [win] cxx_compiler: # [win] From 5edd83e937be6cf1466d51bfa27d5f681b93d8da Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 6 Aug 2026 07:18:43 -0700 Subject: [PATCH 40/40] Restore scripting@intel.com email in authors --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 057ec1e1..c841c9a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,9 @@ requires = [ ] [project] -authors = [{name = "Intel Corporation"}] +authors = [ + {name = "Intel Corporation", email = "scripting@intel.com"} +] classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Science/Research",