MattBro

Standard C Interface to Blas

Discussion created by MattBro on Dec 21, 2007
Latest reply on Jan 2, 2008 by chipf
ACML does not have a standard C interface to BLAS Why?

Fortran is a dying language and many developers prefer to use C and their derivatives even for scientific programming. The BLAS folks long ago have kindly provided us a standard interferace for calling BLAS routines from C. Atlas, MKL GoTo etc. all implement the standard interferace. Legacy code may have hundreds of calls to these routines using the standard CBLAS interface and yet given the tremendous effort to create ACML the interface fails to adhere to the standard at all.

The standard interface document is provided here:
http://www.netlib.org/blas/blast-forum/cinterface.pdf

Instead for our ACML C interface we have some kind of hybrid derived from the Fortran interface. For example, one of the most commonly used routines dgemm has this cblas interface from the standard:

void cblas_dgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA,
const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
const int K, const double alpha, const double *A,
const int lda, const double *B, const int ldb,
const double beta, double *C, const int ldc);

Unfortunately ACML uses this non standard C interface:
extern void dgemm(char transa, char transb, int m, int n, int k, double alpha, double *a, int lda, double *b, int ldb, double beta, double *c, int ldc);

Note that it has one less argument and does not use enumerated types. Thus for several routines it is not a matter of dropping the cblas_ prefix. What I would love to see is a blas to cblas header with the stubs that would give us access to the acml library without having to change hundreds of lines of legacy code.

Outcomes