-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathhybrid_compile.sh
More file actions
51 lines (40 loc) · 1.45 KB
/
hybrid_compile.sh
File metadata and controls
51 lines (40 loc) · 1.45 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
#!/bin/bash
# Hybrid compilation: Use Docker to pre-compile, then run in Debian conda
set -e
echo "🔧 K3D Hybrid Compilation Strategy"
echo "=================================="
echo ""
echo "Step 1: Build Docker compilation environment..."
docker build -f Dockerfile.compile -t k3d-compile . 2>&1 | tail -20
echo ""
echo "Step 2: Pre-compile CuPy kernels in Docker (GCC 11, compatible)..."
docker run --gpus all \
-v $(pwd):/workspace \
k3d-compile
echo ""
echo "Step 3: Verify compiled kernels..."
if [ -d ".cupy_cache" ]; then
cubin_count=$(find .cupy_cache -name "*.cubin" | wc -l)
ptx_count=$(find .cupy_cache -name "*.ptx" | wc -l)
cache_size=$(du -sh .cupy_cache | cut -f1)
echo "✅ Pre-compilation complete!"
echo " - CUBIN files: $cubin_count"
echo " - PTX files: $ptx_count"
echo " - Cache size: $cache_size"
echo ""
echo "Step 4: Testing in Debian 13 conda environment..."
# Activate conda and test with pre-compiled cache
source /home/daniel/miniforge/bin/activate k3d-cranium
export PYTHONPATH=.
export CUPY_CACHE_DIR=$(pwd)/.cupy_cache
echo " Setting CUPY_CACHE_DIR=$CUPY_CACHE_DIR"
echo ""
echo " Running navigation test..."
python test_navigate.py
echo ""
echo "✅ Hybrid compilation SUCCESS!"
echo " Navigation works with pre-compiled Docker kernels in Debian 13!"
else
echo "❌ Cache directory not found. Pre-compilation failed."
exit 1
fi