Skip to content
This repository was archived by the owner on Mar 21, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions launcher/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ fn vram_maximum(
if let Some(vram) = available.checked_sub(model) {
let tokens_allowed = vram / token_vram;
tracing::debug!(
"Available vram {}: model needs {}, every tokens requires {}, maximum allocatable tokens {tokens_allowed}",
human_size(available, "B"),
human_size(model, "B"),
human_size(token_vram, "B"),
);
"Available vram {}: model needs {}, every tokens requires {}, maximum allocatable tokens {tokens_allowed}",
human_size(available, "B"),
human_size(model, "B"),
human_size(token_vram, "B"),
);
Some(tokens_allowed)
} else {
tracing::warn!(
Expand Down Expand Up @@ -1264,7 +1264,12 @@ fn num_cuda_devices() -> Option<usize> {
Ok(devices) => devices,
Err(_) => match env::var("NVIDIA_VISIBLE_DEVICES") {
Ok(devices) => {
if devices.trim() == "all" {
// NVIDIA_VISIBLE_DEVICES is always set when not specified and the nvidia container runtime is
// in (jit-)cdi mode (since 1.14)
// nvidia container runtime default mode switched from legacy to cdi mode from 1.18 on
// Let's handle the void case as all here
// See: https://github.com/NVIDIA/nvidia-container-toolkit
if ["all", "void"].contains(&devices.trim()) {
// Count the number of all GPUs via nvidia-smi
let output = Command::new("nvidia-smi")
.args(["--query-gpu=uuid", "--format=csv,noheader"])
Expand All @@ -1274,8 +1279,7 @@ fn num_cuda_devices() -> Option<usize> {
String::from_utf8_lossy(&output.stdout)
.lines()
.filter(|line| !line.trim().is_empty())
.count()
.to_string()
.collect::<Vec<_>>().join(",")
} else {
devices
}
Expand Down
Loading