- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am writing in C/C++, using Visual Studio 2005 to build my application, linking statically to MKL 10.1.0.018.
If I simply write a function called xerbla (may xerbla_?) will it be linked in preference to the MKL version? Would I use cdecl calling convention for it?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am writing in C/C++, using Visual Studio 2005 to build my application, linking statically to MKL 10.1.0.018.
If I simply write a function called xerbla (may xerbla_?) will it be linked in preference to the MKL version? Would I use cdecl calling convention for it?
The XERBLA has Fortran linkage, so the parameters should be pointer to string, pointer to int, string length (6) by value. At least, this is what I expect to see. If you confirm whether you are writing for 32-bit or X64, I could try to confirm it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
printf("n*** My XERBLA is called :%s: %dn",Name,*Num);
return;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am writing in C/C++, using Visual Studio 2005 to build my application, linking statically to MKL 10.1.0.018.
If I simply write a function called xerbla (may xerbla_?) will it be linked in preference to the MKL version? Would I use cdecl calling convention for it?
What worked for me was implementing the following function (cdecl, implementd as C (not C++))
void cblas_xerbla(const char *srname, const int *info, const int lsrname)
{
printf("n*** My xerbla is called :%s: %dn", srname, info);
return;
}
I do get a call back with that. I am wondering if it's the right way to do it.
And anybody there at Intel, why is it that XERBLA doesn't work? Also, is there a way to just check the error code for BLAS/LAPACK functions after they complete? I don't always want to deal with callback functions.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since the version MKL 10.1 Update 2, you can use both xerbla and XERBLA to replace MKL error handler.
The correct interface of MKL cblas_xerbla() is:
void cblas_xerbla (const char * Name, const int Num);
Note, this function is undocumented and we can change its interface in any time without special warnings.
Please try such example:
#include
#include
#define buf_len 198
int main() {
char transa, transb;
double *a, *b, *c;
double alpha, beta;
int n = 100, N, i, j;
char buf[buf_len];
MKLGetVersionString(buf, buf_len);
printf("nMKL release version:n"); fflush(NULL);
printf("%sn",buf); fflush(NULL);
transa = 'N'; transb = 'N';
alpha = 1.1; beta = -1.2;
a = (double *)calloc( n*n, sizeof( double ) );
b = (double *)calloc( n*n, sizeof( double ) );
c = (double *)calloc( n*n, sizeof( double ) );
N = -n;
printf("nCall dgemmn"); fflush(NULL);
dgemm(&transa,&transb,&N,&N,&N,α,a,&N,b,&N,β,c,&N);
printf("nCall cblas_dgemm"); fflush(NULL);
cblas_dgemm(CblasRowMajor,CblasNoTrans,CblasNoTrans,-N,N,N,alpha,a,N,b,N,beta,c,N);
}
void XERBLA (const char * Name, const int * Num, const int Len) {
printf("nUser xerbla is called :%s:%dn",Name,*Num); fflush(NULL);
return;
}
void cblas_xerbla (const char * Name, const int Num) {
printf("nUser cblas_xerbla is called :%s:%dn",Name,Num); fflush(NULL);
return;
}
You should see the output something like this:
MKL release version:
Intel Math Kernel Library Version 10.1.1 Product Build 082212.12 for Intel 64 architecture applications
Call dgemm
User xerbla is called :DGEMM :3
Call cblas_dgemm
User cblas_xerbla is called :cblas_dgemm:5
-Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Now I understand. dgemm() calls XERBLA and cblas_dgemm calls cblas_xerbla().
Is there a way to avoid getting the callbacks and check an error code instead after the function completes? I know that I can do it for vml (vmlGetErrStatus()). Is there a way to do it for BLAS, dgemm for example?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Now I understand. dgemm() calls XERBLA and cblas_dgemm calls cblas_xerbla().
Is there a way to avoid getting the callbacks and check an error code instead after the function completes? I know that I can do it for vml (vmlGetErrStatus()). Is there a way to do it for BLAS, dgemm for example?
Unfortunately, no. BLAS doesn't have such functionality.
-Vladimir

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page