algorithmic modeling for Rhino
Hi there.
I am trying to implement some Intel Math Kernel Library functionality in a grasshopper plugin. See link below:
https://software.intel.com/en-us/articles/using-intel-mkl-in-your-c...
I can get this working in a c# windows forms program, but as soon as i make a call to the mkl-dll's Rhino and Grasshopper crashes without giving me an exception.
See code code snippet below:
/** Pardiso wrappers */
public class Pardiso
{
private Pardiso() { }
public static int pardiso(IntPtr[] handle,
ref int maxfct, ref int mnum,
ref int mtype, ref int phase, ref int n,
double[] a, int[] ia, int[] ja, int[] perm,
ref int nrhs, int[] iparm, ref int msglvl,
double[] b, double[] x, ref int error)
{
return PardisoNative.pardiso(handle, RHINO CRASHES HERE
ref maxfct, ref mnum, ref mtype, ref phase, ref n,
a, ia, ja, perm, ref nrhs, iparm, ref msglvl,
b, x, ref error);
}
}
/** Pardiso native declarations */
[SuppressUnmanagedCodeSecurity]
public class PardisoNative
{
private PardisoNative() { }
[DllImport("mkl_rt.dll", CallingConvention = CallingConvention.Cdecl,
ExactSpelling = true, SetLastError = false)]
internal static extern int pardiso([In, Out] IntPtr[] handle,
ref int maxfct, ref int mnum,
ref int mtype, ref int phase, ref int n,
[In] double[] a, [In] int[] ia, [In] int[] ja, [In] int[] perm,
ref int nrhs, [In, Out] int[] iparm, ref int msglvl,
[In, Out] double[] b, [Out] double[] x, ref int error);
}
Does anybody know what I am doing wrong? Please find complete code attached.
This is all I get from VS:
The program '[6772] Rhino.exe: Managed (v4.0.30319)' has exited with code 2 (0x2).
Thank you in advance,
Gustav
Tags:
Are you running this on Rhino5 32-bit, Rhino5 64-bit or Rhino6? What bit depth is the pardiso library?
I am running this on Rhino5 64-bit, and the pardiso library is 64-bit aswell.
In that case I'm out of ideas. Clearly the crash is happening outside of .NET channels otherwise the component would catch the exception and handle it, so it's anybody's guess why pardiso and Rhino are not getting along.
Rhino uses some non-standard memory allocation/heap management. That may be a cause of problems, but I'm not a C++ programmer so don't take anything I say about that too seriously.
You could try asking on discourse, maybe an interop/unmanaged code wizard there can see what the problem might be.
I did, thanks for the reply!
I assigned your discourse topic to one of our developers who knows most about C++/.NET interop. But whether he'll be able to help is something we'll find out in due time.
Resolved!
See link below for solution:
https://discourse.mcneel.com/t/rhino-crashes-on-native-call/41789/5
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by