-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_compilation.sh
More file actions
executable file
·48 lines (38 loc) · 995 Bytes
/
test_compilation.sh
File metadata and controls
executable file
·48 lines (38 loc) · 995 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# Test script for CUDA SVM compilation on Colab
echo "=== CUDA SVM Compilation Test ==="
# Navigate to SVM directory
cd SVM
# Clean and build
echo "Cleaning previous build..."
make clean
echo "Building CUDA SVM library..."
if make; then
echo "✅ Compilation successful!"
echo ""
echo "=== Testing Library ==="
# Test the library
python3 -c "
import sys
sys.path.append('..')
from SVM.cuda_svm import CudaSVM
import numpy as np
print('Testing CUDA SVM functionality...')
# Simple test
X = np.random.randn(50, 4).astype(np.float32)
y = (X[:, 0] + X[:, 1] > 0).astype(np.float32) * 2 - 1
svm = CudaSVM(kernel='rbf', C=1.0)
svm.fit(X, y)
pred = svm.predict(X[:10])
print('✅ CUDA SVM test passed!')
print('Library is ready for use.')
" 2>/dev/null
if [ $? -eq 0 ]; then
echo "✅ All tests passed!"
else
echo "⚠️ Python test failed, but compilation was successful"
fi
else
echo "❌ Compilation failed!"
exit 1
fi