8000 ENH: enable OpenBLAS on windows. by charris · Pull Request #10139 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: enable OpenBLAS on windows. #10139

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

Closed
wants to merge 1 commit into from

Conversation

charris
Copy link
Member
@charris charris commented Nov 30, 2017

Backport of #9645.

Previously, #9431 allowed distutils to make use of gfortran to create fortran wrappers that worked with MSVC. For a quick review:

Distutils detects objects that cannot be linked with an MSVC lib.
Distutils compiles unlinkable objects into a DLL
Distutils links Python extension against the DLL
Distutils writes config that includes the DLLs in the PATH.
Here, we use distutils the link against the "unlinkable object" openblas.a. Distutils compiles openblas with gfortran as a DLL and then links against it. As a result of using OpenBLAS, performance restrictions on windows are addressed.

Because gfortran enables BLAS and fortran functionality, some new tests are run that were previously skipped. Some of these newly run tests fail. Such tests are marked as "known failures" on windows because they were previously untested on the CI, thus they are not regressions.

@charris charris added this to the 1.13.4 release milestone Nov 30, 2017
@ghost
Copy link
ghost commented Nov 30, 2017

Note that this requires #9431 also, but that's a pretty big change. You might be better off using our distutils hack:

  # Replace numpy distutils with a version that can build with msvc + mingw-gfortran
  - ps: |
      $NumpyDir = $((python -c 'import os; import numpy; print(os.path.dirname(numpy.__file__))') | Out-String).Trim()
      rm -r -Force "$NumpyDir\distutils"
      $tmpdir = New-TemporaryFile | %{ rm $_; mkdir $_ }
      echo $env:NUMPY_HEAD
      echo $env:NUMPY_BRANCH
      git clone -q --depth=1 -b $env:NUMPY_BRANCH $env:NUMPY_HEAD $tmpdir
      mv $tmpdir\numpy\distutils $NumpyDir

@njsmith
Copy link
Member
njsmith commented Nov 30, 2017

What's the motivation for backporting this to 1.13.x? Switching our wheels to OpenBLAS seems like it might be a risky change to do in a point release.

@ghost
Copy link
ghost commented Nov 30, 2017

This is a significant performance improvement for large arrays. Whether that means anything relevant is not my say.

@charris
Copy link
Member Author
charris commented Nov 30, 2017

@njsmith I canceled the backport as it isn't needed. However, note that 1.13.3 was built with OpenBLAS on windows, which was actually useful, as it got tested and a bug in the 32 bit version was uncovered. The bug also let us test the build version machinery of PIP, so it was a good all round learning experience :0

@charris
Copy link
Member Author
charris commented Nov 30, 2017

@njsmith, oops, I thought we were in a different PR.

@xoviat How did we manage to do the 1.13.3 release without this or its dependency?

@ghost
Copy link
ghost commented Nov 30, 2017

Wait, sorry. This configuration isn't needed to build with OpenBLAS if you standardize on the MSVC ABI:

               |
numpy          |    BLAS/LAPACK
               |
              MSVC
               ABI

The current build procedure (in master) standardizes on the MinGW ABI:

               |
numpy          |    BLAS/LAPACK
               |
              MinGW
               ABI

The reason for this is that this is the way that it was done in SciPy, because you currently must standarize on the MinGW ABI if you are using gfortran. But Numpy doens't have fortran sources.

@ghost
Copy link
ghost commented Nov 30, 2017

I realize this is confusing and am I working on a solution to remove the second scenario entirely: #10047.

@charris charris closed this Nov 30, 2017
@charris
Copy link
Member Author
charris commented Nov 30, 2017

@xoviat So if I do a 1.13.4 it should just work? After the license fix and check that the 32 bit OpenBLAS bug has been fixed.

@ghost
Copy link
ghost commented Dec 1, 2017

Yes, but you should change the OPENBLAS_COMMIT to 5f998ef.

@ghost
Copy link
ghost commented Dec 1, 2017

There are so many moving parts here that it's difficult to say for sure (ugh!). But it should work.

@charris
Copy link
Member Author
charris commented Dec 1, 2017

@xoviat Numpy 1.13.x can not be built for 32 bit windows. I'm guessing something has changed in picking up the correct OpenBLAS module.

@charris
Copy link
Member Author
charris commented Dec 1, 2017

That is with OPENBLAS_COMMIT: 5f998ef. I going to try against master (again), but I suspect that will still be a problem.

@ghost
Copy link
ghost commented Dec 1, 2017 via email

@ghost
Copy link
ghost commented Dec 1, 2017 via email

@ghost
Copy link
ghost commented Dec 1, 2017 via email

@charris
Copy link
Member Author
charris commented Dec 2, 2017

@xoviat Don't think so, as master doesn't build 32 bit window wheels using the new OpenBLAS libraries either. I think the script in windows-wheel-builder needs fixing, note that scipy bundles that script into appveyor.yml. Does the library ABI matter?

@ghost
Copy link
ghost commented Dec 2, 2017

Master uses the same openblas as scipy. Please note that the mingwpy openblas is broken.

@charris
Copy link
Member Author
charris commented Dec 2, 2017

Current status building NumPy wheels against master

openblas-5f998ef_gcc7_1_0_win32: Fails
openblas-5f998ef_gcc7_1_0_win64: Fails
openblas-5f998ef_win32: Fails
openblas-5f998ef_win64: OK
openblas-5f998ef_mingwpy_win32: OK, Cholesky test fails
openblas-5f998ef_mingwpy_win32: OK

@xoviat I assume that we need the gcc7_1_0 versions, but the NumPy wheels cannot be built against them with current master.

EDIT: Note that this PR was against maintenance/1.13.x and that the failures are against master, so backport doesn't apply.

EDIT2: the libraries are unpacked by https://github.com/numpy/windows-wheel-builder/unpack_openblas.bat

@ghost
Copy link
ghost commented Dec 2, 2017

@charris Let me prepare a PR backporting the required fixes. It should take a few minutes.

@charris
Copy link
Member Author
charris commented Dec 2, 2017

The failures are against master.

@ghost
Copy link
ghost commented Dec 2, 2017

@charris The associated PR is #10152. After that is merged, I will submit a PR to numpy-wheels to fix the problem. The PR will not use the windows wheel builder.

@charris
Copy link
Member Author
charris commented Dec 2, 2017

I assume the libraries are being unpacked into the wrong location. I'd rather fix that first and worry about the numpy-wheels repo later after implementing branch dependency.

@ghost
Copy link
ghost commented Dec 2, 2017

Do you want to build master or maintenance/1.13x? I can do either but it's going to be different strategy for each.

Edit: building master is much simpler.

@charris
Copy link
Member Author
charris commented Dec 2, 2017

Both, although I want to do master first and am considering dropping the 1.13.4 release. Because things will probably differ by branch, I'd rather wait to make major modifications till after implementing branches for numpy-wheels.

@charris
Copy link
Member Author
charris commented Dec 2, 2017

Which is to say, I'd rather start by modifying windows-wheel-builder in a common way if possible.

@ghost
Copy link
ghost commented Dec 2, 2017

MacPython/numpy-wheels#11 will build master with gcc_7_1_0, which is to say, zero issues.

@charris charris deleted the backport-9645 branch September 19, 2018 14:32
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.

3 participants
0