Expand description
§tblis-ffi: TBLIS FFI bindings
This crate contains TBLIS FFI bindings.
TBLIS (Tensor BLIS, The Tensor-Based Library Instantiation Software) can perform various tensor operations (multiplication, addition, reduction, transposition, etc.) efficiently on single-node CPU. This library can be an underlying driver for performing einsum (Einstein summation).
Current FFI version is TBLIS 9b95712 after v1.3.0. If you are using an older version of TBLIS, this crate should still work if you do not explicitly call the function that only occurs in higher version of TBLIS.
TBLIS (C++) source code is available on github.
This crate is not official bindgen project. It is originally intended to serve rust tensor toolkit RSTSR and rust electronic structure toolkit REST.
- Audience: Anyone uses TBLIS function may also find it useful, not only RSTSR or REST program developers.
- Pure Extern or Dynamic Loading: This crate supports either pure extern (usual FFI, requires dynamic or static linking) and dynamic-loading, by cargo feature
dynamic_loading.
§Dynamic loading
By default, the tblis shared library is loaded at runtime via libloading. The loading process will search for the library in multiple locations, by the following order:
- User-defined candidates via environment variables
TBLIS_DYLOADorRSTSR_DYLOAD. LD_LIBRARY_PATHstyle discovery via environment variablesLD_LIBRARY_PATH(Linux),DYLD_LIBRARY_PATHandDYLD_FALLBACK_LIBRARY_PATH(macOS),PATH(Windows).- Python interpreter path discovery: if Python is at
/path/bin/python, the library is expected at/path/lib/libtblis.so. This includesTBLIS_PYTHON_PATH,CONDA_PREFIX, and Python interpreters found inPATH. - Standard system candidates such as
/usr/lib,/usr/local/lib, and/lib.
To disable dynamic loading and use static/dynamic linking instead, disable the dynamic_loading cargo feature.
§Cargo features
Optional features:
dynamic_loading: Supports dynamic loading.
§Crate structure
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: StructLibfor dynamic loading.dyload_initializer.rs: The initialization function ofLibfor dynamic loading.dyload_compatible.rs: Unsafe bindgen function that is compatible to that offfi_extern.rs. Only activated when dynamic loading.
Modules§
- tblis
- FFI module for tblis (dynamic loading).