Skip to content

Commit

Permalink
fix a bug in ReDistribute_B_to_X
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyangzhuan committed Sep 2, 2018
1 parent 7ce8a98 commit 5c98bd1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 32 deletions.
21 changes: 5 additions & 16 deletions SRC/pdgstrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ pdReDistribute_B_to_X(double *B, int_t m_loc, int nrhs, int_t ldb,
int_t *perm_r, *perm_c; /* row and column permutation vectors */
int_t *send_ibuf, *recv_ibuf;
double *send_dbuf, *recv_dbuf;
int_t *xsup, *supno, *rowind;
int_t *xsup, *supno;
int_t i, ii, irow, gbi, j, jj, k, knsupc, l, lk, nbrow;
int p, procs;
pxgstrs_comm_t *gstrs_comm = SOLVEstruct->gstrs_comm;
Expand Down Expand Up @@ -199,9 +199,6 @@ pdReDistribute_B_to_X(double *B, int_t m_loc, int nrhs, int_t ldb,

if(procs==1){ // faster memory copy when procs=1

if ( !(rowind = intMalloc_dist(m_loc)) )
ABORT("Malloc fails for rowind[].");

#ifdef _OPENMP
#pragma omp parallel default (shared)
#endif
Expand All @@ -225,18 +222,10 @@ pdReDistribute_B_to_X(double *B, int_t m_loc, int nrhs, int_t ldb,
x[l - XK_H] = k; /* Block number prepended in the header. */

irow = irow - FstBlockC(k); /* Relative row number in X-block */
rowind[i] = l + irow;
}

RHS_ITERATE(j) {
#ifdef _OPENMP
#pragma omp taskloop private (i) untied
#endif
for (i = 0; i < m_loc; ++i) {
x[rowind[i] + j*knsupc] = B[i + j*ldb];
}
RHS_ITERATE(j) {
x[l + irow + j*knsupc] = B[i + j*ldb];
}
}
SUPERLU_FREE(rowind);
}
}
}else{
Expand Down Expand Up @@ -986,7 +975,7 @@ pdgstrs(int_t n, LUstruct_t *LUstruct,

#if ( DEBUGlevel>=1 )
/* Dump the L factor using matlab triple-let format. */
//dDumpLblocks(iam, nsupers, grid, Glu_persist, Llu);
dDumpLblocks(iam, nsupers, grid, Glu_persist, Llu);
#endif
/*---------------------------------------------------
* Forward solve Ly = b.
Expand Down
21 changes: 5 additions & 16 deletions SRC/pzgstrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ pzReDistribute_B_to_X(doublecomplex *B, int_t m_loc, int nrhs, int_t ldb,
int_t *perm_r, *perm_c; /* row and column permutation vectors */
int_t *send_ibuf, *recv_ibuf;
doublecomplex *send_dbuf, *recv_dbuf;
int_t *xsup, *supno, *rowind;
int_t *xsup, *supno;
int_t i, ii, irow, gbi, j, jj, k, knsupc, l, lk, nbrow;
int p, procs;
pxgstrs_comm_t *gstrs_comm = SOLVEstruct->gstrs_comm;
Expand Down Expand Up @@ -198,9 +198,6 @@ pzReDistribute_B_to_X(doublecomplex *B, int_t m_loc, int nrhs, int_t ldb,

if(procs==1){ // faster memory copy when procs=1

if ( !(rowind = intMalloc_dist(m_loc)) )
ABORT("Malloc fails for rowind[].");

#ifdef _OPENMP
#pragma omp parallel default (shared)
#endif
Expand All @@ -211,7 +208,7 @@ pzReDistribute_B_to_X(doublecomplex *B, int_t m_loc, int nrhs, int_t ldb,
{
// t = SuperLU_timer_();
#ifdef _OPENMP
#pragma omp taskloop private (i,l,irow,k,j) untied
#pragma omp taskloop private (i,l,irow,k,j,knsupc,lk) untied
#endif
for (i = 0; i < m_loc; ++i) {
irow = perm_c[perm_r[i+fst_row]]; /* Row number in Pc*Pr*B */
Expand All @@ -225,18 +222,10 @@ pzReDistribute_B_to_X(doublecomplex *B, int_t m_loc, int nrhs, int_t ldb,
x[l - XK_H].i = 0;

irow = irow - FstBlockC(k); /* Relative row number in X-block */
rowind[i] = l + irow;
}

RHS_ITERATE(j) {
#ifdef _OPENMP
#pragma omp taskloop private (i) untied
#endif
for (i = 0; i < m_loc; ++i) {
x[rowind[i] + j*knsupc] = B[i + j*ldb];
}
RHS_ITERATE(j) {
x[l + irow + j*knsupc] = B[i + j*ldb];
}
}
SUPERLU_FREE(rowind);
}
}
}else{
Expand Down

0 comments on commit 5c98bd1

Please sign in to comment.