Skip to content

Instantly share code, notes, and snippets.

@maoe
Last active March 31, 2021 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maoe/953c4e863703be915928b0f8997fcc46 to your computer and use it in GitHub Desktop.
Save maoe/953c4e863703be915928b0f8997fcc46 to your computer and use it in GitHub Desktop.
// cc -o repro repro.c libopenblas.a
// or
// cc -o repro repro.c -L. -lopenblas
// then
// ./repro
#include <stdio.h>
#include "cblas.h"
int main(void)
{
int m = 2;
int n = 2;
int k = 2;
double alpha = 1.0;
double lhs[4] = {1.0, 0.0, 0.0, 1.0};
int lhs_stride = 2;
double rhs[4] = {1.0, 1.0, 1.0, 1.0};
int rhs_stride = 2;
double beta = 0.0;
double c[4] = {0.0, 0.0, 0.0, 0.0};
int c_stride = 2;
cblas_dgemm(
CblasRowMajor,
CblasNoTrans,
CblasNoTrans,
m,
n,
k,
alpha,
lhs,
lhs_stride,
rhs,
rhs_stride,
beta,
c,
c_stride);
for (int i = 0; i < 4; i++)
{
printf("%f\n", c[i]);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment