-
Notifications
You must be signed in to change notification settings - Fork 0
Better memory management #50
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
Conversation
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
Allocating and destroying memory No memory leaks evident atm
Introduce initialisePointersToMatricesData to initialise m_d_ptrMatrices; appropriate checks for safety.
Also in the slice constructor, keep m_d_ptrMatrices=nullptr when we dont slice along axis=2
use cublasDGemm if nMats=1
5 tasks
When necessary, memory is reallocated for m_d_ptrMatrices within reshape
No need to free/reallocate when we can reuse the already allocated memory space (when the number of matrices decreases); no new memory allocation when numMats=1
and format code
ruairimoran
reviewed
Nov 7, 2024
ruairimoran
reviewed
Nov 7, 2024
ruairimoran
reviewed
Nov 7, 2024
ruairimoran
reviewed
Nov 7, 2024
ruairimoran
reviewed
Nov 7, 2024
ruairimoran
reviewed
Nov 7, 2024
ruairimoran
approved these changes
Nov 7, 2024
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.
check comments. Looks great
Unit test: Slice along axis=2 and reshape Write documentation for DTensor<T>::reshape Fix formatting issues in testTensor
ruairimoran
approved these changes
Nov 7, 2024
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.
nice
Free all allocated memory if allocation fails Fix code formatting in testTensor allocateOnDevice made void
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is an alternative to PR #49; this is still WIP.
Main Changes
T** m_d_ptrMatrices
, which is a raw pointer to the matrices of the tensor (to replacepointersToMatrices
)TODOs
addAB
: usegemm
whennMats=1
m_d_ptrMatrix = nullptr
when slicing withaxis=0
oraxis=1
tensorPointersToMatrices
(method deprecation)pointersToMatrices()
inleastSquaresBatched
CholeskyBatchFactoriser
: get rid ofpointersToMatrices
CholeskyBatchFactoriser
: throw error ifnMats=1
addAB
)Note
It probably makes sense to always have
m_d_ptrMatrix = nullptr
whenevernMats=1
and throw an error when the user attempts to use any batched method withnMats=1
.Associated Issues