forked from ROSS-org/ROSS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildAndTest.sh
More file actions
executable file
·157 lines (135 loc) · 4.31 KB
/
Copy pathbuildAndTest.sh
File metadata and controls
executable file
·157 lines (135 loc) · 4.31 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/usr/local/bin/bash
# Test build and run script for ROSS 3D-NoC
set -e # Exit on error
echo "========================================"
echo "ROSS 3D-NoC Build and Test Script"
echo "========================================"
# Configuration
ROSS_DIR="${ROSS_DIR:-./ROSS}"
BUILD_DIR="${BUILD_DIR:-$ROSS_DIR/build}"
MODEL_NAME="3d-noc"
# Check if ROSS directory exists
if [ ! -d "$ROSS_DIR" ]; then
echo "Error: ROSS directory not found at $ROSS_DIR"
echo "Please set ROSS_DIR environment variable or run from correct location"
exit 1
fi
# Check if model files exist
if [ ! -d "$ROSS_DIR/models/$MODEL_NAME" ]; then
echo "Error: Model directory not found at $ROSS_DIR/models/$MODEL_NAME"
exit 1
fi
# Create and enter build directory
echo "Creating build directory..."
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
# Configure with CMake
echo ""
echo "Configuring with CMake..."
# Try to detect best compiler
if command -v mpicc &> /dev/null; then
CC_COMPILER="mpicc"
elif command -v gcc-13 &> /dev/null; then
CC_COMPILER="gcc-13"
elif command -v gcc-12 &> /dev/null; then
CC_COMPILER="gcc-12"
elif command -v clang &> /dev/null; then
CC_COMPILER="clang"
else
CC_COMPILER="cc"
fi
echo "Using compiler: $CC_COMPILER"
cmake .. \
-DROSS_BUILD_MODELS=ON \
-DCMAKE_C_COMPILER="$CC_COMPILER" \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_VERBOSE_MAKEFILE=ON
# Build the model
echo ""
echo "Building $MODEL_NAME..."
make $MODEL_NAME VERBOSE=1
# Check if build succeeded
if [ -f "models/$MODEL_NAME/$MODEL_NAME" ]; then
echo ""
echo "Build successful! Binary created at: $BUILD_DIR/models/$MODEL_NAME/$MODEL_NAME"
# Run basic tests
echo ""
echo "Running basic tests..."
echo "========================================"
# Test 1: Sequential mode, small network
echo ""
echo "Test 1: Sequential mode (4x4x4 mesh)"
./models/$MODEL_NAME/$MODEL_NAME \
--synch=1 \
--noc-x=4 --noc-y=4 --noc-z=4 \
--noc-topology=0 \
--workload=0 \
--end-time=1000 \
--output=test_mesh_sequential.json
if [ -f "test_mesh_sequential.json" ]; then
echo "✓ Test 1 passed - output file created"
else
echo "✗ Test 1 failed - no output file"
fi
# Test 2: Conservative mode with MPI (if available)
if command -v mpirun &> /dev/null; then
echo ""
echo "Test 2: Conservative parallel mode (4x4x4 torus)"
mpirun -np 2 ./models/$MODEL_NAME/$MODEL_NAME \
--synch=2 \
--noc-x=4 --noc-y=4 --noc-z=4 \
--noc-topology=1 \
--workload=1 \
--end-time=1000 \
--output=test_torus_parallel.json
if [ -f "test_torus_parallel.json" ]; then
echo "✓ Test 2 passed - output file created"
else
echo "✗ Test 2 failed - no output file"
fi
else
echo ""
echo "Skipping Test 2 (MPI not available)"
fi
# Test 3: Different workload
echo ""
echo "Test 3: IoT workload test (4x4x4 hypercube)"
./models/$MODEL_NAME/$MODEL_NAME \
--synch=1 \
--noc-x=4 --noc-y=4 --noc-z=4 \
--noc-topology=2 \
--workload=2 \
--end-time=1000 \
--output=test_hypercube_iot.json
if [ -f "test_hypercube_iot.json" ]; then
echo "✓ Test 3 passed - output file created"
# Display sample results
echo ""
echo "Sample results from test_hypercube_iot.json:"
if command -v python3 &> /dev/null; then
python3 -c "
import json
with open('test_hypercube_iot.json', 'r') as f:
data = json.load(f)
print(f' Avg Latency: {data[\"performance\"][\"avg_latency_ns\"]} ns')
print(f' Avg Throughput: {data[\"performance\"][\"avg_throughput_gbps\"]} Gbps')
print(f' Total Power: {data[\"power\"][\"total_power_mw\"]} mW')
"
else
head -20 test_hypercube_iot.json
fi
else
echo "✗ Test 3 failed - no output file"
fi
echo ""
echo "========================================"
echo "All tests completed!"
echo ""
echo "You can now run more experiments with:"
echo " cd $BUILD_DIR"
echo " ./models/$MODEL_NAME/$MODEL_NAME --help"
else
echo ""
echo "Build failed! Check error messages above."
exit 1
fi