[package]
name = "tetration"
version = "0.1.5"
edition = "2024"
rust-version = "1.95"
authors = ["AHurowitz <thicclatka@users.noreply.github.com>"]
description = "Tetration tensor file format: Rust library (tetration) and tet CLI"
license = "MIT or Apache-2.0"
repository = "https://github.com/thicclatka/tetration"
homepage = "https://github.com/thicclatka/tetration"
documentation = "https://docs.rs/tetration"
readme = "README.md"
keywords = ["tensor", "data", "format", "mmap"]
categories = ["encoding", "filesystem", "command-line-utilities"]
default-run = "tet"

# rustdoc on docs.rs: build with default features off (avoid native NetCDF/HDF5; gate optional imports).
[package.metadata.docs.rs]
no-default-features = true

[features]
default = ["tetration-netcdf", "tetration-hdf5"]
tetration-netcdf = ["dep:netcdf"]
tetration-hdf5 = ["dep:hdf5-metno"]
# Phase 10b: CUDA scalar f32 reductions (Linux/Windows + NVIDIA).
tetration-gpu = ["dep:cudarc"]
# Phase 10d: ROCm / HIP scalar f32 reductions (Linux + AMD; do not enable with `tetration-gpu`).
tetration-rocm = ["dep:cudarc"]
# Phase 10c: Metal scalar f32 reductions (macOS + Apple GPU; build on macOS only).
tetration-metal = ["dep:metal"]

[[bin]]
name = "tet"
path = "src/bin/tet.rs"

[[example]]
name = "create_and_query"
path = "examples/create_and_query.rs"

[[example]]
name = "inspect_catalog"
path = "examples/inspect_catalog.rs"

[[example]]
name = "session_write"
path = "examples/session_write.rs"

[[example]]
name = "streaming_write"
path = "examples/streaming_write.rs"

[[example]]
name = "gen_small_tet_fixtures"
path = "examples/gen_small_tet_fixtures.rs"

[dependencies]
bytemuck = "1.25.0"
clap = { version = "4.5.51", features = ["derive"] }
indicatif = "0.18.3"
memmap2 = "0.9.10"
rayon = "1.12.0"
rkyv = "0.8.16"
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.150"
toml = "1.1.2"
thiserror = "2.0.18"
netcdf = { version = "0.12.0", optional = true }
hdf5-metno = { version = "0.12.4", optional = true }
half = { version = "2.6.0", features = ["bytemuck", "serde"] }
zstd = "0.13.3"
cudarc = { version = "0.19.7", optional = true, default-features = false, features = [
  "std",
  "driver",
  "nvrtc",
  # cudarc 0.19: linking mode + pinned CUDA ABI (builds without nvcc; loads libs at runtime).
  "fallback-dynamic-loading",
  "cuda-12080",
] }

[dev-dependencies]
anyhow = "1.0.102"
log = "0.4.29"
proptest = "1.9.0"
tempfile = "3.23.0"

[target.'cfg(target_os = "macos")'.dependencies]
metal = { version = "0.29.0", optional = true }

[profile.release]
codegen-units = 1
lto = true
panic = "abort"
strip = true
