Skip to content

Commit d2861ff

Browse files
Benchmark update
1 parent 2f06345 commit d2861ff

14 files changed

+3628
-7094
lines changed

src/data/Matrix_A.txt

Lines changed: 513 additions & 1025 deletions
Large diffs are not rendered by default.

src/data/Matrix_B.txt

Lines changed: 513 additions & 1025 deletions
Large diffs are not rendered by default.

src/data/Matrix_C.txt

Lines changed: 513 additions & 1025 deletions
Large diffs are not rendered by default.

src/data/Matrix_D.txt

Lines changed: 513 additions & 1025 deletions
Large diffs are not rendered by default.

src/data/Matrix_E.txt

Lines changed: 513 additions & 1025 deletions
Large diffs are not rendered by default.

src/data/Matrix_F.txt

Lines changed: 513 additions & 1025 deletions
Large diffs are not rendered by default.

src/data/Matrix_G.txt

Lines changed: 513 additions & 918 deletions
Large diffs are not rendered by default.

src/data/benchmark_modulo_Barrett.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
256 0.360843
55
512 3.050652
66
1024 27.503507
7+
256 0.221791
8+
512 1.843640
9+
1024 16.366830

src/data/benchmark_modulo_SIMD1.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
256 0.320855
2-
512 2.779970
3-
1024 25.977462
1+
256 0.203090
2+
512 1.740522
3+
1024 15.488686

src/data/benchmark_modulo_SIMD2.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
256 0.353629
2-
512 2.799502
3-
1024 24.423494
1+
256 0.177558
2+
512 1.571384
3+
1024 14.695100

src/data/benchmark_modulo_SIMD3.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
256 0.312455
2-
512 2.680338
3-
1024 24.309112
1+
256 0.221454
2+
512 1.564162
3+
1024 14.567049

src/data/benchmark_modulo_naive.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
256 0.236347
2-
512 2.194848
3-
1024 20.595512
1+
256 0.172510
2+
512 1.320109
3+
1024 10.923446

src/main_test.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ int main(int argc, char** argv){
2626
const int TEST3 = 0;
2727
const int TEST4 = 1;
2828
const int TEST5 = 0;
29-
// const int TEST6 = 0;
29+
const int TEST6 = 0;
3030
// const int TEST7 = 1;
3131

3232

@@ -130,9 +130,9 @@ int main(int argc, char** argv){
130130
u_int32_t u_b = (int) (pow(2, 56) / p); // Constant for Barrett
131131
fesetround(FE_TONEAREST);
132132

133-
int n = 1024;
133+
int n = 512;
134134

135-
for (int i=0; i<1; i++){
135+
for (int i=0; i<10; i++){
136136

137137
double**A = random_matrix(n, p);
138138
double**B = random_matrix(n, p);
@@ -207,5 +207,13 @@ int main(int argc, char** argv){
207207
printf("res4 = %f \n", res4);
208208
}
209209

210+
if (TEST6){
211+
printf("Hello world ! \n");
212+
}
213+
214+
215+
216+
217+
210218
return 0;
211219
}

src/matrix_mul.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ double modulo_naive(double a, double p){
77

88
double modulo_SIMD1(double a, double p, double u){
99
/* Function .1 from SIMD article for floats.
10-
Hypothesis: Rounding mode = down and p < 2^26.
10+
Hypothesis: Rounding mode = nearest and p < 2^26.
1111
*/
1212
double b = a * u;
1313
double c = (double)(int)b;
@@ -73,8 +73,8 @@ u_int32_t modulo_Barrett(u_int64_t a, u_int32_t p, u_int32_t u){
7373
void mp_naive(double** A, double** B, double** C, int n, double p){
7474
// Assert C is a zero matrix
7575
for (int i=0; i<n; i++){
76-
for (int j=0; j<n; j++){
77-
for (int k=0; k<n; k++){
76+
for (int k=0; k<n; k++){
77+
for (int j=0; j<n; j++){
7878
double temp = modulo_naive(A[i][k] * B[k][j], p);
7979
C[i][j] += temp;
8080
}
@@ -92,8 +92,8 @@ void mp_naive(double** A, double** B, double** C, int n, double p){
9292
void mp_SIMD1(double** A, double** B, double** C, int n, double p, double u){
9393
// Assert C is a zero matrix
9494
for (int i=0; i<n; i++){
95-
for (int j=0; j<n; j++){
96-
for (int k=0; k<n; k++){
95+
for (int k=0; k<n; k++){
96+
for (int j=0; j<n; j++){
9797
double temp = modulo_SIMD1(A[i][k] * B[k][j], p, u);
9898
C[i][j] += temp;
9999
}
@@ -111,8 +111,8 @@ void mp_SIMD1(double** A, double** B, double** C, int n, double p, double u){
111111
void mp_SIMD2(double** A, double** B, double** C, int n, double p, double u){
112112
// Assert C is a zero matrix
113113
for (int i=0; i<n; i++){
114-
for (int j=0; j<n; j++){
115-
for (int k=0; k<n; k++){
114+
for (int k=0; k<n; k++){
115+
for (int j=0; j<n; j++){
116116
double temp = modulo_SIMD2(A[i][k] * B[k][j], p, u);
117117
C[i][j] += temp;
118118
}
@@ -130,8 +130,8 @@ void mp_SIMD2(double** A, double** B, double** C, int n, double p, double u){
130130
void mp_SIMD3(double** A, double** B, double** C, int n, double p, double u){
131131
// Assert C is a zero matrix
132132
for (int i=0; i<n; i++){
133-
for (int j=0; j<n; j++){
134-
for (int k=0; k<n; k++){
133+
for (int k=0; k<n; k++){
134+
for (int j=0; j<n; j++){
135135
double temp = modulo_SIMD3(A[i][k] * B[k][j], p, u);
136136
C[i][j] += temp;
137137
}
@@ -150,8 +150,8 @@ void mp_SIMD3(double** A, double** B, double** C, int n, double p, double u){
150150
void mp_Barrett(double** A, double** B, double** C, int n, double p, u_int32_t u){
151151
// Assert C is a zero matrix
152152
for (int i=0; i<n; i++){
153-
for (int j=0; j<n; j++){
154-
for (int k=0; k<n; k++){
153+
for (int k=0; k<n; k++){
154+
for (int j=0; j<n; j++){
155155
double temp = modulo_Barrett(A[i][k] * B[k][j], p, u);
156156
C[i][j] += temp;
157157
}

0 commit comments

Comments
 (0)