Skip to content

Commit

Permalink
feat: Enable SIMD optimizations
Browse files Browse the repository at this point in the history
* Add x86_64-microarch-level as a 'build' requirement.
   - microarch_level 4 not supported yet so only add level 1 to 3.
* Set the build number based on the microarch_level.
* Add conda_build_config.yaml with microarch_level.
* c.f. https://prefix.dev/blog/building_cpu_optimized_packages
* Bump build number.
  • Loading branch information
matthewfeickert committed Sep 6, 2024
1 parent 3007f7b commit f2eaff7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
microarch_level: # [unix and x86_64]
- 1 # [unix and x86_64]
- 3 # [unix and x86_64]
9 changes: 8 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% set name = "boost-histogram" %}
{% set version = "1.5.0" %}
{% set build = 2 %}

package:
name: {{ name|lower }}
Expand All @@ -10,7 +11,12 @@ source:
sha256: 0623f010e6c52e5d018767723959686090db07fc30f0d1d8475b5d663c5ddb2c

build:
number: 1
# Prioritize builds with a higher microarch level.
# microarch_level 4 not supported yet.
# c.f. https://github.com/conda-forge/microarch-level-feedstock/issues/5
number: {{ build }} # [not (unix and x86_64)]
number: {{ build + 100 }} # [unix and x86_64 and microarch_level == 1]
number: {{ build + 300 }} # [unix and x86_64 and microarch_level == 3]
script:
- export CMAKE_BUILD_PARALLEL_LEVEL=${CPU_COUNT} # [not (linux and ppc64le)]
- {{ PYTHON }} -m pip install . -v
Expand All @@ -19,6 +25,7 @@ requirements:
build:
- python # [build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- x86_64-microarch-level {{ microarch_level }} # [unix and x86_64]
- {{ compiler('cxx') }}
- {{ stdlib("c") }}
- cmake
Expand Down

0 comments on commit f2eaff7

Please sign in to comment.