Skip to content

Commit

Permalink
Add a constructor for CudssData
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Apr 25, 2024
1 parent b465732 commit 32a6020
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 32a6020

Please sign in to comment.