Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use DCPU_BASELINE=DETECT for OpenCV when default optarch compiler option is used #2954

Merged
merged 7 commits into from
Aug 30, 2023
Merged
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
15 changes: 15 additions & 0 deletions easybuild/easyblocks/o/opencv.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,23 @@ def configure_step(self):
# configure optimisation for CPU architecture
# see https://github.com/opencv/opencv/wiki/CPU-optimizations-build-options
if self.toolchain.options.get('optarch') and 'CPU_BASELINE' not in self.cfg['configopts']:
optimal_arch_option = self.toolchain.COMPILER_OPTIMAL_ARCHITECTURE_OPTION.get(
(self.toolchain.arch, self.toolchain.cpu_family), '')
optarch = build_option('optarch')
optarch_detect = False
if not optarch:
optarch_detect = True
elif isinstance(optarch, str):
optarch_detect = optimal_arch_option in optarch
elif isinstance(optarch, dict):
optarch_gcc = optarch.get('GCC')
optarch_intel = optarch.get('Intel')
gcc_detect = get_software_root('GCC') and (not optarch_gcc or optimal_arch_option in optarch_gcc)
intel_root = get_software_root('iccifort') or get_software_root('intel-compilers')
intel_detect = intel_root and (not optarch_intel or optimal_arch_option in optarch_intel)
optarch_detect = gcc_detect or intel_detect

if optarch_detect:
# optimize for host arch (let OpenCV detect it)
self.cfg.update('configopts', '-DCPU_BASELINE=DETECT')
elif optarch == OPTARCH_GENERIC:
Expand Down