Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluemi committed Aug 20, 2024
2 parents 965a223 + 7e388e3 commit 08b30f1
Show file tree
Hide file tree
Showing 39 changed files with 3,134 additions and 1,106 deletions.
76 changes: 43 additions & 33 deletions .github/workflows/BuildAndPublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
workflow_dispatch:
pull_request:
push:
branches:
- main
tags:
- 'v*.*.*'

defaults:
run:
Expand All @@ -17,14 +17,9 @@ jobs:
fail-fast: false
matrix:
platform: [windows-latest, macos-latest, macos-13, ubuntu-latest]
# platform: [ubuntu-latest]
python-version: ["3.11", "3.12"]
exclude: # We don't need this as cibuildwheel builds for all python versions
- platform: ubuntu-latest
python-version: "3.11"

runs-on: ${{ matrix.platform }}
if: "contains(github.event.head_commit.message, '+ci')"
if: "github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') && github.base_ref == 'refs/heads/main"

steps:
- uses: actions/checkout@v4
Expand All @@ -33,50 +28,65 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: "3.12"

- name: Add requirements
run: python -m pip install --upgrade wheel setuptools pybind11>=2.12.0 build pytest cibuildwheel
run: python -m pip install --upgrade setuptools pybind11>=2.12.0 cibuildwheel

- name: Copy Build Files
run: python3 setup.py copy_build_files
run: python setup.py copy_build_files

# building package on linux
- name: Build CiBuildWheel
- name: Build Packages
run: cibuildwheel --output-dir "dist"
env:
FORCE_AVX2: "1"
run: cibuildwheel --archs auto64 --output-dir dist
if: runner.os == 'Linux'
CIBW_ARCHS: auto64
CIBW_BUILD_FRONTEND: "pip; args: --verbose"
CIBW_ENVIRONMENT: "FORCE_AVX2=1"
CIBW_ENVIRONMENT_MACOS: "FORCE_AVX2=1 MACOSX_DEPLOYMENT_TARGET=11.00"
CIBW_SKIP: "cp313-*"

# building package on windows / osx
- name: Build
env:
FORCE_AVX2: "1"
run: python3 -m build
if: runner.os != 'Linux'
# upload artifacts
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: release-dists-${{ matrix.platform }}
path: python/dist

- name: Install
run: pip install --verbose .[test]
if: runner.os != 'Linux'
build_sdist:
runs-on: ubuntu-latest
if: "github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') && github.base_ref == 'refs/heads/main"

- name: Test
run: python -m pytest
if: runner.os != 'Linux'
steps:
- uses: actions/checkout@v4
with:
submodules: false

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Add requirements
run: python -m pip install --upgrade setuptools pybind11>=2.12.0

- name: Copy Build Files
run: python setup.py copy_build_files

- name: Build Source Distribution
run: python setup.py sdist

# upload artifacts
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: release-dists-${{ matrix.platform }}-python${{ matrix.python-version}}
path: python/dist/

name: release-dists-sdist
path: python/dist

pypi-publish:
runs-on: "ubuntu-latest"
if: "contains(github.event.head_commit.message, '+ci')"
if: "github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') && github.base_ref == 'refs/heads/main"

needs:
- build
- build_sdist

permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
Expand Down
108 changes: 0 additions & 108 deletions .github/workflows/BuildAndPublishUniform.yml

This file was deleted.

68 changes: 68 additions & 0 deletions .github/workflows/BuildAndTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: BuildAndTest

on:
workflow_dispatch:
pull_request:
push:
branches:
- dev

defaults:
run:
working-directory: python

jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [windows-latest, macos-latest, macos-13, ubuntu-latest]

runs-on: ${{ matrix.platform }}
if: "contains(github.event.head_commit.message, '+ci')"

steps:
- uses: actions/checkout@v4
with:
submodules: false

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Add requirements
run: python -m pip install --upgrade setuptools pybind11>=2.12.0 cibuildwheel

- name: Copy Build Files
run: python setup.py copy_build_files

- name: Build Packages
run: cibuildwheel --output-dir "dist"
env:
CIBW_ARCHS: auto64
CIBW_BUILD_FRONTEND: "pip; args: --verbose"
CIBW_ENVIRONMENT: "FORCE_AVX2=1"
CIBW_ENVIRONMENT_MACOS: "FORCE_AVX2=1 MACOSX_DEPLOYMENT_TARGET=11.00"
CIBW_SKIP: "cp313-*"

build_sdist:
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, '+ci')"

steps:
- uses: actions/checkout@v4
with:
submodules: false

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Add requirements
run: python -m pip install --upgrade setuptools pybind11>=2.12.0

- name: Copy Build Files
run: python setup.py copy_build_files

- name: Build Source Distribution
run: python setup.py sdist
3 changes: 2 additions & 1 deletion cpp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ tmp/
var/
.vscode/
CMakePresets.json
cmake-variants.yaml
build-*
cmake-build-default/
cmake-build*
data/
python-bindings/.venv
36 changes: 23 additions & 13 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,16 @@ if (FORCE_AVX2)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(
compile-options
INTERFACE -O2
INTERFACE -O3
-mavx2
-mfma
-fpic)
-fpic
-w
-fopenmp
-pthread
-ftree-vectorize
-ftree-vectorizer-verbose=0
)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_compile_options(
compile-options
Expand All @@ -51,15 +57,13 @@ if (FORCE_AVX2)
-mfma
-fpic)
elseif(MSVC)
# warning level 4 (show all)
target_compile_options(compile-options INTERFACE /W4)

# always use AVX2
target_compile_options(compile-options INTERFACE /arch:AVX2)

# disable string optimizations and function level linking
# https://stackoverflow.com/questions/5063334/what-is-the-difference-between-the-ox-and-o2-compiler-options
target_compile_options(compile-options INTERFACE $<$<CONFIG:Release>:/Ox>)
target_compile_options(
compile-options
INTERFACE /O2
/arch:AVX2
/W1
/openmp
/EHsc)
else()
message(WARNING "Unknown compiler for AVX2 Build: ${CMAKE_CXX_COMPILER_ID}")
endif()
Expand All @@ -72,10 +76,16 @@ else() # Native build
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(
compile-options
INTERFACE -O2
INTERFACE -O3
-march=native
-mavx2
-mfma
-fpic
-fopenmp)
-w
-fopenmp
-pthread
-ftree-vectorize
-ftree-vectorizer-verbose=0)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_compile_options(
compile-options
Expand Down
5 changes: 5 additions & 0 deletions cpp/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ add_executable(deglib_build_bench ${PROJECT_SOURCE_DIR}/src/deglib_build_bench.c
target_link_libraries(deglib_build_bench PUBLIC DEG_LIB compile-options
fmt::fmt-header-only OpenMP::OpenMP_CXX)
target_compile_definitions(deglib_build_bench PUBLIC "DATA_PATH=\"${DATA_PATH}\"")

add_executable(deglib_groundtruth ${PROJECT_SOURCE_DIR}/src/deglib_groundtruth.cpp)
target_link_libraries(deglib_groundtruth PUBLIC DEG_LIB compile-options
fmt::fmt-header-only OpenMP::OpenMP_CXX)
target_compile_definitions(deglib_groundtruth PUBLIC "DATA_PATH=\"${DATA_PATH}\"")
Loading

0 comments on commit 08b30f1

Please sign in to comment.