projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Enhance shell.
[pintos-anon]
/
src
/
tests
/
userprog
/
matmult.c
diff --git
a/src/tests/userprog/matmult.c
b/src/tests/userprog/matmult.c
index e88b4c900d74c9e66785eaecbcf6c590c37a35b2..4f0615fa06fa642a531309dd0644fe60cccf9d44 100644
(file)
--- a/
src/tests/userprog/matmult.c
+++ b/
src/tests/userprog/matmult.c
@@
-8,27
+8,29
@@
and store the result back to the file system!
*/
and store the result back to the file system!
*/
+#include <stdio.h>
#include <syscall.h>
#include <syscall.h>
-/* 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.
don't fit in physical memory.
- Dim Memory
- --- --------
- 20 93 kB
- 30 316 kB
- 40 750 kB
- 50 1,464 kB
- 60 2,531 kB
- 70 4,019 kB
- 80 6,000 kB
- 90 8,542 kB
- 100 11,718 kB */
-#define Dim 20
-
-int A[Dim][Dim];
-int B[Dim][Dim];
-int C[Dim][Dim];
+ 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
+
+int A[DIM][DIM];
+int B[DIM][DIM];
+int C[DIM][DIM];
int
main (void)
int
main (void)
@@
-36,8
+38,8
@@
main (void)
int i, j, k;
/* Initialize the matrices. */
int i, j, k;
/* Initialize the matrices. */
- for (i = 0; i < D
im
; i++)
- for (j = 0; j < D
im
; j++)
+ for (i = 0; i < D
IM
; i++)
+ for (j = 0; j < D
IM
; j++)
{
A[i][j] = i;
B[i][j] = j;
{
A[i][j] = i;
B[i][j] = j;
@@
-45,11
+47,11
@@
main (void)
}
/* Multiply matrices. */
}
/* Multiply matrices. */
- for (i = 0; i < D
im
; i++)
- for (j = 0; j < D
im
; j++)
- for (k = 0; k < D
im
; k++)
+ for (i = 0; i < D
IM
; i++)
+ for (j = 0; j < D
IM
; j++)
+ for (k = 0; k < D
IM
; k++)
C[i][j] += A[i][k] * B[k][j];
/* Done. */
C[i][j] += A[i][k] * B[k][j];
/* Done. */
- exit (C[D
im - 1][Dim
- 1]);
+ exit (C[D
IM - 1][DIM
- 1]);
}
}