-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Use SYSTEM BLAS on OS X, without using system LAPACK #3365
Comments
Cc: @staticfloat |
Last time I tried this I got crashes because Julia was expecting function endpoints that were provided by OpenBLAS and not by Accelerate/VecLib. I'll try again soon, I think my problem was I wasn't building LAPACK. If we get this working just fine, I'll definitely include this in my eventual performance regressions framework. |
You need to do just this. No crashes, but there's something funny. I verified that it is calling the compiled LAPACK as well, and not the one from vecLib. My
And this is the patch to
|
The motivation for all this is #3369 |
I tried, but compilation of LAPACK hung, and I'm not fluent enough with FORTRAN to follow the instructions here:
In short, I'm not sure what setting ILAENV = 0 for ISPEC = 11 means. |
Scratch that, I was just too impatient. I'm running into errors involving |
zgesdd is not present in old lapacks like Apple's. You need to change build_h.jl manually and replace libblas with liblapack in order to use your compiled lapack. |
The above commit should help try this out easily. |
This is the failure I get.
|
Here is how to reproduce this easily:
Cc: @andreasnoackjensen |
I'm getting the same thing now, and the angle I'm attacking is I've figured out that linking to vecLib in the way we do brings in vecLib's LAPACK. I'm experimenting with linking against |
Seems like a good plan. Perhaps we should write an independent test program and see if spotrf barfs outside of julia in this configuration. |
Update: You need to clean LAPACK as well, because it was linking against |
Alright. I've managed to track down some troubling news;
I'm completely unfamiliar with where the boundary between BLAS and LAPACK should be drawn; if I google spotrf, the first hit signifies to me that this would be included in LAPACK, so having it exported in Investigating further, it seems that Apple agreed with this sentiment after OSX 10.6: we can see that the symbol has been "moved" from
I have an SO question open as I have no idea how to inform the compiler that we want to link as if we're on 10.8 and to hide |
Have you tried changing |
I just tried changing that to 10.8, but it doesn't seem to have changed |
I don't know if this changed, but I think that you need to change the base In a makefile-based project (often based on the Autotools), SDK build
[1] http://wiki.herzbube.ch/index.php/Mac_OS_X_Programming On Tuesday, June 18, 2013, Elliot Saba wrote:
~Dan |
Hmmm. This is definitely worth looking into. Thanks for the info! I tried setting |
I've tried everything listed on that page, and unless I've done something very wrong, I don't think it's working. I'm not entirely sure why that is, other than the fact that most of the weak linking documentation I've found has been for objective-c, and not C/C++, so perhaps the documentation just isn't there for this language. I'm giving up on this for now, pending an answer on SO, and just hoping that we can resolve the OpenBLAS issues quickly. |
@vtjnash Do you have any pointers that may help fix this issue? |
This is a useful read on the topic, but did not help resolve the issue: |
While interesting, this line of work is unrelated to the source of the warning, the julia codegen, a currently has no adverse affects -- it is there to suggest that static compilation may have different results. Jeff / Keno / I have discussed a solution to remove it entirely. There are also more interesting failures that avoid the warnings entirely: julia> eigvals(a'*a)'
1x10 Float64 Array:
0.0282608 0.0475024 0.211544 0.361698 0.419391 0.760586 1.35504 1.681 2.73861 26.6356
julia> eigvals(float32(a'*a))'
1x10 Float32 Array:
-3.68935f19 -129505.0f0 -50746.7f0 -1383.94f0 -53.4826f0 4.07395f0 316.834f0 10145.9f0 23074.5f0 3.68935f19 |
Compiling lapack with (edit: note that the easiest way to do this is to edit |
For more specific information on the incompatibilities,and another way to fix it see http://savannah.gnu.org/file/blaswrap.c?file_id=22779 (LGPL) |
@vtjnash This is really good detective work! It would be nice to go with the |
Of course, the |
Useful discussion here: http://www.macresearch.org/lapackblas-fortran-106 |
Another alternative approach would be to implement |
@StefanKarpinski the main problem is that gcc decided to change the fortran ABI, rather than maintaining binary compatibility with everyone else. Implementing fcall is not a true fix for gcc/gfortran's behavior. |
Ah, I see. Bad gcc/gfortran. |
In theory, |
Completed interface file can be downloaded here: https://gist.github.com/vtjnash/5855643
Note that all we need to do now is make sure that we use the symbols in our (statically-compiled) blaswrap.o file before libBLAS. I have it working (read: passing julia and lapack tests) on my machine, but I need to clean it up before I can commit anything. |
Great. Looking forward to the commit. |
I just did a distclean and noticed that |
I only added just enough rules to get it to build. You're welcome to add the standard set of rules if you think they would be helpful. |
This is some neat work, Jameson. I tried testing it out on my mac mini, and everything is fine except for ARPACK. When I run the tests, ARPACK fails:
I'm not doing anything special, I'm just compiling with the following Make.user, and expecting everything to work out:
I did a |
My bad - ignore the previous comment. I now get the arpack failure as well. Looking into it. |
The ARPACK exception decodes to an LAPACK error.
|
The failures occur in the |
@vtjnash Do we still need to build all our fortran libraries with |
No, I just made a stupid error and Mac's case-insenstive file system covered up for me. |
After a |
That's good. For everyone else, I suspect |
Works for me too - but I had to also delete |
It is amazing to have this flexibility on the mac now! |
|
I uncommented the USE_SYSTEM_LAPACK stuff in deps/Makefile and did
make USE_SYSTEM_BLAS=1 USE_SYSTEM_LAPACK=0
on os x. The idea is to try replace openblas with Apple BLAS, but we need to build lapack since the one that is included with os x is quite old.The
spotrf
test fails in test-linalg, which is the first test to run. However only the Float32 case seems to fail, anddpotrf
seems to work just fine. I wonder if this is an issue withccall
or something else.The text was updated successfully, but these errors were encountered: