From a805358a035a74b9aa66bee9f982894391a178a2 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 18 Oct 2023 13:48:50 -0500 Subject: [PATCH 01/25] Add x86_64_level package --- recipes/x86_64_level/LICENSE.txt | 27 ++++++++++ recipes/x86_64_level/conda_build_config.yaml | 55 ++++++++++++++++++++ recipes/x86_64_level/gen.py | 29 +++++++++++ recipes/x86_64_level/meta.yaml | 21 ++++++++ 4 files changed, 132 insertions(+) create mode 100644 recipes/x86_64_level/LICENSE.txt create mode 100644 recipes/x86_64_level/conda_build_config.yaml create mode 100644 recipes/x86_64_level/gen.py create mode 100644 recipes/x86_64_level/meta.yaml diff --git a/recipes/x86_64_level/LICENSE.txt b/recipes/x86_64_level/LICENSE.txt new file mode 100644 index 0000000000000..ec770927ffff8 --- /dev/null +++ b/recipes/x86_64_level/LICENSE.txt @@ -0,0 +1,27 @@ +Copyright (c) 2023, conda-forge +All rights reserved. + +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 staged-recipes 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 HOLDER 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. diff --git a/recipes/x86_64_level/conda_build_config.yaml b/recipes/x86_64_level/conda_build_config.yaml new file mode 100644 index 0000000000000..2e3134ca5735a --- /dev/null +++ b/recipes/x86_64_level/conda_build_config.yaml @@ -0,0 +1,55 @@ +microarchitecture: +- x86_64 +- x86_64_v2 +- x86_64_v3 +- x86_64_v4 +- nocona +- core2 +- nehalem +- westmere +- sandybridge +- ivybridge +- haswell +- broadwell +- skylake +- mic_knl +- skylake_avx512 +- cannonlake +- cascadelake +- icelake +- k10 +- bulldozer +- piledriver +- steamroller +- excavator +- zen +- zen2 +- zen3 + +level: +- 1 +- 1 +- 2 +- 3 +- 1 +- 1 +- 2 +- 2 +- 2 +- 2 +- 3 +- 3 +- 3 +- 3 +- 4 +- 3 +- 4 +- 4 +- 1 +- 2 +- 2 +- 2 +- 3 +- 3 +- 3 +- 3 diff --git a/recipes/x86_64_level/gen.py b/recipes/x86_64_level/gen.py new file mode 100644 index 0000000000000..614a1e86ebce7 --- /dev/null +++ b/recipes/x86_64_level/gen.py @@ -0,0 +1,29 @@ +import archspec.cpu + +archs = archspec.cpu.TARGETS + +x86_64_levels = {} + +name_mapping = { + "x86_64": 1, + "x86_64_v2": 2, + "x86_64_v3": 3, + "x86_64_v4": 4, +} + +for arch_name, arch in archs.items(): + if arch.family.name != "x86_64": + continue + if arch.parents: + level = max(name_mapping.get(parent.name, 0) for parent in arch.ancestors) + else: + level = 1 + x86_64_levels[arch_name] = level + +print("microarchitecture:") +for arch in x86_64_levels.keys(): + print(f"- {arch}") +print() +print("level:") +for level in x86_64_levels.values(): + print(f"- {level}") diff --git a/recipes/x86_64_level/meta.yaml b/recipes/x86_64_level/meta.yaml new file mode 100644 index 0000000000000..e14671ffc4bf7 --- /dev/null +++ b/recipes/x86_64_level/meta.yaml @@ -0,0 +1,21 @@ +package: + name: x86_64-level + version: {{ level }} + +build: + number: 0 + string: 0_{{ microarchitecture }} + +requirements: + run: + - __archspec 1={{ microarchitecture }} + +about: + home: https://github.com/conda-forge/x86_64-level-feedstock + summary: 'Meta package to build conda recipes with x86_64 microarchitecture levels' + license: BSD-3-Clause + license_file: LICENSE.txt + +extra: + recipe-maintainers: + - isuruf From 4f9d60d344dc1b86fa22d66262678c59f51d3782 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 18 Oct 2023 13:59:23 -0500 Subject: [PATCH 02/25] zip keys --- recipes/x86_64_level/conda_build_config.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes/x86_64_level/conda_build_config.yaml b/recipes/x86_64_level/conda_build_config.yaml index 2e3134ca5735a..6ace3b680d7c4 100644 --- a/recipes/x86_64_level/conda_build_config.yaml +++ b/recipes/x86_64_level/conda_build_config.yaml @@ -53,3 +53,7 @@ level: - 3 - 3 - 3 + +zip_keys: + - - microarchitecture + - level From 9434a797cb831cafe7eebf6db82167bc47c8d5f7 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 18 Oct 2023 14:56:54 -0500 Subject: [PATCH 03/25] add run_exports --- recipes/x86_64_level/meta.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/x86_64_level/meta.yaml b/recipes/x86_64_level/meta.yaml index e14671ffc4bf7..9f64814e172ce 100644 --- a/recipes/x86_64_level/meta.yaml +++ b/recipes/x86_64_level/meta.yaml @@ -5,6 +5,9 @@ package: build: number: 0 string: 0_{{ microarchitecture }} + noarch: generic + run_exports: + - x86_64-level >={{ level }} requirements: run: From ef931d3c63c3425b1442d730af668d7e323b0530 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 18 Oct 2023 15:19:34 -0500 Subject: [PATCH 04/25] Add a new meta-package for use in recipes --- recipes/x86_64_level/install_scripts.sh | 10 +++++ recipes/x86_64_level/meta.yaml | 53 ++++++++++++++++++++++--- 2 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 recipes/x86_64_level/install_scripts.sh diff --git a/recipes/x86_64_level/install_scripts.sh b/recipes/x86_64_level/install_scripts.sh new file mode 100644 index 0000000000000..977c59b08a5a1 --- /dev/null +++ b/recipes/x86_64_level/install_scripts.sh @@ -0,0 +1,10 @@ +mkdir -p "${PREFIX}"/etc/conda/{de,}activate.d/ + +if [[ "$level" == "1" ]]; then + flag="-march=x86-64" +else + flag="-march=x86-64-v{{ level }}" +fi + +echo 'export CXXFLAGS="${CXXFLAGS} '$flag'"' >> "${PREFIX}"/etc/conda/activate.d/~activate-x86-64-level.sh +chmod +x "${PREFIX}"/etc/conda/activate.d/~activate-x86-64-level.sh diff --git a/recipes/x86_64_level/meta.yaml b/recipes/x86_64_level/meta.yaml index 9f64814e172ce..223bddda4e793 100644 --- a/recipes/x86_64_level/meta.yaml +++ b/recipes/x86_64_level/meta.yaml @@ -1,5 +1,5 @@ package: - name: x86_64-level + name: x86_64_level-split version: {{ level }} build: @@ -7,14 +7,55 @@ build: string: 0_{{ microarchitecture }} noarch: generic run_exports: - - x86_64-level >={{ level }} + - x86_64_level >={{ level }} -requirements: - run: - - __archspec 1={{ microarchitecture }} +outputs: + - name: x86_64_level + requirements: + run: + - __archspec 1={{ microarchitecture }} + + about: + home: https://github.com/conda-forge/x86_64_level-feedstock + summary: 'Meta package to build conda recipes with x86_64 microarchitecture levels' + description: | + The meta-package x86_64_level enforces the microarchitecture in the + user system. + + Note that a user would need the archspec-base conda package installed + in the base environment where conda/mamba is run from. + + See x86_64_level_build for using this in conda recipes + license: BSD-3-Clause + license_file: LICENSE.txt + + - name: x86_64_level_build + script: install_scripts.sh + requirements: + run: + - __unix + about: + home: https://github.com/conda-forge/x86_64_level-feedstock + summary: 'Meta package to build conda recipes with x86_64 microarchitecture levels' + description: | + Use the meta-package x86_64_level_build in host in conda recipes + to set up the compiler flags and set up the __archspec virtual + package in the run requirements. + + When building packages on CI, level=4 will not be guaranteed, so + you can only use level<=3 to build. + + The run_exports only has a lower bound and therefore a level=2 + build can be installed on a level=3 user system. A tighter bound + is not added because we want to be able to test both level=2 and + level=3 on a CI machine with level=3. + Therefore in order to prioritise the highest level, use the build + number to prioritise the level. + license: BSD-3-Clause + license_file: LICENSE.txt about: - home: https://github.com/conda-forge/x86_64-level-feedstock + home: https://github.com/conda-forge/x86_64_level-feedstock summary: 'Meta package to build conda recipes with x86_64 microarchitecture levels' license: BSD-3-Clause license_file: LICENSE.txt From c9ad38d6e8ec5695ee9a9e575cac96ed240aacde Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 18 Oct 2023 15:23:35 -0500 Subject: [PATCH 05/25] update descriptions --- recipes/x86_64_level/meta.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/x86_64_level/meta.yaml b/recipes/x86_64_level/meta.yaml index 223bddda4e793..709e65a37eda9 100644 --- a/recipes/x86_64_level/meta.yaml +++ b/recipes/x86_64_level/meta.yaml @@ -22,7 +22,7 @@ outputs: The meta-package x86_64_level enforces the microarchitecture in the user system. - Note that a user would need the archspec-base conda package installed + Note that a user would need the archspec conda package installed in the base environment where conda/mamba is run from. See x86_64_level_build for using this in conda recipes @@ -39,8 +39,8 @@ outputs: summary: 'Meta package to build conda recipes with x86_64 microarchitecture levels' description: | Use the meta-package x86_64_level_build in host in conda recipes - to set up the compiler flags and set up the __archspec virtual - package in the run requirements. + to set up the compiler flags and set up the virtual package + requirements in the run requirements. When building packages on CI, level=4 will not be guaranteed, so you can only use level<=3 to build. From 74ad15d69a071e81bf264f1417dc6a23b0cae80f Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 18 Oct 2023 15:39:53 -0500 Subject: [PATCH 06/25] Set CFLAGS and CPPFLAGS too --- recipes/x86_64_level/install_scripts.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/x86_64_level/install_scripts.sh b/recipes/x86_64_level/install_scripts.sh index 977c59b08a5a1..23f94a1993dfc 100644 --- a/recipes/x86_64_level/install_scripts.sh +++ b/recipes/x86_64_level/install_scripts.sh @@ -7,4 +7,6 @@ else fi echo 'export CXXFLAGS="${CXXFLAGS} '$flag'"' >> "${PREFIX}"/etc/conda/activate.d/~activate-x86-64-level.sh +echo 'export CFLAGS="${CFLAGS} '$flag'"' >> "${PREFIX}"/etc/conda/activate.d/~activate-x86-64-level.sh +echo 'export CPPFLAGS="${CPPFLAGS} '$flag'"' >> "${PREFIX}"/etc/conda/activate.d/~activate-x86-64-level.sh chmod +x "${PREFIX}"/etc/conda/activate.d/~activate-x86-64-level.sh From 683d8f5d41244563716d1c177bb8214ab21baf70 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 18 Oct 2023 16:30:44 -0500 Subject: [PATCH 07/25] Package renames Co-authored-by: Matthew R. Becker --- recipes/x86_64_level/meta.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/x86_64_level/meta.yaml b/recipes/x86_64_level/meta.yaml index 709e65a37eda9..3839d3d018b26 100644 --- a/recipes/x86_64_level/meta.yaml +++ b/recipes/x86_64_level/meta.yaml @@ -7,10 +7,10 @@ build: string: 0_{{ microarchitecture }} noarch: generic run_exports: - - x86_64_level >={{ level }} + - _x86_64-microarch-level >={{ level }} outputs: - - name: x86_64_level + - name: _x86_64-microarch-level requirements: run: - __archspec 1={{ microarchitecture }} @@ -29,7 +29,7 @@ outputs: license: BSD-3-Clause license_file: LICENSE.txt - - name: x86_64_level_build + - name: x86_64-microarch-level script: install_scripts.sh requirements: run: From 4466eee3bc70d5a74308c40e44bf0668e1e1d504 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 18 Oct 2023 16:32:52 -0500 Subject: [PATCH 08/25] fix renaming --- recipes/x86_64_level/meta.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/recipes/x86_64_level/meta.yaml b/recipes/x86_64_level/meta.yaml index 3839d3d018b26..deceb382a713c 100644 --- a/recipes/x86_64_level/meta.yaml +++ b/recipes/x86_64_level/meta.yaml @@ -1,5 +1,5 @@ package: - name: x86_64_level-split + name: _x86_64-microarch-level-split version: {{ level }} build: @@ -16,16 +16,16 @@ outputs: - __archspec 1={{ microarchitecture }} about: - home: https://github.com/conda-forge/x86_64_level-feedstock + home: https://github.com/conda-forge/_x86_64-microarch-level-feedstock summary: 'Meta package to build conda recipes with x86_64 microarchitecture levels' description: | - The meta-package x86_64_level enforces the microarchitecture in the + The meta-package _x86_64-microarch-level enforces the microarchitecture in the user system. Note that a user would need the archspec conda package installed in the base environment where conda/mamba is run from. - See x86_64_level_build for using this in conda recipes + See x86_64-microarch-level for using this in conda recipes license: BSD-3-Clause license_file: LICENSE.txt @@ -35,10 +35,10 @@ outputs: run: - __unix about: - home: https://github.com/conda-forge/x86_64_level-feedstock + home: https://github.com/conda-forge/_x86_64-microarch-level-feedstock summary: 'Meta package to build conda recipes with x86_64 microarchitecture levels' description: | - Use the meta-package x86_64_level_build in host in conda recipes + Use the meta-package x86_64-microarch-level in host in conda recipes to set up the compiler flags and set up the virtual package requirements in the run requirements. @@ -55,7 +55,7 @@ outputs: license_file: LICENSE.txt about: - home: https://github.com/conda-forge/x86_64_level-feedstock + home: https://github.com/conda-forge/x86_64-microarch-level-feedstock summary: 'Meta package to build conda recipes with x86_64 microarchitecture levels' license: BSD-3-Clause license_file: LICENSE.txt From 6bdb5908ab1687f2ce949a53a3506043693bf704 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 18 Oct 2023 16:34:07 -0500 Subject: [PATCH 09/25] strong run_exports --- recipes/x86_64_level/meta.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/recipes/x86_64_level/meta.yaml b/recipes/x86_64_level/meta.yaml index deceb382a713c..c5cd9092d742f 100644 --- a/recipes/x86_64_level/meta.yaml +++ b/recipes/x86_64_level/meta.yaml @@ -1,5 +1,5 @@ package: - name: _x86_64-microarch-level-split + name: x86_64-microarch-level-split version: {{ level }} build: @@ -7,7 +7,8 @@ build: string: 0_{{ microarchitecture }} noarch: generic run_exports: - - _x86_64-microarch-level >={{ level }} + strong: + - _x86_64-microarch-level >={{ level }} outputs: - name: _x86_64-microarch-level @@ -38,8 +39,8 @@ outputs: home: https://github.com/conda-forge/_x86_64-microarch-level-feedstock summary: 'Meta package to build conda recipes with x86_64 microarchitecture levels' description: | - Use the meta-package x86_64-microarch-level in host in conda recipes - to set up the compiler flags and set up the virtual package + Use the meta-package x86_64-microarch-level in requirements/build in conda + recipes to set up the compiler flags and set up the virtual package requirements in the run requirements. When building packages on CI, level=4 will not be guaranteed, so From 418292f565a6a6648a5d5eb2f57deb6e92ea8805 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 18 Oct 2023 16:38:07 -0500 Subject: [PATCH 10/25] Fix home URL --- recipes/x86_64_level/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/x86_64_level/meta.yaml b/recipes/x86_64_level/meta.yaml index c5cd9092d742f..0e6908137b652 100644 --- a/recipes/x86_64_level/meta.yaml +++ b/recipes/x86_64_level/meta.yaml @@ -17,7 +17,7 @@ outputs: - __archspec 1={{ microarchitecture }} about: - home: https://github.com/conda-forge/_x86_64-microarch-level-feedstock + home: https://github.com/conda-forge/x86_64-microarch-level-feedstock summary: 'Meta package to build conda recipes with x86_64 microarchitecture levels' description: | The meta-package _x86_64-microarch-level enforces the microarchitecture in the @@ -36,7 +36,7 @@ outputs: run: - __unix about: - home: https://github.com/conda-forge/_x86_64-microarch-level-feedstock + home: https://github.com/conda-forge/x86_64-microarch-level-feedstock summary: 'Meta package to build conda recipes with x86_64 microarchitecture levels' description: | Use the meta-package x86_64-microarch-level in requirements/build in conda From e2131412e8f89ebfbf13927cb7474ef55fac01a5 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 18 Oct 2023 18:00:43 -0500 Subject: [PATCH 11/25] Update recipes/x86_64_level/gen.py Co-authored-by: Marcel Bargull --- recipes/x86_64_level/gen.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/recipes/x86_64_level/gen.py b/recipes/x86_64_level/gen.py index 614a1e86ebce7..dffbbaa4149c7 100644 --- a/recipes/x86_64_level/gen.py +++ b/recipes/x86_64_level/gen.py @@ -14,11 +14,11 @@ for arch_name, arch in archs.items(): if arch.family.name != "x86_64": continue - if arch.parents: - level = max(name_mapping.get(parent.name, 0) for parent in arch.ancestors) - else: - level = 1 - x86_64_levels[arch_name] = level + x86_64_levels[arch_name] = max( + 1, + name_mapping.get(arch_name, 0), + *(name_mapping.get(parent.name, 0) for parent in (arch.ancestors or ())) + ) print("microarchitecture:") for arch in x86_64_levels.keys(): From 5d3359a6095e7901dd185be0257e633bb81c9663 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 18 Oct 2023 18:01:55 -0500 Subject: [PATCH 12/25] Use latest archspec to generate --- recipes/x86_64_level/conda_build_config.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/x86_64_level/conda_build_config.yaml b/recipes/x86_64_level/conda_build_config.yaml index 6ace3b680d7c4..15350e151d0d4 100644 --- a/recipes/x86_64_level/conda_build_config.yaml +++ b/recipes/x86_64_level/conda_build_config.yaml @@ -25,12 +25,13 @@ microarchitecture: - zen - zen2 - zen3 +- zen4 level: - 1 -- 1 - 2 - 3 +- 4 - 1 - 1 - 2 @@ -53,6 +54,7 @@ level: - 3 - 3 - 3 +- 4 zip_keys: - - microarchitecture From dcefa93a80940f7b4a82d41a2cbca437bbb328dc Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 18 Oct 2023 18:10:52 -0500 Subject: [PATCH 13/25] sort --- recipes/x86_64_level/conda_build_config.yaml | 40 ++++++++++---------- recipes/x86_64_level/gen.py | 3 ++ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/recipes/x86_64_level/conda_build_config.yaml b/recipes/x86_64_level/conda_build_config.yaml index 15350e151d0d4..5bdf7f3d66bcc 100644 --- a/recipes/x86_64_level/conda_build_config.yaml +++ b/recipes/x86_64_level/conda_build_config.yaml @@ -1,39 +1,41 @@ microarchitecture: - x86_64 -- x86_64_v2 -- x86_64_v3 -- x86_64_v4 - nocona - core2 +- k10 +- x86_64_v2 - nehalem - westmere - sandybridge - ivybridge +- bulldozer +- piledriver +- steamroller +- x86_64_v3 - haswell - broadwell - skylake - mic_knl -- skylake_avx512 - cannonlake -- cascadelake -- icelake -- k10 -- bulldozer -- piledriver -- steamroller - excavator - zen - zen2 - zen3 +- x86_64_v4 +- skylake_avx512 +- cascadelake +- icelake - zen4 level: - 1 -- 2 -- 3 -- 4 - 1 - 1 +- 1 +- 2 +- 2 +- 2 +- 2 - 2 - 2 - 2 @@ -42,18 +44,16 @@ level: - 3 - 3 - 3 -- 4 - 3 -- 4 -- 4 -- 1 -- 2 -- 2 -- 2 - 3 - 3 - 3 - 3 +- 3 +- 4 +- 4 +- 4 +- 4 - 4 zip_keys: diff --git a/recipes/x86_64_level/gen.py b/recipes/x86_64_level/gen.py index dffbbaa4149c7..1dc06507b786b 100644 --- a/recipes/x86_64_level/gen.py +++ b/recipes/x86_64_level/gen.py @@ -20,6 +20,9 @@ *(name_mapping.get(parent.name, 0) for parent in (arch.ancestors or ())) ) +x86_64_levels = {arch: level for arch, level in sorted( + x86_64_levels.items(), key=lambda kv: kv[1])} + print("microarchitecture:") for arch in x86_64_levels.keys(): print(f"- {arch}") From 7603ffcca278a57c5ca001f11b5bfd1c1ea1b0c3 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 18 Oct 2023 18:21:50 -0500 Subject: [PATCH 14/25] Add comment about auto-generation --- recipes/x86_64_level/conda_build_config.yaml | 1 + recipes/x86_64_level/gen.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/recipes/x86_64_level/conda_build_config.yaml b/recipes/x86_64_level/conda_build_config.yaml index 5bdf7f3d66bcc..712d786d06f05 100644 --- a/recipes/x86_64_level/conda_build_config.yaml +++ b/recipes/x86_64_level/conda_build_config.yaml @@ -1,3 +1,4 @@ +# This file is auto-generated by recipe/gen.py microarchitecture: - x86_64 - nocona diff --git a/recipes/x86_64_level/gen.py b/recipes/x86_64_level/gen.py index 1dc06507b786b..7506653787ac4 100644 --- a/recipes/x86_64_level/gen.py +++ b/recipes/x86_64_level/gen.py @@ -23,6 +23,7 @@ x86_64_levels = {arch: level for arch, level in sorted( x86_64_levels.items(), key=lambda kv: kv[1])} +print("# This file is auto-generated by recipe/gen.py") print("microarchitecture:") for arch in x86_64_levels.keys(): print(f"- {arch}") @@ -30,3 +31,7 @@ print("level:") for level in x86_64_levels.values(): print(f"- {level}") +print(""" +zip_keys: + - - microarchitecture + - level""") From c557a7257c5a84fc9e0b0e62cc0f1d725dcf9584 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 18 Oct 2023 18:23:23 -0500 Subject: [PATCH 15/25] add comment about unix --- recipes/x86_64_level/meta.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/x86_64_level/meta.yaml b/recipes/x86_64_level/meta.yaml index 0e6908137b652..c84237762f20b 100644 --- a/recipes/x86_64_level/meta.yaml +++ b/recipes/x86_64_level/meta.yaml @@ -52,6 +52,8 @@ outputs: level=3 on a CI machine with level=3. Therefore in order to prioritise the highest level, use the build number to prioritise the level. + + Only supported on Linux and macOS. license: BSD-3-Clause license_file: LICENSE.txt From 95e32f7eee0ab89fb1d2ccf5104823ed6297f145 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Tue, 24 Oct 2023 14:32:00 -0500 Subject: [PATCH 16/25] Add ppc64le --- recipes/x86_64_level/gen.py | 27 +++++++++++++++++++-------- recipes/x86_64_level/meta.yaml | 27 ++++++++++++++------------- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/recipes/x86_64_level/gen.py b/recipes/x86_64_level/gen.py index 7506653787ac4..8d32cb52b4b83 100644 --- a/recipes/x86_64_level/gen.py +++ b/recipes/x86_64_level/gen.py @@ -2,36 +2,47 @@ archs = archspec.cpu.TARGETS -x86_64_levels = {} +levels = {} name_mapping = { "x86_64": 1, "x86_64_v2": 2, "x86_64_v3": 3, "x86_64_v4": 4, + + "ppc64le": 8, + "power8le": 8, + "power9le": 9, + "power10le": 10, } for arch_name, arch in archs.items(): - if arch.family.name != "x86_64": + if arch.family.name not in ("x86_64", "ppc64le"): + print(arch_name, arch.family.name) continue - x86_64_levels[arch_name] = max( + levels[(arch_name, arch.family.name)] = max( 1, name_mapping.get(arch_name, 0), *(name_mapping.get(parent.name, 0) for parent in (arch.ancestors or ())) ) -x86_64_levels = {arch: level for arch, level in sorted( - x86_64_levels.items(), key=lambda kv: kv[1])} +levels = {arch: level for arch, level in sorted( + levels.items(), key=lambda kv: kv[1])} print("# This file is auto-generated by recipe/gen.py") print("microarchitecture:") -for arch in x86_64_levels.keys(): +for arch, _ in levels.keys(): print(f"- {arch}") print() print("level:") -for level in x86_64_levels.values(): +for level in levels.values(): print(f"- {level}") +print() +print("family:") +for _, family in levels.keys(): + print(f"- {family}") print(""" zip_keys: - - microarchitecture - - level""") + - level + - family""") diff --git a/recipes/x86_64_level/meta.yaml b/recipes/x86_64_level/meta.yaml index c84237762f20b..6b5cc8ae10ec3 100644 --- a/recipes/x86_64_level/meta.yaml +++ b/recipes/x86_64_level/meta.yaml @@ -1,5 +1,5 @@ package: - name: x86_64-microarch-level-split + name: microarch-level-split version: {{ level }} build: @@ -8,38 +8,38 @@ build: noarch: generic run_exports: strong: - - _x86_64-microarch-level >={{ level }} + - _{{ family }}-microarch-level >={{ level }} outputs: - - name: _x86_64-microarch-level + - name: _{{ family }}-microarch-level requirements: run: - __archspec 1={{ microarchitecture }} about: - home: https://github.com/conda-forge/x86_64-microarch-level-feedstock - summary: 'Meta package to build conda recipes with x86_64 microarchitecture levels' + home: https://github.com/conda-forge/microarch-level-feedstock + summary: 'Meta package to build conda recipes with microarchitecture levels' description: | - The meta-package _x86_64-microarch-level enforces the microarchitecture in the + The meta-package _{{ family }}-microarch-level enforces the microarchitecture in the user system. Note that a user would need the archspec conda package installed in the base environment where conda/mamba is run from. - See x86_64-microarch-level for using this in conda recipes + See {{ family }}-microarch-level for using this in conda recipes license: BSD-3-Clause license_file: LICENSE.txt - - name: x86_64-microarch-level + - name: {{ family }}-microarch-level script: install_scripts.sh requirements: run: - __unix about: - home: https://github.com/conda-forge/x86_64-microarch-level-feedstock - summary: 'Meta package to build conda recipes with x86_64 microarchitecture levels' + home: https://github.com/conda-forge/microarch-level-feedstock + summary: 'Meta package to build conda recipes with microarchitecture levels' description: | - Use the meta-package x86_64-microarch-level in requirements/build in conda + Use the meta-package {{ family }}-microarch-level in requirements/build in conda recipes to set up the compiler flags and set up the virtual package requirements in the run requirements. @@ -58,11 +58,12 @@ outputs: license_file: LICENSE.txt about: - home: https://github.com/conda-forge/x86_64-microarch-level-feedstock - summary: 'Meta package to build conda recipes with x86_64 microarchitecture levels' + home: https://github.com/conda-forge/microarch-level-feedstock + summary: 'Meta package to build conda recipes with microarchitecture levels' license: BSD-3-Clause license_file: LICENSE.txt extra: + feedstock-name: microarch-level recipe-maintainers: - isuruf From 957205e87c0483ad34de495e16f6acc1329a1df2 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 30 Oct 2023 14:16:28 -0500 Subject: [PATCH 17/25] regen --- recipes/x86_64_level/conda_build_config.yaml | 39 ++++++++++++++++++++ recipes/x86_64_level/gen.py | 1 - 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/recipes/x86_64_level/conda_build_config.yaml b/recipes/x86_64_level/conda_build_config.yaml index 712d786d06f05..e6d653ef07db6 100644 --- a/recipes/x86_64_level/conda_build_config.yaml +++ b/recipes/x86_64_level/conda_build_config.yaml @@ -27,6 +27,9 @@ microarchitecture: - cascadelake - icelake - zen4 +- ppc64le +- power8le +- power9le level: - 1 @@ -56,7 +59,43 @@ level: - 4 - 4 - 4 +- 8 +- 8 +- 9 + +family: +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- x86_64 +- ppc64le +- ppc64le +- ppc64le zip_keys: - - microarchitecture - level + - family diff --git a/recipes/x86_64_level/gen.py b/recipes/x86_64_level/gen.py index 8d32cb52b4b83..05e80d9802dab 100644 --- a/recipes/x86_64_level/gen.py +++ b/recipes/x86_64_level/gen.py @@ -18,7 +18,6 @@ for arch_name, arch in archs.items(): if arch.family.name not in ("x86_64", "ppc64le"): - print(arch_name, arch.family.name) continue levels[(arch_name, arch.family.name)] = max( 1, From aefde8a0970314d07ebe217edf95e8d28cd5da10 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 30 Oct 2023 15:26:14 -0500 Subject: [PATCH 18/25] Fix flags --- recipes/x86_64_level/install_scripts.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/recipes/x86_64_level/install_scripts.sh b/recipes/x86_64_level/install_scripts.sh index 23f94a1993dfc..f79f2ff5795f8 100644 --- a/recipes/x86_64_level/install_scripts.sh +++ b/recipes/x86_64_level/install_scripts.sh @@ -1,9 +1,13 @@ mkdir -p "${PREFIX}"/etc/conda/{de,}activate.d/ -if [[ "$level" == "1" ]]; then - flag="-march=x86-64" -else - flag="-march=x86-64-v{{ level }}" +if [[ "${family}" == "x86_64" ]]; then + if [[ "${level}" == "1" ]]; then + flag="-march=x86-64" + else + flag="-march=x86-64-v${level}" + fi +elif [[ "${family}" == "ppc64le" ]]; then + flag="-mcpu=${level}" fi echo 'export CXXFLAGS="${CXXFLAGS} '$flag'"' >> "${PREFIX}"/etc/conda/activate.d/~activate-x86-64-level.sh From 198ad6bcdace0b21245afeab04e3ae58f6fce592 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 1 Nov 2023 22:19:30 -0500 Subject: [PATCH 19/25] Template build number Co-authored-by: jakirkham --- recipes/x86_64_level/meta.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes/x86_64_level/meta.yaml b/recipes/x86_64_level/meta.yaml index 6b5cc8ae10ec3..80572375d2a5b 100644 --- a/recipes/x86_64_level/meta.yaml +++ b/recipes/x86_64_level/meta.yaml @@ -1,10 +1,12 @@ +{% set number = 0 %} + package: name: microarch-level-split version: {{ level }} build: - number: 0 - string: 0_{{ microarchitecture }} + number: {{ number }} + string: {{ number }}_{{ microarchitecture }} noarch: generic run_exports: strong: From 4510ce53688c1b4e1fb588f067226cc169e72336 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Tue, 7 Nov 2023 09:14:33 -0600 Subject: [PATCH 20/25] Use family in name Co-authored-by: Marcel Bargull --- recipes/x86_64_level/install_scripts.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/recipes/x86_64_level/install_scripts.sh b/recipes/x86_64_level/install_scripts.sh index f79f2ff5795f8..9eb0664d24c0f 100644 --- a/recipes/x86_64_level/install_scripts.sh +++ b/recipes/x86_64_level/install_scripts.sh @@ -10,7 +10,8 @@ elif [[ "${family}" == "ppc64le" ]]; then flag="-mcpu=${level}" fi -echo 'export CXXFLAGS="${CXXFLAGS} '$flag'"' >> "${PREFIX}"/etc/conda/activate.d/~activate-x86-64-level.sh -echo 'export CFLAGS="${CFLAGS} '$flag'"' >> "${PREFIX}"/etc/conda/activate.d/~activate-x86-64-level.sh -echo 'export CPPFLAGS="${CPPFLAGS} '$flag'"' >> "${PREFIX}"/etc/conda/activate.d/~activate-x86-64-level.sh -chmod +x "${PREFIX}"/etc/conda/activate.d/~activate-x86-64-level.sh +cat << EOF > "${PREFIX}/etc/conda/activate.d/~activate-${family}-level.sh" +export CXXFLAGS="\${CXXFLAGS} ${flag}" +export CFLAGS="\${CFLAGS} ${flag}" +export CPPFLAGS="\${CPPFLAGS} ${flag}" +EOF From 9a8b322d477015bbc492378436a00b5df84d63e8 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Tue, 7 Nov 2023 09:42:02 -0600 Subject: [PATCH 21/25] Fix build --- recipes/x86_64_level/meta.yaml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/recipes/x86_64_level/meta.yaml b/recipes/x86_64_level/meta.yaml index 80572375d2a5b..9721ecf991a5f 100644 --- a/recipes/x86_64_level/meta.yaml +++ b/recipes/x86_64_level/meta.yaml @@ -7,13 +7,14 @@ package: build: number: {{ number }} string: {{ number }}_{{ microarchitecture }} - noarch: generic - run_exports: - strong: - - _{{ family }}-microarch-level >={{ level }} outputs: - - name: _{{ family }}-microarch-level + - name: _{{ family }}-microarch-levelbuild + build: + noarch: generic + run_exports: + strong: + - _{{ family }}-microarch-level >={{ level }} requirements: run: - __archspec 1={{ microarchitecture }} @@ -34,6 +35,11 @@ outputs: - name: {{ family }}-microarch-level script: install_scripts.sh + build: + noarch: generic + run_exports: + strong: + - _{{ family }}-microarch-level >={{ level }} requirements: run: - __unix From 2ed37d7f82a0c384d5695ea814af70368eaf6cb9 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Tue, 7 Nov 2023 09:45:28 -0600 Subject: [PATCH 22/25] Update for new archspec --- recipes/x86_64_level/conda_build_config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/x86_64_level/conda_build_config.yaml b/recipes/x86_64_level/conda_build_config.yaml index e6d653ef07db6..a192d88a2addd 100644 --- a/recipes/x86_64_level/conda_build_config.yaml +++ b/recipes/x86_64_level/conda_build_config.yaml @@ -30,6 +30,7 @@ microarchitecture: - ppc64le - power8le - power9le +- power10le level: - 1 @@ -62,6 +63,7 @@ level: - 8 - 8 - 9 +- 10 family: - x86_64 @@ -94,6 +96,7 @@ family: - ppc64le - ppc64le - ppc64le +- ppc64le zip_keys: - - microarchitecture From 73c096919a3e740eb8a2b1eb9058d535cc533c64 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Tue, 7 Nov 2023 10:20:06 -0600 Subject: [PATCH 23/25] Fix build strings --- recipes/x86_64_level/meta.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/recipes/x86_64_level/meta.yaml b/recipes/x86_64_level/meta.yaml index 9721ecf991a5f..87e7874f07b04 100644 --- a/recipes/x86_64_level/meta.yaml +++ b/recipes/x86_64_level/meta.yaml @@ -9,8 +9,10 @@ build: string: {{ number }}_{{ microarchitecture }} outputs: - - name: _{{ family }}-microarch-levelbuild + - name: _{{ family }}-microarch-level build: + number: {{ number }} + string: {{ number }}_{{ microarchitecture }} noarch: generic run_exports: strong: @@ -36,6 +38,8 @@ outputs: - name: {{ family }}-microarch-level script: install_scripts.sh build: + number: {{ number }} + string: {{ number }}_{{ microarchitecture }} noarch: generic run_exports: strong: From 026fd419a40ea502ee73fc12be45f53abb467b07 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Tue, 7 Nov 2023 13:45:49 -0600 Subject: [PATCH 24/25] Keep the whole recipe noarch:generic Co-authored-by: Marcel Bargull --- recipes/x86_64_level/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/x86_64_level/meta.yaml b/recipes/x86_64_level/meta.yaml index 87e7874f07b04..6510ab9a28036 100644 --- a/recipes/x86_64_level/meta.yaml +++ b/recipes/x86_64_level/meta.yaml @@ -7,6 +7,7 @@ package: build: number: {{ number }} string: {{ number }}_{{ microarchitecture }} + noarch: generic outputs: - name: _{{ family }}-microarch-level From 1a33eb802be7853428c8b4ab10306c595601187d Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Tue, 7 Nov 2023 14:08:02 -0600 Subject: [PATCH 25/25] Record archspec version Co-authored-by: Marcel Bargull --- recipes/x86_64_level/gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/x86_64_level/gen.py b/recipes/x86_64_level/gen.py index 05e80d9802dab..bb2cffa977f7b 100644 --- a/recipes/x86_64_level/gen.py +++ b/recipes/x86_64_level/gen.py @@ -28,7 +28,7 @@ levels = {arch: level for arch, level in sorted( levels.items(), key=lambda kv: kv[1])} -print("# This file is auto-generated by recipe/gen.py") +print(f"# This file is auto-generated by recipe/gen.py with archspec={archspec.__version__}") print("microarchitecture:") for arch, _ in levels.keys(): print(f"- {arch}")