Skip to content

Commit

Permalink
Add an handle as an optional argument when we create a CudssData
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Apr 19, 2024
1 parent 81121f2 commit 547a3fc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/helpers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,18 @@ mutable struct CudssData
handle::cudssHandle_t
data::cudssData_t

function CudssData()
function CudssData(cudss_handle::cudssHandle_t)
data_ref = Ref{cudssData_t}()
cudss_handle = handle()
cudssDataCreate(cudss_handle, data_ref)
obj = new(cudss_handle, data_ref[])
finalizer(cudssDataDestroy, obj)
obj
end

function CudssData()
cudss_handle = handle()
CudssData(cudss_handle)
end
end

Base.unsafe_convert(::Type{cudssData_t}, data::CudssData) = data.data
Expand Down

0 comments on commit 547a3fc

Please sign in to comment.