mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Fixed memory issues when cusparseSolver is disabled by unsupported blocksize
This commit is contained in:
@@ -128,6 +128,7 @@ void BdaBridge::solve_system(BridgeMatrix *mat OPM_UNUSED, BridgeVector &b OPM_U
|
|||||||
if (dim != 3) {
|
if (dim != 3) {
|
||||||
OpmLog::warning("cusparseSolver only accepts blocksize = 3 at this time, will use Dune for the remainder of the program");
|
OpmLog::warning("cusparseSolver only accepts blocksize = 3 at this time, will use Dune for the remainder of the program");
|
||||||
use_gpu = false;
|
use_gpu = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (h_rows.capacity() == 0) {
|
if (h_rows.capacity() == 0) {
|
||||||
|
|||||||
@@ -256,33 +256,35 @@ namespace Opm
|
|||||||
} // end initialize()
|
} // end initialize()
|
||||||
|
|
||||||
void cusparseSolverBackend::finalize() {
|
void cusparseSolverBackend::finalize() {
|
||||||
cudaFree(d_x);
|
if (initialized) {
|
||||||
cudaFree(d_b);
|
cudaFree(d_x);
|
||||||
cudaFree(d_r);
|
cudaFree(d_b);
|
||||||
cudaFree(d_rw);
|
cudaFree(d_r);
|
||||||
cudaFree(d_p);
|
cudaFree(d_rw);
|
||||||
cudaFree(d_pw);
|
cudaFree(d_p);
|
||||||
cudaFree(d_s);
|
cudaFree(d_pw);
|
||||||
cudaFree(d_t);
|
cudaFree(d_s);
|
||||||
cudaFree(d_v);
|
cudaFree(d_t);
|
||||||
cudaFree(d_mVals);
|
cudaFree(d_v);
|
||||||
cudaFree(d_bVals);
|
cudaFree(d_mVals);
|
||||||
cudaFree(d_bCols);
|
cudaFree(d_bVals);
|
||||||
cudaFree(d_bRows);
|
cudaFree(d_bCols);
|
||||||
cudaFree(d_buffer);
|
cudaFree(d_bRows);
|
||||||
cusparseDestroyBsrilu02Info(info_M);
|
cudaFree(d_buffer);
|
||||||
cusparseDestroyBsrsv2Info(info_L);
|
cusparseDestroyBsrilu02Info(info_M);
|
||||||
cusparseDestroyBsrsv2Info(info_U);
|
cusparseDestroyBsrsv2Info(info_L);
|
||||||
cusparseDestroyMatDescr(descr_B);
|
cusparseDestroyBsrsv2Info(info_U);
|
||||||
cusparseDestroyMatDescr(descr_M);
|
cusparseDestroyMatDescr(descr_B);
|
||||||
cusparseDestroyMatDescr(descr_L);
|
cusparseDestroyMatDescr(descr_M);
|
||||||
cusparseDestroyMatDescr(descr_U);
|
cusparseDestroyMatDescr(descr_L);
|
||||||
cusparseDestroy(cusparseHandle);
|
cusparseDestroyMatDescr(descr_U);
|
||||||
cublasDestroy(cublasHandle);
|
cusparseDestroy(cusparseHandle);
|
||||||
|
cublasDestroy(cublasHandle);
|
||||||
#if COPY_ROW_BY_ROW
|
#if COPY_ROW_BY_ROW
|
||||||
cudaFreeHost(vals_contiguous);
|
cudaFreeHost(vals_contiguous);
|
||||||
#endif
|
#endif
|
||||||
cudaStreamDestroy(stream);
|
cudaStreamDestroy(stream);
|
||||||
|
}
|
||||||
} // end finalize()
|
} // end finalize()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user