Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/IJ_mv/IJMatrix_parcsr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 +1866,7 @@ hypre_IJMatrixAssembleOffProcValsParCSR( hypre_IJMatrix *matrix,

MPI_Comm comm = hypre_IJMatrixComm(matrix);

HYPRE_Int i, j, k, in_i;
HYPRE_Int i, j, k, in_i, li;
HYPRE_Int myid;

HYPRE_Int proc_id, last_proc, prev_id, tmp_id;
Expand Down Expand Up @@ -2451,10 +2451,9 @@ hypre_IJMatrixAssembleOffProcValsParCSR( hypre_IJMatrix *matrix,
HYPRE_MEMORY_HOST);
}

HYPRE_Int i;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to stay in, but with a new name like li. It's inside an outer loop that is already using i. In general, this simple renaming approach is the most reliable way to make these changes. I'll try to look for other potential issues like this, but you might want to take a second look as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching! This one was a real bug! Fixed

for (i = 0; i < num_elements; i++)
for (li = 0; li < num_elements; li++)
{
off_proc_i_recv[off_proc_nelm_recv_cur + i] = row;
off_proc_i_recv[off_proc_nelm_recv_cur + li] = row;
}
hypre_TMemcpy(off_proc_j_recv + off_proc_nelm_recv_cur, col_ptr, HYPRE_BigInt, num_elements,
HYPRE_MEMORY_HOST, HYPRE_MEMORY_HOST);
Expand Down
26 changes: 13 additions & 13 deletions src/distributed_ls/Euclid/Mat_dh.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,23 +742,23 @@ void Mat_dhPrintRows(Mat_dh A, SubdomainGraph_dh sg, FILE *fp)
hypre_fprintf(fp, " 1st bdry row= %i \n", 1+end_row-sg->bdry_count[oldBlock]);

for (oldRow=beg_row; oldRow<end_row; ++oldRow) {
HYPRE_Int len = 0, *cval;
HYPRE_Real *aval;
HYPRE_Int len = 0, *lcval;
HYPRE_Real *laval;

hypre_fprintf(fp, "%3i (old= %3i) :: ", idx, 1+oldRow);
++idx;
Mat_dhGetRow(A, oldRow, &len, &cval, &aval); CHECK_V_ERROR;
Mat_dhGetRow(A, oldRow, &len, &lcval, &laval); CHECK_V_ERROR;

for (k=0; k<len; ++k) {
if (noValues) {
hypre_fprintf(fp, "%i ", 1+sg->o2n_col[cval[k]]);
hypre_fprintf(fp, "%i ", 1+sg->o2n_col[lcval[k]]);
} else {
hypre_fprintf(fp, "%i,%g ; ", 1+sg->o2n_col[cval[k]], aval[k]);
hypre_fprintf(fp, "%i,%g ; ", 1+sg->o2n_col[lcval[k]], laval[k]);
}
}

hypre_fprintf(fp, "\n");
Mat_dhRestoreRow(A, oldRow, &len, &cval, &aval); CHECK_V_ERROR;
Mat_dhRestoreRow(A, oldRow, &len, &lcval, &laval); CHECK_V_ERROR;
}
}
}
Expand Down Expand Up @@ -873,28 +873,28 @@ void Mat_dhPrintTriples(Mat_dh A, SubdomainGraph_dh sg, char *filename)
HYPRE_Int end_row = beg_row + sg->row_count[oldBlock];

for (j=beg_row; j<end_row; ++j) {
HYPRE_Int len = 0, *cval;
HYPRE_Real *aval;
HYPRE_Int len = 0, *lcval;
HYPRE_Real *laval;
HYPRE_Int oldRow = sg->n2o_row[j];

Mat_dhGetRow(A, oldRow, &len, &cval, &aval); CHECK_V_ERROR;
Mat_dhGetRow(A, oldRow, &len, &lcval, &laval); CHECK_V_ERROR;

if (noValues) {
for (k=0; k<len; ++k) {
hypre_fprintf(fp, "%i %i\n", idx, 1+sg->o2n_col[cval[k]]);
hypre_fprintf(fp, "%i %i\n", idx, 1+sg->o2n_col[lcval[k]]);
}
++idx;
}

else {
for (k=0; k<len; ++k) {
HYPRE_Real val = aval[k];
HYPRE_Real val = laval[k];
if (val == 0.0 && matlab) val = _MATLAB_ZERO_;
hypre_fprintf(fp, TRIPLES_FORMAT, idx, 1+sg->o2n_col[cval[k]], val);
hypre_fprintf(fp, TRIPLES_FORMAT, idx, 1+sg->o2n_col[lcval[k]], val);
}
++idx;
}
Mat_dhRestoreRow(A, oldRow, &len, &cval, &aval); CHECK_V_ERROR;
Mat_dhRestoreRow(A, oldRow, &len, &lcval, &laval); CHECK_V_ERROR;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/distributed_ls/Euclid/SubdomainGraph_dh.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,9 +570,9 @@ void init_mpi_private(SubdomainGraph_dh s, HYPRE_Int blocks, bool bj, void *A)
/* bj setup */
else {
HYPRE_Int *o2n = s->o2n_col, *n2o = s->n2o_row;
HYPRE_Int i, m = s->m;
HYPRE_Int i;

for (i=0; i<m; ++i) {
for (i=0; i<s->m; ++i) {
o2n[i] = i;
n2o[i] = i;
}
Expand Down
4 changes: 1 addition & 3 deletions src/distributed_ls/Euclid/Vec_dh.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void Vec_dhPrint(Vec_dh v, SubdomainGraph_dh sg, char *filename)
{
START_FUNC_DH
HYPRE_Real *vals = v->vals;
HYPRE_Int pe, i, m = v->n;
HYPRE_Int pe, i, j, m = v->n;
FILE *fp;

if (v->vals == NULL) SET_V_ERROR("v->vals is NULL");
Expand Down Expand Up @@ -144,8 +144,6 @@ void Vec_dhPrint(Vec_dh v, SubdomainGraph_dh sg, char *filename)
* case 2: single mpi task, multiple subdomains
*--------------------------------------------------------*/
else if (np_dh == 1) {
HYPRE_Int i, j;

fp=openFile_dh(filename, "w"); CHECK_V_ERROR;

for (i=0; i<sg->blocks; ++i) {
Expand Down
1 change: 0 additions & 1 deletion src/parcsr_ls/par_2s_interp.c
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,6 @@ hypre_BoomerAMGBuildModPartialExtPEInterpHost( hypre_ParCSRMatrix *A,
if (num_functions > 1)
{
HYPRE_Int *int_buf_data = NULL;
HYPRE_Int num_sends, startc;
HYPRE_Int num_cols_A_offd = hypre_CSRMatrixNumCols(A_offd);
dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, memory_location_P);
index = 0;
Expand Down
1 change: 0 additions & 1 deletion src/parcsr_ls/par_amg.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,6 @@ hypre_BoomerAMGDestroy( void *data )
}
if (grid_relax_type)
{
HYPRE_Int num_levels = hypre_ParAMGDataNumLevels(amg_data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one might need to stay in as well. I would have to look at the logic here to be sure, but num_levels is initialized at the top of the routine so it's value may be needed outside of this if section.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I double checked this one and the current change is fine. We're in the destructor, so num_levels cannot change in that function. We can rely on the value initialized at the beginning

if (grid_relax_type[1] == 15 || grid_relax_type[3] == 15 )
{
if (grid_relax_type[1] == 15)
Expand Down
28 changes: 14 additions & 14 deletions src/parcsr_ls/par_amg_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ hypre_BoomerAMGSetup( void *amg_vdata,
hypre_ParCSRMatrix *P = NULL;
hypre_ParCSRMatrix *R = NULL;
hypre_ParCSRMatrix *A_H;
hypre_ParCSRMatrix *Q = NULL;
hypre_ParCSRMatrix *AN = NULL;
hypre_ParCSRMatrix *P1;
hypre_ParCSRMatrix *P2;
Expand Down Expand Up @@ -232,6 +233,7 @@ hypre_BoomerAMGSetup( void *amg_vdata,

HYPRE_Int *num_grid_sweeps = hypre_ParAMGDataNumGridSweeps(amg_data);
HYPRE_Int ns = num_grid_sweeps[1];
HYPRE_Int **grid_relax_points;
HYPRE_Real wall_time = 0.0; /* for debugging instrumentation */
HYPRE_Int add_end;

Expand Down Expand Up @@ -1689,18 +1691,18 @@ hypre_BoomerAMGSetup( void *amg_vdata,
* coarsest solve to be a single sweep of default smoother or smoother set by user */
if ((coarse_size == 0) || (coarse_size == fine_size))
{
HYPRE_Int *num_grid_sweeps = hypre_ParAMGDataNumGridSweeps(amg_data);
HYPRE_Int **grid_relax_points = hypre_ParAMGDataGridRelaxPoints(amg_data);
num_grid_sweeps = hypre_ParAMGDataNumGridSweeps(amg_data);
grid_relax_points = hypre_ParAMGDataGridRelaxPoints(amg_data);
if (grid_relax_type[3] == 9 || grid_relax_type[3] == 99 ||
grid_relax_type[3] == 19 || grid_relax_type[3] == 98)
{
grid_relax_type[3] = grid_relax_type[0];
num_grid_sweeps[3] = 1;
if (grid_relax_points) { grid_relax_points[3][0] = 0; }
}
if (S) { hypre_ParCSRMatrixDestroy(S); }
if (SN) { hypre_ParCSRMatrixDestroy(SN); }
if (AN) { hypre_ParCSRMatrixDestroy(AN); }
hypre_ParCSRMatrixDestroy(S);
hypre_ParCSRMatrixDestroy(SN);
hypre_ParCSRMatrixDestroy(AN);
//hypre_TFree(CF_marker, HYPRE_MEMORY_HOST);
if (level > 0)
{
Expand Down Expand Up @@ -2495,8 +2497,8 @@ hypre_BoomerAMGSetup( void *amg_vdata,
* coarsest solve to be a single sweep of Jacobi */
if ( (coarse_size == 0) || (coarse_size == fine_size) )
{
HYPRE_Int *num_grid_sweeps = hypre_ParAMGDataNumGridSweeps(amg_data);
HYPRE_Int **grid_relax_points = hypre_ParAMGDataGridRelaxPoints(amg_data);
num_grid_sweeps = hypre_ParAMGDataNumGridSweeps(amg_data);
grid_relax_points = hypre_ParAMGDataGridRelaxPoints(amg_data);

if (grid_relax_type[3] == 9 || grid_relax_type[3] == 99 ||
grid_relax_type[3] == 19 || grid_relax_type[3] == 98)
Expand Down Expand Up @@ -2753,7 +2755,6 @@ hypre_BoomerAMGSetup( void *amg_vdata,
HYPRE_ANNOTATE_REGION_BEGIN("%s", "RAP");
if (ns == 1)
{
hypre_ParCSRMatrix *Q = NULL;
if (hypre_ParAMGDataModularizedMatMat(amg_data))
{
Q = hypre_ParCSRMatMat(A_array[level], P);
Expand All @@ -2778,8 +2779,7 @@ hypre_BoomerAMGSetup( void *amg_vdata,
if (nongalerk_tol_l > 0.0)
{
/* Build Non-Galerkin Coarse Grid */
hypre_ParCSRMatrix *Q = NULL;
hypre_BoomerAMGBuildNonGalerkinCoarseOperator(&A_H, Q,
hypre_BoomerAMGBuildNonGalerkinCoarseOperator(&A_H, NULL,
0.333 * strong_threshold, max_row_sum, num_functions,
dof_func_data, hypre_IntArrayData(CF_marker_array[level]),
/* nongalerk_tol, sym_collapse, lump_percent, beta );*/
Expand Down Expand Up @@ -2809,7 +2809,7 @@ hypre_BoomerAMGSetup( void *amg_vdata,
if (nongalerk_tol_l > 0.0)
{
/* Construct AP, and then RAP */
hypre_ParCSRMatrix *Q = NULL;
Q = NULL;
if (hypre_ParAMGDataModularizedMatMat(amg_data))
{
Q = hypre_ParCSRMatMat(A_array[level], P);
Expand Down Expand Up @@ -2843,7 +2843,7 @@ hypre_BoomerAMGSetup( void *amg_vdata,
else if (rap2)
{
/* Use two matrix products to generate A_H */
hypre_ParCSRMatrix *Q = NULL;
Q = NULL;
if (hypre_ParAMGDataModularizedMatMat(amg_data))
{
Q = hypre_ParCSRMatMat(A_array[level], P);
Expand Down Expand Up @@ -2972,7 +2972,7 @@ hypre_BoomerAMGSetup( void *amg_vdata,
if (nongalerk_tol_l > 0.0)
{
/* Construct AP, and then RAP */
hypre_ParCSRMatrix *Q = NULL;
Q = NULL;
if (hypre_ParAMGDataModularizedMatMat(amg_data))
{
Q = hypre_ParCSRMatMat(A_array[level], P_array[level]);
Expand Down Expand Up @@ -3027,7 +3027,7 @@ hypre_BoomerAMGSetup( void *amg_vdata,
else if (rap2)
{
/* Use two matrix products to generate A_H */
hypre_ParCSRMatrix *Q = NULL;
Q = NULL;
if (hypre_ParAMGDataModularizedMatMat(amg_data))
{
Q = hypre_ParCSRMatMat(A_array[level], P_array[level]);
Expand Down
1 change: 0 additions & 1 deletion src/parcsr_ls/par_amgdd_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,6 @@ hypre_BoomerAMGDD_FindNeighborProcessors( hypre_ParCSRMatrix *A,
}

// Loop over the requested dofs for this destination proc
HYPRE_Int j;
for (j = 0; j < num_requested_dofs; j++)
{
// Get the local index for this dof on this processor
Expand Down
9 changes: 1 addition & 8 deletions src/parcsr_ls/par_coarsen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1124,14 +1124,7 @@ hypre_BoomerAMGCoarsenRuge( hypre_ParCSRMatrix *S,

if ((meas_type || (coarsen_type != 1 && coarsen_type != 11)) && num_procs > 1)
{
if (use_commpkg_A)
{
S_ext = hypre_ParCSRMatrixExtractBExt(S, A, 0);
}
else
{
S_ext = hypre_ParCSRMatrixExtractBExt(S, S, 0);
}
S_ext = hypre_ParCSRMatrixExtractBExt(S, (use_commpkg_A) ? A : S, 0);
S_ext_i = hypre_CSRMatrixI(S_ext);
S_ext_j = hypre_CSRMatrixBigJ(S_ext);

Expand Down
16 changes: 8 additions & 8 deletions src/parcsr_ls/par_fsai_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ hypre_FSAISetupOMPDyn( void *fsai_vdata,
HYPRE_Int max_nnzrow_diag_G; /* Max. number of nonzeros per row in G_diag */

/* Local variables */
HYPRE_Int i, j, jj;
HYPRE_Int iG, jG, jjG;
char msg[512]; /* Warning message */
HYPRE_Complex *twspace; /* shared work space for omp threads */

Expand Down Expand Up @@ -743,7 +743,7 @@ hypre_FSAISetupOMPDyn( void *fsai_vdata,
hypre_Vector *A_subrow; /* Vector holding A[i, P] */
hypre_Vector *kap_grad; /* Vector holding the Kaporin gradient values */
HYPRE_Int *kg_pos; /* Indices of nonzero entries of kap_grad */
HYPRE_Int *kg_marker; /* Marker array with nonzeros pointing to kg_pos */
HYPRE_Int *kg_marker; /* Marker array with nnzs pointing to kg_pos */
HYPRE_Int *marker; /* Marker array with nonzeros pointing to P */
HYPRE_Int *pattern; /* Array holding column indices of G[i,:] */
HYPRE_Int patt_size; /* Number of entries in current pattern */
Expand Down Expand Up @@ -888,14 +888,14 @@ hypre_FSAISetupOMPDyn( void *fsai_vdata,

/* Reorder array */
G_i[0] = 0;
for (i = 0; i < num_rows_diag_A; i++)
for (iG = 0; iG < num_rows_diag_A; iG++)
{
G_i[i + 1] = G_i[i] + G_nnzcnt[i];
jj = i * max_nnzrow_diag_G;
for (j = G_i[i]; j < G_i[i + 1]; j++)
G_i[iG + 1] = G_i[iG] + G_nnzcnt[iG];
jjG = iG * max_nnzrow_diag_G;
for (jG = G_i[iG]; jG < G_i[iG + 1]; jG++)
{
G_j[j] = G_j[jj];
G_a[j] = G_a[jj++];
G_j[jG] = G_j[jjG];
G_a[jG] = G_a[jjG++];
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/parcsr_ls/par_lr_restr.c
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ hypre_BoomerAMGBuildRestrDist2AIR( hypre_ParCSRMatrix *A,
/* open row j1 and fill ja and a */
for (k = A_diag_i[j1]; k < A_diag_i[j1 + 1]; k++)
{
HYPRE_Int k1 = A_diag_j[k];
k1 = A_diag_j[k];
if (CF_marker[k1] < 0)
{
send_FF2_j[i1] = col_start + k1;
Expand All @@ -646,7 +646,7 @@ hypre_BoomerAMGBuildRestrDist2AIR( hypre_ParCSRMatrix *A,
{
for (k = A_offd_i[j1]; k < A_offd_i[j1 + 1]; k++)
{
HYPRE_Int k1 = A_offd_j[k];
k1 = A_offd_j[k];
if (CF_marker_offd[k1] < 0)
{
send_FF2_j[i1] = col_map_offd_A[k1];
Expand Down
4 changes: 2 additions & 2 deletions src/parcsr_ls/par_mgr_rap.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,9 +650,9 @@ hypre_MGRBuildCoarseOperator(void *mgr_vdata,
if (threshold > 0.0)
{
#if defined (HYPRE_USING_GPU)
HYPRE_MemoryLocation memory_location = hypre_ParCSRMatrixMemoryLocation(RAP);
HYPRE_MemoryLocation rap_memory_location = hypre_ParCSRMatrixMemoryLocation(RAP);

if (hypre_GetExecPolicy1(memory_location) == HYPRE_EXEC_DEVICE)
if (hypre_GetExecPolicy1(rap_memory_location) == HYPRE_EXEC_DEVICE)
{
hypre_ParCSRMatrixDropSmallEntriesDevice(RAP, threshold, -1);
rebuild_commpkg = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/parcsr_ls/par_mgr_solve.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ hypre_MGRCycle( void *mgr_vdata,
{
hypre_BoomerAMGRelax(A_array[fine_grid], F_array[fine_grid],
NULL, level_smooth_type[fine_grid],
0, fp_one, fp_one, l1_norms,
0, fp_one, fp_one, l1_norms, //NULL,
U_array[fine_grid], Vtemp, Ztemp);
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/parcsr_ls/par_mod_lr_interp.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,6 @@ hypre_BoomerAMGBuildModExtPIInterpHost(hypre_ParCSRMatrix *A,
if (num_functions > 1)
{
HYPRE_Int *int_buf_data = NULL;
HYPRE_Int num_sends, startc;
HYPRE_Int num_cols_A_offd = hypre_CSRMatrixNumCols(A_offd);
dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST);
index = 0;
Expand Down Expand Up @@ -1439,7 +1438,6 @@ hypre_BoomerAMGBuildModExtPEInterpHost(hypre_ParCSRMatrix *A,
if (num_functions > 1)
{
HYPRE_Int *int_buf_data = NULL;
HYPRE_Int num_sends, startc;
HYPRE_Int num_cols_A_offd = hypre_CSRMatrixNumCols(A_offd);
dof_func_offd = hypre_CTAlloc(HYPRE_Int, num_cols_A_offd, HYPRE_MEMORY_HOST);
index = 0;
Expand Down
7 changes: 4 additions & 3 deletions src/parcsr_ls/par_rap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1625,7 +1625,8 @@ hypre_BoomerAMGBuildCoarseOperatorKT( hypre_ParCSRMatrix *RT,
HYPRE_Int i = hypre_UnorderedIntMapGet(&send_map_elmts_RT_inverse_map, ic);
if (i != -1)
{
for (j = send_map_elmts_starts_RT_aggregated[i]; j < send_map_elmts_starts_RT_aggregated[i + 1];
for (j = send_map_elmts_starts_RT_aggregated[i];
j < send_map_elmts_starts_RT_aggregated[i + 1];
j++)
{
HYPRE_Int jj = send_map_elmts_RT_aggregated[j];
Expand Down Expand Up @@ -1860,8 +1861,8 @@ hypre_BoomerAMGBuildCoarseOperatorKT( hypre_ParCSRMatrix *RT,

for (jj1 = ra_row_begin_diag; jj1 < RA_diag.num_nonzeros; jj1++)
{
HYPRE_Int i1 = RA_diag.j[jj1 - ra_row_begin_diag];
HYPRE_Real r_a_product = RA_diag.data[jj1 - ra_row_begin_diag];
i1 = RA_diag.j[jj1 - ra_row_begin_diag];
r_a_product = RA_diag.data[jj1 - ra_row_begin_diag];

/*-----------------------------------------------------------------
* Loop over entries in row i1 of P_diag.
Expand Down
Loading