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:
parent
dc487086b4
commit
991f2e15eb
@ -148,7 +148,7 @@ hypre_BoomerAMGSetup( void *amg_vdata,
|
|||||||
HYPRE_Real *max_eig_est = NULL;
|
HYPRE_Real *max_eig_est = NULL;
|
||||||
HYPRE_Real *min_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_type = hypre_ParAMGDataSmoothType(amg_data);
|
||||||
HYPRE_Int smooth_num_levels = hypre_ParAMGDataSmoothNumLevels(amg_data);
|
HYPRE_Int smooth_num_levels = hypre_ParAMGDataSmoothNumLevels(amg_data);
|
||||||
HYPRE_Int sym;
|
HYPRE_Int sym;
|
||||||
@ -559,7 +559,8 @@ hypre_BoomerAMGSetup( void *amg_vdata,
|
|||||||
}
|
}
|
||||||
if (smooth_num_levels && smoother)
|
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;
|
smooth_num_levels = old_num_levels - 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -246,7 +246,7 @@ HYPRE_Initialize(void)
|
|||||||
/* Update library state */
|
/* Update library state */
|
||||||
hypre_SetInitialized();
|
hypre_SetInitialized();
|
||||||
|
|
||||||
#ifdef HYPRE_USING_MEMORY_TRACKER
|
#if defined(HYPRE_USING_MEMORY_TRACKER)
|
||||||
if (!_hypre_memory_tracker)
|
if (!_hypre_memory_tracker)
|
||||||
{
|
{
|
||||||
_hypre_memory_tracker = hypre_MemoryTrackerCreate();
|
_hypre_memory_tracker = hypre_MemoryTrackerCreate();
|
||||||
@ -310,7 +310,7 @@ HYPRE_Initialize(void)
|
|||||||
hypre_HandleVendorSolverHandle(_hypre_handle);
|
hypre_HandleVendorSolverHandle(_hypre_handle);
|
||||||
#endif
|
#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)
|
#if defined(HYPRE_USING_CUDA) && defined(HYPRE_DEBUG)
|
||||||
hypre_CudaCompileFlagCheck();
|
hypre_CudaCompileFlagCheck();
|
||||||
#endif
|
#endif
|
||||||
@ -378,7 +378,7 @@ HYPRE_Finalize(void)
|
|||||||
hypre_GetDeviceLastError();
|
hypre_GetDeviceLastError();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HYPRE_USING_MEMORY_TRACKER
|
#if defined(HYPRE_USING_MEMORY_TRACKER)
|
||||||
hypre_PrintMemoryTracker(hypre_total_bytes, hypre_peak_bytes, hypre_current_bytes,
|
hypre_PrintMemoryTracker(hypre_total_bytes, hypre_peak_bytes, hypre_current_bytes,
|
||||||
hypre_memory_tracker_print, hypre_memory_tracker_filename);
|
hypre_memory_tracker_print, hypre_memory_tracker_filename);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user