C Interface Conventions for BLAS
Routines
CBLAS, the C interface to the Basic Linear Algebra Subprograms (BLAS), provides a C language interface to BLAS routines for . While you can call the Fortran implementation of BLAS, for coding in C the CBLAS interface has some advantages such as allowing you to specify column-major or row-major ordering with the
Intel® oneAPI Math Kernel Library
layout
parameter.
For more information about calling Fortran routines from C in general, and specifically about calling BLAS and CBLAS routines, see " Mixed-language Programming with the " in the Developer Guide.
Intel® oneAPI
Math Kernel LibraryIntel® oneAPI
Math Kernel LibraryThis reference contains syntax in C for both the CBLAS interface and
the Fortran BLAS routines.
In CBLAS, the Fortran routine names are prefixed with
cblas_
(for example,
dasum
becomes
cblas_dasum
). Names of
all CBLAS functions are in lowercase letters.
Complex functions
?dotc
and
?dotu
become CBLAS
subroutines (void functions); they return the complex result via a void
pointer, added as the last parameter. CBLAS names of these functions are
suffixed with
_sub
. For example, the
BLAS function
cdotc
corresponds to
cblas_cdotc_sub
.
Users of the CBLAS interface should be aware that the
CBLAS are just a C interface to the BLAS, which is based on the FORTRAN
standard and subject to the FORTRAN standard restrictions. In particular, the
output parameters should not be referenced through more than one argument.
This interface is not implemented in the Sparse BLAS
Level 2 and Level 3 routines.
The arguments of
CBLAS functions comply with the following rules:
- Input arguments are declared with theconstmodifier.
- Non-complex scalar input arguments are passed by value.
- Complex scalar input arguments are passed as void pointers.
- Array arguments are passed by address.
- BLAS character arguments are replaced by the appropriate enumerated type.
- Level 2 and Level 3 routines acquire an additional parameter of typeCBLAS_LAYOUTas their first argument. This parameter specifies whether two-dimensional arrays are row-major (CblasRowMajor) or column-major (CblasColMajor).
Enumerated Types
The CBLAS interface uses the following enumerated
types:
enum CBLAS_LAYOUT { CblasRowMajor=101, /* row-major arrays */ CblasColMajor=102}; /* column-major arrays */ enum CBLAS_TRANSPOSE { CblasNoTrans=111, /* trans='N' */ CblasTrans=112, /* trans='T' */ CblasConjTrans=113}; /* trans='C' */ enum CBLAS_UPLO { CblasUpper=121, /* uplo ='U' */ CblasLower=122}; /* uplo ='L' */ enum CBLAS_DIAG { CblasNonUnit=131, /* diag ='N' */ CblasUnit=132}; /* diag ='U' */ enum CBLAS_SIDE { CblasLeft=141, /* side ='L' */ CblasRight=142}; /* side ='R' */