JuliaLinearAlgebra / libblastrampoline

Using PLT trampolines to provide a BLAS and LAPACK demuxing library.
MIT License
66 stars 17 forks source link

Add `lbt_get_config()` and get/set threads APIs and some tests showing how to use it from Julia #27

Closed staticfloat closed 3 years ago

staticfloat commented 3 years ago

This adds the first piece of a meta information API to LBT, showcasing how it can keep track of which libraries have been loaded, and some meta-information about those libraries.

ViralBShah commented 3 years ago

I'm thinking that instead of having the threading API for every BLAS needing to be updated in LBT and then make a new release and such - what would be better is to have the ability to set these from user code. So MKL.jl would communicate to LBT what its threading API is - but then all other Julia code just uses the generic API.

This way, when we want to add BLIS, AMD BLAS or NVBLAS etc., we can do it without having to recompile LBT.

staticfloat commented 3 years ago

The only thing that makes me uncertain about that is whether the function signature will be the same across all of them. Right now, the OpenBLAS and MKL signatures are the same, it looks like BLIS changes the int size from 32 to 64-bit if it's built as an ILP64 build, but that should still work, since we'll pass a 32-bit integer and it will just get zero-extended up. I don't think NVBLAS has any concept of setting the number of threads, so that's probably fine.

I'm going to go with a dual approach; we have some common ones built-in (OpenBLAS, MKL, BLIS) and the user can add their own via a registration function if they need to.

ViralBShah commented 3 years ago

Yeah - NVBLAS most likely doesn't have its own threading, but it forwards a bunch to one of those other ones that are covered.

ViralBShah commented 3 years ago

Are we ready for a 2.1 release?