-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_cuda_env.sh
More file actions
executable file
·34 lines (27 loc) · 940 Bytes
/
setup_cuda_env.sh
File metadata and controls
executable file
·34 lines (27 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Setup CUDA environment for building llama-cpp with GPU support
# Source this file before building: source setup_cuda_env.sh
echo "Setting up CUDA environment..."
# CUDA paths
export CUDA_HOME=/usr/local/cuda
export CUDA_PATH=$CUDA_HOME
export CUDA_ROOT=$CUDA_HOME
# Add CUDA to PATH
export PATH=$CUDA_HOME/bin:$PATH
# Library paths
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
# Build optimization
export CMAKE_BUILD_PARALLEL_LEVEL=16
# Verify CUDA is accessible
if command -v nvcc &> /dev/null; then
echo "CUDA version: $(nvcc --version | grep release | awk '{print $5}' | cut -d',' -f1)"
echo "CUDA_HOME: $CUDA_HOME"
echo "Environment ready for CUDA build"
else
echo "WARNING: nvcc not found in PATH"
echo "CUDA_HOME: $CUDA_HOME"
fi
# Check GPU
echo ""
echo "GPU Status:"
nvidia-smi --query-gpu=name,memory.total,memory.free --format=csv,noheader 2>/dev/null || echo "No GPU detected"