/* Starting point for Matrix Multiply Homework * By P. Koopman for CMU 18-742 10/11/97 */ /* Probably you'll want to remove the three define directives * below and go to compiler flags so you can try alternatives * from a batch file. * Compile with "N" defined for array size * "OFFSET" for row offset value * "FILLER" for inter-array filler value * e.g., -DN=512 for a 512x512 array * -DOFFSET=32 for row offset value of 32 * -DFILLER=256 * cc -DN=512 -DOFFSET=32 -DFILLER=3 -O4 matmul.c -o matmul * note that the above values are all in terms of 8-byte longs */ #include #include #include #include #define HZ 60 long a[N][N+OFFSET]; #if (FILLER) long ax[FILLER]; #endif long b[N][N+OFFSET]; #if (FILLER) long bx[FILLER]; #endif long c[N][N+OFFSET]; #if (FILLER) long cx[FILLER]; #endif long gold_c[N][N]; /* modify this routine to improve performance */ void my_matmul(void) { int i,j,k; long temp; for (i=0;i