-
Notifications
You must be signed in to change notification settings - Fork 62
GPU-friendly truncation implementations #349
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
Merged
Merged
Changes from 25 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
8df520e
try to make truncation GPU-friendly
lkdvos 1481184
Temporarily fix StridedViews version
kshyatt 1e46b0d
Revert "Temporarily fix StridedViews version"
kshyatt 8ef0425
Small update for diagonal pullbacks
kshyatt 8423ce8
Fix last error
kshyatt 848f0cc
Reenable truncated CUDA tests
kshyatt 7ae9b05
make truncation run on GPU
lkdvos b1fe3bd
bypass scalar indexing by specializing
lkdvos 94ecfca
convenience overloads
lkdvos 7395b8a
gpu-friendly copies
lkdvos 9af19b7
retain storagetype in extended_S
lkdvos 180afe6
avoid GPU issues with truncated adjoint tensormaps
lkdvos efbe088
various utility improvements
lkdvos eafd7a8
complete rewrite of implementation
lkdvos f4892cf
GPU doesn't like `trues`
lkdvos 3f273a1
remove CUDA specializations and temporarily add missing MatrixAlgebra…
lkdvos 6842a70
better dimension testing
lkdvos 5bb2a23
fix unbound type parameter
lkdvos ddd0ed6
add missing import
lkdvos f3b45ef
be careful about double method definitions
lkdvos f26cffe
disable diagonal test
lkdvos 6ff9ac8
bump MatrixAlgebraKit dependency
lkdvos 6666459
Revert "disable diagonal test"
lkdvos ebbdb84
remove unnecessary specializations
lkdvos 2d7338a
specialize CPU implementations
lkdvos bde9c50
add explanation TruncationByOrder
lkdvos d603b9e
add explanation and specialization TruncationByError
lkdvos 5bc1506
fix stupidity
lkdvos b44878f
fix views
lkdvos 4a722ef
enfore positive and finite p-norms
lkdvos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,5 +17,6 @@ using TensorKit: MatrixAlgebraKit | |
| using Random | ||
|
|
||
| include("cutensormap.jl") | ||
| include("truncation.jl") | ||
|
|
||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| const CuSectorVector{T, I} = TensorKit.SectorVector{T, I, <:CuVector{T}} | ||
|
|
||
| function MatrixAlgebraKit.findtruncated( | ||
| values::CuSectorVector, strategy::MatrixAlgebraKit.TruncationByOrder | ||
| ) | ||
| I = sectortype(values) | ||
|
|
||
| dims = similar(values, Base.promote_op(dim, I)) | ||
| for (c, v) in pairs(dims) | ||
| fill!(v, dim(c)) | ||
| end | ||
|
|
||
| perm = sortperm(parent(values); strategy.by, strategy.rev) | ||
| cumulative_dim = cumsum(Base.permute!(parent(dims), perm)) | ||
|
|
||
| result = similar(values, Bool) | ||
| parent(result)[perm] .= cumulative_dim .<= strategy.howmany | ||
| return result | ||
| end | ||
|
|
||
| # Needed until MatrixAlgebraKit patch hits... | ||
|
kshyatt marked this conversation as resolved.
|
||
| function MatrixAlgebraKit._ind_intersect(A::CuVector{Bool}, B::CuVector{Int}) | ||
| result = fill!(similar(A), false) | ||
| result[B] .= @view A[B] | ||
|
kshyatt marked this conversation as resolved.
|
||
| return result | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
lkdvos marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.