//=================================================================C // Test Program of C=A*B for 2-Case C //-----------------------------------------------------------------C // Written by Yasunori Ushiro, 2007/04/08 C // ( Kanagawa University ) C //=================================================================C #include #include #include // Global Define #define ND 2400 double A[ND][ND], B[ND][ND], C[ND][ND] ; // Function Definition //=================================================================C void MULT2(int N, int M, int L) //=================================================================C // Real-Dense Matrix Multiplication C // C = A*B with JKI-Type C //-----------------------------------------------------------------C // A,B,C Global define Matrix C // N I*4, In, Matrix Size of A(Column), C(Column) C // M I*4, In, Matrix Size of B(Row), C(Row) C // L I*4, In, Matrix Size of A(Row), B(Column) C //-----------------------------------------------------------------C // Written by Yasunori Ushiro, 2003/08/28 C // ( Hitachi Ltd. and Waseda University ) C //=================================================================C { int i, j, k ; double BW ; // Clear C for (j=0; j ND) { N = ND ; } printf("Type Time(s) MFLOPS \n") ; M = N ; L = N ; // Loop for All Type of C=A*B for (k=1; k<=2; k++) { // Set A,B SETAB(N) ; T1 = clock() ; if(k <= 1) { // JKI-Type Multiplication MULT1(N, M, L) ; } else { // IKJ-Type Multiplication MULT2(N, M, L) ; } T2 = clock() ; // Output CPU = (double)(T2 - T1)/CLOCKS_PER_SEC ; FLOP = 0.0 ; if(CPU > 0.0) { FLOP = 2.0*N*N*N*1.0e-6/CPU ; } SUM = 0.0 ; for (i=0; i