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

Skip to content

BLD: put openblas library in local directory on windows #16101

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 3 commits into from
Apr 29, 2020

Conversation

mattip
Copy link
Member

@mattip mattip commented Apr 28, 2020

Something changed in the image used for windows on azure: python is on C: and the checkout is done in D:. This causes mingw to fail to link with the openblas library if it is put in the "known path" <python-dir>/libs that the openblas discovery mechanism searches. Instead, use an environment variable $OPENBLAS to point to a local directory and copy the library there.

This code is copiedbased on code from numpy-wheels.

@mattip
Copy link
Member Author

mattip commented Apr 28, 2020

Hmm, that didn't work: openblas_info searched the directory but did not find the file

@WarrenWeckesser
Copy link
Member

It looks like you still need to install urllib3. It is needed in tools/openblas_support.py.

@mattip mattip force-pushed the azure-windows branch 2 times, most recently from 8f4669f to c692cf3 Compare April 28, 2020 21:17
@mattip
Copy link
Member Author

mattip commented Apr 28, 2020

I needed to change to powershell to add the windows-formatted name of the directory as an environmental variable. The windows build uses pip wheel not python setup.py install, which by default does an isolated build somewhere in %TEMP% (I think, am not sure 100%), so I cannot be sure the relative path will be correct.

I also noticed one of the build steps had a small problem so I tweaked it to succeed.

@@ -32,15 +40,15 @@ steps:
refreshenv
}
python -c "from tools import openblas_support; openblas_support.make_init('numpy')"
pip wheel -v -v -v --wheel-dir=dist .
pip wheel -v -v -v --no-build-isolation --no-use-pep517 --wheel-dir=dist .
Copy link
Member Author

Choose a reason for hiding this comment

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

While not really part of the openblas handling, this will disable all the fancy "copy to tmp directory, exec(setup.py)" things that pip now does when calling pip wheel. The former slows things down, the latter breaks our setup.py (it cannot find parse_setuppy_commands)


ls dist -r | Foreach-Object {
pip install $_.FullName
}
displayName: 'Build NumPy'
- bash: |
pushd . && cd .. && target=$(python -c "import numpy, os; print(os.path.abspath(os.path.join(os.path.dirname(numpy.__file__), '.libs')))") && popd
pip download -d destination --only-binary --no-deps numpy==1.14
pip download -d destination --only-binary :all: --no-deps numpy==1.14
Copy link
Member Author

Choose a reason for hiding this comment

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

this was broken

Copy link
Member

Choose a reason for hiding this comment

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

Out of curiosity, why download numpy==1.14?

Copy link
Member Author

Choose a reason for hiding this comment

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

If I recall correctly, this was added to test that numpy will still load properly even if there are two fortran dlls in the .lib directory on windows. The real test is in the next step

echo "##vso[task.setvariable variable=OPENBLAS64_]$pwd\openblas"
} else {
echo "##vso[task.setvariable variable=OPENBLAS]$pwd\openblas"
}
Copy link
Member Author

Choose a reason for hiding this comment

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

The need to add OPENBLAS_SUFFIX (line 20, 21) seems to me to be a bug in the packaging of the openblas-lib. It knows about 64bit builds, and should package the library appropriately.

@WarrenWeckesser
Copy link
Member

FYI: I tried making some changes similar to these for the SciPy tests: scipy/scipy#11965

@mattip
Copy link
Member Author

mattip commented Apr 29, 2020

Azure tests now passing, I think this is ready for review

@mattip
Copy link
Member Author

mattip commented Apr 29, 2020

Fixes #16107

@charris charris merged commit 4cd9871 into numpy:master Apr 29, 2020
@charris
Copy link
Member

charris commented Apr 29, 2020

This may not be the end of the story, but we need to get CI working again so in it goes. I've also marked it for possible backport for the 1.18.4 release if needed. Thanks Matti.

@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label Apr 29, 2020
@charris charris added this to the 1.18.4 release milestone Apr 29, 2020
@charris
Copy link
Member

charris commented Apr 29, 2020

These changes on the windows end are annoying, it would be nice if we got some prior warning.

@tylerjereddy
Copy link
Contributor

Perhaps partly my fault--I think there was a warning in the Azure docs somewhere about depending on absolute paths with drive letters, but it was easier to do at the time.

charris pushed a commit to charris/numpy that referenced this pull request Apr 29, 2020
* BLD: put openblas library in local directory on windows

* TST: fix broken pip install on windows

* BLD: handle 64-bit windows BLAS
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label May 19, 2020
@charris charris removed this from the 1.18.4 release milestone May 19, 2020
@mattip mattip deleted the azure-windows branch April 8, 2021 11:12
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.

4 participants