Initial version
This commit is contained in:
commit
6f405265a5
102 changed files with 14486 additions and 0 deletions
39
code/test/matmult.c
Normal file
39
code/test/matmult.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
/* matmult.c
|
||||
* Test program to do matrix multiplication on large arrays.
|
||||
*
|
||||
* Intended to stress virtual memory system.
|
||||
*
|
||||
* Ideally, we could read the matrices off of the file system,
|
||||
* and store the result back to the file system!
|
||||
*/
|
||||
|
||||
#include "syscall.h"
|
||||
|
||||
#define Dim 20 /* sum total of the arrays doesn't fit in
|
||||
* physical memory
|
||||
*/
|
||||
|
||||
int A[Dim][Dim];
|
||||
int B[Dim][Dim];
|
||||
int C[Dim][Dim];
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
for (i = 0; i < Dim; i++) /* first initialize the matrices */
|
||||
for (j = 0; j < Dim; j++)
|
||||
{
|
||||
A[i][j] = i;
|
||||
B[i][j] = j;
|
||||
C[i][j] = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < Dim; i++) /* then multiply them together */
|
||||
for (j = 0; j < Dim; j++)
|
||||
for (k = 0; k < Dim; k++)
|
||||
C[i][j] += A[i][k] * B[k][j];
|
||||
|
||||
Exit (C[Dim - 1][Dim - 1]); /* and then we're done */
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue