Community
cancel
Showing results for 
Search instead for 
Did you mean: 
yenn99
Beginner
104 Views

mkl_dcsrmultcsr

Hi I'm computing A'A for getting a squared matrix for AX=b (I would implemented it as A'AX=A'b).
While I was working on A'A, I got stocked. The following is my program:
char trA = 'T';
int request = 1;
int sort =0;
int columns = A->n;
std::vector C(A->n*A->n+1);
std::vector JC(A->n*A->n+1);
std::vector IC(A->m+1);
int nzmax = A->n * A->n+1;
int info = 0;
mkl_dcsrmultcsr(&trA, &request, &sort, &A->m, &A->n, &A->n, &A->v[0], &A->jv[0], &A->iv1[0], b, &A->jv[0], &A->iv1[0], &C[0], &JC[0], &IC[0], &nzmax, &info);
A was allocated and was filled in with values. The error message I got was as follows:
An unhandled exception of type 'System.AccessViolationException' occurred in OpenGL_on_a_Windows_Form.exe
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
An unhandled exception of type 'System.AccessViolationException' occurred in OpenGL_on_a_Windows_Form.exe
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Anyone could give me some ideas of what was wrong? or any other solutions for solving a non-squared matrix A for AX=b?
Thank you!
0 Kudos
7 Replies
Chao_Y_Intel
Employee
104 Views

Hello,

Do you have test code that shows this problem? That will be very helpful to check this problem.

I aslo found IC is define as:
std::vector IC(A->m+1);

When trA='T', IC is:
INTEGER. Array of length m + 1 when trans = 'N' or 'n', or n + 1 otherwise.

Could you please check if its length should be n+1?

Thanks,
Chao

yenn99
Beginner
104 Views

Hi Chao,
Thank you for helping me on this problem.
I tried n+1 but it still shows the same error message: "Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Even though I changed the size of IJ and IC to a big vector array, it still shows the same message. :-(
yenn99
Beginner
104 Views

I'm sorry I found a bug in my code. In my case I have A'*A=C in replace ofA*B=C.
Therefore, I should not have any 'b' when calling the function.
The current one is:
mkl_dcsrmultcsr(&trA, &request, &sort, &A->m, &A->n, &A->n,
&A->v[0], &A->jv[0], &A->iv1[0], /* for A' */
&A->v[0], &A->jv[0], &A->iv1[0], /* for A */
&C[0], &JC[0], &IC[0], /* for C */
&nzmax, &info);
But it still shows: "Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
yenn99
Beginner
104 Views

GSparseCSR C;
C.Resize(A->n, A->n, A->n * A->n);
mkl_dcsrmultcsr(&trA, &request, &sort, &A->m, &A->n, &A->n, &A->v[0], &A->jv[0], &A->iv1[0], &A->v[0], &A->jv[0], &A->iv1[0], &C.v[0], &C.jv[0], &C.iv1[0], &nzmax, &info);
I also tried the above. Still the same. :-(
yenn99
Beginner
104 Views

The size of my array A:18580(A->m) x 2616(A->n)
Thanks.
yenn99
Beginner
104 Views

char trA = 'T';
int request = 1;
int sort =0;
int nzmax = A->n * A->n;
int info = 0;
GSparseCSR C;
C.Resize(A->n, A->n, A->n * A->n);
mkl_dcsrmultcsr(&trA, &request, &sort, &A->m, &A->n, &A->n, &A->v[0], &A->jv[0], &A->iv2[0], &A->v[0], &A->jv[0], &A->iv2[0], &C.v[0], &C.jv[0], &C.iv2[0], &nzmax, &info);

Now it runs well, but the result values in C.jv are all zeros (info=0, the execution is successful)...
I'm sure I have a good A.
I can't get why.
Chao_Y_Intel
Employee
104 Views


Hi, do you have atest code that could show the problem? I want to check if there is any code problem.

Thanks,
Chao

Reply