- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hello!
I'm trying to use MKL in my C# project.
But I get an exception even in such a simple function as dgetrf.
In this example I want to factorize matrix {(2,0),(0,1)}
[DllImport("C:\IA32\bin\mkl_lapack64.dll" )]
static extern int dgetrf(ref int m,ref int n, ref double[] a,ref int lda,ref int[] ipiv,ref int info);
private void button1_Click(object sender, EventArgs e)
{
double[] a = (double[])Array.CreateInstance(typeof(double),4);
a[0] = 2;
a[1] = 0;
a[2] = 0;
a[3] = 1;
int[] ipiv=(int[])Array.CreateInstance(typeof(int),2);
int info=0;
int m=2,n=2;
int lda =2;
dgetrf(ref m,ref n,ref a,ref lda,ref ipiv, ref info);
}
The exception is 'System.AccessViolationException'.Attempted to read or write protected memory.
Possibly you could tell me where I'm mistaken.
if I set lda=1 I don't get the exception but info returns -4.
I'm trying to use MKL in my C# project.
But I get an exception even in such a simple function as dgetrf.
In this example I want to factorize matrix {(2,0),(0,1)}
[DllImport("C:\IA32\bin\mkl_lapack64.dll" )]
static extern int dgetrf(ref int m,ref int n, ref double[] a,ref int lda,ref int[] ipiv,ref int info);
private void button1_Click(object sender, EventArgs e)
{
double[] a = (double[])Array.CreateInstance(typeof(double),4);
a[0] = 2;
a[1] = 0;
a[2] = 0;
a[3] = 1;
int[] ipiv=(int[])Array.CreateInstance(typeof(int),2);
int info=0;
int m=2,n=2;
int lda =2;
dgetrf(ref m,ref n,ref a,ref lda,ref ipiv, ref info);
}
The exception is 'System.AccessViolationException'.Attempted to read or write protected memory.
Possibly you could tell me where I'm mistaken.
if I set lda=1 I don't get the exception but info returns -4.
Message Edited by flashnik on 03-28-200603:14 PM
Message Edited by flashnik on 03-28-200603:16 PM
링크가 복사됨
3 응답
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hi Bo,
We had some example for how to call MKL function in C#. You may download the Intel_MKL_C#_Examples.zip from
https://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program
and try them to see if you can run them first.
Best Regards,
Ying