Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6536 Discussions

How to generate a fatal exception to test mkl_set_exit_handler

Gert-Jan
Beginner
222 Views
I would like to test my custom handler of fatal errors, but I can't figure out to generate a fatal error :( I use mkl_set_exit_handler(...) to register my custom handler, but I don't know how to test this. I 'm using the C interface, see https://software.intel.com/en-us/node/522125. Any suggestions are welcome. Generating segmentation faults by out-of-memory-bounds memory accesses (not allocating enough memory) does not seem to trigger the custom handler.
0 Kudos
2 Replies
Dmitry_B_Intel
Employee
222 Views

Hi Gert-Jan,

MKL Reference Manual describes what a fatal error may be. "For example, a fatal error occurs when Intel MKL cannot load a dynamic library...". If you link your application dynamically with MKL and run it with dynamic libraries inaccessible you will get a call to exit handler.

 

 

Gert-Jan
Beginner
222 Views
Hi Dmitry, thanks for your reply. I can create fatal errors when the dynamic libraries are not available. However, I'm using a custom shared library (https://software.intel.com/en-us/node/528533) which groups all the dynamic libraries in a single file. I'm also using one specific processor, so the library will always match the processor. Does this mean that I can never get this kind of fatal error, which are handled by the function registered with mkl_set_exit_handler(...)? Or are there other ways to trigger the function set by mkl_set_exit_handler(...)? Second question, is there a way to catch the printed error message like "Intel MKL FATAL ERROR: Cannot load libmkl_avx2.so or libmkl_def.so."?
Reply