Advertisement
volkovich_maksim

cyc_papi

Oct 26th, 2017
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1.     if ( mode == 2 ){//opltimal, ikj
  2.         int lib = PAPI_library_init(PAPI_VER_CURRENT);
  3.         if ( lib == 0 ) cout << "lib == 0\n";
  4.         const PAPI_hw_info_t *info = PAPI_get_hardware_info();
  5.         if (!info)
  6.             cout << "PAPI_get_hardware_info() returns NULL\n";
  7.         int blocksize = sqrt((info->mem_hierarchy.level[0].cache[0].size)/3);
  8. //      cout << blocksize << endl;
  9.         for ( i = 0; i < rows; i += blocksize ){
  10.             for ( k = 0; k < columns; k += blocksize ){
  11.                 for ( j = 0; j < M2.columns; j += blocksize ){
  12.                 //block mult
  13.                     for ( int i1 = i; i1 < i + blocksize && i1 < rows; i1++ ){
  14.                         for ( int k1 = k; k1 < k + blocksize && k1 < M2.columns; k1++ ){
  15.                             for ( int j1 = j; j1 < j + blocksize && j1 < columns; j1++ ){
  16.                                 Tmp.vals[i1][j1] += vals[i1][k1]*M2.vals[k1][j1];
  17.                             }
  18.                         }
  19.                     }
  20.                 }
  21.             }
  22.         }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement