Skip to content
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

Compile all backends without auto-detection #13

Closed
epsilon-0 opened this issue Feb 21, 2021 · 3 comments
Closed

Compile all backends without auto-detection #13

epsilon-0 opened this issue Feb 21, 2021 · 3 comments

Comments

@epsilon-0
Copy link

How would I compile flexiblas with support for all ATLAS, OpenBLAS, MKL and BLIS while not having them present at compile time?

Thanks a lot!!

@grisuthedragon
Copy link
Member

The fun fact is, that there is no need to have them at compile time. Just create a file myblas.conf in /etc/flexiblasrc.d (or wherever your system-wide flexiblasrc lies) with the following content:

[NAMEOFTHEBLASLIBRARY]
library = /path/to/the/so/file/containing/the/blas/inferface.so

and check with flexiblas list if they are now available.

The so-file have to contain the a normal NETLIB compatible BLAS interface and must include all its dependencies. If a BLAS symbols does not exists in the so-file it is automatically replaced by its NETLIB implementation.

For ATLAS that means you need the combined so as installed by Debian/Ubuntu as /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3. So the file will look like

[ATLAS]
library = /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3

For OpenBLAS, just use the generated so file.

For BLIS, just use the generated so file, but it have to be compiled with the BLAS wrapper layer. (config option: --enable-blas).

In case of the MKL its a bit tricky, since it consits of at least three so files that have to be combined such that they fit your requirements. Therefore, Intel provides a tool called mklbuilder. In my installation it is located in ${MKLROOT}/tools/build. This is a makefile which can be used to generate a custom single so file variant of the MKL. For example with

make libintel64 export=blas_example_list interface=lp64 parallel=gnu threading=sequential name=flexiblas_mkl_sequential

One can generate such an so-file which includes the sequential version of the MKL as a single so file. This can be used in the config files. (The parallel=gnu is required to tell the makefile to use the GNU Fotran interface instead of the Intel Fortran interface)

For fast tests is is enought to set the the FLEXIBLAS environment variable to the absolute path of a so file which contains the desired BLAS.

As long as the names in the configfiles are unique, many different BLAS libraries of the same vendor could be defined. I use this to switch between OpenBLAS in sequential and OpenMP mode while developing software.

Does this help? I think I write a short readme in the next release abou this.

@epsilon-0
Copy link
Author

Does this help?

Yes, this was very informative! Thanks a lot!

I think I write a short readme in the next release abou this.

I'd really appreciate this as well, thanks! ❤️

@grisuthedragon
Copy link
Member

Then I close this issue and some information on this will appear in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants