X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ftests%2Fuserprog%2Fmatmult.c;h=4f0615fa06fa642a531309dd0644fe60cccf9d44;hb=a6774e749e1ecc7483fa31e5868cc355bb87f53b;hp=c30c05b76fd54d00262b0af5508a4fd0ae43b890;hpb=3e63d9d34f21b656a67c05cf5f22aa4bbcb024e6;p=pintos-anon diff --git a/src/tests/userprog/matmult.c b/src/tests/userprog/matmult.c index c30c05b..4f0615f 100644 --- a/src/tests/userprog/matmult.c +++ b/src/tests/userprog/matmult.c @@ -8,25 +8,29 @@ and store the result back to the file system! */ +#include #include -/* You should define this to be large enough that the arrays +/* You should define DIM to be large enough that the arrays don't fit in physical memory. Dim Memory ------ -------- 16 3 kB 64 48 kB + 128 192 kB 256 768 kB + 512 3,072 kB 1,024 12,288 kB + 2,048 49,152 kB 4,096 196,608 kB + 8,192 786,432 kB 16,384 3,145,728 kB */ +#define DIM 128 -#define Dim 1024 - -int A[Dim][Dim]; -int B[Dim][Dim]; -int C[Dim][Dim]; +int A[DIM][DIM]; +int B[DIM][DIM]; +int C[DIM][DIM]; int main (void) @@ -34,8 +38,8 @@ main (void) int i, j, k; /* Initialize the matrices. */ - for (i = 0; i < Dim; i++) - for (j = 0; j < Dim; j++) + for (i = 0; i < DIM; i++) + for (j = 0; j < DIM; j++) { A[i][j] = i; B[i][j] = j; @@ -43,11 +47,11 @@ main (void) } /* Multiply matrices. */ - for (i = 0; i < Dim; i++) - for (j = 0; j < Dim; j++) - for (k = 0; k < Dim; k++) + for (i = 0; i < DIM; i++) + for (j = 0; j < DIM; j++) + for (k = 0; k < DIM; k++) C[i][j] += A[i][k] * B[k][j]; /* Done. */ - exit (C[Dim - 1][Dim - 1]); + exit (C[DIM - 1][DIM - 1]); }