I have used Eigen library in my object oriented cpp code. I defined a main object, 2DGF, and in some methods of it, I have used openmp. Now I want to use openmp in another method as following:
#pragma omp parallel num_threads(NON)
#pragma omp for
for(unsigned int iE=0;iE<NE;iE++){
for(unsigned int iK=0;iK<NK;iK++){
for(unsigned int ii=0; ii<NL ;ii++){
for(unsigned int jj=0; jj<NL ;jj++){
if(abs(CoorX[ii]-CoorX[jj])<DiogLim){
G.insert(iE*NL+ii,iK*NL+jj)=0;
GR.insert(iE*NL+ii,iK*NL+jj)=0;
S.insert(iE*NL+ii,iK*NL+jj)=0;
SR.insert(iE*NL+ii,iK*NL+jj)=0;
}
}
}
}
}
where G, GR, S and SR are sparse matrices. Without using openmp it works with no problem. But when I use the openmp, I receive the following error:
2DGF : malloc.c:2372: sysmalloc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 *(sizeof(size_t))) - 1)) & ~((2 *(sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long) old_end & pagemask) == 0)' failed.
Aborted (core dumped)
May anybody help me to fix it?