How to free memory of SuperLU_dist solver?
Hi, I'm using SuperLU with MFEM to solve Stokes equations. The solver works very well. But I noticed that if I made a for loop of the part of the solver and call the solver over and over again, it starts using more and more memory. Even though I'm deleting the solver's pointer.
HypreParMatrix *H = HypreParMatrixFromBlocks(hBlocks, &blockCoeff);
SuperLUSolver *superlu = new SuperLUSolver(MPI_COMM_WORLD);
Operator *SLU_A = new SuperLURowLocMatrix(*H);
superlu->SetOperator(*SLU_A);
superlu->SetPrintStatistics(true);
superlu->SetSymmetricPattern(true);
superlu->SetColumnPermutation(superlu::PARMETIS);
superlu->SetIterativeRefine(superlu::SLU_DOUBLE);
//Solve the linear system Ax=B
X.Randomize();
superlu->Mult(B, X);
//Delete used memory
delete H;
delete superlu;
delete SLU_A;
I tried to use delete[] superlu and other ways of freeing the memory but nothing works. It's important to make that work because I want to use the solver in conjunction with a time-dependent problem and I have to call it multiple times. What should I do to fix the problem?
I am looping in the MFEM developers, who did the MFEM - SuperLU interface.
Aaron: Do you know what does "delete superlu" do? Perhaps some meta data structures are not freed, causing memory leak ?
Thanks, Sherry
On Mon, Jul 19, 2021 at 4:40 PM Carlos del Valle @.***> wrote:
Hi, I'm using SuperLU with MFEM to solve Stokes equations. The solver works very well. But I noticed that if I made a for loop of the part of the solver and call the solver over and over again, it starts using more and more memory. Even though I'm deleting the solver's pointer.
HypreParMatrix *H = HypreParMatrixFromBlocks(hBlocks, &blockCoeff); SuperLUSolver *superlu = new SuperLUSolver(MPI_COMM_WORLD); Operator *SLU_A = new SuperLURowLocMatrix(*H); superlu->SetOperator(*SLU_A); superlu->SetPrintStatistics(true); superlu->SetSymmetricPattern(true); superlu->SetColumnPermutation(superlu::PARMETIS); superlu->SetIterativeRefine(superlu::SLU_DOUBLE); //Solve the linear system Ax=B X.Randomize(); superlu->Mult(B, X); //Delete used memory delete H; delete superlu; delete SLU_A;I tried to use delete[] superlu and other ways of freeing the memory but nothing works. It's important to make that work because I want to use the solver in conjunction with a time-dependent problem and I have to call it multiple times. What should I do to fix the problem?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/xiaoyeli/superlu/issues/52, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZSV577OZJIYUAP4Y3CFTLTYSZVXANCNFSM5AUVIOCA .
To complement this @xiaoyeli , I have been searching for a potential solution and found this http://www.elmerfem.org/forum/viewtopic.php?t=3625. I also have found people reporting similar leaks.