Advertisement
mahmoodn

mm_int_blas

Mar 6th, 2022
984
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <cblas.h>
  5.  
  6. #define N 1200
  7.  
  8.  
  9. void fill_matrices(int first[][N], int second[][N], int result[][N])
  10. {
  11.     srand(time(NULL)); // randomize seed
  12.     for (int i = 0; i < N; i++){
  13.         for (int j = 0; j < N; j++){
  14.             first[i][j] = rand() % 10;
  15.             second[i][j] = rand() % 10;
  16.             result[i][j] = 0;
  17.         }
  18.     }
  19. }
  20.  
  21. int main()
  22. {
  23.     int first[N][N], second[N][N], result[N][N];
  24.     fill_matrices(first, second, result);
  25.  
  26.     cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, N, N, N, 1.0, first, N, second, N, 0.0, result, N);
  27.  
  28.     return 0;
  29. }
  30.    
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement