- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi and thanks for the attention! I'm a beginner and i would like to use the mkl library for my thesis. I must use the function mkl_dcsrgemv, but there are always the error: "segmentation error(core dump created)". The code used is the following and i don't see the error. Someone can help me?
code:
#include <stdio.h>
#include "mkl.h"
int main() {
double *val,*x,*y;
int *I,*J;
int k;
int M;
char transa='N';
M=4;
val=(double *) calloc(M,sizeof(double));
x=(double *) calloc(M,sizeof(double));
y=(double *) calloc(M,sizeof(double));
I=(int *) calloc (M,sizeof(int));
J=(int *) calloc(M,sizeof(int));
for(k=0;k<M;++k){
val
x
J
I
}
I[M+1]=M+1;
mkl_dcsrgemv(&transa,&M,val,I,J,x,y);
printf("\n il vettore y: \n");
for(k=0;k<M;++k){
printf(" %lf \t %lf \n",val
}
return 0;
}
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
which version of mkl do you use?
I release only all dynamically allocated arrays and linked against mkl 2020. it works
$ ./a.out
il vettore y:
2.000000 4.000000
2.000000 4.000000
2.000000 4.000000
2.000000 0.000000
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since I is of length M, valid subscripts for I are integers from 0 to M-1, inclusive.
You are attempting to store into I[M+1], which is an invalid memory access.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
are there any updates? Do you still see the segfault?
![](/skins/images/7FC17B7B85029576C25F1E43CE255B51/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page