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

ENH: Add support for windows on arm targets #19513

Merged
merged 7 commits into from Jul 27, 2021

Conversation

niyas-sait
Copy link
Contributor

No description provided.

@charris
Copy link
Member

charris commented Jul 18, 2021

IIRC, we are still waiting for azure to add support for Windows on arm so that we can test it. It has been in the pipeline for several months. . .

@bashtage
Copy link
Contributor

Patch LGTM. Probably need to wire up an ARM64/Windows host to really know. @nsait-linaro do you have a suitable system locally and does it pass all tests?

@niyas-sait
Copy link
Contributor Author

Patch LGTM. Probably need to wire up an ARM64/Windows host to really know. @nsait-linaro do you have a suitable system locally and does it pass all tests?

Yes, Please see test results below

====================================== short test summary info ==================================================================
FAILED numpy\core\tests\test_scalarprint.py::TestRealScalars::test_dragon4 - AssertionError:
=======================1 failed, 15456 passed, 513 skipped, 19 xfailed, 2 warnings in 927.26s (0:15:27) ===========

The failing test case seems to be due to a c runtime issue. The precision for pow is slightly lower on windows/arm64 targets , I will raise this separately with Microsoft.

In the meantime we might need to workaround the issue in the test. Either we can skip the test or make one small change to the testcase as shown below.

-        assert_equal(fpos64(0.5**(1022 + 52), unique=False, precision=1074),
+        assert_equal(fpos64(8e-323, unique=False, precision=1074),

Any recommendation on how to progress ?

@niyas-sait
Copy link
Contributor Author

IIRC, we are still waiting for azure to add support for Windows on arm so that we can test it. It has been in the pipeline for several months. . .

In Linaro, we have a couple of windows on arm machines and might be able to set up a CI flow. I think this patch doesn't have to be blocked due to CI as it is not introducing any regression and works locally. Do you know who would be the right person to talk to regarding setting up CI for WoA targets?

@bashtage
Copy link
Contributor

You can either conditionally skip the test or set the tolerance conditional on Win/ARM64. The latter is probably more useful.

@charris
Copy link
Member

charris commented Jul 22, 2021

Do you know who would be the right person to talk to regarding setting up CI for WoA targets?

See #17804, we seem to have lost that PR, it is still open. @zooba is the Microsoft contact in that PR.

@niyas-sait
Copy link
Contributor Author

Tests are all passing and can be merged if there are no concerns.

@niyas-sait
Copy link
Contributor Author

@charris / @bashtage - Keen to get this merged. Tests are all passing and let me know if anything more needs to be done to accept this PR

Copy link
Member

@mattip mattip left a comment

Choose a reason for hiding this comment

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

Other than adding a comment for the new MSVC-specific macro, LGTM. Does mingw64 support ARM compilation?

Co-authored-by: Matti Picus <matti.picus@gmail.com>
@niyas-sait
Copy link
Contributor Author

Other than adding a comment for the new MSVC-specific macro, LGTM. Does mingw64 support ARM compilation?

I don't think mingw64 has support for arm targets yet. I am not sure though.

@bashtage
Copy link
Contributor

LGTM and hopefully could be backported to 1.21.x so that Windows ARM users could have NumPy.

@mattip
Copy link
Member

mattip commented Jul 26, 2021

Does OpenBLAS support ARM64 on windows? In order to truly support this we should have some kind of BLAS backend

@bashtage
Copy link
Contributor

I was wondering if there are any Fortran compilers for Windows ARM64. This would be a big blocker for SciPy I think.

@niyas-sait
Copy link
Contributor Author

I was wondering if there are any Fortran compilers for Windows ARM64. This would be a big blocker for SciPy I think.

flag-new has support for windows arm64. I have used build from https://github.com/kaadam/flang/releases/tag/v0.1 and worked

@niyas-sait
Copy link
Contributor Author

Does OpenBLAS support ARM64 on windows? In order to truly support this we should have some kind of BLAS backend

Unfortunately, OpenBLAS doesn't support arm64/windows yet. This could be a blocker for scipy and related packages.

@niyas-sait
Copy link
Contributor Author

@mattip / @bashtage / @charris - Can we merge this PR ?

@bashtage
Copy link
Contributor

I second support for early merge. NumPy + Lapack Lite is a lot better Python without NumPy. It also starts letting downstream projects accept patches that would be necessary for Win/ARM64, e.g., pandas, if needed.

@mattip mattip added the 56 - Needs Release Note. Needs an entry in doc/release/upcoming_changes label Jul 27, 2021
@mattip
Copy link
Member

mattip commented Jul 27, 2021

This needs a new_feature release note, see the README for instructions. Probably should mention "preliminary support" and "no OpenBLAS"

@niyas-sait
Copy link
Contributor Author

This needs a new_feature release note, see the README for instructions. Probably should mention "preliminary support" and "no OpenBLAS"

Updated branch with release notes

@charris charris changed the title add support for windows on arm targets ENH: Add support for windows on arm targets Jul 27, 2021
@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label Jul 27, 2021
@charris charris merged commit 77bc322 into numpy:main Jul 27, 2021
@charris
Copy link
Member

charris commented Jul 27, 2021

Thanks @nsait-linaro .

@charris charris removed the 56 - Needs Release Note. Needs an entry in doc/release/upcoming_changes label Aug 12, 2021
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Aug 12, 2021
scratchmex pushed a commit to scratchmex/numpy that referenced this pull request Aug 13, 2021
* add support for windows on arm targets

* Philox: Use  _umulh intrinsic for ARM64 target

* CPU Detection: Refactor to avoid separate pre-processor definition for WoA

* adapt test_dragon4 to avoid using pow (**) to workaround issue in windows C RT for arm64

* Update numpy/core/include/numpy/npy_cpu.h

Co-authored-by: Matti Picus <matti.picus@gmail.com>

* add release note for numpy windows/arm64 support

* Update 19513.new_feature.rst

Co-authored-by: Matti Picus <matti.picus@gmail.com>
Co-authored-by: Charles Harris <charlesr.harris@gmail.com>
@niyas-sait
Copy link
Contributor Author

I've managed to build OpenBLAS (BLAS+LAPACK) for win-arm64 and configured NumPy to use it with site.cfg. Tests all are passing. But I wanted to confirm if numpy is really using the LAPACK routines. Does anyone know what would be the best way to do a quick sanity test to check this specifically? @charris , @mattip , @bashtage - could you help ?

@mattip
Copy link
Member

mattip commented Aug 17, 2021

If you built it like our CI does, you should have a dll in site-packages/numpy/.libs something like libopenblas.GK7GX5KEQ4F6UYO3P26ULGBQYHGQO7J4.gfortran-win_amd64.dll (but of course not amd64. If you stop python and rename this file, then start python, numpy will not longer successfully work since this file will be missing.

@bashtage
Copy link
Contributor

You could turn on open blas debug information to see that it is loaded OPENBLAS_VERBOSE=2.

@bashtage
Copy link
Contributor

If tools like process explorer are available for ARM, you could also check that the dll is loaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants