-
Notifications
You must be signed in to change notification settings - Fork 99
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
BLAS underscore mangling #369
Comments
@kyungjoo-kim @ndellingwood Can you make this a PR ? |
@srajama1 based on the comment it looks this is a good start but more work will be necessary for a complete fix. I can help, but would like to talk with you and @kyungjoo-kim more about what is involved to support XL and not break compatibility with other compilers. Adding reference to #307 and trilinos/Trilinos#2850 (closed issues with follow-ons) that have discussion that may be relevant. |
This may be okay for xl but it is not okay with other compilrs like intel and gcc. To do this more correctly, we need to detect fortran mangling from the compilation level (like trilinos does). CMake can do this but I dont know how to. Anyone CMake grue might know how to. We also need help from @crtrott for the stand-alone makefile. |
@kyungjoo-kim Teuchos uses some CMake logic for this. Tpetra used to have an improved version of that CMake logic, until y'all deleted the GEMV and GEMM wrappers. If you want me to help, I'll be happy to, but please send me an e-mail first asking specifically for what you want. |
@kyungjoo-kim Please send me an e-mail requesting this feature. I will begin at that time. Thanks! |
@kyungjoo-kim @mhoemmen I apologize, I should have been more clear. What you have suggested IS what I would like kokkos to do (properly select the underscore mangling). |
@theguruat12 reminded me that kokkos-kernels has a customer that needs this to work for the Makefile-based build system as well. This shouldn't be hard -- just specify the mangling macro definition on the command line as a |
@kyungjoo-kim @ndellingwood I have a fix in Trilinos, in the Here is a link to the branch: https://github.com/trilinos/Trilinos/compare/Fix-KokkosKernels-BLAS-mangling |
@mhoemmen I'd like to get @kyungjoo-kim 's feedback on the PR, I can help work on testing the Makefile-based changes etc. |
Thanks @ndellingwood ! It really helps that we require a recent CMake; that means I can use entirely native CMake functions. |
Thanks @ndellingwood for your investigations! |
Thank you for working on this. It seems to be quite easy to just include |
@kyungjoo-kim wrote:
My plan was to have sane defaults and let users override by defining Makefile variables themselves. That's what I did in the branch. I'm just not sure how to test it. |
@mhoemmen Thanks. If you don't mind, would you please submit PR for both KK and Trilinos ? From there I can take care and test it. |
I'll do Trilinos first today since Sierra needs it for the next Trilinos promotion. |
@kyungjoo-kim Here is the Trilinos patch: trilinos/Trilinos#4228 |
@theguruat12 Do you have this problem when you compile kokkoskernels with Trilinos ? Or kokkoskernels is used as stand alone ? |
@theguruat12 Another question. According to XL programming guide, page 90, XL provides blas library with C interface. This is different from IBM ESSL library (this is fortran library). So, I am wondering if you mean that the C-interface provided from the XL compiler (-lxopt) when you say XL uses no underscore blas. If so, trilinos/Trilinos#4228 won't fix your problem as it is not a problem of fortran mangling. If XL indeed uses no-underscore fortran mangling, the current Trilinos won't identify such fortran mangling, either. Thus, Trilinos will not work either in that case. |
@kyungjoo-kim - on Page 90 it says that they only ship |
@nmhamster I don't really mind about the functionalities but I just want to double check what is real problem in this issue. When I googling examples of xlc with blas, it uses a single underbar interface, which conflicts this issue. So, I want to assure that XL indeed uses no-underbar fortran mangling. |
Example:
When compiled with XL (lower case, no underscore):
When compiled with gfortran (lower case, with underscore):
|
@nmhamster Ah................................ sounds like the problem is quite complicated. So the example I googled uses blas library complied by another compiler as it uses a single underscore. So, our IBM machines are equipped with OpenBLAS, LAPACK or ESSL compiled by XL, right ? Due to the different fortran interface, it might be also problematic with other third party libraries (if the TPLs uses BLAS internally and the code does not correctly deduce fortran interface). Ah.............. have you compiled trilinos with XL compiled BLAS ? I am wondering this because Trilinos fortran mangling choose between single and double underscores if the fortran compiler is not enabled in the configuration and this is how trilinos is built for ATDM apps. |
@kyungjoo-kim The one I'm attempting to use was compiled with XL, thus, no underscores. For this use case, only the CMake (as part of Trilinos) build is needed. |
@sebrowne Thank you. |
Sorry that this is coming in late, but I wanted to make sure you saw that IBM XL Fortran offers a compiler option called |
@trudeaun , Thank you for the information. In this case, since I'm compiling against an existing version of BLAS, I do still need the functionality of dynamically determining the mangling, but yes, if I were to compile all TPLs (including BLAS) myself, I could specify that option. |
With XL, there is no underscore added for Fortran calls from C. Kokkos-Kernels appears to hard-code this with one underscore (which works for most compilers).
Attached is the patch that I had to implement to get it to build on the miniature version of the Sierra platform (Essentially just changing the hard-coding to not have underscores; this only changed the symbols that were referenced in my project, it will be necessary to change them for all of the externs). I would like a configure-time option to choose the mangling, just like Trilinos does (I think it's in Teuchos).
Patch:
0001-KokkosKernels-Change-BLAS-to-no-underscores.patch.txt
The text was updated successfully, but these errors were encountered: