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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 29 additions & 20 deletions .github/workflows/conda-package-cf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ jobs:

build_windows:
runs-on: windows-latest

defaults:
run:
shell: cmd /C CALL {0}
strategy:
matrix:
include:
Expand All @@ -103,10 +105,10 @@ jobs:

- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
with:
conda-remove-defaults: true
miniforge-version: latest
activate-environment: build
channels: conda-forge
auto-activate: true
activate-environment: base
python-version: ${{ matrix.python }}

- name: Cache conda packages
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
Expand All @@ -120,19 +122,24 @@ jobs:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-

- name: Install conda-build
run: conda install -n base -y conda-build
- name: Store conda paths as envs
shell: bash -l {0}
run: |
echo "CONDA_BLD=$CONDA/conda-bld/win-64/" | tr "\\\\" '/' >> "$GITHUB_ENV"

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

- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- name: Build conda package
run: conda build --no-test --python ${{ matrix.python }} --numpy ${{ matrix.numpy }} -c conda-forge --override-channels conda-recipe-cf

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

test_linux:
needs: build_linux
Expand Down Expand Up @@ -219,7 +226,9 @@ jobs:
test_windows:
needs: build_windows
runs-on: windows-latest

defaults:
run:
shell: cmd /C CALL {0}
strategy:
matrix:
include:
Expand All @@ -245,20 +254,21 @@ jobs:

- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
with:
conda-remove-defaults: true
miniforge-version: latest
channels: conda-forge
auto-activate: true
activate-environment: base
activate-environment: ${{ env.TEST_ENV_NAME }}
python-version: ${{ matrix.python }}

- name: Install conda-build
# Needed to be able to run conda index
run: conda install conda-build
- name: Install conda-index
run: |
conda install conda-index

- name: Create conda channel
run: |
mkdir ${{ env.GITHUB_WORKSPACE }}\channel\win-64
move ${{ env.PACKAGE_NAME }}-*.conda ${{ env.GITHUB_WORKSPACE }}\channel\win-64
conda index ${{ env.GITHUB_WORKSPACE }}/channel
python -m 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
Expand All @@ -272,8 +282,7 @@ jobs:
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 }} numpy=${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
more lockfile
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} numpy=${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile

- name: Cache conda packages
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
Expand Down Expand Up @@ -302,5 +311,5 @@ jobs:

- name: Run tests
run: |
conda activate -n ${{ env.TEST_ENV_NAME }}
conda activate ${{ env.TEST_ENV_NAME }}
pytest -v --pyargs ${{ env.MODULE_NAME }}
42 changes: 22 additions & 20 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ jobs:

build_windows:
runs-on: windows-latest

defaults:
run:
shell: cmd /C CALL {0}
strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
Expand All @@ -97,10 +99,9 @@ jobs:
- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
with:
miniforge-version: latest
use-mamba: 'true'
conda-remove-defaults: 'true'
activate-environment: 'build'
python-version: '3.13' # no python 3.14 support by conda-build
activate-environment: build
channels: conda-forge
python-version: ${{ matrix.python }}

- name: Cache conda packages
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
Expand All @@ -114,13 +115,15 @@ jobs:
${{ 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: Store conda paths as envs
shell: bash -el {0}
shell: bash -l {0}
run: |
echo "CONDA_BLD=${CONDA_PREFIX}\\conda-bld\\win-64\\" >> "$GITHUB_ENV"
echo "CONDA_BLD=$CONDA/conda-bld/win-64/" | tr "\\\\" '/' >> "$GITHUB_ENV"

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

- name: Build conda package
run: conda build --no-test --python "${{ matrix.python }}" -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels conda-recipe
Expand Down Expand Up @@ -247,19 +250,19 @@ jobs:
- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
with:
miniforge-version: latest
use-mamba: 'true'
conda-remove-defaults: 'true'
activate-environment: 'test'
python-version: '3.13' # no python 3.14 support by conda-index
channels: conda-forge
activate-environment: ${{ env.TEST_ENV_NAME }}
python-version: ${{ matrix.python }}

- name: Install conda-index
run: conda install conda-index
run: |
conda install conda-index

- name: Create conda channel
run: |
mkdir ${{ env.GITHUB_WORKSPACE }}\channel\win-64
move ${{ env.PACKAGE_NAME }}-*.conda ${{ env.GITHUB_WORKSPACE }}\channel\win-64
python -m conda_index "${{ env.GITHUB_WORKSPACE }}/channel"
python -m 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
Expand All @@ -274,8 +277,7 @@ jobs:
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 }} numpy=${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile
more lockfile
conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} numpy=${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile

- name: Cache conda packages
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
Expand All @@ -302,12 +304,12 @@ jobs:
)
SET "WORKAROUND_DEPENDENCIES=intel-openmp"
conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %WORKAROUND_DEPENDENCIES% pytest python=${{ matrix.python }} numpy=${{ matrix.numpy }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }}
conda activate -n ${{ env.TEST_ENV_NAME }}
conda activate ${{ env.TEST_ENV_NAME }}

# Test installed packages
conda list

- name: Run tests
run: |
conda activate -n "${{ env.TEST_ENV_NAME }}"
conda activate "${{ env.TEST_ENV_NAME }}"
pytest -v --pyargs ${{ env.MODULE_NAME }}
14 changes: 12 additions & 2 deletions conda-recipe-cf/bld.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
@rem Remember to source the compiler

set MKLROOT=%CONDA_PREFIX%
%PYTHON% -m pip install --no-build-isolation --no-deps .
if errorlevel 1 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
)
15 changes: 14 additions & 1 deletion conda-recipe-cf/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
#!/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
$PYTHON -m pip install --no-build-isolation --no-deps .

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
16 changes: 16 additions & 0 deletions conda-recipe-cf/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
c_compiler: # [linux]
- gcc # [linux]
cxx_compiler: # [linux]
- gxx # [linux]
cxx_compiler_version: # [linux]
- '14' # [linux]
c_stdlib: # [linux]
- sysroot # [linux]
c_stdlib_version: # [linux]
- '2.28' # [linux]
c_stdlib: # [win]
- vs # [win]
cxx_compiler: # [win]
- vs2022 # [win]
c_compiler: # [win]
- vs2022 # [win]
24 changes: 18 additions & 6 deletions conda-recipe-cf/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
{% set version = "1.4.0dev1" %}
{% set buildnumber = 0 %}

package:
name: mkl_random
version: {{ version }}
version: {{ GIT_DESCRIBE_TAG }}

source:
path: ..

build:
number: {{buildnumber}}
number: {{ GIT_DESCRIBE_NUMBER }}
script_env:
- WHEELS_OUTPUT_FOLDER
ignore_run_exports:
- blas

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ stdlib('c') }}
host:
- python
- python-gil # [py>=314]
- setuptools >=77
- mkl-devel
- cython
- numpy
- pip
- wheel >=0.41.3
run:
- python
- numpy
- python-gil [py>=314]
- {{ pin_compatible('numpy', min_pin="x.x", max_pin="x") }}
- {{ pin_compatible('mkl', min_pin="x.x", max_pin="x") }}

test:
Expand All @@ -43,3 +46,12 @@ about:
license: BSD-3-Clause
license_file: LICENSE.txt
summary: NumPy-based implementation of random number generation sampling using Intel (R) Math Kernel Library, mirroring numpy.random, but exposing all choices of sampling algorithms available in MKL.
description: |
<strong>LEGAL NOTICE: Use of this software package is subject to the
software license agreement (as set forth above, in the license section of
the installed Conda package and/or the README file) and all notices,
disclaimers or license terms for third party or open source software
included in or with the software.</strong>
<br/><br/>
EULA: <a href="https://opensource.org/licenses/BSD-3-Clause" target="_blank">BSD-3-Clause</a>
<br/><br/>
Loading