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

Linux setcap and MKL

Barry__Alex
Beginner
688 Views

I have a program using MKL on Linux (Centos 7.3 1611) that runs fine without any setcap capabilities.  I would like to adjust thread priorities, so I added CAP_SYS_NICE using setcap.  When I run the program, it starts fine.  As soon as it tries to run any MKL functions, it fails with an error saying it failed to load mkl_loader.  The program runs fine as root with CAP_SYS_NICE set.  I have googled around, and have not found a solution that works yet.

0 Kudos
3 Replies
Gennady_F_Intel
Moderator
688 Views

"error saying it failed to load mkl_loader". Alex, what is the full message do you see?

0 Kudos
Evarist_F_Intel
Employee
688 Views

Hi Alex,

I second Gennady's question.

If I understand things right you run the application with root privileges. Could you please confirm the application works fine if you simply run it with root privileges, but w/o any setcap stuff?

If yes, could you please try running your application with

LD_DEBUG=libs

and look for a hint why it can't load mkl_loader or put the trace here?

 

0 Kudos
Barry__Alex
Beginner
688 Views

Sorry to put this question on hold for so long, but project priorities changed...

The exact error message I get is:

Intel MKL FATAL ERROR: Cannot load <mkl-loader>.

I get this when I run the program (linked to MKL, Linux, x64) as a standard user with CAP_SYS_NICE set.  With CAP_SYS_NICE not set, a call to change the scheduler priority (to SCHED_FIFO in a different thread) and policy fails, but MKL still loads.  The goal is to get it to run as a standard user, be able to change priority and use MKL.

The kernel version was 3.10.0-514.6.1.el7.x86_64.  I tried this exact same program on a Fedora 27 install using a 4.13 kernel, and I had no problems loading MKL, with or without CAP_SYS_NICE set.

Running the program as root allows the program to run with CAP_SYS_NICE set.  It is not desirable to run as root permanently.

 

0 Kudos
Reply