@ckl, Success! Thank you!
* I tried using your amd64\bin\libopenblas.dll and it works! Note, using the static library library libopenblas.a did not work.
So now my questions are:
------------------------
* Can this binary dll be built by openblas team and available on their website? maybe it is already? is it the one that is available on the site now? maybe I made mistakes before building it? Or it didn't build without CKL's numpy patch?
* Can the wheel that uses openblas.dll be uploaded top PyPI and sourceforge for x64 windows users to use? Let's make this the status quo instead of the crazy hoops we have to jump through now.
* How can we benchmark the performance of NumPy-OpenBLAS vs NumPy-MKL?
* can openblas.dll be put into Python DLL's folder or dynload folder for Numpy to build on automatically? this would make the process even easier and make it available for other python packages to use it too
Exact steps to build NumPy with CKL's dynamic OpenBLAS library:
---------------------------------------------------------------
1. Create definitions file and a new dll export lib.
* Unfortunately using the lib export file created by openblas build (aka amd64\lib\libopenblas.dll.a which is about 5kb) does not work
* you will need wither mingw-w64/msys2 gendef.exe or mingw/msys pexports.exe
* you will also need microsoft sdk 7, the following commands used the sdk 7 environment shell
C:\> setenv /x64 /release
C:\> pexports.exe libopenblas.dll > libopenblas.def
C:\> lib.exe /machine:X64 /def:libopenblas.def
* the new libopenblas.lib file is about 1kb
2. copy both dll, lib files to numpy/core
3. copy header files to numpy/core/openblas (is this necessary?)
4. create site.cfg
[openblas]
libraries = libopenblas
library_dirs = c:\path\to\numpy-1.9.1\numpy\core
include_dirs = c:\path\to\numpy-1.9.1\numpy\core\openblas
The dll and exports library must be in core, or I get the traceback that the DLL could not be imported.
* The dll and exports library must be in core, or I get the traceback that the DLL could not be imported
* Can relative paths be used here? eg just "numpy\core" instead of absolute path
* from here on out I ran these in a windows cmd console in a virtualenv called "venv" with only pip, setuptools, wheel and nose
(venv) C:\> python setup.py config # check config is okay
(venv) C:\> python setup.py config build install
5. copy libopenblas.dll to lib\site-packages\numpy\core
6. start python and import numpy, yay! it works! show the config and run the tests
(venv) C:\Users\mmikofski\Downloads>python
Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.__config__.show()
lapack_opt_info:
libraries = ['libopenblas', 'libopenblas']
library_dirs = ['c:\\path\\to\\numpy-1.9.1\\numpy\\core']
language = f77
blas_opt_info:
libraries = ['libopenblas', 'libopenblas']
library_dirs = ['c:\\path\\to\\numpy-1.9.1\\numpy\\core']
language = f77
openblas_info:
libraries = ['libopenblas', 'libopenblas']
library_dirs = ['c:\\path\\to\\numpy-1.9.1\\numpy\\core']
language = f77
openblas_lapack_info:
libraries = ['libopenblas', 'libopenblas']
library_dirs = ['c:\\path\\to\\numpy-1.9.1\\numpy\\core']
language = f77
blas_mkl_info:
NOT AVAILABLE
>>> numpy.test()
Running unit tests for numpy
NumPy version 1.9.1
NumPy is installed in C:\path\to\numpy-1.9.1\venv\lib\site-packages\numpy
Python version 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)]
nose version 1.3.4
----------------------------------------------------------------------
Ran 5178 tests in 33.850s
OK (KNOWNFAIL=10, SKIP=19)
<nose.result.TextTestResult run=5178 errors=0 failures=0>
7. create a binary distribution windows installer and convert to wheel (attached)
* I had to add this to setup.py to add the dll to the binary distribution windows installer
--- setup.py.orig Wed Nov 12 14:51:41 2014
+++ setup.py Wed Nov 12 14:41:20 2014
@@ -213,6 +213,7 @@
platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"],
test_suite='nose.collector',
cmdclass={"sdist": sdist_checked},
+ package_data={'numpy.core': ['*.dll']}
)
# Run build
* Now make the binary distribution windows installer and convert it to a wheel.
C:\> python setup.py config build bdist_wininst
C:\> wheel convert dist\numpy-1.9.1.win-amd64-py2.7.exe
As I mentioned above, I also tried using libopenblas.dll.a as the exports library as it says in the wiki, but I got this traceback.