- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have just started using MKL on Macintosh for its LAPACK implementation, which seems to be better than the one in Apple's Accelerate framework. I'm using the MKL that came with the Fortran compiler, 11.1.88. I call it from C/C++ code.
In the past we've had troubles with LAPACK's annoying default of calling EXIT on an error, so I followed the MKL documentation and created my own version of xerbla. Then I created a test case with an intentional error. My xerbla() gets called as expected.If I don't provide my own xerbla(), nothing happens except that the info parameter gets set to a non-zero value. I think that's wonderful, but it is non-standard.Finally, my question- is the observed behavior intended for MKL? Can it be counted on?I scanned the MKL documentation and can't find anything that says MKL xerbla is in any way non-standard.Thanks!-John WeeksWaveMetrics, Inc.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If an issue is found with an input parameter, xerbla prints a message similar to the following:MKL ERROR: Parameter 6 was incorrect on entry to DGEMM
and then returns to the user application.
I also note that on netlib.org this comment is in the reference source for xerbla:
* Installers may consider modifying the STOP statement in order to
* call system-specific exception-handling facilities.
I can ask our LAPACK developers if they have more comment.
-Todd
- 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
Yes, I see now in the LAPACK book that while they suggest that the installer could remove the STOP that they recommend otherwise.
-Todd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using one's own XERBLA may not work if the routine is called by another routine in the MKL (.DLL or .so version), because calls within the shared library (DLL) are directed to routines that are already in the DLL. In other words, if you use the shared version of MKL, calls to XERBLA go to the routine already in MKL, so your XERBLA may never get called.
A better solution would be to generalize the XERBLA in the MKL along the following lines:
1. Write to a unit that the user has selected in a call to I1MACH(), rather than to *.
2. Use a global flag which is consulted in XERBLA to select between stopping and continuing after setting an error number, with a default to stop and provide a way for the user to to set the global flag so that no stopping occurs. It may also be useful to let the user allow XERBLA to stop after some n errors occur, where n has a default value of, say 1 or 10, but may be set to another value by the user.
These suggestions are based on the principles that software should
(i) work as expected for most users, with failures/aborts carried out as gracefully as possible and with a minimum of fuss.
(ii) allow more advanced users more control over handling errors.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using one's own XERBLA may not work if the routine is called by another routine in the MKL (.DLL or .so version), because calls within the shared library (DLL) are directed to routines that are already in the DLL. In other words, if you use the shared version of MKL, calls to XERBLA go to the routine already in MKL, so your XERBLA may never get called.
2. Use a global flag which is consulted in XERBLA to select between stopping and continuing after setting an error number, with a default to stop and provide a way for the user to to set the global flag so that no stopping occurs. It may also be useful to let the user allow XERBLA to stop after some n errors occur, where n has a default value of, say 1 or 10, but may be set to another value by the user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As to your views regarding error-handling: there was a related thread in comp.lang.fortran on whether end-of-file is to be regarded as an error or not, whether a core dump should occur as a result of attempting to read past end-of-file, etc. In these matters, we have to remember that the users may range from C-programmers using just one Lapack routine to engineers of big packages, such as yourself. The default set-up should work safely for the majority of users, many of whom may be casual, non-expert users.
Your statement that "the LAPACK standard is just plain wrong" is rather harsh, and dismissive of historical perspective. If Lapack constitutes a "standard", it is more w.r.t. the interface than the implementation.
The Lapack user guide specifically says:
In the model implementation of XERBLA which is supplied with LAPACK, execution stops after the message; but the call to XERBLA is followed by a RETURN statement in the LAPACK routine, so that if the installer removes the STOP statement in XERBLA, the result will be an immediate exit from the LAPACK routine with a negative value of INFO. It is good practice always to check for a non-zero value of INFO on return from an LAPACK routine. (We recommend however that XERBLA should not be modified to return control to the calling routine, unless absolutely necessary, since this would remove one of the built-in safety-features of LAPACK.)
I read from this that the "installer" (=Intel, for MKL) who removes the STOP takes on the responsibility of monitoring the non-zero return values of INFO. This, however, will have to be done outside the Lapack library routines, by the MKL user (you and me, not Intel).
I hope that you see the problem now: simply removing the STOP without providing a replacement mechanism for handling user errors is not a good choice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oh well, if you are using a custom-built library (a fact which you had not divulged earlier) my comments about not being able to use a curstom XERBLA with a shared,standardMKL library no longer apply.
The default set-up should work safely for the majority of users, many of whom may be casual, non-expert users.
TheLapack user guidespecifically says:
Your statement that "the LAPACK standard is just plain wrong" is rather harsh, and dismissive of historical perspective.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Meanwhile, I've opened a request to improve our documentation on xerbla so that it explicitly states where Intel MKL diverges from the recommendations made in the LAPACK user guide.
Todd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In practice, I suspect that this is not a major issue because XERBLA is called only for parameter mismatches or wrong array sizes. These errors would tend to be eliminated by the time code using MKL reaches production/release status. Other errors, such as those attributable to singular and ill-conditioned matrices, have to be monitored through INFO anyway.
Furthermore, as more applications use Lapack95 rather than the F77 interfaces of classical Lapack, once the compiler accepts the code there should be fewer instances of XERBLA needing to be called.
Another possibility: in analogy with what ifort currently does with the -fpe switch, which can be specified/selected in ifort.cfg, there could be an mkl.cfg with, say, a -usexerbla switch. Then all that jd_weeks would have to do is to set -usexerbla=no in his mkl.cfg, one time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm an MKL LAPACK engineer. Let me say a couple of words about LAPACK behavior w.r.t. XERBLA and INFO.
LAPACK routines call XERBLA on two conditions: 1) wrong parameter (actually it's a user-supplied parameter, internally all parameters are passed correctly) in full accordance with standard, 2) not enough memory to allocate - some routines acquire extra memory - this is MKL-specific behaviour.
No XERBLA is invoked on singular matrix condition, or when an algorithm diverges and fails to compute the output correctly, that is, when INFO returned is positive.
To sum up, XERBLA is called onlywhen theuser may encounter some fatal error if theexecution flowisn'tback to the user program immediately. We use RETURN instead of STOP in MKL supplied XERBLAso thatthe user can do something with it, have a chance to understand what happened and make another route.
I agreeit would benice to document a deviation from de-facto standard behavior, even though 'standard' behavior can be easily overridden.
Michael.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We use RETURN instead of STOP in MKL supplied XERBLAso thatthe user can do something with it, have a chance to understand what happened and make another route.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page