BLD: Check Intel compiler when checking complex types in build#25044
BLD: Check Intel compiler when checking complex types in build#25044lysnikolaou wants to merge 5 commits into
Conversation
Fixes numpy#25034. use clearer syntax Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
320cea0 to
0ff966e
Compare
|
Rebased to fix the accidental submodule merge (and squash commits). Since it's a one line change and nobody commented on it, will assume this is a step in the right direction. Thanks @lysnikolaou. |
|
I'm not sure about this, but I think I can recall EDIT: Yes, |
|
Argg, sorry... Interesting, but that makes me think that more that switching to C11 requires also changing this here in gh-25072. |
also add 'std=' flags and avoid a '-utf-8' flag by adding '-source-charset'
|
I added a few more changes, especially the one needed for fast math from this comment in the issue and adding a few more |
|
Hmm. it seems |
Yup, that's right. I think |
|
This is what we want, right?
So `cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl' |
|
CI is passing |
|
I don't understand the Intel/fastmath related change well enough to comment on it, but the rest looks good! |
rgommers
left a comment
There was a problem hiding this comment.
This looks pretty good, thanks Matti and Lysandros. One question in a comment inline. Second question: there are quite a few more __INTEL_COMPILER usages in the code base, did you audit those, or only changed the 3 in this PR in response to build/test failures?
| _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') |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
|
I only added This PR is still incomplete: linking fails. To recap (from a comment in the issue), to test this PR one needs to
If we decide this is important, there is an example github repo with a workflow that downloads and caches the compiler. |
I tried this before in scipy/scipy#16957. It's a real pain to work with. I'm hoping the Intel compilers before available in conda-forge (we had some discussions with Intel engineers around that), then it'll be much easier. I wouldn't bother now. |
|
Needs rebase. |
|
Be good to finish this. |
|
There is so much already in 2.0 I didn't want to add more. Also
and I have not gotten it to work yet |
|
Got it. I only wanted to remind you all of it, just in case it was missed. |
|
With new version of visual studio professional following is the status: Build command: python -m pip install . -Cbuild-dir=build -Csetup-args=-Dallow-noblas=false -Csetup-args=-Dblas-order=mkl -Csetup-args=-Dlapack-order=mkl -Csetup-args=-Dblas=mkl -Csetup-args=-Dlapack=mkl Selecting Microsoft compilers with MKL PASSES: set CC=clang-cl Setting intel icx fails with error npy_clongdouble definition is not compatible with C99 complex definition ! By default numpy selected cl compiler + MKL during build with new intelOneAPI. icx is still a problem. same error. For numpy 2.1.3 meson fails to detect icx: |
|
Would it be possible if the changes to numpy/_core/include/numpy/npy_common.h from commit c9de672 were merged back? For context, we are not building numpy from source, but do link it to our c application which is build with icx. This currently gives compilation errors because _Dcomplex is unknown, which is fixed by the npy_common.h patch. |
|
@s-fleuren thanks for the ping, this just fell through the cracks it looks like. Just to confirm, with only commit c9de672, does your application work fine? |
|
As far as I can see yes. We're still in the process of updating some other dependencies, so I can't run our full test suite yet. But the change to npy_common.h was enough to get the application to compile again, and basic Numpy operations work. |
With these changes, downstream users wanting to use the Intel compilers can do so when linking against NumPy headers. Also include a build change for NumPy itself that is clearly correct: Intel compilers do not use `_Fcomplex` & co for complex types, but the regular C99 complex.h types. Taken over from PR 25044 Closes gh-25044 Closes gh-31337 (reports the same `_Fcomplex` issue) Co-authored-by: Matti Picus <matti.picus@gmail.com>
With these changes, downstream users wanting to use the Intel compilers can do so when linking against NumPy headers. Also include a build change for NumPy itself that is clearly correct: Intel compilers do not use `_Fcomplex` & co for complex types, but the regular C99 complex.h types. Taken over from PR 25044 Closes gh-25044 Closes gh-31337 (reports the same `_Fcomplex` issue) Co-authored-by: Matti Picus <matti.picus@gmail.com>
With these changes, downstream users wanting to use the Intel compilers can do so when linking against NumPy headers. Also include a build change for NumPy itself that is clearly correct: Intel compilers do not use `_Fcomplex` & co for complex types, but the regular C99 complex.h types. Taken over from PR 25044 Closes numpygh-25044 Closes numpygh-31337 (reports the same `_Fcomplex` issue) Co-authored-by: Matti Picus <matti.picus@gmail.com>
Fixes #25034.