-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_kernels.sh
More file actions
executable file
·38 lines (29 loc) · 1.08 KB
/
build_kernels.sh
File metadata and controls
executable file
·38 lines (29 loc) · 1.08 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
#!/bin/bash
# Build script for YAIE custom kernels
set -e # Exit on any error
echo "Building YAIE custom kernels..."
# Check if CUDA is available
if ! command -v nvcc &> /dev/null; then
echo "CUDA not found. Building CPU-only version."
echo "For GPU acceleration, please install CUDA toolkit."
exit 0
fi
# Check if Python is available
if ! command -v python &> /dev/null; then
echo "Python not found. Please install Python 3.8+."
exit 1
fi
# Check for PyTorch with CUDA support
python -c "import torch; assert torch.cuda.is_available(), 'PyTorch CUDA not available'" 2>/dev/null
if [ $? -ne 0 ]; then
echo "PyTorch with CUDA support not found. Please install PyTorch with CUDA support."
exit 1
fi
echo "Found CUDA and PyTorch with CUDA support. Starting build..."
# Create build directory if it doesn't exist
mkdir -p build
# Build the extensions
python setup_kernels.py build_ext --inplace
echo "Build completed successfully!"
echo "To verify the installation:"
echo " python -c \"import torch; from src.kernels import *; print('Kernels loaded successfully')\""