Skip to content

BLD: update OpenBLAS to 0.3.21 and clean up openblas download test - #22525

Merged
charris merged 23 commits into
numpy:mainfrom
mattip:openblas-v0.3.21
Nov 17, 2022
Merged

charris merged 23 commits into
numpy:mainfrom
mattip:openblas-v0.3.21

Conversation

@mattip

@mattip mattip commented Nov 3, 2022 •

Copy link
Copy Markdown
Member

The builds have changed slightly:

  • no longer need to check for manylinux1, manylinux2010 OpenBLAS builds: we exclusively build manylinux2014 wheels
  • windows 64 bits compiles with gcc 10.3
  • windows 32 bits compiles with gcc 8.3
  • macos builds with gfortran from MacPython/gfortran-install
  • consistently re-use the gfortran_utils.sh install script to provide the macos gfortran compiler
  • check the OpenBLAS version on all wheels via tools/openblas_support.py and threadpoolctl

Maybe related to #22502

@mattip

mattip commented Nov 3, 2022 •

Copy link
Copy Markdown
Member Author

At this time the openblas-libs ppc64le 64-bit interface build times out, I hope to get the archive uploaded soon. But ppc64le is a best-effort platform, so I think it is OK to move forward without that build.

Edit: using the 32-bit interfaces instead.

@charris charris added the 36 - Build Build related PR label Nov 3, 2022
@charris charris changed the title BUILD: update OpenBLAS to 0.3.21 and clean up openblas download test BLD: update OpenBLAS to 0.3.21 and clean up openblas download test Nov 3, 2022
@charris

charris commented Nov 3, 2022

Copy link
Copy Markdown
Member

close/reopen

@charris charris closed this Nov 3, 2022
@charris charris reopened this Nov 3, 2022
@mattip

mattip commented Nov 3, 2022

Copy link
Copy Markdown
Member Author

Windows 64-bit wheel builds and regular builds are failing with

D:\a\1\s\openblas\openblas.a(memory.obj):memory.c:(.text+0xe6): \
    undefined reference to `__conio_common_vcprintf'

Windows 32-bit builds are passing.

@mattip

mattip commented Nov 3, 2022

Copy link
Copy Markdown
Member Author

@matthew-brett maybe this is due to using choco install rtools in the openblas build, or because we set MSYSTEM=UCRT64 in the openblas build environment?

@mattip

mattip commented Nov 8, 2022

Copy link
Copy Markdown
Member Author

progress: 32-bit interface builds (openblas) are passing 64-bit (openblas64) are failing.

@mattip

mattip commented Nov 9, 2022

Copy link
Copy Markdown
Member Author

it may make sense to add threadpoolctl to test dependencies?

@mattip
mattip force-pushed the openblas-v0.3.21 branch 2 times, most recently from 10f6ed5 to 33df8da Compare November 16, 2022 17:39
@mattip

mattip commented Nov 16, 2022

Copy link
Copy Markdown
Member Author

Whew. Finally I got the otool -L output for the f2py-built shared object. No big surprise, since the error message mentioned @rpath/libgfortran.5.dylib

<tmp>/tmpjnw10nwm/_test_ext_module_5404.cpython-38-darwin.so:
 	@rpath/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
 	@rpath/libgcc_s.1.1.dylib (compatibility version 1.0.0, current version 1.1.0)
 	@rpath/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)

Now how do I show the active dylib search path?

@mattip
mattip force-pushed the openblas-v0.3.21 branch 2 times, most recently from 742e223 to c11f07c Compare November 16, 2022 19:56
# if: github.repository == 'numpy/numpy'

name: CircleCI artifact redirector

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.

A small cleanup to improve the UX when looking at the github action summaries

for d in ext.runtime_library_dirs:
for f in glob(d + '/*.dll'):
copy_file(f, self.extra_dll_dir)
ext.runtime_library_dirs = []

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.

This change is connected to the use of a DLL directly from the OpenBLAS build, rather than pulling out the libopenblas.a and wrapping it via gfortran to create another DLL. Apparently numpy/distutils was never set up to do this before.

# Not clear why this is needed but it seems on x86_64 this is not the default
# and without it f2py tests fail
export DYLD_LIBRARY_PATH=/usr/local/lib
fi

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.

This took way to long to work out.

@mattip

mattip commented Nov 16, 2022 •

Copy link
Copy Markdown
Member Author

Travis CI build is failing for ppc64le when using 64-bit interfaces. I will disable that job use 32-bit interface until someone can figure out why the openblaslib build of that times out.

@mattip

mattip commented Nov 16, 2022

Copy link
Copy Markdown
Member Author

Assuming CI passes I think this is ready for review. If desired, I could clean up the git history into meaningful commits, or the whole thing could be squash-merged.

@mattip

mattip commented Nov 17, 2022

Copy link
Copy Markdown
Member Author

Windows + pypy is segfaulting

numpy\lib\tests\test_format.py . [ 56%]
.................................s
D:\a\numpy\numpy/tools/wheels/cibw_test_command.sh: line 29:  2011 Segmentation fault

I suspect the test_large_archive test and will skip it. I don't know what the connection to the OpenBLAS version is, but I don't think it is worth diving into.

@mattip

mattip commented Nov 17, 2022

Copy link
Copy Markdown
Member Author

CI is passing

@mattip

mattip commented Nov 17, 2022

Copy link
Copy Markdown
Member Author

This will close #22502

Comment thread .travis.yml
# use OpenBLAS build, not system ATLAS
- DOWNLOAD_OPENBLAS=1
- NPY_USE_BLAS_ILP64=1
# - NPY_USE_BLAS_ILP64=1 # the openblas build fails

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.

Maybe open an issue for this?

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.

Done in #22610

@charris

charris commented Nov 17, 2022

Copy link
Copy Markdown
Member

Thanks Matti. I suspect this isn't the last time we will deal with these problems :)

@mattip
mattip deleted the openblas-v0.3.21 branch December 27, 2022 16:51
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Oct 9, 2026
…f float64 (#197547)

### Summary

Fixes #200245
Fixes: intel/torch-xpu-ops#5074
Related: intel/torch-xpu-ops#4313
Related: intel/torch-xpu-ops#2618

Removes the XPU `expectedFailure` for `TestCommon.test_numpy_ref` (`linalg.tensorinv`, `float64`) from the OpInfo in `torch/testing/_internal/opinfo/definitions/linalg.py`.

No `linalg.tensorinv` or XPU kernel code is changed. The XPU result was always correct. The `expectedFailure` was hiding a wrong **NumPy reference** in the PyTorch XPU CI environment, and that environment was fixed by #199535.

### Root cause

- `test_numpy_ref` compares `torch.linalg.tensorinv` on XPU against `np.linalg.tensorinv` computed on the CPU host.
- NumPy <= 1.23.x bundles OpenBLAS <= 0.3.20, which returns wrong results for LU-based routines (inv/solve/det) on Intel Xeon Sapphire Rapids and Granite Rapids CPUs (numpy/numpy#22502, fixed in OpenBLAS 0.3.21 / NumPy 1.24.0 via numpy/numpy#22525). Detailed analysis: intel/torch-xpu-ops#2618.
- PyTorch XPU CI images used Python 3.10, for which `.ci/docker/requirements-ci.txt` pins `numpy==1.23.2`, on affected host CPUs. As a result the reference was wrong and the test failed.
- The failure was originally attributed to PVC / oneMKL. That turned out to be incorrect: the deciding factor was the host CPU + NumPy/OpenBLAS version, not the GPU.

### Validation

Intel BMG:
```
python test_ops_xpu.py TestCommonXPU.test_numpy_ref_linalg_tensorinv_xpu_float64 -v
```
- before: FAILED (unexpected success)
- after: OK (complex128 variant also passes)

PyTorch XPU CI: rebased onto `viable/strict` 5de236d which includes #199535.

Pull Request resolved: #197547
Approved by: https://github.com/dvrogozh, https://github.com/BBBela, https://github.com/chuanqi129, https://github.com/atalman
cyyever pushed a commit to BakeLab/pytorch that referenced this pull request Oct 11, 2026
…f float64 (pytorch#197547)

### Summary

Fixes pytorch#200245
Fixes: intel/torch-xpu-ops#5074
Related: intel/torch-xpu-ops#4313
Related: intel/torch-xpu-ops#2618

Removes the XPU `expectedFailure` for `TestCommon.test_numpy_ref` (`linalg.tensorinv`, `float64`) from the OpInfo in `torch/testing/_internal/opinfo/definitions/linalg.py`.

No `linalg.tensorinv` or XPU kernel code is changed. The XPU result was always correct. The `expectedFailure` was hiding a wrong **NumPy reference** in the PyTorch XPU CI environment, and that environment was fixed by pytorch#199535.

### Root cause

- `test_numpy_ref` compares `torch.linalg.tensorinv` on XPU against `np.linalg.tensorinv` computed on the CPU host.
- NumPy <= 1.23.x bundles OpenBLAS <= 0.3.20, which returns wrong results for LU-based routines (inv/solve/det) on Intel Xeon Sapphire Rapids and Granite Rapids CPUs (numpy/numpy#22502, fixed in OpenBLAS 0.3.21 / NumPy 1.24.0 via numpy/numpy#22525). Detailed analysis: intel/torch-xpu-ops#2618.
- PyTorch XPU CI images used Python 3.10, for which `.ci/docker/requirements-ci.txt` pins `numpy==1.23.2`, on affected host CPUs. As a result the reference was wrong and the test failed.
- The failure was originally attributed to PVC / oneMKL. That turned out to be incorrect: the deciding factor was the host CPU + NumPy/OpenBLAS version, not the GPU.

### Validation

Intel BMG:
```
python test_ops_xpu.py TestCommonXPU.test_numpy_ref_linalg_tensorinv_xpu_float64 -v
```
- before: FAILED (unexpected success)
- after: OK (complex128 variant also passes)

PyTorch XPU CI: rebased onto `viable/strict` 5de236d which includes pytorch#199535.

Pull Request resolved: pytorch#197547
Approved by: https://github.com/dvrogozh, https://github.com/BBBela, https://github.com/chuanqi129, https://github.com/atalman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

36 - Build Build related PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants