8000 BLD: Check Intel compiler when checking complex types in build by lysnikolaou · Pull Request #25044 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BLD: Check Intel compiler when checking complex types in build #25044

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
BLD: avoid fast-math on intel compilers (taken from scipy)
also add 'std=' flags and avoid a '-utf-8' flag by adding '-source-charset'
  • Loading branch information
mattip committed Nov 7, 2023
commit 33849a44686b7b6c4ad681e089f4aa5c3a6ec569
23 changes: 23 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,29 @@ if not cy.version().version_compare('>=0.29.34')
error('NumPy requires Cython >= 0.29.34')
endif

# Intel compilers default to fast-math, so disable it if we detect Intel
# compilers. A word of warning: this may not work with the conda-forge
# compilers, because those have the annoying habit of including lots of flags
# that are gcc-specific in CFLAGS/CXXFLAGS/FFLAGS, which throws off the
# detection logic below. You have to remove the wrong flags (only `-isystem`
# is actually needed, everything else shouldn't be there).
_intel_cflags = []
if cc.get_id() == 'intel'
_intel_cflags += cc.get_supported_arguments('-fp-model=strict')
elif cc.get_id() == 'intel-cl'
_intel_cflags += cc.get_supported_arguments('/fp:strict')
elif cc.get_id() == 'intel-llvm-cl'
_intel_cflags += cc.get_supported_arguments('/fp:strict')
_intel_cflags += cc.get_supported_arguments('/source-charset:utf-8')
endif
add_project_arguments(_intel_cflags, language: ['c', 'cpp'])
if cc.get_id() == 'intel-llvm-cl'
_intel_c99_flag = cc.get_supported_arguments('/Qstd=c99')
add_project_arguments(_intel_c99_flag, language: 'c')
_intel_c17 = cpp.get_supported_arguments('/Qstd=c++17')
add_project_arguments(_intel_c17, language: 'cpp')
Copy link
Member

Choose a reason for hiding this comment

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

This whole if block looks incorrect, because it hardcodes flags that should be set already by the default options higher up. And that may be a problem soon because I already have a PR open to upgrade from C99 to C11. Did you add this to work around a problem with the default flags Meson is adding? If so, let's add a comment and link the upstream issue for it.

Copy link
Member

Choose a reason for hiding this comment

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

This was to solve the same problem as in #25072: hundreds of warnings about needed language standards. I am happy to wait for that PR to land first.

Copy link
Member

Choose a reason for hiding this comment

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

Oh yes, you added the /Qstd=c99 warning higher up. That should already be added, because we have c_std=c99' in default_options at the top of meson.build. If it's indeed not added, can you open a Meson issue for it?

To check if it's added:

cd build
python ../vendored-meson/meson/meson.py introspect --targets -i | grep c99

Copy link
Member

Choose a reason for hiding this comment

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

On main of course the build fails when checking for complex, which what started this whole exercise in the first place. But if I run the command on the broken build, I do not see any c99. Maybe I need to create a minimal reproducer for a proper meson issue.

endif

py = import('python').find_installation(pure: false)
py_dep = py.dependency()

Expand Down
0