Skip to content

Commit

Permalink
Merge pull request #148 from ExaScience/dev/conda
Browse files Browse the repository at this point in the history
conda: upgrade to use scikit-build-core and GitHub Workflows
  • Loading branch information
tvandera authored Jun 20, 2024
2 parents 195af50 + ad9e39c commit e4c7b90
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 161 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build

on:
pull_request:
push:
branches:
- master

jobs:
conda-build:
name: Build Conda Package on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: 3.8
channels: conda-forge
activate-environment: devtools
environment-file: conda-recipes/devtools.yml
- run: conda info
- run: conda list
- run: conda config --show
- name: Conda Info
run: |
conda info
- run: git describe --tags
- name: Run 'conda build'
run: |
conda build -c vanderaa smurff
working-directory: conda-recipes
19 changes: 8 additions & 11 deletions conda-recipes/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
CONDA_BUILD_SYSROOT:
- /opt/MacOSX10.9.sdk # [osx]

python:
- 3.7
- 3.8
- 3.9
- 3.10
- 3.11

blas_impl:
- openblas
- mkl

numpy:
- 1.16
blas_impl: # [linux64 or win64]
- openblas # [linux64 or win64]
- mkl # [linux64 or win64]

hdf5:
- 1.10.4
- 1.10.6

c_compiler: vs2022 # [win]
cxx_compiler: vs2022 # [win]

pin_run_as_build:
libboost: x.x
numpy: x.x
hdf5: x.x.x
6 changes: 6 additions & 0 deletions conda-recipes/devtools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: devtools
channels:
- defaults
- conda-forge
dependencies:
- conda-build
13 changes: 0 additions & 13 deletions conda-recipes/eigen3/bld.bat

This file was deleted.

4 changes: 0 additions & 4 deletions conda-recipes/eigen3/build.sh

This file was deleted.

25 changes: 0 additions & 25 deletions conda-recipes/eigen3/meta.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions conda-recipes/eigen3/run_test.sh

This file was deleted.

13 changes: 0 additions & 13 deletions conda-recipes/eigen3/test.cc

This file was deleted.

15 changes: 0 additions & 15 deletions conda-recipes/highfive/bld.bat

This file was deleted.

20 changes: 0 additions & 20 deletions conda-recipes/highfive/build.sh

This file was deleted.

26 changes: 0 additions & 26 deletions conda-recipes/highfive/meta.yaml

This file was deleted.

17 changes: 8 additions & 9 deletions conda-recipes/smurff/bld.bat
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
REM SET "CMAKE_ARGS=-DENABLE_MKL=ON -DBoost_COMPILER=-vc140 -DCMAKE_INSTALL_PREFIX=%PREFIX%"
SET "CMAKE_ARGS=-DENABLE_MKL=ON -DCMAKE_INSTALL_PREFIX=%PREFIX%"
if "%blas_impl%"=="mkl" (
set "SKBUILD_CMAKE_ARGS=-DENABLE_MKL=ON -DENABLE_OPENBLAS=OFF"
) else (
set "SKBUILD_CMAKE_ARGS=-DENABLE_OPENBLAS=ON -DENABLE_MKL=OFF"
)

REM conda build sets "Visual Studio 15 2017 Win64" generator
REM which is incompatible with "-A x64" that we add ourselves in setup.py,
REM hence we remove " Win64"
SET "CMAKE_GENERATOR=%CMAKE_GENERATOR: Win64=%"
echo extra CMAKE_ARGS: %SKBUILD_CMAKE_ARGS%

%PYTHON% setup.py install ^
--install-binaries ^
--single-version-externally-managed --record=record.txt
%PYTHON% -m pip install . --no-deps -vv
if errorlevel 1 exit 1
18 changes: 10 additions & 8 deletions conda-recipes/smurff/build.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/bin/bash

export CMAKE_ARGS="-DENABLE_MKL=ON -DCMAKE_INSTALL_PREFIX=$PREFIX -DENABLE_MPI=OFF"
if [ "$blas_impl" == "mkl" ]
then
SKBUILD_CMAKE_ARGS="-DENABLE_MKL=ON -DENABLE_OPENBLAS=OFF"
else
SKBUILD_CMAKE_ARGS="-DENABLE_OPENBLAS=ON -DENABLE_MKL=OFF"
fi

# make sure we use CONDA_BUILD_SYSROOT
# https://github.com/conda/conda-build/issues/3452#issuecomment-47539707
[[ ${target_platform} == "osx-64" ]] && \
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_OSX_SYSROOT=${CONDA_BUILD_SYSROOT}"
echo "extra CMAKE_ARGS: $SKBUILD_CMAKE_ARGS"

$PYTHON setup.py install \
--install-binaries \
--single-version-externally-managed --record=record.txt
export SKBUILD_CMAKE_ARGS

$PYTHON -m pip install . --no-deps -vv
19 changes: 9 additions & 10 deletions conda-recipes/smurff/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,29 @@ requirements:
- llvm-openmp # [osx]
host:
- llvm-openmp # [osx]
- intel-openmp
- mkl-devel
- eigen3
- libboost
- mkl-devel # [blas_impl == 'mkl']
- openblas # [blas_impl != 'mkl']
- eigen
- libboost-devel
- pybind11
- highfive >=2.2
- h5py
- python {{ python }}
- setuptools
- scikit-build-core
- setuptools_scm
- numpy
run:
- python {{ python }}
- intel-openmp # [not win]
- mkl
- libboost # [not win]
- mkl # [blas_impl == 'mkl']
- openblas # [blas_impl != 'mkl']
- libboost # [not win]
- numpy
- scipy
- pandas
- scikit-learn
- hdf5
- h5py
- h5sparse-tensor >=0.2.2

test:
requires:
- setuptools
Expand Down
6 changes: 3 additions & 3 deletions conda-recipes/smurff/run_test.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
%CONDA_PREFIX%\libexec\tests ~[random]
if errorlevel 1 exit 1
%PYTHON% -m pytest
REM %CONDA_PREFIX%\libexec\tests ~[random]
REM if errorlevel 1 exit 1
%PYTHON% -m pytest
2 changes: 1 addition & 1 deletion conda-recipes/smurff/run_test.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
$PREFIX/libexec/tests
# $PREFIX/libexec/tests
$PYTHON -m pytest -v python/test

0 comments on commit e4c7b90

Please sign in to comment.