Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Disabling OMP in dynamic libraries

delwynh
Beginner
810 Views
Is there a way of completely disabling forking in the dynamic library IPP functions? ippSetNumThreads(1) and the environment variable OMP_NUM_THREADS don't disable it, they just cause a single thread to be created instead.
The reason I ask is because I'm getting a variety of strange problems in my app with V5, which did not happen in V4.1 I think it's related to calling IPP functions which now use multithreading from my own worker threads. Some of the strangeness is cured by setting numthreads to 1, but my main problem is my app hangs in ExitProcess after using the IPP functions - the stack trace shows kmp_wait_yield / kmp_acquire_lock. At this point no other threads still exist, and in particular the threads which called the IPP functions have already ended.
Any thoughts?
Regards,

Delwyn
0 Kudos
7 Replies
Vladimir_Dudnik
Employee
810 Views

Hi,

the most radical way is to use IPP static libraries instead of DLLs. IPP static libraries does not contain any internal threading at all.

Regarding IPP DLLs you can control how many threads will be used inside of IPP by call ippSetNumThreads function. So if you set only 1 thread - IPP will not use threading inside.

Regards,
Vladimir

0 Kudos
delwynh
Beginner
810 Views

Hi,

Thanks for your prompt reply!

When I set ippSetNumThreads(1), calling an IPP function results in a newthread being created. Is there a way, without static linking, of preventing the creation of any threads by the IPP code? If not, istherea workaround for the problem I described, where my application won't exit! It seems it mightbe a bug in the IPP threading code. An additional problem I had before setting numThreads to 1 was that IPP functions would hang up in libguide on the second time they were called. I wonder whether it's to dowith callingIPP functions from multiple threads, which are themselves created and deleted on demand by my app?

Regards,

Delwyn

0 Kudos
delwynh
Beginner
810 Views

Hi Vladimir,

Do you have any information on the problem I describe with threading? I have been unsuccessful so far in working around it.

Regards,

Delwyn

0 Kudos
Vladimir_Dudnik
Employee
810 Views

Hi Delwyn,

we did not face such throubles when we test IPP threading, but thinking more about your issue I got anidea that problem can be related to different versions of libguide library. As you had IPP v4.1 it is very probable that you still have old libguide40.dll somewhere in your system and loader fond it before new libguide40.dll from IPP v5.0. Could you please check if new libguide dll is located in your PATH environment earlier than the old one?

There is no other way to disable OMP threading in IPP.

Regards,
Vladimir

0 Kudos
delwynh
Beginner
810 Views
Hi Vladimir,
Unfortunately it's not the libguide version, the app will not start at all with the old version due to functions not defined.
I'll try to reproduce the problem with a standalone test program and raise a support issue.
Thanks for your help.
Regards,
Delwyn
0 Kudos
Vladimir_Dudnik
Employee
810 Views

Ok, thanks

Vladimir

0 Kudos
delwynh
Beginner
810 Views

Hi Vladimir,

I have written a short program to demonstrate this bug. It is as I suspected, if you call ipp functions which use threading from worker threads, the application will not exit (hangs in libguide). If you also call ipp functions from the main thread it closes down correctly. The support issue number is 339297.

Thanks,

Delwyn

0 Kudos
Reply