Fix segfaults rocalutionSolver

This commit is contained in:
Tong Dong Qiu 2022-11-18 14:19:10 +01:00
parent c7fec18a86
commit 5620b08033
2 changed files with 5 additions and 1 deletions

View File

@ -52,6 +52,11 @@ rocalutionSolverBackend<block_size>::rocalutionSolverBackend(int verbosity_, int
template <unsigned int block_size>
rocalutionSolverBackend<block_size>::~rocalutionSolverBackend() {
// normally, these rocalution variables are destroyed after the destructor automatically,
// but sometimes it segfaults, both with test_rocalutionSolver and with an actual case
// release both variables here to prevent that segfault
roc_prec.release();
roc_solver.release();
rocalution::stop_rocalution();
}

View File

@ -60,7 +60,6 @@ private:
int *tmp_colindices; // store matrix on host, this pointer is given to and freed by rocalution
double *tmp_nnzvalues; // store matrix on host, this pointer is given to and freed by rocalution
// must be declared in this order, to prevent a segfault during the test
std::unique_ptr<rocalution::ILU<rocalution::LocalMatrix<double>, rocalution::LocalVector<double>, double> > roc_prec;
std::unique_ptr<rocalution::BiCGStab<rocalution::LocalMatrix<double>, rocalution::LocalVector<double>, double> > roc_solver;