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

How to deploy IPP DLL with .NET ClickOnce technology

Gandolfo__Mauro
Beginner
1,757 Views
I'm trying the Intel IPP and in particular I'm interested in the Signal Processing functionalities (ipps-7.0.dll). I've a solution under Visual Studio 2010 written in C# and deployed via ClickOnce.

I've created a new DLL project with the C# wrapper I found on the provided MAIN -Microsoft .NET (C#) - language-interface\\csharp sample. The C# wrapper (ipps.cs) makes use of theipps-7.0.dll library and it works perfectly on the development machine. Now I would like to deploy the solution to a client machine by keeping the automated capability of IPP to dispatch by detecting the CPU on the client machine and selecting the optimized library. I guess it is not enough to add to the project theipps-7.0.dll library, so what should I do?
0 Kudos
1 Solution
Ilya_Albrekht
Novice
1,757 Views
Hello ganswer,
I came across the same issue and the best way to "fix" this:
  • Add C++ library (dll) project to your solution
  • Turn on IPP linking "Configuration Properties -> Intel Performance Libraries -> Use IPP = *-thread Static Library"
  • Add "extern" wrappers for functions you'd like to use
extern "C" {
__declspec(dllexport) void __cdecl DFTFwd_64fc(double *src, double *dst, int len);
}
extern "C" { __declspec(dllexport) void __cdecl DFTFwd_64fc(double *src, double *dst, int len);}
  • Use DllImport from your C# code
[DllImport("my_ipp_wrapper.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void DFTFwd_64fc(double[] src, double[] dst, int len);
In this case you don't have to keep all IPP libraries with your program.
Best Regards,
Ilya Albrekht

View solution in original post

0 Kudos
16 Replies
Gandolfo__Mauro
Beginner
1,757 Views
Hi Tamer,

thanks for your reply and I read those articles but I'm still missing something. The problem is that I do not want to create my custom C# wrapper. I just simple want to use the one provided by Intel in the laguage-interface sample that works greatly on my development machine. The problem is that this sample will not work on a client machine and that I didn't find any example on how to make it work easily (even in this white paper on .NEt support I didn't find a guide for this). For instance if somebody would like to redistribute this Intel-provided sample with ClickOnce technology what should he do?

Regards,
Mauro
0 Kudos
Tamer_Assad
Innovator
1,757 Views
Hi Mauro,

Static linking with dispatching is the answer.

Regards,
Tamer
0 Kudos
Gandolfo__Mauro
Beginner
1,757 Views
Hi Tamer,

I was instead expecting to link only to DLLs. Now I've tried to simply add to my project the following libraries: ippcore-7.0.dll, ipp*-7.0.dll (* denotes all the domains for signal processing libraries, e.g. ipps-7.0.dll, ippsu8-7.0,dll, etc.).

When I run my testing executable (tryingipp.exe) on my development machine it works and I can see with Dependency Walker that all the ipp*-7.0.dll are properly loaded from the local path where the project is built (and not from the ipp redist path).

The same tryingipp.exe redistribuited with ClickOnce on a client machine instead does not work because it says it cannot find the ipps-7.0.dll. The ipp-7.0.dll is in the same path of the installed tryingipp.exe hence I guess it is not working because I'm still in the 30days evaluating period, isn't it? Or is there another reason?

Mauro
0 Kudos
SergeyKostrov
Valued Contributor II
1,757 Views
Quoting ganswer
...The same tryingipp.exe redistribuited with ClickOnce on a client machine instead does not work because
it says it cannot find the ipps-7.0.dll. The ipp-7.0.dll is in the same path of the installed tryingipp.exe
hence I guess it is not working because I'm still in the 30days evaluating period, isn't it?

[SergeyK] If your trial installation is less than 30 days old it should work.

Or is there another reason?

[SergeyK] Did you verify that ipps-7.0.dll was reallyinstalled / copiedonthe client computer?
( including all the rest "waterfall" IPP DLLs )

Best regards,
Sergey
0 Kudos
Gandolfo__Mauro
Beginner
1,757 Views
Hi Sergey,
Yes I'm still in the evaluation period and yes I've verified that all the libraries are in the installation path (the "obscure" path used by ClickOnce and reserved to each single app in order to avoid DLL conflicts). Ok in this case the problem is even more weird since as far as I understand the Dependency Walker output, the library is firstly found and immediatelly after it is not any more. Below you can find an extract of DW output.
Also the C# Intel provided sample does not work on a client machine when deployed with ClickOnce (it's normal in this case since the IPP DLLs are not included in the publishing files). So, is there somewhere around an IPP C# test project that works in all respects?
-------------------------DW output-----------------------------
[...]

LoadLibraryExW("C:\Users\Experimenter\AppData\Local\Apps\2.0\CWRDN757.DPV\HLLT5OMD.R2Z\tryi..tion_323e7b0fd32f6d2f_0001.0000_2105c64726deb6eb\ipps_cs.dll", 0x0000000000000000, DONT_RESOLVE_DLL_REFERENCES | LOAD_WITH_ALTERED_SEARCH_PATH) returned 0x000007FEF7C30000.

LoadLibraryExW("C:\Users\Experimenter\AppData\Local\Apps\2.0\CWRDN757.DPV\HLLT5OMD.R2Z\tryi..tion_323e7b0fd32f6d2f_0001.0000_2105c64726deb6eb\ipps-7.0.dll", 0x0000000000000000, LOAD_WITH_ALTERED_SEARCH_PATH) called from "CLR.DLL" at address 0x000007FEF7FF7651.

Loaded "IPPS-7.0.DLL" at address 0x0000000180000000. Successfully hooked module.

Loaded "IPPCORE-7.0.DLL" at address 0x00000000008F0000. Successfully hooked module.

Unloaded "IPPS-7.0.DLL" at address 0x0000000180000000.

Unloaded "IPPCORE-7.0.DLL" at address 0x00000000008F0000.

LoadLibraryExW("C:\Users\Experimenter\AppData\Local\Apps\2.0\CWRDN757.DPV\HLLT5OMD.R2Z\tryi..tion_323e7b0fd32f6d2f_0001.0000_2105c64726deb6eb\ipps-7.0.dll", 0x0000000000000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: The specified module could not be found (126).

LoadLibraryExW("ipps-7.0.dll", 0x0000000000000000, 0x00000000) called from "CLR.DLL" at address 0x000007FEF7FF7651.

Loaded "IPPS-7.0.DLL" at address 0x0000000180000000. Successfully hooked module.

Loaded "IPPCORE-7.0.DLL" at address 0x00000000008F0000. Successfully hooked module.

Unloaded "IPPS-7.0.DLL" at address 0x0000000180000000.

Unloaded "IPPCORE-7.0.DLL" at address 0x00000000008F0000.

LoadLibraryExW("ipps-7.0.dll", 0x0000000000000000, 0x00000000) returned NULL. Error: The specified module could not be found (126).

[...]

0 Kudos
SergeyKostrov
Valued Contributor II
1,757 Views
Hi Mauro,

I've madea couple ofcomments and please take a look:

Quoting ganswer
...Also the C# Intel provided sample does not work on a client machine when deployed with ClickOnce (it's normal in this case since the IPP DLLs are not included in the publishing files). So, is there somewhere around an IPP C# test project that works in all respects?

[SergeyK] Is it possible to test on the client machinea C# Intel sample without ClickOnce deployment? Did you try it?
-------------------------DW output-----------------------------
[...]

C:\Users\Experimenter\AppData\Local\Apps\2.0CWRDN757.DPV\HLLT5OMD.R2Z\tryi..tion_323e7b0fd32f6d2f_0001.0000_2105c64726deb6eb\ipps_cs.dll

[SergeyK] What is 'tryi..tion'?
What is a total length of the path? Is it greater than 255 characters?

...

LoadLibraryExW("ipps-7.0.dll", 0x0000000000000000, 0x00000000) returned NULL. Error: The specified module could not be found (126).

[...]


The error code 126 is what 'GetLastError' Win32 API function returns after unsuccessful attempt to load 'ipps-7.0.dll'.

Would you be able to attach a complete output from Dependency Walker?

Best regards,
Sergey

0 Kudos
Gandolfo__Mauro
Beginner
1,757 Views
Hi Sergey,
I've tried the app also as a stand-alone on two different client machine and it does not work. The stand-alone was in a path for sure smaller than 255 characters. I'm attaching both the Dependency Walker output and a screenshot showing the application folder (and the included libraries).
Best Regards,
Mauro
0 Kudos
SergeyKostrov
Valued Contributor II
1,757 Views
Hi Mauro,

Please review in Dependency Walkerall cases with IPP libraries, like 'ipps-7.0.dll', etc, because they could be dependent on
another Intelruntime libraries.

This is what I see in the dwi-file you provided:

ipps-7.0.dll ( 64-bit )
|
+-> depends on ippcore-7.0.dll ( 64-bit )
|
+-> depends on libiomp5md.dll ( it has to be a 64-bit version / this is Intel's version of OpenMP )

Did you install Intel runtime libraries on the client computer?

Best regards,
Sergey
0 Kudos
Gandolfo__Mauro
Beginner
1,757 Views
Hi Sergey,
thanks for provided info. No I've not installed other runtime libraries on the client machine. This was actually my initial question. What should I install on the client machine? Is there an installer that must be used on the client machine or should I include other libraries?
Best regards,
Mauro
0 Kudos
SergeyKostrov
Valued Contributor II
1,757 Views
Hi Mauro,

Quoting ganswer
What should I install on the client machine? Is there an installer that must be used on the client machine or should I include other libraries?


Pleasetry to find and downloada Redistributable package of Intel runtimeDLLs.

For example, I have Intel C++ Composer XE 2011 32-bit installation on a drive C. A path to a folder with Redistributable DLLs is
as follows:

..\Composer XE\Redist\ia32\Compiler\
+- different DLLs like, 'libiomp5md.dll'

Best regards,
Sergey

0 Kudos
Ilya_Albrekht
Novice
1,758 Views
Hello ganswer,
I came across the same issue and the best way to "fix" this:
  • Add C++ library (dll) project to your solution
  • Turn on IPP linking "Configuration Properties -> Intel Performance Libraries -> Use IPP = *-thread Static Library"
  • Add "extern" wrappers for functions you'd like to use
extern "C" {
__declspec(dllexport) void __cdecl DFTFwd_64fc(double *src, double *dst, int len);
}
extern "C" { __declspec(dllexport) void __cdecl DFTFwd_64fc(double *src, double *dst, int len);}
  • Use DllImport from your C# code
[DllImport("my_ipp_wrapper.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void DFTFwd_64fc(double[] src, double[] dst, int len);
In this case you don't have to keep all IPP libraries with your program.
Best Regards,
Ilya Albrekht
0 Kudos
Gandolfo__Mauro
Beginner
1,757 Views
Thanks for your reply. I'm trying what you suggested since it would be better to do not inclide all the IPP libraries. However I'm having problems.
I've tried:
extern "C" __declspec(dllexport) void __cdecl DFTFwd_64fc(double *src, double *dst, int len);
but then when I import it with P/Invoke in C#, at runtime I get the following error:
"Unable to find an entry point named 'DFTFwd_64fc' in DLL 'ippwrapper.dll'"
I've tried also another function (one that I really need):
extern "C" __declspec(dllexport) IppStatus __cdecl ippsIIRGenHighpass_64f(double rFreq, double ripple, int order, double* pTaps, IppsIIRFilterType filterType);
and in this case I cannot compile because I get the error C2375.
I guess my problem is that I do not know how to use Visula C++ libraries. In my solution I've a C++/CLI library using /clr and my .h and .cpp files content is:
// ippwrapper.h
#include
// ippwrapper.cpp
#include "stdafx.h"
#include "ippwrapper.h"
//extern "C" __declspec(dllexport) IppStatus __cdecl ippsIIRGenHighpass_64f(double rFreq, double ripple, int order, double* pTaps, IppsIIRFilterType filterType);
extern "C" __declspec(dllexport) void __cdecl DFTFwd_64fc(double *src, double *dst, int len);
0 Kudos
SergeyKostrov
Valued Contributor II
1,757 Views
Quoting ganswer
Thanks for your reply. I'm trying what you suggested since it would be better to do not inclide all the IPP libraries. However I'm having problems.
I've tried:
extern "C" __declspec(dllexport) void __cdecl DFTFwd_64fc(double *src, double *dst, int len);
but then when I import it with P/Invoke in C#, at runtime I get the following error:
"Unable to find an entry point named 'DFTFwd_64fc' in DLL 'ippwrapper.dll'"
I've tried also another function (one that I really need):
extern "C" __declspec(dllexport) IppStatus __cdecl ippsIIRGenHighpass_64f(double rFreq, double ripple, int order, double* pTaps, IppsIIRFilterType filterType);
and in this case I cannot compile because I get the error C2375.


Hi,

I understood that you've re-declared two IPP functions in your sources. Unfortunately, it didn't change
signatures of these two functions in IPP header, lib and dll files.

The compilererror C2375 clearly tells you that something is wrong with declarations:

"Redefinition; Different linkage"

and I thinkit is related to a '__declspec( dllexport )'.

Arule is as follows:

In a DLL "Abc.dll" the'__declspec( dllexport )' is used for allexported functions, classesor data structures
In an APP "Abc.exe" that uses "Abc.dll" the'__declspec( dllimport )' is used

Best regards,
Sergey

0 Kudos
Gandolfo__Mauro
Beginner
1,757 Views
Thanks Sergey,
I've solved the name conflict and now it works. I can now use both the native DLL (export "C" _declspec(dllexport)) or a managed C++/CLI DLL that wraps the IPP native functions and it works!

Also it workd with the Dynamic Linking by adding thelibiomp5md.dll but in this case I've 27MB of libraries to add and since I'm trying really few IPP functions I prefer static linking
0 Kudos
Ilya_Albrekht
Novice
1,757 Views
Hello ganwer,
I'm sorry I missed your post, and I'm glad Sergey was able to help and it finally works for you. I'm personally using static linking - less in size and no need to remember which libraries you need to copy with your application.
Regards,
Ilya
0 Kudos
Reply