Closed
Conversation
rkdud007
reviewed
Mar 28, 2025
Comment on lines
+185
to
+189
| (0..nrow) | ||
| .map(|i| (0..ncol).map(|j| dcrt_trapdoor.get_public_matrix(i, j)).collect()) | ||
| .collect(), | ||
| ); | ||
| debug_mem("After get public matrix"); |
Collaborator
There was a problem hiding this comment.
i'd be curious to check time/memory difference with larger scale (e.g run middle param up to point reach trapdoor gen?) little worry if this non parallel loop might be too slow.
Member
There was a problem hiding this comment.
if this non parallel loop might be too slow.
I have the same concern.
Contributor
Author
There was a problem hiding this comment.
Ok, I can modify the PR and add the parallel feature then :)
|
Great work @enricobottazzi |
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
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.
The original goal was to reduce the memory consumption on the trapdoor generation function. The experiment by logging directly from the C++ reveals that the big jump between
Before trapdoor genandAfter trapdoor genis entirely due to the openfhe-developmentTrapdoorGenfunction so there's not much we can do there.Something else that I noticed is that in the current
mainthere's a small memory increase when generating the public matrix (https://github.com/MachinaIO/diamond-io/blob/main/src/poly/dcrt/sampler/trapdoor.rs#L180-L187) due to duplication.This is fixed by an update on openfhe-rs -> MachinaIO/openfhe-rs#5
You can see the benefits of this approach as there's no longer memory increase between
After trapdoor genandAfter get_public_matrix.Next issues that I'm planning to tackle:
GetMatrixElementGetMatrixElementand `SetMatrixElement in parallelBefore
After