- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
I am having trouble calling a MKL library function in a 32bit-compiled C# application in Visual Studio. The MKL library function is exposed through a native DLL for C# to reference. I wonder what I need to do in terms of the function signature part: lapack_int. I saw in
LAPACK: LAPACKE/include/lapack.h Source File (netlib.org)
that there is a switch between int32 and int64. Do I need c# "long" for int64_t and "int" for int32_t"?
Link kopiert
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
The distinction between LP64 and ILP64 apply only to 64 bit MKL libraries and DLLs. They do not apply to 32-bit applications and DLLs, which pass only 32-bit integer arguments to MKL routines. The distinctions have no relevance for MKL routine arguments of types other than integer.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Many thanks for the rely.
My 32bits C# application had this error message when calling the native dll, which links to the MKL library and has the MKL function exposed.
Managed Debugging Assistant 'PInvokeStackImbalance' : 'A call to PInvoke function 'Intel.MKL.Native.UnsafeNativeMethods::LAPACKE_dsytrf' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.'
The same call has no problem when compiling in x64 mode.
This is the function signature defined in the native dll:
[DllImport(LibName)]
internal static extern int LAPACKE_dsytrf(int layout, char uplo, int n, double* a, int lda, int* ipiv);
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Did you build the Lapack_E library yourself? Were they built from sources at Netlib or the ones in the Zip file provided with the MKL examples?
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
MKL library (both 32/64bit version) was installed in Visual Studio via Nuget.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi,
Thanks for posting in Intel Communities.
Could you please assist us by providing the following details so that we can reproduce the issue from our end:
- MKL version, software, and hardware details along with a sample reproducer.
- Detail Steps that you have followed for installing Visual Studio via Nuget.
- Steps for linking your 32-bit C# application with Visual Studio.
- Complete error log.
We request you to use 64bit only, since Intel® oneMKL 32-bit binaries will be deprecated in the upcoming release. Please refer to this link:
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Deprecation-Notices/td-p/1505877
Thanks & Regards,
Aryan
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
1) MKL version, software, and hardware details along with a sample reproducer.
MKL static lib installed from NuGet (https://www.nuget.org/packages/intelmkl.static.win-x64).
Version Number: 2023.1.0.46356
2) Detail Steps that you have followed for installing Visual Studio via Nuget.
Solution Menu/Manager NuGet Packages for Solution.../Browse, type in IntelMKL.static in the search box and install.
3) Steps for linking your 32-bit C# application with Visual Studio.
Create a DLL project in the solution and enable mkl api by setting up appropriate header/lib files.
Expose the MKL function in the exports.def file
Create a C# project in the same solution and import the function by
[DllImport(LibName)]
internal static extern int LAPACKE_dsytrf(MklLayoutEnum layout, char uplo, int n, double* a, int lda, int* ipiv);
4) Complete error log.
Managed Debugging Assistant 'PInvokeStackImbalance'
Message=Managed Debugging Assistant 'PInvokeStackImbalance' : 'A call to PInvoke function 'Intel.MKL.Native.UnsafeNativeMethods::LAPACKE_dsytrf' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.'
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi,
Thank you for providing the steps.
We have successfully installed the MKL static library from NuGet. Could you please elaborate on step 3 for better understanding?
Alternatively, it would be more convenient for us to reproduce the issue if you could share your project file zipped and provide the necessary steps for replication (if applicable). If the file size is too large, you can try to isolate the issue and send us a sample working reproducer. This will greatly assist us in addressing the issue and providing you with the appropriate assistance.
Thanks and Regards,
Aryan
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi,
Gentle reminder:
We haven't heard back from you. Could you please provide an update on the above information?
Thanks and Regards,
Aryan
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi,
Gentle reminder:
We haven't heard back from you. Could you please provide an update on the above information?
Thanks and Regards,
Aryan
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite