gunrock / graphblast

High-Performance Linear Algebra-based Graph Primitives on GPUs
Apache License 2.0
211 stars 27 forks source link

Double cudaFree when using raw GPU pointer variant Matrix::build #11

Closed ctcyang closed 3 years ago

ctcyang commented 4 years ago

Running gspgemm unit test results in: Cuda error in file '/home/ctcyang/graphblast-ben/./graphblas/backend/cuda/sparse_matrix.hpp' in line 167 : invalid device pointer.

The way to fix this is to either: 1) add a member variable per Matrix called owner_, which is set to true only when Matrix::build is called using a non-raw GPU pointer variant; or 2) add a wrapper struct around the GPU memory and use std::shared_ptr to keep track of this structure. Then when the number drops down to 0, this can be cleared. Downsides of this approach is it makes interacting with third-party libraries more difficult.