-
Notifications
You must be signed in to change notification settings - Fork 125
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
[NDTensors] Circumvent scalar indexing to improve GPU performance #1216
Closed
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7453e04
Add FieldType module with Unallocated and Unspecified Types
kmp5VT af065e7
format
kmp5VT bd2a078
Merge branch 'main' into kmp5/feature/FieldTypes
kmp5VT 9daa5c9
updates to prevent elementwise operations on gpu
kmp5VT 41a17a9
Changes to copy(dense)
kmp5VT 281cef0
Add comment
kmp5VT cd48a2f
Add comment about change
kmp5VT ed80c9e
remove fieldtypes
kmp5VT a0c8671
remove fillarrays
kmp5VT a015bee
remove fieldtypes
kmp5VT 8d00ea4
remove commented code
kmp5VT 2d99348
Merge branch 'main' into kmp5/enhancements/more_gpu
kmp5VT 1d579fe
format
kmp5VT f61555d
Merge branch 'kmp5/enhancements/more_gpu' of github.com:kmp5VT/ITenso…
kmp5VT 0a901e8
Make truncate!! to have a type based call of truncate!
kmp5VT da8b193
use truncate!!
kmp5VT 17fb6bf
format
kmp5VT 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
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1,11 +1,15 @@ | ||
|
||
## TODO here it looks at the elements of S so convert to CPU when on GPU | ||
## Could write this as a GPU impl which just converts S to array. S | ||
## is not used again so we don't need to convert back to GPU. | ||
function checkSVDDone(S::AbstractArray, thresh::Float64) | ||
N = length(S) | ||
(N <= 1 || thresh < 0.0) && return (true, 1) | ||
S1t = S[1] * thresh | ||
Scpu = NDTensors.cpu(S) | ||
S1t = Scpu[1] * thresh | ||
start = 2 | ||
while start <= N | ||
(S[start] < S1t) && break | ||
(Scpu[start] < S1t) && break | ||
start += 1 | ||
end | ||
if start >= N | ||
|
@@ -32,9 +36,8 @@ function svd_recursive(M::AbstractMatrix; thresh::Float64=1E-3, north_pass::Int= | |
V = M' * U | ||
|
||
V, R = qr_positive(V) | ||
for n in 1:Nd | ||
D[n] = R[n, n] | ||
end | ||
n = size(R)[1] | ||
D = diag(R, (n - Nd)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this is doing what you think it is doing, I went with: D[1:Nd] = diag(R)[1:Nd] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see, thanks! |
||
|
||
(done, start) = checkSVDDone(D, thresh) | ||
|
||
|
This file contains 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same suggestion here as above for
truncate!!
, I think we should useleaf_parenttype
dispatch.