Skip to content

Instantly share code, notes, and snippets.

View xianyi's full-sized avatar
😆

Zhang Xianyi xianyi

😆
View GitHub Profile
@xianyi
xianyi / test_dgemv.c
Created May 6, 2015 20:26
performance test for dgemv
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
//#define ITERS 1000000
void dgemv_(char *, int*, int *, double*, double*, int*, double*, int*, double*, double*, int*);
int main(int argc, char * argv[])
{
int m, n;
#include <stdio.h>
void cblas_drotmg (double *d1, double *d2, double *x1, const double y1, double *param);
void drotmg_ (double *d1, double *d2, double *x1, const double* y1, double *param);
int main()
{
int i;
double d1,d2,x1,y1;
double param[5];
#include <stdio.h>
#ifndef unlikely
#ifdef __GNUC__
#define unlikely(x) __builtin_expect(!!(x), 0)
#else
#define unlikely(x) (x)
#endif
#endif
@xianyi
xianyi / test_dgeqrt3_int64.c
Last active February 15, 2017 21:10
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;
@xianyi
xianyi / test_cblas_dgemm.c
Created October 11, 2013 06:59
cc -static -o test_cblas_open test_cblas_dgemm.c -I /opt/OpenBLAS/include/ -L/opt/OpenBLAS/lib -lopenblas -lpthread -lgfortran
#include <cblas.h>
#include <stdio.h>
void main()
{
int i=0;
double A[6] = {1.0,2.0,1.0,-3.0,4.0,-1.0};
double B[6] = {1.0,2.0,1.0,-3.0,4.0,-1.0};
double C[9] = {.5,.5,.5,.5,.5,.5,.5,.5,.5};
cblas_dgemm(CblasColMajor, CblasNoTrans, CblasTrans,3,3,2,1,A, 3, B, 3,2,C,3);
/***************************************************************************
Copyright (c) 2013, The OpenBLAS Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
@xianyi
xianyi / time_clbas_dgemm.c
Created June 14, 2013 16:17
timing cblas dgemm.
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include "cblas.h"
int main(int argc, char* argv[])
{
int i;
@xianyi
xianyi / time_dgemm.c
Created June 14, 2013 07:07
timming dgemm gcc -o time_dgemm time_dgemm.c /your/path/libopenblas.a ./time_dgemm <m> <n> <k> e.g. ./time_dgemm 1000 1000 1000
#include "stdio.h"
#include "stdlib.h"
#include "sys/time.h"
#include "time.h"
extern void dgemm_(char*, char*, int*, int*,int*, double*, double*, int*, double*, int*, double*, double*, int*);
int main(int argc, char* argv[])
{
int i;
@xianyi
xianyi / time_dgemm_int64.c
Created June 14, 2013 00:30
timming dgemm with int64 interface.
#include "stdio.h"
#include "stdlib.h"
#include "sys/time.h"
#include "time.h"
extern void dgemm_(char*, char*, long*, long*,long*, double*, double*, long*, double*, long*, double*, double*, long*);
long main(long argc, char* argv[])
{
long i;
@xianyi
xianyi / test_dgetrf.c
Created February 12, 2013 16:31
Test dgetrf. gcc -o test test_dgetrf.c -I OpenBLAS_install/include OpenBLAS_install/lib/libopenblas.a -lpthread -lgfortran
#include <stdio.h>
#include "cblas.h"
#include "lapacke.h"
int main(int argc, char* argv[])
{
int* ipiv;
int info;
int i, j;
int n;