Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

DOC: Add instructions to build NumPy on WoA #28141

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

Merged
merged 2 commits into from
Mar 26, 2025

Conversation

Mugundanmcw
Copy link
Contributor

This pull request introduces documentation to guide users for building NumPy from source on Windows on Arm64(WoA).

  1. Add intructions to build NumPy on WoA:
  • This commit updates the source file index.rst to include comprehensive steps for building NumPy on WoA in documentation
  • The current build setup successfully compiles NumPy on WoA using the MSVC compiler along with flang-new.
  • The updated documentation includes a reference for linking and compiling OpenBLAS on WoA for NumPy.

@ngoldbaum
Copy link
Member

I'm a little unclear why the NumPy docs need to talk about installing a Fortran compiler? Shouldn't that information be in e.g. the OpenBLAS docs.

Glad you got your NumPy install figured out.

@Mugundanmcw Mugundanmcw reopened this Jan 14, 2025
@Mugundanmcw
Copy link
Contributor Author

Hi @ngoldbaum

  • Compiling NumPy from source does not require a Fortran compiler for the build process.
  • However, f2py, which is located in the numpy/f2py directory, requires a Fortran compiler. It is used for linking and compiling Fortran source code to generate a shared object, which is then linked with the Python interface via f2py (Fortran to Python interface generator). That is the reason I include a link to install flang-new in the NumPy documentation.

Thanks!

@ngoldbaum
Copy link
Member

Sorry, I missed that the surrounding text was already describing how to set up fortran compilers. I don't have time right now to follow these instructions and verify that they're correct, but it looks like an improvement to me.

I agree changing the command to not install all_requirements is probably correct in that context.

It seems like there aren't any more blockers to setting up Windows Arm64 CI - maybe we should to that?

See https://github.blog/changelog/2024-09-03-github-actions-arm64-linux-and-windows-runners-are-now-generally-available/.

@ngoldbaum ngoldbaum added the triage review Issue/PR to be discussed at the next triage meeting label Jan 14, 2025
@ngoldbaum
Copy link
Member

I added the triage review label which should hopefully get the attention of another reviewer with more context about Windows packaging to hit the merge button or give you more comments.

tests, simply using MSVC is easiest. Otherwise, you will need the following
set of compilers:

1. MSVC + Flang-new (``flang-new``)
Copy link
Member

Choose a reason for hiding this comment

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

What about the ifx compiler and lfortran? Perhaps @certik knows better about ARM64 support (don't have a machine to test).

Otherwise this looks good.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think currently the above is correct. If there is interest from anybody, we are open to collaborate with NumPy on LFortran support. Otherwise I recommend to wait until we reach beta quality.

Copy link
Member

Choose a reason for hiding this comment

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

Note that in LLVM 20 (release imminent I think, it's at 20.1.0rc3 now), flang-new becomes simply flang. That would be good to include here.

Copy link
Member

@HaoZeke HaoZeke left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @Mugundanmcw!

On a second read-through, I think most of this is probably better situated in the context of the f2py/windows/ folder. However, there's plenty of duplication as is, so I'm changing this to a comment instead of a requested change.

Since a bunch of windows + fortran compiler toolchains are discussed there, adding these instructions in a new file, say arm64.rst then to the f2py/windows/index.rst and finally linking to that file from the building document makes more sense.

Copy link
Member

@HaoZeke HaoZeke left a comment

Choose a reason for hiding this comment

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

LGTM, perhaps a follow up de-duplicating information in the F2PY documentation would be nice.

EDIT: Now tracked in #28187


.. tab-item:: MSVC

The MSVC installer does not put the compilers on the system path, and
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be worth specifying a .config file for a minimal Visual Studio install that will support the build? As in the one that used to be at https://community.arm.com/arm-community-blogs/b/tools-software-ides-blog/posts/native-clang-for-windows-on-arm - you can find an intact woa.config file at https://web.archive.org/web/20200915005824/https://s3armawstosg.s3-us-west-2.amazonaws.com/clang/10.0.1/woa.vsconfig.

Copy link
Member

Choose a reason for hiding this comment

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

Linking to a gist like that with a stable URL would be useful - it's too long to include verbatim.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rgommers It is necessary to link VS config file for MSVC, I have a minimal VS config that supports building NumPy on WoA, but how that could be linked over here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Between from VS installer, installing Desktop development with C++ workload is more enough to build NumPy on WoA

Copy link
Member

Choose a reason for hiding this comment

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

but how that could be linked over here?

My suggestion was a gist, meaning you put it at https://gist.github.com/ as a new gist under your username and link to that.

In Windows on ARM64, the set of a compiler options that are available for
building NumPy are limited. Compilers such as GCC and GFortran are not yet
supported for Windows on ARM64. Currently, the NumPy build for Windows on ARM64
is supported with MSVC toolchain only. The use of a Fortran compiler is more
Copy link
Member

Choose a reason for hiding this comment

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

I think this limitation is fixed now that #28234 is merged - would you mind pushing a quick edit of this text?

Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

This looks pretty close. A few comments.

tests, simply using MSVC is easiest. Otherwise, you will need the following
set of compilers:

1. MSVC + Flang-new (``flang-new``)
Copy link
Member

Choose a reason for hiding this comment

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

Note that in LLVM 20 (release imminent I think, it's at 20.1.0rc3 now), flang-new becomes simply flang. That would be good to include here.

1. MSVC + Flang-new (``flang-new``)

First, install Microsoft Visual Studio - the 2022 Community Edition will
work(see the `Visual Studio download site <https://visualstudio.microsoft.com/downloads/>`__).
Copy link
Member

Choose a reason for hiding this comment

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

typo: space after "work"

of Visual Studio can be deselected if desired, to save disk space). The
recommended version of the UCRT is >= 10.0.22621.0.

To use flang-new fortran compiler for Windows on ARM64, install Latest LLVM
Copy link
Member

Choose a reason for hiding this comment

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

So here better to call it "the Flang compiler"


.. tab-item:: MSVC

The MSVC installer does not put the compilers on the system path, and
Copy link
Member

Choose a reason for hiding this comment

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

Linking to a gist like that with a stable URL would be useful - it's too long to include verbatim.

Building NumPy with BLAS and LAPACK functions requires OpenBLAS
library at Runtime. In Windows on ARM64, this can be done by setting
up pkg-config for OpenBLAS dependency. The build steps for OpenBLAS
for Windows on ARM64 can be found `here <https://github.com/OpenMathLib/OpenBLAS/blob/develop/docs/install.md#windows-on-arm>`__.
Copy link
Member

Choose a reason for hiding this comment

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

Better to link to the actual html docs here: http://www.openmathlib.org/OpenBLAS/docs/install/#windows-on-arm

Copy link
Contributor Author

@Mugundanmcw Mugundanmcw Feb 28, 2025

Choose a reason for hiding this comment

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

@rgommers yeah sure, would make the appropriate changes and edit the PR

@rgommers rgommers changed the title DOC: Add intructions to build NumPy on WoA DOC: Add instructions to build NumPy on WoA Feb 27, 2025
@Mugundanmcw
Copy link
Contributor Author

@rgommers, @matthew-brett, and @ngoldbaum, could you please review the latest commit which includes the necessary changes?

@melissawm melissawm moved this from Pending authors' response to Awaiting a code review in NumPy first-time contributor PRs Mar 5, 2025
Copy link
Member

@ngoldbaum ngoldbaum left a comment

Choose a reason for hiding this comment

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

I'm no Windows expert but this definitely looks like an improvement and I don't see any issues.

Test failures are unrelated and will likely go away if you merge with main or push a commit with annotations that it doesn't need actions, cirrus, or azp CI: https://numpy.org/doc/stable/dev/development_workflow.html#commands-to-skip-continuous-integration

The docs build runs on circleci so you do need that.

@charris charris merged commit aca10dc into numpy:main Mar 26, 2025
66 of 68 checks passed
@github-project-automation github-project-automation bot moved this from Awaiting a code review to Completed in NumPy first-time contributor PRs Mar 26, 2025
@charris
Copy link
Member

charris commented Mar 26, 2025

Thanks @Mugundanmcw .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
04 - Documentation triage review Issue/PR to be discussed at the next triage meeting
Projects
Development

Successfully merging this pull request may close these issues.

7 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.