Improve error handling for multi-component vectors (#848)
This PR improves error handling for preconditioners and relaxation methods that do not support multi-component vectors yet.
This commit is contained in:
parent
16c4d8304d
commit
04d1991625
@ -3522,6 +3522,14 @@ hypre_BoomerAMGSetup( void *amg_vdata,
|
||||
|
||||
if ((smooth_type == 6 || smooth_type == 16) && smooth_num_levels > j)
|
||||
{
|
||||
/* Sanity check */
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"Schwarz smoothing doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
schwarz_relax_wt = hypre_ParAMGDataSchwarzRlxWeight(amg_data);
|
||||
|
||||
HYPRE_SchwarzCreate(&smoother[j]);
|
||||
@ -3559,10 +3567,20 @@ hypre_BoomerAMGSetup( void *amg_vdata,
|
||||
}
|
||||
else if ((smooth_type == 9 || smooth_type == 19) && smooth_num_levels > j)
|
||||
{
|
||||
/* Sanity checks */
|
||||
#ifdef HYPRE_MIXEDINT
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC, "Euclid smoothing is not available in mixedint mode!");
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"Euclid smoothing is not available in mixedint mode!");
|
||||
return hypre_error_flag;
|
||||
#endif
|
||||
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"Euclid smoothing doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
HYPRE_EuclidCreate(comm, &smoother[j]);
|
||||
if (euclidfile)
|
||||
{
|
||||
@ -3584,6 +3602,14 @@ hypre_BoomerAMGSetup( void *amg_vdata,
|
||||
}
|
||||
else if ((smooth_type == 4 || smooth_type == 14) && smooth_num_levels > j)
|
||||
{
|
||||
/* Sanity check */
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"FSAI smoothing doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
HYPRE_FSAICreate(&smoother[j]);
|
||||
HYPRE_FSAISetMaxSteps(smoother[j], fsai_max_steps);
|
||||
HYPRE_FSAISetMaxStepSize(smoother[j], fsai_max_step_size);
|
||||
@ -3601,13 +3627,22 @@ hypre_BoomerAMGSetup( void *amg_vdata,
|
||||
#if DEBUG_SAVE_ALL_OPS
|
||||
char file[256];
|
||||
hypre_sprintf(file, "G_%02d.IJ.out", j);
|
||||
hypre_ParCSRMatrixPrintIJ(hypre_ParFSAIDataGmat((hypre_ParFSAIData*) smoother[j]), 0, 0, file);
|
||||
hypre_ParCSRMatrixPrintIJ(hypre_ParFSAIDataGmat((hypre_ParFSAIData*) smoother[j]),
|
||||
0, 0, file);
|
||||
#endif
|
||||
}
|
||||
else if ((smooth_type == 5 || smooth_type == 15) && smooth_num_levels > j)
|
||||
{
|
||||
HYPRE_ILUCreate( &smoother[j]);
|
||||
HYPRE_ILUSetType( smoother[j], ilu_type);
|
||||
/* Sanity check */
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"ILU smoothing doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
HYPRE_ILUCreate(&smoother[j]);
|
||||
HYPRE_ILUSetType(smoother[j], ilu_type);
|
||||
HYPRE_ILUSetLocalReordering( smoother[j], ilu_reordering_type);
|
||||
HYPRE_ILUSetMaxIter(smoother[j], ilu_max_iter);
|
||||
HYPRE_ILUSetTriSolve(smoother[j], ilu_tri_solve);
|
||||
@ -3626,10 +3661,20 @@ hypre_BoomerAMGSetup( void *amg_vdata,
|
||||
}
|
||||
else if ((smooth_type == 8 || smooth_type == 18) && smooth_num_levels > j)
|
||||
{
|
||||
/* Sanity checks */
|
||||
#ifdef HYPRE_MIXEDINT
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC, "ParaSails smoothing is not available in mixedint mode!");
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"ParaSails smoothing is not available in mixedint mode!");
|
||||
return hypre_error_flag;
|
||||
#endif
|
||||
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"ParaSails smoothing doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
HYPRE_ParCSRParaSailsCreate(comm, &smoother[j]);
|
||||
HYPRE_ParCSRParaSailsSetParams(smoother[j], thresh, nlevel);
|
||||
HYPRE_ParCSRParaSailsSetFilter(smoother[j], filter);
|
||||
@ -3641,10 +3686,20 @@ hypre_BoomerAMGSetup( void *amg_vdata,
|
||||
}
|
||||
else if ((smooth_type == 7 || smooth_type == 17) && smooth_num_levels > j)
|
||||
{
|
||||
/* Sanity checks */
|
||||
#ifdef HYPRE_MIXEDINT
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC, "pilut smoothing is not available in mixedint mode!");
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"Pilut smoothing is not available in mixedint mode!");
|
||||
return hypre_error_flag;
|
||||
#endif
|
||||
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"Pilut smoothing doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
HYPRE_ParCSRPilutCreate(comm, &smoother[j]);
|
||||
HYPRE_ParCSRPilutSetup(smoother[j],
|
||||
(HYPRE_ParCSRMatrix) A_array[j],
|
||||
@ -3653,9 +3708,10 @@ hypre_BoomerAMGSetup( void *amg_vdata,
|
||||
HYPRE_ParCSRPilutSetDropTolerance(smoother[j], drop_tol);
|
||||
HYPRE_ParCSRPilutSetFactorRowSize(smoother[j], max_nz_per_row);
|
||||
}
|
||||
else if ( (j < num_levels - 1) || ((j == num_levels - 1) &&
|
||||
(grid_relax_type[3] != 9 && grid_relax_type[3] != 99 &&
|
||||
grid_relax_type[3] != 19 && grid_relax_type[3] != 98) && coarse_size > 9) )
|
||||
else if ( (j < num_levels - 1) ||
|
||||
((j == num_levels - 1) &&
|
||||
(grid_relax_type[3] != 9 && grid_relax_type[3] != 99 &&
|
||||
grid_relax_type[3] != 19 && grid_relax_type[3] != 98) && coarse_size > 9) )
|
||||
{
|
||||
if (relax_weight[j] < 0)
|
||||
{
|
||||
|
||||
@ -63,6 +63,13 @@ hypre_BoomerAMGDDSetup( void *amgdd_vdata,
|
||||
HYPRE_Int num_requests;
|
||||
HYPRE_Int request_counter;
|
||||
|
||||
/* Sanity check */
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC, "BoomerAMGDD doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
// If the underlying AMG data structure has not yet been set up, call BoomerAMGSetup()
|
||||
if (!hypre_ParAMGDataAArray(amg_data))
|
||||
{
|
||||
|
||||
@ -419,6 +419,14 @@ hypre_ParCSRRelax_Cheby_Solve(hypre_ParCSRMatrix *A, /* matrix to relax with */
|
||||
#endif
|
||||
HYPRE_Int ierr = 0;
|
||||
|
||||
/* Sanity check */
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"Requested relaxation type doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
#if defined(HYPRE_USING_CUDA) || defined(HYPRE_USING_HIP)
|
||||
HYPRE_ExecutionPolicy exec = hypre_GetExecPolicy1(hypre_ParCSRMatrixMemoryLocation(A));
|
||||
if (exec == HYPRE_EXEC_DEVICE)
|
||||
|
||||
@ -952,6 +952,13 @@ hypre_FSAISetup( void *fsai_vdata,
|
||||
HYPRE_Int max_nnzrow_diag_G; /* Max. number of nonzeros per row in G_diag */
|
||||
HYPRE_Int max_nonzeros_diag_G; /* Max. number of nonzeros in G_diag */
|
||||
|
||||
/* Sanity check */
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC, "FSAI doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
HYPRE_ANNOTATE_FUNC_BEGIN;
|
||||
|
||||
/* Create and initialize work vectors used in the solve phase */
|
||||
|
||||
@ -115,6 +115,13 @@ hypre_ILUSetup( void *ilu_vdata,
|
||||
HYPRE_Int send_size;
|
||||
HYPRE_Int recv_size;
|
||||
|
||||
/* Sanity check */
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC, "ILU doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
/* ----- begin -----*/
|
||||
HYPRE_ANNOTATE_FUNC_BEGIN;
|
||||
hypre_GpuProfilingPushRange("hypre_ILUSetup");
|
||||
|
||||
@ -202,6 +202,15 @@ hypre_MGRSetup( void *mgr_vdata,
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
/* Sanity check */
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC, "MGR doesn't support multicomponent vectors");
|
||||
HYPRE_ANNOTATE_FUNC_END;
|
||||
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
/* If we reduce the reserved C-points, increase one level */
|
||||
if (lvl_to_keep_cpoints > 0) { max_num_coarse_levels++; }
|
||||
/* Initialize local indexes of coarse sets at different levels */
|
||||
|
||||
@ -219,6 +219,14 @@ hypre_BoomerAMGRelaxWeightedJacobi_core( hypre_ParCSRMatrix *A,
|
||||
HYPRE_Int num_procs, my_id, i, j, ii, jj, index, num_sends, start;
|
||||
hypre_ParCSRCommHandle *comm_handle;
|
||||
|
||||
/* Sanity check */
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"Jacobi relaxation doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
hypre_MPI_Comm_size(comm, &num_procs);
|
||||
hypre_MPI_Comm_rank(comm, &my_id);
|
||||
|
||||
@ -388,6 +396,14 @@ hypre_BoomerAMGRelax1GaussSeidel( hypre_ParCSRMatrix *A,
|
||||
hypre_MPI_Status *status;
|
||||
hypre_MPI_Request *requests;
|
||||
|
||||
/* Sanity check */
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"GS (1) relaxation doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
hypre_MPI_Comm_size(comm, &num_procs);
|
||||
hypre_MPI_Comm_rank(comm, &my_id);
|
||||
|
||||
@ -520,6 +536,14 @@ hypre_BoomerAMGRelax2GaussSeidel( hypre_ParCSRMatrix *A,
|
||||
hypre_MPI_Status *status;
|
||||
hypre_MPI_Request *requests;
|
||||
|
||||
/* Sanity check */
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"GS (2) relaxation doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
hypre_MPI_Comm_size(comm, &num_procs);
|
||||
hypre_MPI_Comm_rank(comm, &my_id);
|
||||
|
||||
@ -694,6 +718,14 @@ hypre_BoomerAMGRelaxHybridGaussSeidel_core( hypre_ParCSRMatrix *A,
|
||||
hypre_MPI_Comm_rank(comm, &my_id);
|
||||
num_threads = forced_seq ? 1 : hypre_NumThreads();
|
||||
|
||||
/* Sanity check */
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"Hybrid GS relaxation doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
/* GS order: forward or backward */
|
||||
const HYPRE_Int gs_order = GS_order > 0 ? 1 : -1;
|
||||
/* for symmetric GS, a forward followed by a backward */
|
||||
@ -949,6 +981,14 @@ hypre_BoomerAMGRelax5ChaoticHybridGaussSeidel( hypre_ParCSRMatrix *A,
|
||||
HYPRE_Int num_procs, my_id, i, j, ii, jj, index, num_sends, start;
|
||||
hypre_ParCSRCommHandle *comm_handle;
|
||||
|
||||
/* Sanity check */
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"Chaotic GS relaxation doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
hypre_MPI_Comm_size(comm, &num_procs);
|
||||
hypre_MPI_Comm_rank(comm, &my_id);
|
||||
|
||||
@ -1259,9 +1299,18 @@ hypre_BoomerAMGRelax19GaussElim( hypre_ParCSRMatrix *A,
|
||||
HYPRE_Real *b_vec;
|
||||
HYPRE_Int i, jj, column, relax_error = 0;
|
||||
|
||||
/* Sanity check */
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"Gauss Elim. relaxation doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------
|
||||
* Generate CSR matrix from ParCSRMatrix A
|
||||
*-----------------------------------------------------------------*/
|
||||
|
||||
/* all processors are needed for these routines */
|
||||
A_CSR = hypre_ParCSRMatrixToCSRMatrixAll(A);
|
||||
f_vector = hypre_ParVectorToVectorAll(f);
|
||||
@ -1338,9 +1387,18 @@ hypre_BoomerAMGRelax98GaussElimPivot( hypre_ParCSRMatrix *A,
|
||||
HYPRE_Int one_i = 1;
|
||||
HYPRE_Int *piv;
|
||||
|
||||
/* Sanity check */
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"Gauss Elim. (98) relaxation doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------
|
||||
* Generate CSR matrix from ParCSRMatrix A
|
||||
*-----------------------------------------------------------------*/
|
||||
|
||||
/* all processors are needed for these routines */
|
||||
A_CSR = hypre_ParCSRMatrixToCSRMatrixAll(A);
|
||||
f_vector = hypre_ParVectorToVectorAll(f);
|
||||
@ -1431,6 +1489,14 @@ hypre_BoomerAMGRelaxKaczmarz( hypre_ParCSRMatrix *A,
|
||||
HYPRE_Int num_procs, my_id, i, j, index, num_sends, start;
|
||||
hypre_ParCSRCommHandle *comm_handle;
|
||||
|
||||
/* Sanity check */
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"Kaczmarz relaxation doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
hypre_MPI_Comm_size(comm, &num_procs);
|
||||
hypre_MPI_Comm_rank(comm, &my_id);
|
||||
|
||||
@ -1537,6 +1603,14 @@ hypre_BoomerAMGRelaxTwoStageGaussSeidelHost( hypre_ParCSRMatrix *A,
|
||||
HYPRE_Complex multiplier = 1.0;
|
||||
HYPRE_Int i, k, jj, ii;
|
||||
|
||||
/* Sanity check */
|
||||
if (hypre_ParVectorNumVectors(f) > 1)
|
||||
{
|
||||
hypre_error_w_msg(HYPRE_ERROR_GENERIC,
|
||||
"2-stage GS relaxation (Host) doesn't support multicomponent vectors");
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
/* Need to check that EVERY diagonal is nonzero first. If any are, throw exception */
|
||||
for (i = 0; i < num_rows; i++)
|
||||
{
|
||||
@ -1657,4 +1731,3 @@ hypre_BoomerAMGRelax12TwoStageGaussSeidel( hypre_ParCSRMatrix *A,
|
||||
|
||||
return hypre_error_flag;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user