-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuildTest.sh
More file actions
executable file
·129 lines (107 loc) · 3.63 KB
/
Copy pathbuildTest.sh
File metadata and controls
executable file
·129 lines (107 loc) · 3.63 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
# Compile all 2^4 format combinations
# Combinations: SCS/CRS × true/false (complex) × SP/DP (float) × U/ULL (uint)
# Total: 2 × 2 × 2 × 2 = 16 builds
set -e # Exit on error
# Check if toolchain argument is provided
if [ -z "$1" ]; then
echo "Error: Toolchain must be passed as the first argument possible (GCC, CLANG, ICX, NVCC, HIP)"
echo "Usage: $0 <TOOLCHAIN>"
exit 1
fi
TOOLCHAIN="${1}" # Fixed toolchain
BUILD_DIR="./builds"
LOG_DIR="./compile_logs"
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
# Create directories
mkdir -p "$BUILD_DIR"
mkdir -p "$LOG_DIR"
echo "======================================"
echo "Compiling 16 Format Combinations"
echo "Toolchain: $TOOLCHAIN"
echo "Timestamp: $TIMESTAMP"
echo "======================================"
# Initial distclean to remove all previous builds
echo "Running initial distclean..."
make distclean > /dev/null 2>&1 || true
# Arrays for combinations
MTX_FORMATS=("SCS" "CRS")
COMPLEX_OPTIONS=("true" "false")
FLOAT_TYPES=("SP" "DP")
UINT_TYPES=("U" "ULL")
BUILD_COUNT=0
SUCCESS_COUNT=0
FAIL_COUNT=0
# Track passed and failed builds for summary
PASSED_BUILDS=()
FAILED_BUILDS=()
# Iterate through all combinations
for mtx in "${MTX_FORMATS[@]}"; do
for complex in "${COMPLEX_OPTIONS[@]}"; do
for float_type in "${FLOAT_TYPES[@]}"; do
for uint_type in "${UINT_TYPES[@]}"; do
BUILD_COUNT=$((BUILD_COUNT + 1))
BUILD_NAME="${mtx}_complex-${complex}_${float_type}_${uint_type}"
LOG_FILE="${LOG_DIR}/${TIMESTAMP}_${BUILD_NAME}.log"
DEST_DIR="${BUILD_DIR}/${BUILD_NAME}"
echo ""
echo "[${BUILD_COUNT}/16] Building: $BUILD_NAME"
echo " MTX_FMT=$mtx COMPLEX=$complex FLOAT=$float_type UINT=$uint_type"
# Clean before each build to avoid stale artifacts
make distclean > /dev/null 2>&1 || true
# Run the build, capturing stdout+stderr to log
if make -j MTX_FMT="$mtx" \
COMPLEX="$complex" \
FLOAT_TYPE="$float_type" \
UINT_TYPE="$uint_type" \
TOOLCHAIN="$TOOLCHAIN" \
>> "$LOG_FILE" 2>&1; then
echo " ✓ PASSED → log: $LOG_FILE"
SUCCESS_COUNT=$((SUCCESS_COUNT + 1))
PASSED_BUILDS+=("$BUILD_NAME")
# Copy binaries/artifacts into a named subdirectory
mkdir -p "$DEST_DIR"
# Adjust the glob below to match your actual output binary name(s)
cp -r ./build/. "$DEST_DIR"/ 2>/dev/null || \
find . -maxdepth 1 -type f -executable -exec cp {} "$DEST_DIR"/ \; 2>/dev/null || true
else
EXIT_CODE=$?
echo " ✗ FAILED (exit $EXIT_CODE) → log: $LOG_FILE"
FAIL_COUNT=$((FAIL_COUNT + 1))
FAILED_BUILDS+=("$BUILD_NAME")
fi
done
done
done
done
echo ""
echo "======================================"
echo "Compilation Summary"
echo "======================================"
echo "Total Builds: $BUILD_COUNT"
echo "Successful: $SUCCESS_COUNT"
echo "Failed: $FAIL_COUNT"
echo "Build Directory: $BUILD_DIR"
echo "Log Directory: $LOG_DIR"
echo ""
if [ ${#PASSED_BUILDS[@]} -gt 0 ]; then
echo "✓ Passed builds (${SUCCESS_COUNT}):"
for b in "${PASSED_BUILDS[@]}"; do
echo " • $b"
done
fi
if [ ${#FAILED_BUILDS[@]} -gt 0 ]; then
echo ""
echo "✗ Failed builds (${FAIL_COUNT}):"
for b in "${FAILED_BUILDS[@]}"; do
echo " • $b → ${LOG_DIR}/${TIMESTAMP}_${b}.log"
done
fi
echo "======================================"
if [ $FAIL_COUNT -eq 0 ]; then
echo "All builds completed successfully!"
exit 0
else
echo "Some builds failed. Check logs in $LOG_DIR"
exit 1
fi