Skip to content

Instantly share code, notes, and snippets.

@xianyi
Last active February 15, 2017 21:10
Show Gist options
  • Save xianyi/7350668 to your computer and use it in GitHub Desktop.
Save xianyi/7350668 to your computer and use it in GitHub Desktop.
compile OpenBLAS with INTERFACE64=1. clang/gcc -o test test_dgeqrt3_int64.c /your/path/libopenblas.a
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
extern void dgeqrt3_(long * m, long *n, double * a, long *lda, double *t, long *ldt, long*info);
int main(int argc, char**argv)
{
int in, i;
long n,info=1;
int ct;
double * a, *t, *ia;
if(argc<=2){
printf("Please input n and count\n");
exit(1);
}
in=atoi(argv[1]);
ct=atoi(argv[2]);
n=in;
a=(double*)malloc(n*n*sizeof(double));
ia=(double*)malloc(n*n*sizeof(double));
t=(double*)malloc(n*n*sizeof(double));
srand((unsigned)time(NULL));
if(a==NULL || t==NULL || ia==NULL){
printf("memory alloc error!\n");
exit(1);
}
for (i=0; i<n*n; i++){
ia[i] = (rand()%100)/10.0;
t[i]=0.0;
}
for (i = 0; i < ct; i++) {
memcpy(a,ia,n*n*sizeof(double));
dgeqrt3_(&n, &n, a, &n, t, &n, &info);
if (i % 10 == 0) printf("Iteration %d\n", i);
}
printf("%ld\n",info);
free(a);
free(t);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment