- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
dgetrf(ref m,ref n,ref a,ref lda,ref ipiv, ref info)?
If dgetrf is call by C-code:
dgetrf(&m,&n,a,&lda,ipiv,&info);
so the problem is...
If dgetrf is call by C-code:
dgetrf(&m,&n,a,&lda,ipiv,&info);
so the problem is...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page