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 3 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
6 changes: 5 additions & 1 deletion easybuild/easyblocks/o/opencv.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ def configure_step(self):
# 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']:
optarch = build_option('optarch')
if not optarch:
if (
not optarch
or (get_software_root('GCC') and (optarch == 'march=native' or optarch.get('GCC') == 'march=native'))
or (get_software_root('intel-compilers') and (optarch == 'xHost' or optarch.get('Intel') == 'xHost'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we don't hardcode march=native and xHost here, since those values may change.

We should check whether we can extract the default from framework (and if not maybe we need to introduce a constant in framework so the default can be easily obtained without hardcoding)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And note that a manually set optarch may well be something more than march=native/xHost so a simple == doesn't suffice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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