Skip to content

Commit

Permalink
Fix coarsen type (#1080)
Browse files Browse the repository at this point in the history
This PR removes a potential coarsen_type change in AMG setup on GPUs.
  • Loading branch information
liruipeng authored Mar 11, 2024
1 parent 86e7287 commit 48052f6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
17 changes: 11 additions & 6 deletions src/parcsr_ls/par_amg_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ hypre_BoomerAMGSetup( void *amg_vdata,

HYPRE_MemoryLocation memory_location = hypre_ParCSRMatrixMemoryLocation(A);
hypre_ParAMGDataMemoryLocation(amg_data) = memory_location;
#if defined(HYPRE_USING_GPU)
HYPRE_ExecutionPolicy exec = hypre_GetExecPolicy1(memory_location);
#endif

/* Local variables */
HYPRE_Int *CF_marker;
Expand Down Expand Up @@ -121,7 +124,6 @@ hypre_BoomerAMGSetup( void *amg_vdata,
HYPRE_Int setup_type;
HYPRE_BigInt fine_size;
HYPRE_Int offset;
HYPRE_Real size;
HYPRE_Int not_finished_coarsening = 1;
HYPRE_Int coarse_threshold = hypre_ParAMGDataMaxCoarseSize(amg_data);
HYPRE_Int min_coarse_size = hypre_ParAMGDataMinCoarseSize(amg_data);
Expand Down Expand Up @@ -697,7 +699,6 @@ hypre_BoomerAMGSetup( void *amg_vdata,
if (num_C_points_coarse > 0)
{
#if defined(HYPRE_USING_GPU)
HYPRE_ExecutionPolicy exec = hypre_GetExecPolicy1(memory_location);
if (exec == HYPRE_EXEC_DEVICE)
{
#if defined(HYPRE_USING_SYCL)
Expand Down Expand Up @@ -753,7 +754,6 @@ hypre_BoomerAMGSetup( void *amg_vdata,
offset = (HYPRE_Int) ( first_local_row % ((HYPRE_BigInt) num_functions) );

#if defined(HYPRE_USING_GPU)
HYPRE_ExecutionPolicy exec = hypre_GetExecPolicy1(memory_location);
if (exec == HYPRE_EXEC_DEVICE)
{
hypre_BoomerAMGInitDofFuncDevice(hypre_IntArrayData(dof_func), local_size, offset, num_functions);
Expand Down Expand Up @@ -3127,10 +3127,15 @@ hypre_BoomerAMGSetup( void *amg_vdata,
A_array[level] = A_H;
}

size = ((HYPRE_Real) fine_size ) * .75;
if (coarsen_type > 0 && coarse_size >= (HYPRE_BigInt) size)
#if defined(HYPRE_USING_GPU)
if (exec == HYPRE_EXEC_HOST)
#endif
{
coarsen_type = 0;
HYPRE_Real size = ((HYPRE_Real)fine_size) * .75;
if (coarsen_type > 0 && coarse_size >= (HYPRE_BigInt)size)
{
coarsen_type = 0;
}
}

{
Expand Down
8 changes: 4 additions & 4 deletions src/test/TEST_ij/solvers.saved.lassen
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,15 @@ Final Relative Residual Norm = 7.317392e-09

# Output file: solvers.out.201
MGR Iterations = 9
Final Relative Residual Norm = 1.807958e-09
Final Relative Residual Norm = 1.802890e-09

# Output file: solvers.out.202
MGR Iterations = 8
Final Relative Residual Norm = 7.317392e-09

# Output file: solvers.out.203
MGR Iterations = 9
Final Relative Residual Norm = 1.807958e-09
Final Relative Residual Norm = 1.802890e-09

# Output file: solvers.out.204
MGR Iterations = 74
Expand All @@ -283,15 +283,15 @@ Final Relative Residual Norm = 5.064272e-09

# Output file: solvers.out.209
MGR Iterations = 15
Final Relative Residual Norm = 4.616163e-09
Final Relative Residual Norm = 7.693914e-09

# Output file: solvers.out.210
MGR Iterations = 23
Final Relative Residual Norm = 4.625304e-09

# Output file: solvers.out.211
MGR Iterations = 29
Final Relative Residual Norm = 7.457096e-09
Final Relative Residual Norm = 8.665192e-09

# Output file: solvers.out.212
Iterations = 11
Expand Down
4 changes: 2 additions & 2 deletions src/test/TEST_ij/solvers.saved.sunspot
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,15 @@ Final Relative Residual Norm = 1.247303e-09

# Output file: solvers.out.201
MGR Iterations = 9
Final Relative Residual Norm = 3.697256e-09
Final Relative Residual Norm = 3.708381e-09

# Output file: solvers.out.202
MGR Iterations = 9
Final Relative Residual Norm = 1.247303e-09

# Output file: solvers.out.203
MGR Iterations = 9
Final Relative Residual Norm = 3.697256e-09
Final Relative Residual Norm = 3.708381e-09

# Output file: solvers.out.204
MGR Iterations = 74
Expand Down

0 comments on commit 48052f6

Please sign in to comment.