Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
46 Views

ippSetNumThreads

Dear Forum Members,

one way recommended to control the number of threads inan application using Intel IPP is to useippSetNumThreads. Actually I did this at the beginning of my main function and set the number of threads to 1. However, when the application is running on our hpc-cluster with Quadcore or Octocore Nodes, the application creates 4 Threads instead of one. Due to the fact, that my code itself creates no threads at all, I was wondering why the Intel Ipp Library is creating more than one thread. (The cluster is running under SLES 10.1 in combination with Intel Ipp 6.0). Has anyone else observed this behaviour. Are there any restrictions or requirements whereippSetNumThreads has to be called or is it not sufficient to call ippSetNumThreads once?

Thomas
0 Kudos
5 Replies
Highlighted
46 Views

Hi Thomas,

Intel IPP is threaded using OpenMP API. The OpenMP run time will create number of threads equal to number of cores on your system. How much threads will do real work for IPP depends on value you set with ippSetNumThreads function. In your case these additional threads are always in sleep state and do not require any cpu cycles.

Regards,
Vladimir
0 Kudos
Highlighted
Beginner
46 Views

Hi Thomas,

Intel IPP is threaded using OpenMP API. The OpenMP run time will create number of threads equal to number of cores on your system. How much threads will do real work for IPP depends on value you set with ippSetNumThreads function. In your case these additional threads are always in sleep state and do not require any cpu cycles.

Regards,
Vladimir

Hi Vladimir,

thanks for your interesting answer, but I think I do not really understand the behaviour of IPP in this case. According to your argumentation, a call ofippGetNumThreads previously toippSetNumThreads should be equal to the number of threads after callingippSetNumThreads. However in my case, the number of threads returned byippGetNumThreads is larger (NThreads=8) than the observed number of threads after setting ippSetNumThreads (NThreads=4). Does this mean, that some of the Threads are switched in sleep state and others are destroyed?

Thanks,
Thomas
0 Kudos
Highlighted
46 Views


GetNumThreads should return default number which is equal to number of cores on your system if you did not call SetNumThreads before. But after you set some particular number of threads with SetNumThreads call, then GetNumThreads should return this number.

Regards,
Vladimir

0 Kudos
Highlighted
Beginner
46 Views


GetNumThreads should return default number which is equal to number of cores on your system if you did not call SetNumThreads before. But after you set some particular number of threads with SetNumThreads call, then GetNumThreads should return this number.

Regards,
Vladimir

I absolutely agree, but my question was pointing on another issue. According to your comment, Open MP in the Intel IPP starts a number of threads according to the number of cores in the system? These threads are switched to sleep state, if ippSetNumThreads was called with a number less than the available number of cores.Furthermore, the IPP manual says that the initial number of threads returned by ippGetNumThreads (previously to any call of ippSetNumThreads)is equal to the number of cores in a system.

So my question is, why is the number of threads returned by ippGetNumThreads (directly after starting the program and without calling ippSetNumThreads) different to the number of observable threads when the program is running? In my case the number of 'possible' threads returned by ippGetNumThreads (without calling ippSetNumThreads before) is 8 and the number of observable threads running in the system after calling ippSetNumThreads( 1 ) is 4. I'm not sure, but considering your post, I think, there should be 8 threads again (7 threads in the sleep state and one thread working)?

Maybe this is due to some internals of the library and there are always 4 threads independent of the number of available cores in the system, or some of the threads are destroyed?

ippGetNumThreads in the manual:This function returns the number of OMP threads specified by the user previously. If it has not been specified,the function returns the initial number of threads that depends on the number of logical processors.

Best regards,

Thomas

0 Kudos
Highlighted
46 Views

Thomas,

I think it is specific for OpenMP run time how many threads it will create by default. But you may be sure that with ippSetNumThreads(N) you direct IPP (and underlaying OpenMP run time) to only useN threads.

Regards,
Vladimir
0 Kudos