I am trying to implement some Intel Math Kernel Library functionality in a grasshopper plugin. See link below for the example I am trying to implement:
https://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program
I can get this working in a c# windows forms program just fine, but as soon as I run it through grasshopper and 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);
}
Am I doing something wrong?
This is all I get from Visual Studio:
The program '[6772] Rhino.exe: Managed (v4.0.30319)' has exited with code 2 (0x2).
See grasshopper forum post for complete code: