viva_tensor/blas

Types

BLAS backend types

pub type BlasBackend {
  IntelMKL
  OpenBLAS
  ZigSIMD
  Unknown
}

Constructors

  • IntelMKL
  • OpenBLAS
  • ZigSIMD
  • Unknown

CPU topology info from NIF

pub type CpuTopology {
  CpuTopology(
    logical_cpus: Int,
    physical_cores: Int,
    l2_cache_kb: Int,
    l3_cache_kb: Int,
    has_avx2: Bool,
    has_avx512: Bool,
  )
}

Constructors

  • CpuTopology(
      logical_cpus: Int,
      physical_cores: Int,
      l2_cache_kb: Int,
      l3_cache_kb: Int,
      has_avx2: Bool,
      has_avx512: Bool,
    )

Values

pub fn auto_configure() -> Result(BlasBackend, String)

Auto-configure for maximum performance

pub fn backend_name(backend: BlasBackend) -> String

Get backend name as string

pub fn configure_threads(num_threads: Int) -> Result(Nil, String)

Configure MKL/OpenBLAS threads for optimal performance

pub fn detect_backend() -> BlasBackend

Detect the best available BLAS backend

pub fn expected_gflops(
  backend: BlasBackend,
  matrix_size: Int,
) -> Int

Performance tier for the backend

pub fn get_cpu_topology() -> CpuTopology

Get CPU topology for tuning

pub fn set_affinity(mode: String) -> Result(Nil, String)

Set thread affinity (scatter for hybrid CPUs)

Search Document