Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update error.jl and management.jl #24

Merged
merged 1 commit into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions src/error.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

name(err::CUDSSError) = string(err.code)

## COV_EXCL_START
function description(err)
function description(err::CUDSSError)

Check warning on line 12 in src/error.jl

View check run for this annotation

Codecov / codecov/patch

src/error.jl#L12

Added line #L12 was not covered by tests
if err.code == CUDSS_STATUS_SUCCESS
return "the operation completed successfully"
elseif err.code == CUDSS_STATUS_NOT_INITIALIZED
Expand Down Expand Up @@ -43,14 +42,13 @@
end
end

function check(f, errs...)
res = retry_reclaim(in((CUDSS_STATUS_ALLOC_FAILED, errs...))) do
return f()
end
@inline function check(f)
retry_if(res) = res in (CUDSS_STATUS_NOT_INITIALIZED,
CUDSS_STATUS_ALLOC_FAILED,
CUDSS_STATUS_INTERNAL_ERROR)
res = retry_reclaim(f, retry_if)

if res != CUDSS_STATUS_SUCCESS
throw_api_error(res)
end

return
end
4 changes: 1 addition & 3 deletions src/management.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

function cudssCreate()
handle = Ref{cudssHandle_t}()
check(CUDSS_STATUS_NOT_INITIALIZED) do
unsafe_cudssCreate(handle)
end
cudssCreate(handle)
handle[]
end

Expand Down
Loading