ExBurn (ex_burn v0.3.1)

Copy Markdown View Source

ExBurn — Elixir bridge to the Burn deep learning framework.

ExBurn provides a high-level API for tensor computation, neural network training, and GPU-accelerated machine learning by delegating to Burn via Rust NIFs (Native Implemented Functions).

Architecture

Elixir/Axon  Nx.Defn  ExBurn.Defn.Compiler  ExBurn.Backend  ExBurn.Nif (Rustler)  Burn/CubeCL  GPU
                                                                                 
                                                                           ExCubecl (GPU buffers, kernels, pipelines)

Quick Start

# Set ExBurn as the default Nx backend
Nx.default_backend(ExBurn.Backend)

# Create and manipulate tensors
t = Nx.tensor([1.0, 2.0, 3.0])
Nx.add(t, t) |> Nx.to_list()

Modules

Summary

Functions

Sets the default Nx backend to ExBurn.Backend.

Checks whether an NVIDIA CUDA GPU is available.

Returns the default device for tensor operations.

Returns a map with device information including GPU availability, backend name, and available backends.

Returns the name of the active compute device (e.g., "CUDA (NVIDIA GPU)").

Returns the number of NIF functions registered by the Rust library.

Checks whether the NIF library is loaded and functional.

Performs a quick smoke test of the ExBurn pipeline.

Returns a summary of the ExBurn environment.

Returns the current version of ExBurn.

Functions

configure!()

@spec configure!() :: :ok

Sets the default Nx backend to ExBurn.Backend.

After calling this, all Nx operations will be executed via Burn.

cuda_available?()

@spec cuda_available?() :: boolean()

Checks whether an NVIDIA CUDA GPU is available.

default_device()

@spec default_device() :: :cpu | :gpu

Returns the default device for tensor operations.

Currently returns :gpu when a compatible GPU backend is available, otherwise falls back to :cpu.

device_info()

@spec device_info() :: map()

Returns a map with device information including GPU availability, backend name, and available backends.

device_name()

@spec device_name() :: String.t()

Returns the name of the active compute device (e.g., "CUDA (NVIDIA GPU)").

nif_function_count()

@spec nif_function_count() :: non_neg_integer()

Returns the number of NIF functions registered by the Rust library.

Useful for debugging NIF loading issues.

nif_loaded?()

@spec nif_loaded?() :: boolean()

Checks whether the NIF library is loaded and functional.

Returns true if the NIF responds to a basic health check, false otherwise.

smoke_test()

@spec smoke_test() :: :ok | {:error, String.t()}

Performs a quick smoke test of the ExBurn pipeline.

Creates a small tensor, runs it through the backend, and verifies the result. Returns :ok on success or {:error, reason} on failure.

Example

case ExBurn.smoke_test() do
  :ok -> IO.puts("ExBurn is working!")
  {:error, message} -> IO.puts("ExBurn error: " <> message)
end

summary()

@spec summary() :: String.t()

Returns a summary of the ExBurn environment.

Includes version, device info, GPU availability, and available backends.

Example

IO.puts(ExBurn.summary())

version()

@spec version() :: String.t()

Returns the current version of ExBurn.