Mentions légales du service

Skip to content
Snippets Groups Projects
Commit b4776ac4 authored by Tony Delarue's avatar Tony Delarue Committed by Mathieu Faverge
Browse files

Fix spmGather with csx matrices and less unknonws than nodes

parent fc6104e4
No related branches found
No related tags found
1 merge request!38SpmSortMultidof
...@@ -115,7 +115,7 @@ spm_gather_csx_update( const spmatrix_t *spm, ...@@ -115,7 +115,7 @@ spm_gather_csx_update( const spmatrix_t *spm,
for ( c=1; c<spm->clustnbr; c++ ) { for ( c=1; c<spm->clustnbr; c++ ) {
/* Let's start shifting the value after the first array */ /* Let's start shifting the value after the first array */
spm_int_t shift = recvdispls[c]; spm_int_t shift = recvdispls[c];
spm_int_t end = ( c < (spm->clustnbr-1) ) ? recvdispls[c+1] : spm->gN+1; spm_int_t end = ( c < (spm->clustnbr-1) ) ? recvdispls[c+1] : spm->gN;
spm_int_t i; spm_int_t i;
to_add += recvcounts[c-1]; to_add += recvcounts[c-1];
...@@ -123,6 +123,9 @@ spm_gather_csx_update( const spmatrix_t *spm, ...@@ -123,6 +123,9 @@ spm_gather_csx_update( const spmatrix_t *spm,
colptr[i] += to_add; colptr[i] += to_add;
} }
} }
assert( to_add + recvcounts[spm->clustnbr-1] == spm->gnnz );
/* Set the last value */
colptr[spm->gN] = colptr[0] + spm->gnnz;
} }
/** /**
...@@ -177,7 +180,6 @@ spm_gather_csx_continuous( const spmatrix_t *oldspm, ...@@ -177,7 +180,6 @@ spm_gather_csx_continuous( const spmatrix_t *oldspm,
recvdispls[c] = recvdispls[c-1] + recvcounts[c-1]; recvdispls[c] = recvdispls[c-1] + recvcounts[c-1];
recvcounts[c] = allcounts[ 3 * c ]; recvcounts[c] = allcounts[ 3 * c ];
} }
recvcounts[ oldspm->clustnbr - 1 ] += 1; /* Add the extra elements */
/* Initialize the new pointers */ /* Initialize the new pointers */
assert( newspm ); assert( newspm );
...@@ -186,11 +188,6 @@ spm_gather_csx_continuous( const spmatrix_t *oldspm, ...@@ -186,11 +188,6 @@ spm_gather_csx_continuous( const spmatrix_t *oldspm,
newval = newspm->values; newval = newspm->values;
} }
/* Add the first value from the first node */
if ( oldspm->clustnum == oldspm->clustnbr-1 ) {
n++;
}
/* Gather the colptr */ /* Gather the colptr */
if ( root == -1 ) { if ( root == -1 ) {
MPI_Allgatherv( oldcol, n, SPM_MPI_INT, MPI_Allgatherv( oldcol, n, SPM_MPI_INT,
......
...@@ -117,9 +117,9 @@ z_spmCSCExpand( const spmatrix_t *spm_in, spmatrix_t *spm_out ) ...@@ -117,9 +117,9 @@ z_spmCSCExpand( const spmatrix_t *spm_in, spmatrix_t *spm_out )
/* Sum the heights of the elements in the column */ /* Sum the heights of the elements in the column */
newcol[1] = newcol[0]; newcol[1] = newcol[0];
for(k=oldcol[0]; k<oldcol[1]; k++) for(k=oldcol[0]; k<oldcol[1]; k++, oldrow++ )
{ {
ig = oldrow[k-baseval] - baseval; ig = *oldrow - baseval;
dofi = (spm_in->dof > 0 ) ? spm_in->dof : dofs[ig+1] - dofs[ig]; dofi = (spm_in->dof > 0 ) ? spm_in->dof : dofs[ig+1] - dofs[ig];
newcol[1] += dofi; newcol[1] += dofi;
...@@ -280,9 +280,9 @@ z_spmCSRExpand( const spmatrix_t *spm_in, spmatrix_t *spm_out ) ...@@ -280,9 +280,9 @@ z_spmCSRExpand( const spmatrix_t *spm_in, spmatrix_t *spm_out )
/* Sum the width of the elements in the row */ /* Sum the width of the elements in the row */
newrow[1] = newrow[0]; newrow[1] = newrow[0];
for(k=oldrow[0]; k<oldrow[1]; k++) for(k=oldrow[0]; k<oldrow[1]; k++, oldcol++)
{ {
jg = oldcol[k-baseval] - baseval; jg = *oldcol - baseval;
dofj = (spm_in->dof > 0 ) ? spm_in->dof : dofs[jg+1] - dofs[jg]; dofj = (spm_in->dof > 0 ) ? spm_in->dof : dofs[jg+1] - dofs[jg];
newrow[1] += dofj; newrow[1] += dofj;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment