-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproj3_eval.sh
executable file
·148 lines (129 loc) · 3.15 KB
/
proj3_eval.sh
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
#!/bin/bash
set -x
BENCHMARK="benchmark_thread"
# Benchmark to copy
BENCH=/home/sudarsun/ssd/$BENCHMARK
# Run C or CPP projects
PROC1RUN="timeout 15s ./pthread_test"
PROC2RUN="timeout 15s ./pthreadcpp"
RUNPATH=""
OUTPUT=out.txt
SUBMISSION_DIR=/home/sudarsun/ssd/Project_3_User_Level_Memory_Management
cd $SUBMISSION_DIR
iteratename=""
OUTPUTPATTERN1="1 1 1 1 1"
OUTPUTPATTERN2="15 15 15 15 15"
OUTPUTPATTERN1_COUNT=15
OUTPUTPATTERN2_COUNT=15
GETRESULT() {
#Check for output match using our benchmark.
# The thread benchmark performs 15 * 15 matrix multiplication using 25 threads
match1=`grep -c -r $OUTPUTPATTERN1 $OUTPUT`
match2=`grep -c -r $OUTPUTPATTERN2 $OUTPUT`
# Number of output line match
match1count=$OUTPUTPATTERN1_COUNT
match2count=$OUTPUTPATTERN2_COUNT
if [ "${match1}" = $match1count ] && [ "${match2}" = $match2count ]
then
temp=`grep -c -r "pthread" ../*vm.c*`
matches3=$temp
if [ "${matches3}" != 0 ];
then
let matches4=0
#echo $run
temp=`grep -c -r "TLB" ../*vm.c*`
matches4=$temp
if [ "${matches4}" != 0 ];
then
echo ${RUNPATH%/*/*} $match1 $match2 $matches3 $matches4
else
echo ${RUNPATH%/*/*} $match1 $match2 $matches3 0
fi
else
echo ${RUNPATH%/*/*} $match1 $match2 $matches3 0
fi
else
echo ${RUNPATH%/*/*} 0 0 0 0
fi
match1=0
match2=0
matches4=0
}
#Some students have their code in NAME/Submission_attachments/project3 or a similar directory
RUN_EXP() {
for iteratename in */Submission_attachments
do
ls $iteratename/* >/dev/null 2>&1 ;
if [ $? != 0 ];
then
RUNPATH=$iteratename/"dummy"
GETRESULT
else
for f in $iteratename/*; do
if [ -d "$f" ]; then
#The library code is present immediately within the project directory
if [ ! -f "$f/my_vm.c" ]; then
#The library code is present inside a
#subdirectory code, so traverse to it.
cd $f/code
else
cd $f
fi
RUNPATH=$f
if [ -d "$BENCHMARK" ]; then
cd $BENCHMARK
rm $OUTPUT
$PROC1RUN &> $OUTPUT
$PROC2RUN &>> $OUTPUT
GETRESULT
elif [ -f "my_vm.c" ]; then
cp -r $BENCH .
cd $BENCHMARK
rm $OUTPUT
$PROC1RUN &> $OUTPUT
$PROC2RUN &>> $OUTPUT
GETRESULT
fi
fi
done
cd $SUBMISSION_DIR
fi
done
}
# We must also handle a condition where some students have not submitted the benchmark code, so
COMPILE_BENCHMARK() {
for iteratename in */Submission_attachments
do
MYPATH="$iteratename/*3*"
for f in $iteratename/*; do
if [ -d "$f" ]; then
#The library code is present immediately within the project directory
if [ ! -f "$f/my_vm.c" ]; then
#The library code is present inside a
#subdirectory code, so traverse to it.
cd $f/code
else
cd $f
fi
make clean &> $OUTPUT
make &> $OUTPUT
if [ -d "$BENCHMARK" ]; then
cd $BENCHMARK
rm test
make clean &> $OUTPUT
make &> $OUTPUT
else
# Student has not submitted the benchmark code, so copy`
cp -r $BENCH .
cd $BENCHMARK
rm test
make clean &> $OUTPUT
make &> $OUTPUT
fi
fi
done
cd $SUBMISSION_DIR
done
}
COMPILE_BENCHMARK
RUN_EXP