Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BLD/MAINT: improve support for Intel LLVM compilers - #31389

Merged
seberg merged 1 commit into
numpy:mainfrom
rgommers:intel-compiler-fixes
May 5, 2026
Merged

BLD/MAINT: improve support for Intel LLVM compilers#31389
seberg merged 1 commit into
numpy:mainfrom
rgommers:intel-compiler-fixes

Conversation

@rgommers

@rgommers rgommers commented May 5, 2026

Copy link
Copy Markdown
Member

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 gh-25044

Closes gh-25044
Closes gh-31337 (reports the same _Fcomplex issue)

Note: I decided to start fresh because gh-25044 accumulated a conflict, and while most of that PR should no longer be relevant, I didn't want to just push a commit to remove that code. This is the most important and the clearly correct part of that PR, and there's no reason that wasn't merged already.

AI Disclosure

No AI usage

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 <[email protected]>
@rgommers rgommers added 00 - Bug 09 - Backport-Candidate PRs tagged should be backported 36 - Build Build related PR labels May 5, 2026
@rgommers rgommers added this to the 2.5.0 Release milestone May 5, 2026
@rgommers
rgommers requested a review from mattip May 5, 2026 09:23

@seberg seberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, LGTM, and as per discussion on the issue an important fix for intel compilers.

@seberg
seberg merged commit 0f897ea into numpy:main May 5, 2026
84 of 86 checks passed
@rgommers
rgommers deleted the intel-compiler-fixes branch May 5, 2026 10:38
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label May 5, 2026
typedef _Fcomplex npy_cfloat;
typedef _Lcomplex npy_clongdouble;
#else /* !defined(_MSC_VER) || defined(__INTEL_COMPILER) */
#else /* !defined(_MSC_VER) || defined(__INTEL_COMPILER) && !defined(__INTEL_LLVM_COMPILER) */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor: I suppose the final conditional in the comment should be inverted like its neighbors relative to above with a preceding ||

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah indeed. Doesn't matter much since it's just a comment; I was just in too much of a hurry it looks like. Not sure why the comment is even there, deleting it seems cleaner.

rgommers added a commit to rgommers/numpy that referenced this pull request Sep 8, 2026
Since numpygh-31389, npy_common.h exempted __INTEL_LLVM_COMPILER from the branch
using the MSVC runtime's _Fcomplex/_Dcomplex/_Lcomplex, so npy_cdouble became
`double _Complex` for icx on Windows. The accessors in npy_math.h still call
the runtime's creal()/cimag() though, and those are declared as taking
_Dcomplex & co. regardless of which front end compiles them - it is the same C
runtime. The two headers disagreed, so `#include <numpy/npy_math.h>` on its own
stopped compiling with icx, which broke downstream builds of mkl_umath.

Which complex types exist is a property of the C runtime, not of the compiler
front end, so drop the exemption. That restores the 2.4.4 behaviour, which is
known to build with icx.

The two spellings are layout-compatible, so extensions that only use these
types to describe array data were unaffected beyond the compile error. For
extensions linking npymath it also changed the signature of every function
there taking or returning a complex value by value; npymath is shipped as a
static library, built with MSVC for the official wheels.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

00 - Bug 36 - Build Build related PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Failed to build numpy on Windows using intel compiler

4 participants