Skip to content

Commit

Permalink
change integer type of permr[]/perm_c[] from int_t to int, always 32bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyeli committed Dec 26, 2024
1 parent fe0e4e8 commit 9f4c5bc
Show file tree
Hide file tree
Showing 63 changed files with 452 additions and 482 deletions.
2 changes: 1 addition & 1 deletion PYTHON/pdbridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ int dcreate_matrix_from_csc(SuperMatrix *A,
}


int count_swaps(int_t perm[], int n) {
int count_swaps(int perm[], int n) {
bool visited[n];
for (int i = 0; i < n; i++) {
visited[i] = false;
Expand Down
2 changes: 1 addition & 1 deletion PYTHON/pdbridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ extern void pdbridge_logdet(void ** pyobj, int * sign, double * logdet);
#endif

int dcreate_matrix_from_csc(SuperMatrix *A, int_t m, int_t n, int_t nnz, int_t *rowind0, int_t *colptr0, double *nzval0, gridinfo_t *grid);
int count_swaps(int_t perm[], int n);
int count_swaps(int perm[], int n);
6 changes: 1 addition & 5 deletions SRC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,7 @@ if (TPL_ENABLE_CUDALIB)
list(APPEND sources cuda/psgstrs_lsum_cuda.cu cuda/ssuperlu_gpu.cu)
endif()
if (HAVE_COMBBLAS)
if (enable_double)
list(APPEND sources double/d_c2cpp_GetHWPM.cpp)
else()
list(APPEND sources single/s_c2cpp_GetHWPM.cpp double/dHWPM_CombBLAS.hpp)
endif()
endif()

endif() ########## enable single
Expand Down Expand Up @@ -465,4 +461,4 @@ install(TARGETS ${targets}
install(FILES ${headers}
# DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
)
4 changes: 2 additions & 2 deletions SRC/complex16/pzdistribute.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ zReDistribute_A(SuperMatrix *A, zScalePermstruct_t *ScalePermstruct,
doublecomplex *a[])
{
NRformat_loc *Astore;
int_t *perm_r; /* row permutation vector */
int_t *perm_c; /* column permutation vector */
int *perm_r; /* row permutation vector */
int *perm_c; /* column permutation vector */
int_t i, irow, fst_row, j, jcol, k, gbi, gbj, n, m_loc, jsize,nnz_tot;
int_t nnz_loc; /* number of local nonzeros */
int_t SendCnt; /* number of remote nonzeros to be sent */
Expand Down
14 changes: 8 additions & 6 deletions SRC/complex16/pzgssvx.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,8 @@ pzgssvx(superlu_dist_options_t *options, SuperMatrix *A,
fact_t Fact;
doublecomplex *a;
int_t *colptr, *rowind;
int_t *perm_r; /* row permutations from partial pivoting */
int_t *perm_c; /* column permutation vector */
int *perm_r; /* row permutations from partial pivoting */
int *perm_c; /* column permutation vector */
int_t *etree; /* elimination tree */
int_t *rowptr, *colind; /* Local A in NR*/
int_t nnz_loc, nnz;
Expand Down Expand Up @@ -812,7 +812,8 @@ pzgssvx(superlu_dist_options_t *options, SuperMatrix *A,

MPI_Bcast( &iinfo, 1, MPI_INT, 0, grid->comm );
if ( iinfo == 0 ) {
MPI_Bcast( perm_r, m, mpi_int_t, 0, grid->comm );
//MPI_Bcast( perm_r, m, mpi_int_t, 0, grid->comm );
MPI_Bcast( perm_r, m, MPI_INT, 0, grid->comm );
if ( job == 5 && Equil ) {
MPI_Bcast( R1, m, MPI_DOUBLE, 0, grid->comm );
MPI_Bcast( C1, n, MPI_DOUBLE, 0, grid->comm );
Expand All @@ -821,7 +822,8 @@ pzgssvx(superlu_dist_options_t *options, SuperMatrix *A,
} else {
MPI_Bcast( &iinfo, 1, MPI_INT, 0, grid->comm );
if ( iinfo == 0 ) {
MPI_Bcast( perm_r, m, mpi_int_t, 0, grid->comm );
//MPI_Bcast( perm_r, m, mpi_int_t, 0, grid->comm );
MPI_Bcast( perm_r, m, MPI_INT, 0, grid->comm );
if ( job == 5 && Equil ) {
MPI_Bcast( R1, m, MPI_DOUBLE, 0, grid->comm );
MPI_Bcast( C1, n, MPI_DOUBLE, 0, grid->comm );
Expand Down Expand Up @@ -935,7 +937,7 @@ pzgssvx(superlu_dist_options_t *options, SuperMatrix *A,
}

#if ( DEBUGlevel>=2 )
if ( !iam ) PrintInt10("perm_r", m, perm_r);
if ( !iam ) PrintInt32("perm_r", m, perm_r);
#endif
} /* end if (!factored) */

Expand Down Expand Up @@ -1365,7 +1367,7 @@ pzgssvx(superlu_dist_options_t *options, SuperMatrix *A,
int buffer_peak_rank = global_struct.rank;
float buffer_peak = global_struct.val*1e-6;

if ( iam==0 ) {
if ( iam == 0 ) {
printf("** Total highmark (MB):\n"
" Sum-of-all : %8.2f | Avg : %8.2f | Max : %8.2f\n",
avg * 1e-6,
Expand Down
4 changes: 2 additions & 2 deletions SRC/complex16/pzgssvx3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@ void pzgssvx3d(superlu_dist_options_t *options, SuperMatrix *A,
fact_t Fact;
doublecomplex *a;
int_t *colptr, *rowind;
int_t *perm_r; /* row permutations from partial pivoting */
int_t *perm_c; /* column permutation vector */
int *perm_r; /* row permutations from partial pivoting */
int *perm_c; /* column permutation vector */
int_t *etree; /* elimination tree */
int_t *rowptr, *colind; /* Local A in NR */
int colequ, Equil, factored, job, notran, rowequ, need_value;
Expand Down
2 changes: 1 addition & 1 deletion SRC/complex16/pzgssvx3d_csc_batch.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ pzgssvx3d_csc_batch(
#if (PRNTlevel >= 1)
printf("\tBIG system: berr[0] %e\n", berr[0]);
printf("after pzgssvx3d: DiagScale %d\n", ScalePermstruct.DiagScale);
//PrintInt10("after pdgssvx3d: ScalePermstruct.perm_c", (int_t) m_big, ScalePermstruct.perm_c);
//PrintInt32("after pdgssvx3d: ScalePermstruct.perm_c", m_big, ScalePermstruct.perm_c);
//Printdouble5("big-B-solution", m_big, b);
#endif

Expand Down
8 changes: 4 additions & 4 deletions SRC/complex16/pzgssvx_ABglobal.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,8 @@ pzgssvx_ABglobal(superlu_dist_options_t *options, SuperMatrix *A,
structures are not used. */
fact_t Fact;
doublecomplex *a;
int_t *perm_r; /* row permutations from partial pivoting */
int_t *perm_c; /* column permutation vector */
int *perm_r; /* row permutations from partial pivoting */
int *perm_c; /* column permutation vector */
int_t *etree; /* elimination tree */
int_t *colptr, *rowind;
int_t Equil, factored, job, notran, colequ, rowequ;
Expand Down Expand Up @@ -724,7 +724,7 @@ pzgssvx_ABglobal(superlu_dist_options_t *options, SuperMatrix *A,

MPI_Bcast( &iinfo, 1, mpi_int_t, 0, grid->comm );
if ( iinfo == 0 ) {
MPI_Bcast( perm_r, m, mpi_int_t, 0, grid->comm );
MPI_Bcast( perm_r, m, MPI_INT, 0, grid->comm );
if ( job == 5 && Equil ) {
MPI_Bcast( R1, m, MPI_DOUBLE, 0, grid->comm );
MPI_Bcast( C1, n, MPI_DOUBLE, 0, grid->comm );
Expand All @@ -733,7 +733,7 @@ pzgssvx_ABglobal(superlu_dist_options_t *options, SuperMatrix *A,
} else {
MPI_Bcast( &iinfo, 1, mpi_int_t, 0, grid->comm );
if ( iinfo == 0 ) {
MPI_Bcast( perm_r, m, mpi_int_t, 0, grid->comm );
MPI_Bcast( perm_r, m, MPI_INT, 0, grid->comm );
if ( job == 5 && Equil ) {
MPI_Bcast( R1, m, MPI_DOUBLE, 0, grid->comm );
MPI_Bcast( C1, n, MPI_DOUBLE, 0, grid->comm );
Expand Down
2 changes: 1 addition & 1 deletion SRC/complex16/pzgstrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ pzReDistribute_B_to_X(doublecomplex *B, int_t m_loc, int nrhs, int_t ldb,
int *SendCnt, *SendCnt_nrhs, *RecvCnt, *RecvCnt_nrhs;
int *sdispls, *sdispls_nrhs, *rdispls, *rdispls_nrhs;
int *ptr_to_ibuf, *ptr_to_dbuf;
int_t *perm_r, *perm_c; /* row and column permutation vectors */
int *perm_r, *perm_c; /* row and column permutation vectors */
int_t *send_ibuf, *recv_ibuf;
doublecomplex *send_dbuf, *recv_dbuf;
int_t *xsup, *supno;
Expand Down
2 changes: 1 addition & 1 deletion SRC/complex16/pzgstrs3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -6288,7 +6288,7 @@ pzReDistribute3d_B_to_X (doublecomplex *B, int_t m_loc, int nrhs, int_t ldb,
int *SendCnt, *SendCnt_nrhs, *RecvCnt, *RecvCnt_nrhs;
int *sdispls, *sdispls_nrhs, *rdispls, *rdispls_nrhs;
int *ptr_to_ibuf, *ptr_to_dbuf;
int_t *perm_r, *perm_c; /* row and column permutation vectors */
int *perm_r, *perm_c; /* row and column permutation vectors */
int_t *send_ibuf, *recv_ibuf;
doublecomplex *send_dbuf, *recv_dbuf;
int_t *xsup, *supno;
Expand Down
4 changes: 2 additions & 2 deletions SRC/complex16/pzsymbfact_distdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,8 +783,8 @@ zdist_A(SuperMatrix *A, zScalePermstruct_t *ScalePermstruct,
{
int iam, p, procs;
NRformat_loc *Astore;
int_t *perm_r; /* row permutation vector */
int_t *perm_c; /* column permutation vector */
int *perm_r; /* row permutation vector */
int *perm_c; /* column permutation vector */
int_t i, it, irow, fst_row, j, jcol, k, gbi, gbj, n, m_loc, jsize, isize;
int_t nsupers, nsupers_i, nsupers_j;
int_t nnz_loc, nnz_loc_ainf, nnz_loc_asup; /* number of local nonzeros */
Expand Down
13 changes: 7 additions & 6 deletions SRC/complex16/pzutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ int pzPermute_Dense_Matrix
int_t fst_row,
int_t m_loc,
int_t row_to_proc[],
int_t perm[],
int perm[],
doublecomplex X[], int ldx,
doublecomplex B[], int ldb,
int nrhs,
Expand Down Expand Up @@ -649,7 +649,7 @@ if (get_acc_solve()){
*/
int_t
pzgstrs_init(int_t n, int_t m_loc, int_t nrhs, int_t fst_row,
int_t perm_r[], int_t perm_c[], gridinfo_t *grid,
int perm_r[], int perm_c[], gridinfo_t *grid,
Glu_persist_t *Glu_persist, zSOLVEstruct_t *SOLVEstruct)
{

Expand Down Expand Up @@ -1108,11 +1108,12 @@ pzgstrs_delete_device_lsum_x(zSOLVEstruct_t *SOLVEstruct)
/*! \brief Initialize the data structure for the solution phase.
*/
int zSolveInit(superlu_dist_options_t *options, SuperMatrix *A,
int_t perm_r[], int_t perm_c[], int_t nrhs,
int perm_r[], int perm_c[], int_t nrhs,
zLUstruct_t *LUstruct, gridinfo_t *grid,
zSOLVEstruct_t *SOLVEstruct)
{
int_t *row_to_proc, *inv_perm_c, *itemp;
int_t *row_to_proc, *itemp;
int *inv_perm_c;
NRformat_loc *Astore;
int_t i, fst_row, m_loc, p;
int procs;
Expand All @@ -1125,7 +1126,7 @@ int zSolveInit(superlu_dist_options_t *options, SuperMatrix *A,
if ( !(row_to_proc = intMalloc_dist(A->nrow)) )
ABORT("Malloc fails for row_to_proc[]");
SOLVEstruct->row_to_proc = row_to_proc;
if ( !(inv_perm_c = intMalloc_dist(A->ncol)) )
if ( !(inv_perm_c = int32Malloc_dist(A->ncol)) )
ABORT("Malloc fails for inv_perm_c[].");
for (i = 0; i < A->ncol; ++i) inv_perm_c[perm_c[i]] = i;
SOLVEstruct->inv_perm_c = inv_perm_c;
Expand All @@ -1149,7 +1150,7 @@ int zSolveInit(superlu_dist_options_t *options, SuperMatrix *A,
if ( !grid->iam ) {
printf("fst_row = %d\n", fst_row);
PrintInt10("row_to_proc", A->nrow, row_to_proc);
PrintInt10("inv_perm_c", A->ncol, inv_perm_c);
PrintInt32("inv_perm_c", A->ncol, inv_perm_c);
}
#endif
SUPERLU_FREE(itemp);
Expand Down
22 changes: 11 additions & 11 deletions SRC/complex16/z3DPartition.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void zbcastPermutedSparseA(SuperMatrix *A,
zLUstruct_t *LUstruct, gridinfo3d_t *grid3d)
{
int_t m = A->nrow;
int_t n = A->ncol;
int_t n = A->ncol;
Glu_persist_t *Glu_persist = LUstruct->Glu_persist;
zLocalLU_t *Llu = LUstruct->Llu;
NRformat_loc *Astore = (NRformat_loc *) A->Store;
Expand All @@ -204,12 +204,12 @@ void zbcastPermutedSparseA(SuperMatrix *A,

/* broadcast etree */
int_t *etree = LUstruct->etree;
if(etree)
MPI_Bcast( etree, n, mpi_int_t, 0, grid3d->zscp.comm);
if (etree)
MPI_Bcast( etree, n, mpi_int_t, 0, grid3d->zscp.comm);


// list of all the arrays to be broadcasted:
// A, ScalePermstruct, Glu_freeable, LUstruct
// list of all the arrays to be broadcast:
// A, ScalePermstruct, Glu_freeable, LUstruct
int_t nsupers;

if (!grid3d->zscp.Iam)
Expand Down Expand Up @@ -241,20 +241,20 @@ void zbcastPermutedSparseA(SuperMatrix *A,
/***** YL: remove the allocation in the following as perm_r/perm_c has been allocated on all grids by dScalePermstructInit
*/
#if 1
MPI_Bcast(ScalePermstruct->perm_r, m*sizeof(int_t), MPI_BYTE, 0, grid3d->zscp.comm);
MPI_Bcast(ScalePermstruct->perm_c, n*sizeof(int_t), MPI_BYTE, 0, grid3d->zscp.comm);
MPI_Bcast(ScalePermstruct->perm_r, m*sizeof(int), MPI_BYTE, 0, grid3d->zscp.comm);
MPI_Bcast(ScalePermstruct->perm_c, n*sizeof(int), MPI_BYTE, 0, grid3d->zscp.comm);
#else
allocBcastArray ( &(ScalePermstruct->perm_r), m*sizeof(int_t),
0, grid3d->zscp.comm);
allocBcastArray ( &(ScalePermstruct->perm_c), n*sizeof(int_t),
0, grid3d->zscp.comm);
#endif
if(ScalePermstruct->DiagScale==ROW || ScalePermstruct->DiagScale==BOTH)
allocBcastArray ( (void **) &(ScalePermstruct->R), m*sizeof(double),
0, grid3d->zscp.comm);
allocBcastArray ( (void **) &(ScalePermstruct->R), m*sizeof(double),
0, grid3d->zscp.comm);
if(ScalePermstruct->DiagScale==COL || ScalePermstruct->DiagScale==BOTH)
allocBcastArray ( (void **) &(ScalePermstruct->C), n*sizeof(double),
0, grid3d->zscp.comm);
allocBcastArray ( (void **) &(ScalePermstruct->C), n*sizeof(double),
0, grid3d->zscp.comm);


/* ==== Broadcasting Glu_freeable ======= */
Expand Down
10 changes: 5 additions & 5 deletions SRC/complex16/zldperm_dist.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ at the top-level directory.
#include "superlu_zdefs.h"

extern int mc64ad_dist(int *job, int *n, int_t *ne, int_t *ip,
int_t *irn, double *a, int *num, int_t *cperm,
int_t *irn, double *a, int *num, int *cperm,
int_t *liw, int_t *iw, int_t *ldw, double *dw,
int * icntl, int *info);

Expand Down Expand Up @@ -93,10 +93,10 @@ extern int mc64ad_dist(int *job, int *n, int_t *ne, int_t *ip,

int
zldperm_dist(int job, int n, int_t nnz, int_t colptr[], int_t adjncy[],
doublecomplex nzval[], int_t *perm, double u[], double v[])
doublecomplex nzval[], int *perm, double u[], double v[])
{
int i;
int num, icntl[10], info[10];
int num, icntl[10], info[10];
int_t liw, ldw;
int_t *iw;
double *dw;
Expand Down Expand Up @@ -147,12 +147,12 @@ zldperm_dist(int job, int n, int_t nnz, int_t colptr[], int_t adjncy[],
&liw, iw, &ldw, dw, icntl, info);

#if ( DEBUGlevel>=2 )
PrintInt10("perm", n, perm);
PrintInt32("perm", n, perm);
printf(".. After MC64AD info %d\tsize of matching %d\n", info[0], num);
#endif
if ( info[0] == 1 ) { /* Structurally singular */
printf(".. The last %d permutations:\n", n-num);
PrintInt10("perm", n-num, &perm[num]);
PrintInt32("perm", n-num, &perm[num]);
}

/* Restore to 0-based indexing. */
Expand Down
Loading

0 comments on commit 9f4c5bc

Please sign in to comment.