forked from wutzebaer/tensorflow-5090
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.sh
More file actions
62 lines (54 loc) · 1.77 KB
/
build.sh
File metadata and controls
62 lines (54 loc) · 1.77 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# build.sh - Build script for PyTorch + TensorFlow GPU container
set -e
echo "🛠️ Building PyTorch + TensorFlow GPU Docker image..."
echo "📋 Build info:"
echo " - Image name: pytorch-tensorflow-gpu"
echo " - Container name: PYTORCH_TENSORFLOW_GPU"
echo " - CUDA 12.8 base"
echo " - PyTorch nightly with CUDA 12.8 (best Blackwell support)"
echo " - TensorFlow nightly"
echo ""
# Check NVIDIA driver
echo "🔍 Checking NVIDIA driver..."
if command -v nvidia-smi &> /dev/null; then
driver_version=$(nvidia-smi --query-gpu=driver_version --format=csv,noheader | head -1)
echo " Driver version: $driver_version"
else
echo " ⚠️ nvidia-smi not found"
fi
# Create workspace if needed
if [ ! -d "$HOME/ai_training_env" ]; then
echo "📁 Creating workspace directory: ~/ai_training_env"
mkdir -p ~/ai_training_env
fi
echo ""
echo "🔨 Building Docker image..."
DOCKER_BUILDKIT=1 docker build \
--progress=plain \
-t pytorch-tensorflow-gpu \
.
echo ""
echo "✅ Build completed!"
echo ""
# Check for existing container
if docker ps -a --format "table {{.Names}}" | grep -q "^PYTORCH_TENSORFLOW_GPU$"; then
echo "⚠️ Container 'PYTORCH_TENSORFLOW_GPU' already exists."
read -p "Remove existing container? (y/N) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "🗑️ Removing existing container..."
docker stop PYTORCH_TENSORFLOW_GPU 2>/dev/null || true
docker rm PYTORCH_TENSORFLOW_GPU
else
echo "❌ Aborting. Please manually handle the existing container."
exit 1
fi
fi
echo ""
echo "🚀 Starting container..."
docker run -it --gpus all \
--name PYTORCH_TENSORFLOW_GPU \
--restart unless-stopped \
-v ~/ai_training_env:/workspace \
pytorch-tensorflow-gpu