- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
For the sake of the experiment, let's assume that moving the initialization code to the main application thread is not an option.
コピーされたリンク
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hello,
IPP manual, volume 1, Chapter 3, page 3-16
CAUTION.
You can not use any other Intel IPP function while the function ippStaticInit continues execution.Regards,
Vladimir
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
For example, one can imagine that on the first call ippStaticInit() initializes the dispatcher and on subsequent calls it returns without doing anything of importance.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hello,
you are right. The description is not sufficient. You need to take care that no other threads in your application are calling IPP functions when you call IPP static dispatcher (ippStaticInit) because it modifies some internalfunction table.
Regards,
Vladimir
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hello.
It is enough to call ippStaticInit() once per each thread (we are using 3 threads) wheneach thread is created or it is needed to call ippStaticInit() before each ipp function ineach thread? I am asking because it is not clear for me.
What is the best scenarioto use dispatchingvia ippStaticInit() in multithreaded application where ipp functions are used in all threads? We are using IPP version 6.1.1.035.
Thank you
Viktor.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hello,
in typical scenario you need to call ippStaticInit only once. Usually it is done in beginning of application. The call of ippStaticInit will configure global IPP dispatching table, so any IPP functions called after that from any thread will use appropriate cpu-specific code.
Regards,
Vladimir
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi,
if ippStaticInit only update the dispatch table, wouldn't each element be updated atomically ? If this is the case then, it shouldn't matter if ipp functions are called when calling again ippStaticInit from a different thread. Of course, there might be other critical data I'm not aware of.
Regards,
Matthieu
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Doesn't ippStaticInit() need to be called once per module? I tend to call it in DllMain and in the application.
Peter
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Please review these KB articles for some more info regarding ippInit():
Understanding CPU Dispatching in the Intel IPP Library
IPP Dispatcher Control Functions - ipp*Init*() functions
You should use the ippInit() function, ippStaticInit() is deprecated and will be removed in a future version of the library.
In general, you only need to make the ippInit() call once in your application, preferrably before all other IPP calls and not during any other IPP calls. If all your threads are within the same application (they share the same code and data space) then only one call needs to be made, not one per thread.
Separate applications, with separate copies of the library (i.e., distinct code and data space) need to make their own call to the library. That is, a call to ippInit() by application A to the library does not initialize the library for application B. Each application must make its own initialization call.
Shared libraries (DLL/SO) make the initialization call automatically, at load time. Thus, a call to ippInit() for a dynamically linked IPP application is redundant but not harmful.
At this time a call to ippInit() only initializes the dispatcher, so you can probably call it multiple times without any significant issues, although it could clear the dispatch table before resetting it (I don't know exactly), so you could have a window of time in which the dispatch table sends you to the non-optimized functions if you make a call to ippInit() at the same time as another IPP function.
So, in sum, best to just call the function once, per process.
Paul
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Thanks for pointing this out - as of Intel C++ Pro 11.1.054, the IPP user's guide still lists ippStaticInit() andthe the Signal Processing manual does not yet mention that ippStaticInit is depricated (but it does list the new ippInit() call).
Also, when statically linking with IPP, when did it no longer become necessary to call ipp*Init() within a DLL? The last time I tested (probably back in IPP 6.0) DLLs statically linked with IPP needed to call ipp*Init().
Thanks,
Peter
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Peter,
If you create a DLL that uses the IPP static libraries then youDO need to make the ippInit() call. The only place where the call is taken care of for you is in the standard DLL files that are pre-built and provided with the library. Custom DLL files still need to take care of this issue (in essence, any code that calls a static version of the IPP library). We've already done just that in the DLL form of the library that is provided as part of the product.
Sorry about that confusion,
Paul
p.s. The fact that ippStaticInit() is not marked as deprecated in the documentation is a mistake. ippInit() is the call to use and replaces ippStaticInit().
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Paul F. (Intel) wrote:
At this time a call to ippInit() only initializes the dispatcher, so you can probably call it multiple times without any significant issues, although it could clear the dispatch table before resetting it (I don't know exactly), so you could have a window of time in which the dispatch table sends you to the non-optimized functions if you make a call to ippInit() at the same time as another IPP function.
Is this still true with the latest version of library?
I'm making a DLL, which include ipp.h, and I Single-threaded Static Library the IPP library. I was reading this, which says:
NOTE You can not use any other Intel IPP function while the function ippInit continues execution.
So, it sounds to me that if ippInit() is running (in a multi-thread context process), another IPP function can't run. Am I right? Are ippInit thread safe now?
Or I still need to make ippInit() call before any other calls?
Thanks
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hello Markzzz,
it depends on which version IPP you use. Starting from IPP 2018 dispatch mechanism works automatically. In any case for double-safe I recommend you to call ippInit() before parallel region, just in start of the application.
Pavel
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Pavel Berdnikov (Intel) wrote:Hello Markzzz,
it depends on which version IPP you use. Starting from IPP 2018 dispatch mechanism works automatically. In any case for double-safe I recommend you to call ippInit() before parallel region, just in start of the application.
Pavel
I'm using w_ipp_2019.1.144.
I got it works automatically, but is this automatic mechanism also thread-safe?
Out of curiosity... I don't see written in any manual ;)
