Fix memory leak on BoomerAMG complex smoothers (#890)

The memory leak was happening when:
    A complex smoother for BoomerAMG was selected.
    The AMG hierarchy consisted of one level.
    The BoomerAMG preconditioner was destroyed and recomputed again.
This commit is contained in:
Victor A. P. Magri 2023-05-04 10:59:02 -04:00 committed by GitHub
parent dc487086b4
commit 991f2e15eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -148,7 +148,7 @@ hypre_BoomerAMGSetup( void *amg_vdata,
HYPRE_Real *max_eig_est = NULL;
HYPRE_Real *min_eig_est = NULL;
HYPRE_Solver *smoother = NULL;
HYPRE_Solver *smoother = hypre_ParAMGDataSmoother(amg_data);
HYPRE_Int smooth_type = hypre_ParAMGDataSmoothType(amg_data);
HYPRE_Int smooth_num_levels = hypre_ParAMGDataSmoothNumLevels(amg_data);
HYPRE_Int sym;
@ -559,7 +559,8 @@ hypre_BoomerAMGSetup( void *amg_vdata,
}
if (smooth_num_levels && smoother)
{
if (smooth_num_levels > old_num_levels - 1)
if (smooth_num_levels > 1 &&
smooth_num_levels > old_num_levels - 1)
{
smooth_num_levels = old_num_levels - 1;
}

View File

@ -246,7 +246,7 @@ HYPRE_Initialize(void)
/* Update library state */
hypre_SetInitialized();
#ifdef HYPRE_USING_MEMORY_TRACKER
#if defined(HYPRE_USING_MEMORY_TRACKER)
if (!_hypre_memory_tracker)
{
_hypre_memory_tracker = hypre_MemoryTrackerCreate();
@ -310,7 +310,7 @@ HYPRE_Initialize(void)
hypre_HandleVendorSolverHandle(_hypre_handle);
#endif
/* Check if cuda arch flags in compiling match the device */
/* Check if cuda arch flags in compiling match the device */
#if defined(HYPRE_USING_CUDA) && defined(HYPRE_DEBUG)
hypre_CudaCompileFlagCheck();
#endif
@ -378,7 +378,7 @@ HYPRE_Finalize(void)
hypre_GetDeviceLastError();
#endif
#ifdef HYPRE_USING_MEMORY_TRACKER
#if defined(HYPRE_USING_MEMORY_TRACKER)
hypre_PrintMemoryTracker(hypre_total_bytes, hypre_peak_bytes, hypre_current_bytes,
hypre_memory_tracker_print, hypre_memory_tracker_filename);