Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Ben_Ochoa
Beginner
115 Views

xerbla overrides VML callback when mixing with BLAS, LAPACK, VSL

I have encountered an issue with the MKL error handling functions when mixing calls to BLAS, LAPACK, VML, and VSL in C. Essentially, the VML callback, which is being set using vmlSetErrorCallBack, is not being called; instead, it appears that xerbla is being called. When only making VML calls, the callback function set using vmlSetErrorCallBack is being called just fine, so it's only an issue when mixing with BLAS, LAPACK, and/or VSL (I haven't determine which causes this issue). I don't mind xerbla being used for BLAS, LAPACK, and VSL error handling, but if I set the VML callback function using vmlSetErrorCallBack, then I expect this callback function to be called to handle VML errors. I think it would be best if MKL checked to see the value of the VML callback function pointer upon a VML error: if it's null, then call xerbla; otherwise, then call the VML callback function (which could also call xerbla, if desired). I'd like to request that this change be made to MKL. Thanks, Ben
0 Kudos
9 Replies
Andrey_N_Intel
Employee
115 Views

Hi Ben, we are analyzing your request and let you know the update and/or ask additional questions. Thanks, Andrey

Gennady_F_Intel
Moderator
115 Views

Ben, Could you please give us example of this case to check the problem on our side?

Ben_Ochoa
Beginner
115 Views

In attempting to isolate the issue, I've learned that this issue does not have to do with mixing BLAS, LAPACK, and VSL as I originally thought.  The issue is that certain errors call xerbla and others call the VML callback, if set.  A simple modification of the MKL example code found in callback.c illustrates this.

#include <stdio.h>
#include "mkl_vml.h"

int UserCallBack(DefVmlErrorContext* );

int main()
{
  VMLErrorCallBack errcb;
  double dbA = 0.0;
  double dbR;

  printf("Set/Get/Clear CallBack example program\n\n");

  errcb=vmlGetErrorCallBack();
  printf("Initial adress of CallBack function: 0x%p\n",errcb);

  errcb=UserCallBack;
  vmlSetErrorCallBack(errcb);
  errcb=vmlGetErrorCallBack();
  printf("Adress of CallBack function after using Set CallBack: 0x%p\n",errcb);
  printf("Test user callback on vdLn function\n");
  vdLn(1, &dbA, &dbR);

#if 1
  // TEST
  vdLn(1, &dbA, 0);
#endif

  vmlClearErrorCallBack();
  errcb=vmlGetErrorCallBack();
  printf("Adress of CallBack function after using Clear CallBack: 0x%p\n",errcb);

  return 0;
}

int UserCallBack(DefVmlErrorContext* pdefVmlErrorContext)
{
    printf("In function %s argument a[%d]=%f is wrong.\n",
      pdefVmlErrorContext->cFuncName,
      pdefVmlErrorContext->iIndex,
      pdefVmlErrorContext->dbA1);
    return 0;
}

The resulting output is:

Set/Get/Clear CallBack example program

Initial adress of CallBack function: 0x00000000
Adress of CallBack function after using Set CallBack: 0x00FD12D0
Test user callback on vdLn function
In function vdLn argument a[0]=0.000000 is wrong.

Intel MKL ERROR: Parameter 3 was incorrect on entry to vdLn.
Adress of CallBack function after using Clear CallBack: 0x00000000

Note that the added code (see // TEST) results in a call to xerbla, not UserCallBack.  If I set an error callback, I expect it to be called on all errors.  I consider this a bug, not a feature.

Thanks,
Ben

Andrey_G_Intel2
Employee
115 Views

Ben, as I can see - main question addressed to VML error handlers behavior. I will try to give some explanations.

VML errors can be divided for 2 classes: bad arguments and computation errors (like divide by zero).

VML error handlers behave differently in these cases.

1) bad args:

xerbla called

vml error status code set (can be read via vmlGetErrStatus)

vml csall back isn`t called

2) computation error

xerbla isn`t called

vml error status code set (can be read via vmlGetErrStatus)

vml csall back isn`t called if vml mode set to proper value (as in your example)

so, you can see that vml call back can`t be overridden by xerbla - these two functions complete independent

note. xerbla also can be redefined as vml call back function

Ben_Ochoa
Beginner
115 Views

I would argue that any time a VML error status is set, the VML error callback should be called. An error is an error, regardless of the type of error. How do I submit a formal change request? Thanks, Ben

Gennady_F_Intel
Moderator
115 Views

You can submit the formal ticket through Intel® Premier Support. But I am not sure this request would be implemented. Andrey provided the comprehensive answer of VML error handlers behavior. 

Ben_Ochoa
Beginner
115 Views

Although an explanation was given, it doesn't imply that this is correct or desirable behavior. I tried to submit a formal ticket, but cannot log in to Premier Support. I've had this issue with Premier Support in the past due to multiple accounts. It was resolved, but is now back. Who should I contact to fix this. Thanks, Ben
Gennady_F_Intel
Moderator
115 Views

Ben,  I have escalated your request to the internal database for the future development. I will keep update when the issue would be implemented or rejected be VML team.

 

 

 

Ben_Ochoa
Beginner
115 Views

Thanks, but I'd still like to be able to log in to Premier Support. Who should I contact to resolve the issue with my account?
Reply