OpenBLAS
OpenBLAS copied to clipboard
If application has sgemm without underscore how do we handle in Openblas
If application has sgemm without underscore how do we handle in Openblas?
Also is it possible to choose which version of the functions are created - AKA sgemm vs sgemm_?
And lastly is it possible to build OpenBLAS with both versions in the same compile?
I think that is a peculiarity of the compiler used to build the respective code, part of the compiler detection in the build system is devoted to finding out if symbols get trailing underscores added or not, so that inter-language calls will work within the library at least. Creating additional symbols/aliases would probably be doable with objcopy, but nothing of the sort is implemented and I do not remember any earlier requirement for this.
Coincidentally I've just seen this come up on the Reference-LAPACK issue tracker in the context of Microsoft Windows, when trying to use a library compiled with the mingw gcc/gfortran together with the Visual Studio compilers - there the best option is probably to add -fno-underscore to the compiler flags.
Would probably need something like nm libopenblas.so|grep ".* T .*_$" to obtain the underscored symbols and their entry points, combined with some awk magic to create a bunch of objcopy --add-symbol <name_without_underscore>=text:<the_entry_point> oldlib.so newlib.so (possibly the same functionality could be achieved with a linker script that uses the PROVIDE command, but my understanding of that is extremely sketchy)
Thanks @martin-frbg for the suggestions. If we find a way to do this, can we include that in openblas with some flags?
Sure, as long as it does not get terribly invasive - the alternative at the C file level (for BLAS) would be to use attribute(alias) but I am no sure how portable that is, and I expect the main problem will be with LAPACK where almost everything is in Fortran and there would be a few thousand files to change.
Another big question here would be if the underscore is the only difference, or if the "other" compiler/environment expects different conventions for passing arguments and results as well
Did you get any further with that (possible) requirement, or would it be okay to close this for now ?