sam3rs 0.2.0

Real-time Meta SAM 3 in native Rust on NVIDIA GPUs (CUDA) and Apple silicon (Metal): text, box and click segmentation and video tracking, up to 93x faster than PyTorch
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Builds csrc/nvtx.c, a two-function shim over the header-only NVTX3 API, when the
//! `nvtx` feature is on. The kernels need no build step: they ship as prebuilt PTX in
//! kernels/ptx (see scripts/build-ptx.sh), so default builds need no CUDA toolkit

fn main() {
    println!("cargo:rerun-if-changed=build.rs");
    #[cfg(feature = "nvtx")]
    nvtx();
}

#[cfg(feature = "nvtx")]
fn nvtx() {
    let cuda = std::env::var("CUDA_HOME").unwrap_or_else(|_| "/usr/local/cuda".into());
    println!("cargo:rerun-if-changed=csrc/nvtx.c");
    println!("cargo:rerun-if-env-changed=CUDA_HOME");
    cc::Build::new().file("csrc/nvtx.c").include(std::path::Path::new(&cuda).join("include")).compile("sam3rs_nvtx");
    println!("cargo:rustc-link-lib=dylib=dl");
}