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

Add a method inv(CuMatrix) #2095

Merged
merged 2 commits into from
Sep 26, 2023
Merged

Add a method inv(CuMatrix) #2095

merged 2 commits into from
Sep 26, 2023

Conversation

amontoison
Copy link
Member

No description provided.

n = checksquare(A)
F = copy(A)
factors, ipiv, info = getrf!(F)
B = CuMatrix{T}(I, n, n)
Copy link
Member Author

@amontoison amontoison Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maleadt Do you know a better way to create an identity matrix of size n with CUDA.jl?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine, and is specialized in GPUArrays. We could avoid a kernel to set the diagonal by using a 2D memcpy, but looking at the profiler most of the time is spent during the zero initialization, so there's not much to gain.

@amontoison
Copy link
Member Author

CUSOLVER also has an optimized routine to directly invert triangular matrices (trtri). I started to interface it here.

@maleadt maleadt added enhancement New feature or request cuda array Stuff about CuArray. labels Sep 26, 2023
@maleadt
Copy link
Member

maleadt commented Sep 26, 2023

Thanks! This has been often requested, so is great to have.

@maleadt maleadt merged commit 52340d8 into JuliaGPU:master Sep 26, 2023
1 check passed
@amontoison amontoison deleted the inv branch September 26, 2023 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cuda array Stuff about CuArray. enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants