Skip to content

Commit 6be225c

Browse files
authored
fix: building on non-cuda platforms without nvcc (#576)
1 parent 8a2c551 commit 6be225c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tools/make/rust.mk

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,14 @@ rust: ## Ensure Rust is installed and build the Rust library with CUDA support (
118118
exit 1; \
119119
fi; \
120120
else \
121-
echo "Building Rust library with CUDA support..." && \
122-
echo "💡 Tip: For 20-30% speedup on RTX 3090+/A100/H100, use: make rust ENABLE_FLASH_ATTN=1" && \
123-
cd candle-binding && cargo build --release; \
121+
if command -v nvcc >/dev/null 2>&1; then \
122+
echo "Building Rust library with CUDA support..." && \
123+
echo "💡 Tip: For 20-30% speedup on RTX 3090+/A100/H100, use: make rust ENABLE_FLASH_ATTN=1" && \
124+
cd candle-binding && cargo build --release; \
125+
else \
126+
echo "Building Rust library for CPU (nvcc not found)..." && \
127+
cd candle-binding && cargo build --release --no-default-features; \
128+
fi; \
124129
fi'
125130

126131
# Build the Rust library without CUDA (for CI/CD environments)

0 commit comments

Comments
 (0)