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

Using MKL Single Dynamic Library (mkl_rt)

Towie__Ewan
New Contributor I
2,351 Views

Hi,

I'm currently in the middle of migrating our software tools to using the Single Dynamic Library method for MKL, in replacement for directly linking the interface/threading layer libs. The main reason for this is to improve compatibility within Python environments.

I was aware that the runtime calls to define the interface/threading layers must be prior to any use of the MKL library, but in some cases it can be difficult to ensure that this is actually the case.

Worse still, there doesn't appear to be any way to determine if the MKL library has been initialised at the point of the runtime layer calls. It seems that if the MKL library has been used in any way prior to the layer calls, then they are simply ignored without any error/warning message or information.

For example, I had a case where the CNR mode had been defined prior to the calls to `mkl_set_interface_layer()` and `mkl_set_threading_layer()`. This meant these calls were ignored and the default interface/threading layers were initialised causing a seg fault later in the runtime.

Is there some way to check at the time of the call to define the layers if the MKL library has already been initialised?

Is it possible for the runtime layer commands to actually report if they are successful or not?

Thanks,

Ewan

 

For reference, I'm working on a:

- Linux x86_64 system

- MKL 2023.0

- GCC 9.5.0 compilers

- Mix of C/C++/Fortran code

0 Kudos
1 Solution
Gennady_F_Intel
Moderator
2,271 Views

Ewan,

explicitly, MKL has only mkl_set_interface_layer() and mkl_set_threading_layer() API to track if the requested interface layer has been set.

-Gennady

View solution in original post

7 Replies
VarshaS_Intel
Moderator
2,292 Views

Hi,


Thanks for posting in Intel Communities.


Could you please provide us with the sample reproducer code where you are observing such behavior which helps us to investigate more on your issue?


Thanks & Regards,

Varsha


0 Kudos
Gennady_F_Intel
Moderator
2,272 Views

Ewan,

explicitly, MKL has only mkl_set_interface_layer() and mkl_set_threading_layer() API to track if the requested interface layer has been set.

-Gennady

Towie__Ewan
New Contributor I
2,159 Views

Hi Gennady,

 

I haven't yet had the time to create a reproducer, although I do intend to.

 

I see from the documentation that these two method return an integer that is meant to represent the layer, but to clarify is this the layer that is currently set or the layer that it has been set to?

 

I'm trying to understand if there is a way to determine what layers are currently loaded, and how to check if the call was successful.

 

Thanks,

Ewan 

0 Kudos
VarshaS_Intel
Moderator
2,218 Views

Hi,


We have not heard back from you. Could you please let us know if you have any other queries?


Thanks & Regards,

Varsha


0 Kudos
VarshaS_Intel
Moderator
2,169 Views

Hi,


We have not heard back from you. Could you please let us know if you have any other queries?


Thanks & Regards,

Varsha


0 Kudos
VarshaS_Intel
Moderator
2,090 Views

Hi,


mkl_set_interface_layer sets the interface layer for Intel oneMKL at run time. 


>>how to check if the call was successful

The function call returns -1 if the input parameter is incorrect or if the layer was not specified prior to the function call.


For more details regarding the setting of the interface/threading layer please go through the below link:

https://www.intel.com/content/www/us/en/docs/onemkl/developer-guide-windows/2023-2/dynamic-select-the-interface-and-threading-layer.html


Thanks & Regards,

Varsha



0 Kudos
VarshaS_Intel
Moderator
2,073 Views

Hi,


We have not heard back from you. Could you please provide us with an update on your issue?


Thanks & Regards,

Varsha


0 Kudos
Reply