#linkage #linear-algebra #nvblas

sys nvblas-sys

This package provides linkage to NVBLAS

2 releases

0.1.1 Mar 9, 2023
0.1.0 Mar 9, 2023

#1089 in Math

MIT license

8KB

nvblas-sys

This package provides linkage to and configuration for NVBLAS.

Why should you use nvblas-sys

It's easy to link to a system library, especially when another package provides bindings. However, anyone who includes your package down the line will be unable to override it. Using nvblas-sys means exactly one package will link to libnvblas and those who wish to override it can do so without causing problems for dependents thanks to the use of the links manifest tag.

Setup

Before anything else, NVBLAS must be installed and exist in cargo search path. On Linux machines, it should be named libnvblas.so. If it is necessary to override the linkage, it can be overridden on a per-machine or per-crate basis by using a config.toml file.

Make sure to invoke the crate to make sure it runs:

extern crate nvblas-sys;

nvblas-sys comes with a default configuration file, but it may not be may not be acceptable for your usage. To use your own configuration file, include the following line in your build.rs file:

println!("cargo:rustc-env=NVBLAS_CONFIG_FILE={}/nvblas.conf",
          env::var("CARGO_MANIFEST_DIR").unwrap());

Alternatively, you can set the environment variable NVBLAS_CONFIG_FILE manually.

Since NVBLAS is a limited drop-in replacement to traditional CPU BLAS implementations, nvblas-sys does not provide any declarations; you will also need to include blas-sys as a dependency.

Dependencies