openblas.c 523 B

12345678910111213141516171819
  1. /*
  2. OpenBLAS hello world, initially adapted from:
  3. https://stackoverflow.com/questions/49227682/gem5-can-not-simulate-my-program-that-calls-openblas-functions-with-an-fatal-err
  4. */
  5. #include <cblas.h>
  6. #include <stdio.h>
  7. int main() {
  8. size_t i = 0;
  9. double A[6] = {1.0,2.0,1.0,-3.0,4.0,-1.0};
  10. double B[6] = {1.0,2.0,1.0,-3.0,4.0,-1.0};
  11. double C[9] = {.5,.5,.5,.5,.5,.5,.5,.5,.5};
  12. cblas_dgemm(CblasColMajor, CblasNoTrans, CblasTrans,3,3,2,1,A, 3, B, 3,2,C,3);
  13. for(i = 0; i < 9; i++)
  14. printf("%f ", C[i]);
  15. printf("\n");
  16. }