| Crates.io | rstsr-blis-ffi |
| lib.rs | rstsr-blis-ffi |
| version | 0.2.0 |
| created_at | 2025-07-28 12:13:10.567128+00 |
| updated_at | 2025-08-26 14:39:29.296201+00 |
| description | BLIS and FLAME FFI bindings |
| homepage | |
| repository | https://github.com/RESTGroup/rstsr-ffi |
| max_upload_size | |
| id | 1771087 |
| size | 11,685,843 |
This crate contains BLIS FFI bindings.
Current FFI version is BLIS v2.0. If you are using an older version of BLIS, this crate should still work if you do not explicitly call the function that only occurs in higher version of BLIS.
Architecture Not Complete: The current bindgen is generated in x86_64. We are planning to generate arm64 in future.
This crate aims to provide common usage (architecture-independent) of BLIS and FLAME. All architecture-independent functions/constants are actually included in this crate. However, if you are interested in other architectures, you either
- do not use architecture-dependent functions,
- file an issue to let us know some other architecture is required,
- use
blis-syscrate for usual extern FFIs (without dynamic loading).
This crate is not official bindgen project. It is originally intended to serve rust tensor toolkit RSTSR and rust electronic structure toolkit REST.
dynamic_loading.BLIS/FLAME header, used in this project, is not directly obtained from BLIS repository, but from the installed library.
The header file for x86_64 architectures is obtained by
# BLIS
./configure --enable-shared --enable-cblas --enable-blas --enable-threading=openmp,pthread x86_64
# FLAME
LDFLAGS=-L<blis_dir> LIBS=-lblis ./configure --enable-dynamic-build --enable-lapack2flame
This crate supports dynamic loading.
If you want to use dynamic loading, please enable cargo feature dynamic_loading when cargo build.
The dynamic loading will try to find proper library when your program initializes.
LD_LIBRARY_PATH (Linux) DYLD_LIBRARY_PATH (Mac OS), PATH (Windows).RSTSR_DYLOAD_BLIS, RSTSR_DYLOAD_FLAME to the dynamic library path.NOTE: When you call BLAS and LAPACK functions with dynamic loading, please DO NOT USE other crates (such as rstsr_lapack_ffi). Please make sure you are only using rstsr_blis_ffi::blis, rstsr_blis_ffi::lapack. Sticking to using rstsr_blis_ffi will make sure you are calling BLAS and LAPACK functions from BLIS, instead of other BLAS vendors.
If you encountered large compile time or disk consumption, you may consider add these lines in your Cargo.toml:
[profile.dev.package.rstsr-blis-ffi]
opt-level = 0
debug = false
Default features:
lapack: Include LAPACK bindgens.x86_64: Use bindgen generated from x86_64 (not necessarily meaning arm64 could not use most functions in x86_64 bindgen, but arm64 will not able to use much lower-level ASM functions).Optional features:
dynamic_loading: Supports dynamic loading.ilp64: Use int64_t for dimension specification, or lapack error code types if this feature specified. Otherwise, use int32_t.
blas, error code is returned by c_int; in module cblas, BLIS utility functions use c_int for input or output.flame: Include FLAME bindgens.Mutually exclusive features:
flame and ilp64: We found that FLAME must be compiled with int of C, which is lp64 exclusive. Also use ilp64 carefully in BLIS and lapack.header: Header files copied (or renamed) from original source.scripts: Script to generate FFI bindgens.ffi_base.rs: Basic type, enum, struct definitions.ffi_extern.rs: Unsafe extern "C" bindgen functions. Only activated when not dynamic loading.dyload_struct.rs: Struct Lib for dynamic loading.dyload_initializer.rs: The initialization function of Lib for dynamic loading.dyload_compatible.rs: Unsafe bindgen function that is compatible to that of ffi_extern.rs. Only activated when dynamic loading.cblas::ffi_base: the enums CBLAS_TRANSPOSE, CBLAS_UPLO, etc comes from crate rstsr_lapack_ffi for convenience. This crate depends on rstsr_lapack_ffi for those definitions of enums.v0.2.0
dynamic_loading is not default.v0.1.3
v0.1.2
BLIS_BLAS_INT_TYPE_SIZE in root level.v0.1.1
rstsr-cblas-base.